. X file format detailed analysis. x file format

Source: Internet
Author: User

The picture below is. X file opened by DirectX Mesh View. today, we look at the X file's detail information. I stronugly 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.

 


Type Required Size (in bytes) Value Description
Magic Number x 4 "xof"
Version Number x 2 "03" Major version 3
"03" Minor version 3
Format Type x 4 "txt" Text File
"Bin" Binary file
"Tzip" MSZip compressed text file
"Bzip" MSZip compressed binary file
Float Size x "0064" 64-bit floats
X "0032" 32-bit floats

 

 

[Cpp]
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;, // Array of mesh face normals
3; 0, 0 ;,
3; 1, 1 ;,
3; 1, 1 ;,
3; 2, 2 ;,
3; 2, 2 ;,
3; 3, 3 ;,
3; 3, 3 ;,
3; 4, 4 ;,
3; 4, 4 ;,
3; 5, 5 ;,
3; 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 ;;
}
}
}

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;, // Array of mesh face normals
3; 0, 0 ;,
3; 1, 1 ;,
3; 1, 1 ;,
3; 2, 2 ;,
3; 2, 2 ;,
3; 3, 3 ;,
3; 3, 3 ;,
3; 4, 4 ;,
3; 4, 4 ;,
3; 5, 5 ;,
3; 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 ;;
}
}
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.