📄 quake 3 md3 file format.htm
字号:
</div>
<div align="left"></div>
<blockquote>
<div align="left">
<pre><font color="#999900">char ID[4]; //id, must be IDP3
char Name[68]; //name of mesh
//65 chars, <br> //32 bit aligned == 68 chars
int MeshFrame_num; //number of meshframes
//in mesh
int Skin_num; //number of skins in mesh
int Vertex_num; //number of vertices
int Triangle_num; //number of Triangles
int Triangle_Start; //starting position of
//Triangle data, relative <br> //to start of Mesh_Header
int HeaderSize; //size of header
int TexVec_Start; //starting position of <br> //texvector data, relative <br> //to start of Mesh_Header
int Vertex_Start; //starting position of <br> //vertex data,relative <br> //to start of Mesh_Header
int MeshSize; //size of mesh
</font> </pre>
</div>
</blockquote>
<div align="left">
<p><font face=Arial><b><i><font size="2">comments:</font></i></b></font><font size="2"><br>
<font face=Arial>Meshframe_num is the number
of quake1/quake2 type frames in the mesh.<br>
(these frames work on a morph like way, the vertices are moved from
one position to another instead of rotated around eachother like in
bone-based-animations) <br>
Skin_num is the number of skins in the md3 file..<br>
These skins are animated.<br>
Triangle_Start, TexVec_Start & Vertex_Start are the number of
bytes in the file from the start of the mesh header to the start of
the triangle, texvec and vertex data (in that order).<br>
</font></font></p>
<p> </p>
<p><font face=Arial>After the Mesh header come
the skin structures used by the mesh. </font><font face=Arial>
</font><font face=Arial><br>
The mesh header variable </font><font color="#999900" face=Arial>Skin_num</font><font face=Arial>
holds the ammount of skins..</font><font size="2" face=Arial>
</font></p>
<p><b><font face=Arial>SKIN:</font></b></p>
</div>
<blockquote>
<div align="left">
<pre><font color="#999900">char Name[68]; //name of skin used by mesh
//65 chars, <br> //32 bit aligned == 68 chars </font> </pre>
</div>
</blockquote>
<div align="left">
<p><font face=Arial><b><i><font size="2">comments:</font></i></b></font><font size="2"><br>
</font><font size="2"><font face=Arial>Name
holds the name of the texture, relative to the baseq3 path.<br>
Q3 has a peculiar way of handling textures..<br>
The scripts in the /script directory in the baseq3 directory contain
scripts that hold information about how some surfaces are drawn and
animate (and out of how many layers it consist etc.)<br>
Now the strange thing is, if you remove the ".tga" at the
end of the skin, and that name is used in the script files, than that
scripted surface is used.<br>
If it isn't mentioned in the script files then the filename is used
to load the <br>
tga file.</font></font></p>
<p><br>
<font face=Arial>After the Skins come the
triangles.<br>
The mesh header variable </font><font color="#999900" face=Arial>Triangle_num</font><font face=Arial>
holds the ammount of triangles..</font><br></p>
</div>
<div align="left">
<p><b><font face=Arial>TRIANGLE </font></b></p>
</div>
<blockquote>
<div align="left">
<pre><font color="#999900">int Triangle[3]; //vertex 1,2,3 of triangle
</font> </pre>
</div>
</blockquote>
<div align="left">
<p><font face=Arial><b><i><font size="2">comments:</font></i></b></font><font size="2"><br>
<font face=Arial>This is the simplest of
structures.<br>
A triangle has 3 points which make up the triangle, each point is
a vertex and the three ints that the triangle has point to those vertices.<br>
So you have a list of vertices, for example you have a list of 28
vertices and the triangle uses 3 of them: vertex 1, vertex 14 and
vertex 7.<br>
Then the ints contain 1, 14 and 7.<br>
</font></font></p>
<p> </p>
<p><font face=Arial>After the triangle data
come the texture u/v coordinates of each vertex. The mesh header variable
</font><font color="#999900" face=Arial>Vertex_num</font><font face=Arial>
holds the ammount of u/v coordinates and vertices..<br>
You have an U/V coordinate per vertex.</font><br></p>
</div>
<div align="left"><font face=Arial><b>TEXTURE
U/V COORDINATES:</b></font><br>
<br>
</div>
<blockquote>
<div align="left">
<pre><font color="#999900">Vec2 TexVec; //Texture U/V coordinates of vertex
</font>
</pre>
</div>
</blockquote>
<div align="left">
<p><font face=Arial><b><i><font size="2">comments:</font></i></b></font><font size="2"><br>
<font face=Arial>U/V coordinates are basically
the X/Y coordinates on the </font><font size="2"><font face=Arial>texture</font></font>.<font face=Arial><br>
This is used by the triangles to know which part of the skin to display.<br>
</font></font></p>
<p> </p>
<p><font face=Arial>After the texture u/v coordinates
come the vertices.<br>
The mesh header variable </font><font color="#999900" face=Arial>Vertex_num</font><font face=Arial>
holds the ammount of vertices per frame, and the mesh header variable
</font><font color="#999900" face=Arial>MeshFrame_num</font><font face=Arial>
contains the ammount of frames in the mesh.<br>
So you have </font><font color="#999900" face=Arial>MeshFrame_num
</font><font face=Arial>times <font color="#999900">Vertex_num</font></font><font face=Arial>
vertices. <br>
</font></p>
</div>
<div align="left"> <b><font face=Arial>VERTICES:
</font></b><br>
</div>
<blockquote>
<div align="left">
<pre>
<font color="#999900">//!!!important!!! signed!<br>signed short Vec[3]; //vertex X/Y/Z coordinate
unsigned char EnvTex[2]; //enviromental mapping texture coordinates<br> </font> </pre>
</div>
</blockquote>
<div align="left"><font face=Arial><b><i><font size="2">comments:</font></i></b></font><font size="2"><br>
<font face=Arial>Vec contains the 3d xyz coordinates
of the vertices that form the model.</font><font size="2"><font face=Arial>EnvTex
contains the texture coordinates for the enviromental mapping.<br>
Why does md3 have a second set of texture coordinates?<br>
Because:<br>
1. </font></font>these texture coordinates need to be interpolated when
the model changes shape,<br>
2. these texture coordinates are different from the normal texture coordinates
but still both need to be used (with shaders you can have multi-layered
surfaces, one could be an enviromental map, an other could be a transparent
texture) <font face=Arial><br>
</font></font><font size="2"><font face=Arial>
</font></font></div>
</blockquote>
</td>
</tr>
</table>
</body>
</html>
<NOSCRIPT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -