.x file format 详细分析.x 文件格式

.x file format 详细分析.x 文件格式

分类: DirectX   525人阅读  评论(0)  收藏  举报

The picture below is a .X file opened by DirectX Mesh View. Today, we look at the X file's detail information. I strongly recommand readers search "X File Format Reference" topic in DirectX SDK  documentation.




The variable-length header is compulsory and must be at the beginning of the data stream. The header contains the following data.


TypeRequiredSize (in bytes)ValueDescription
Magic Numberx4"xof " 
Version Numberx2"03"Major version 3
  "03"Minor version 3
Format Typex4"txt "Text File
  "bin "Binary file
  "tzip"MSZip compressed text file
  "bzip"MSZip compressed binary file
Float Sizex"0064"64-bit floats
x"0032"32-bit floats



[cpp]  view plain copy
  1. xof 0302txt 0032                              //Header  
  2. Material PDX01_-_Default {  
  3. 1.000000;1.000000;1.000000;1.000000;;         //Face color  
  4. 0.000000;                                     //Power - the power is the specular exponent of the material  
  5. 0.900000;0.900000;0.900000;;                  //Material specular color  
  6. 0.000000;0.000000;0.000000;;                  //Material emissive color  
  7. TextureFilename {  
  8. "wood.boards.bmp";  
  9. }  
  10. }  
  11. Frame Box01 {  
  12. FrameTransformMatrix {                         // Defines a local transform for a frame(Optional)  
  13. 1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,-4.720104,0.000000,3.721657,1.000000;;  
  14. }  
  15. Mesh {  
  16. 8;                                             //Number of vertices.  
  17. -19.277889;-15.037872;0.000000;,               //Array of vertices, each of type Vector  
  18. 9.837681;-15.037872;0.000000;,  
  19. -19.277889;22.481186;0.000000;,  
  20. 9.837681;22.481186;0.000000;,  
  21. -19.277889;-15.037872;13.356144;,  
  22. 9.837681;-15.037872;13.356144;,  
  23. -19.277889;22.481186;13.356144;,  
  24. 9.837681;22.481186;13.356144;;  
  25.   
  26. 12;                                            //Number of faces(triangle)  
  27. 3;0,2,3;,                                      //Array of indices  
  28. 3;3,1,0;,  
  29. 3;4,5,7;,  
  30. 3;7,6,4;,  
  31. 3;0,1,5;,  
  32. 3;5,4,0;,  
  33. 3;1,3,7;,  
  34. 3;7,5,1;,  
  35. 3;3,2,6;,  
  36. 3;6,7,3;,  
  37. 3;2,0,4;,  
  38. 3;4,6,2;;  
  39. MeshNormals  {                                 //Optional  
  40. 6;                                             //Number of normals.  
  41. 0.000000;0.000000;-1.000000;,                  //Array of normals  
  42. 0.000000;0.000000;1.000000;,  
  43. 0.000000;-1.000000;0.000000;,  
  44. 1.000000;0.000000;0.000000;,  
  45. 0.000000;1.000000;0.000000;,  
  46. -1.000000;0.000000;0.000000;;  
  47. 12;                                            //Number of face normals, equal face's number!  
  48. 3;0,0,0;,                                      //Array of mesh face normals  
  49. 3;0,0,0;,  
  50. 3;1,1,1;,  
  51. 3;1,1,1;,  
  52. 3;2,2,2;,  
  53. 3;2,2,2;,  
  54. 3;3,3,3;,  
  55. 3;3,3,3;,  
  56. 3;4,4,4;,  
  57. 3;4,4,4;,  
  58. 3;5,5,5;,  
  59. 3;5,5,5;;  
  60. }  
  61. MeshMaterialList  {                           //Optional  
  62.    1;                                         //The number of materials.  
  63.    12;                                        //The number of indices. equal face's number  
  64.    0,                                         //An arrray of DWORDs containing the face indices  
  65.    0,  
  66.    0,  
  67.    0,  
  68.    0,  
  69.    0,  
  70.    0,  
  71.    0,  
  72.    0,  
  73.    0,  
  74.    0,  
  75.    0;  
  76. { PDX01_-_Default }                           //Reference to the material we define  
  77. }  
  78. MeshTextureCoords {                          //Optional  
  79. 8;                                            //Number of texture coordinates  
  80. 0.000000;0.000000;,                          //Array of 2D texture coordinates.  
  81. 1.000000;0.000000;,  
  82. 0.000000;-1.000000;,  
  83. 1.000000;-1.000000;,  
  84. 0.000000;0.000000;,  
  85. 1.000000;0.000000;,  
  86. 0.000000;-1.000000;,  
  87. 1.000000;-1.000000;;  
  88. }  
  89. }  
  90. }  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值