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

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



xof 0302txt 0032                              //Header
Material PDX01_-_Default {
1.000000;1.000000;1.000000;1.000000;;         //Face color
0.000000;                                     //Power - the power is the specular exponent of the material
0.900000;0.900000;0.900000;;                  //Material specular color
0.000000;0.000000;0.000000;;                  //Material emissive color
TextureFilename {
"wood.boards.bmp";
}
}
Frame Box01 {
FrameTransformMatrix {                         // Defines a local transform for a frame(Optional)
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;;
}
Mesh {
8;                                             //Number of vertices.
-19.277889;-15.037872;0.000000;,               //Array of vertices, each of type Vector
9.837681;-15.037872;0.000000;,
-19.277889;22.481186;0.000000;,
9.837681;22.481186;0.000000;,
-19.277889;-15.037872;13.356144;,
9.837681;-15.037872;13.356144;,
-19.277889;22.481186;13.356144;,
9.837681;22.481186;13.356144;;

12;                                            //Number of faces(triangle)
3;0,2,3;,                                      //Array of indices
3;3,1,0;,
3;4,5,7;,
3;7,6,4;,
3;0,1,5;,
3;5,4,0;,
3;1,3,7;,
3;7,5,1;,
3;3,2,6;,
3;6,7,3;,
3;2,0,4;,
3;4,6,2;;
MeshNormals  {                                 //Optional
6;                                             //Number of normals.
0.000000;0.000000;-1.000000;,                  //Array of normals
0.000000;0.000000;1.000000;,
0.000000;-1.000000;0.000000;,
1.000000;0.000000;0.000000;,
0.000000;1.000000;0.000000;,
-1.000000;0.000000;0.000000;;
12;                                            //Number of face normals, equal face's number!
3;0,0,0;,                                      //Array of mesh face normals
3;0,0,0;,
3;1,1,1;,
3;1,1,1;,
3;2,2,2;,
3;2,2,2;,
3;3,3,3;,
3;3,3,3;,
3;4,4,4;,
3;4,4,4;,
3;5,5,5;,
3;5,5,5;;
}
MeshMaterialList  {                           //Optional
   1;                                         //The number of materials.
   12;                                        //The number of indices. equal face's number
   0,                                         //An arrray of DWORDs containing the face indices
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0;
{ PDX01_-_Default }                           //Reference to the material we define
}
MeshTextureCoords {                          //Optional
8;                                            //Number of texture coordinates
0.000000;0.000000;,                          //Array of 2D texture coordinates.
1.000000;0.000000;,
0.000000;-1.000000;,
1.000000;-1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
0.000000;-1.000000;,
1.000000;-1.000000;;
}
}
}

http://www.waitingfy.com/?p=460
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

瓦力冫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值