The MD2 format is used for 3D animated models in id Sofware's Quake II.
A model consists of named frames
, each with the same number of vertices
(vertices_per_frame
). Each such vertex has a position
and normal
in
model space. Each vertex has the same topological "meaning" across frames, in
terms of triangle and texture info; it just varies in position and normal for
animation purposes.
How the vertices form triangles is defined via disjoint triangles
or via
gl_cmds
(which allows strip and fan topology). Each triangle contains three
vertex_indices
into frame vertices, and three tex_point_indices
into
global tex_coords
. Each texture point has pixel coords s_px
and t_px
ranging from 0 to skin_{width,height}_px
respectively, along with
{s,t}_normalized
ranging from 0 to 1 for your convenience.
A GL command has a primitive
type (TRIANGLE_FAN
or TRIANGLE_STRIP
) along
with some vertices
. Each GL vertex contains tex_coords_normalized
from 0
to 1, and a vertex_index
into frame vertices.
A model may also contain skins
, which are just file paths to PCX images.
However, this is empty for many models, in which case it is up to the client
(e.g. Q2PRO) to offer skins some other way (e.g. by similar filename in the
current directory).
There are 198 frames
in total, partitioned into a fixed set of ranges used
for different animations. Each frame has a standard name
for humans, but the
client just uses their index and the name can be arbitrary. The name, start
frame index and frame count of each animation can be looked up in the arrays
anim_names
, anim_start_indices
, and anim_num_frames
respectively. This
information is summarized in the following table:
| INDEX | NAME | SUFFIX | NOTES |
|:--------:|--------:|:-------|:-------------------------------------------------------|
| 0-39 | stand | 01-40 | Idle animation |
| 40-45 | run | 1-6 | Full run cycle |
| 46-53 | attack | 1-8 | Shoot, reload; some weapons just repeat 1st few frames |
| 54-57 | pain1 | 01-04 | Q2Pro also uses this for switching weapons |
| 58-61 | pain2 | 01-04 | |
| 62-65 | pain3 | 01-04 | |
| 66-71 | jump | 1-6 | Starts at height and lands on feet |
| 72-83 | flip | 01-12 | Flipoff, i.e. middle finger |
| 84-94 | salute | 01-11 | |
| 95-111 | taunt | 01-17 | |
| 112-122 | wave | 01-11 | Q2Pro plays this backwards for a handgrenade toss |
| 123-134 | point | 01-12 | |
| 135-153 | crstnd | 01-19 | Idle while crouching |
| 154-159 | crwalk | 1-6 | |
| 160-168 | crattak | 1-9 | |
| 169-172 | crpain | 1-4 | |
| 173-177 | crdeath | 1-5 | |
| 178-183 | death1 | 01-06 | |
| 184-189 | death2 | 01-06 | |
| 190-197 | death3 | 01-08 | |
The above are filled in for player models; for the separate weapon models,
the final frame is 173 "g_view" (unknown purpose) since weapons aren't shown
during death animations. a_grenades.md2
, the handgrenade weapon model, is
the same except that the wave
frames are blank (according to the default
female model files). This is likely due to its dual use as a grenade throw
animation where this model must leave the player's model.
This page hosts a formal specification of Quake II player model (version 8) using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
digraph {
rankdir=LR;
node [shape=plaintext];
subgraph cluster__quake2_md2 {
label="Quake2Md2";
graph[style=dotted];
quake2_md2__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="magic_pos">0</TD><TD PORT="magic_size">4</TD><TD></TD><TD PORT="magic_type">magic</TD></TR>
<TR><TD PORT="version_pos">4</TD><TD PORT="version_size">4</TD><TD>u4le</TD><TD PORT="version_type">version</TD></TR>
<TR><TD PORT="skin_width_px_pos">8</TD><TD PORT="skin_width_px_size">4</TD><TD>u4le</TD><TD PORT="skin_width_px_type">skin_width_px</TD></TR>
<TR><TD PORT="skin_height_px_pos">12</TD><TD PORT="skin_height_px_size">4</TD><TD>u4le</TD><TD PORT="skin_height_px_type">skin_height_px</TD></TR>
<TR><TD PORT="bytes_per_frame_pos">16</TD><TD PORT="bytes_per_frame_size">4</TD><TD>u4le</TD><TD PORT="bytes_per_frame_type">bytes_per_frame</TD></TR>
<TR><TD PORT="num_skins_pos">20</TD><TD PORT="num_skins_size">4</TD><TD>u4le</TD><TD PORT="num_skins_type">num_skins</TD></TR>
<TR><TD PORT="vertices_per_frame_pos">24</TD><TD PORT="vertices_per_frame_size">4</TD><TD>u4le</TD><TD PORT="vertices_per_frame_type">vertices_per_frame</TD></TR>
<TR><TD PORT="num_tex_coords_pos">28</TD><TD PORT="num_tex_coords_size">4</TD><TD>u4le</TD><TD PORT="num_tex_coords_type">num_tex_coords</TD></TR>
<TR><TD PORT="num_triangles_pos">32</TD><TD PORT="num_triangles_size">4</TD><TD>u4le</TD><TD PORT="num_triangles_type">num_triangles</TD></TR>
<TR><TD PORT="num_gl_cmds_pos">36</TD><TD PORT="num_gl_cmds_size">4</TD><TD>u4le</TD><TD PORT="num_gl_cmds_type">num_gl_cmds</TD></TR>
<TR><TD PORT="num_frames_pos">40</TD><TD PORT="num_frames_size">4</TD><TD>u4le</TD><TD PORT="num_frames_type">num_frames</TD></TR>
<TR><TD PORT="ofs_skins_pos">44</TD><TD PORT="ofs_skins_size">4</TD><TD>u4le</TD><TD PORT="ofs_skins_type">ofs_skins</TD></TR>
<TR><TD PORT="ofs_tex_coords_pos">48</TD><TD PORT="ofs_tex_coords_size">4</TD><TD>u4le</TD><TD PORT="ofs_tex_coords_type">ofs_tex_coords</TD></TR>
<TR><TD PORT="ofs_triangles_pos">52</TD><TD PORT="ofs_triangles_size">4</TD><TD>u4le</TD><TD PORT="ofs_triangles_type">ofs_triangles</TD></TR>
<TR><TD PORT="ofs_frames_pos">56</TD><TD PORT="ofs_frames_size">4</TD><TD>u4le</TD><TD PORT="ofs_frames_type">ofs_frames</TD></TR>
<TR><TD PORT="ofs_gl_cmds_pos">60</TD><TD PORT="ofs_gl_cmds_size">4</TD><TD>u4le</TD><TD PORT="ofs_gl_cmds_type">ofs_gl_cmds</TD></TR>
<TR><TD PORT="ofs_eof_pos">64</TD><TD PORT="ofs_eof_size">4</TD><TD>u4le</TD><TD PORT="ofs_eof_type">ofs_eof</TD></TR>
</TABLE>>];
quake2_md2__inst__anim_num_frames [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>anim_num_frames</TD><TD>[40, 6, 8, 4, 4, 4, 6, 12, 11, 17, 11, 12, 19, 6, 9, 4, 5, 6, 6, 8].pack('C*')</TD></TR>
</TABLE>>];
quake2_md2__inst__anorms_table [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>anorms_table</TD><TD>[[-0.525731, 0.000000, 0.850651], [-0.442863, 0.238856, 0.864188], [-0.295242, 0.000000, 0.955423], [-0.309017, 0.500000, 0.809017], [-0.162460, 0.262866, 0.951056], [0.000000, 0.000000, 1.000000], [0.000000, 0.850651, 0.525731], [-0.147621, 0.716567, 0.681718], [0.147621, 0.716567, 0.681718], [0.000000, 0.525731, 0.850651], [0.309017, 0.500000, 0.809017], [0.525731, 0.000000, 0.850651], [0.295242, 0.000000, 0.955423], [0.442863, 0.238856, 0.864188], [0.162460, 0.262866, 0.951056], [-0.681718, 0.147621, 0.716567], [-0.809017, 0.309017, 0.500000], [-0.587785, 0.425325, 0.688191], [-0.850651, 0.525731, 0.000000], [-0.864188, 0.442863, 0.238856], [-0.716567, 0.681718, 0.147621], [-0.688191, 0.587785, 0.425325], [-0.500000, 0.809017, 0.309017], [-0.238856, 0.864188, 0.442863], [-0.425325, 0.688191, 0.587785], [-0.716567, 0.681718, -0.147621], [-0.500000, 0.809017, -0.309017], [-0.525731, 0.850651, 0.000000], [0.000000, 0.850651, -0.525731], [-0.238856, 0.864188, -0.442863], [0.000000, 0.955423, -0.295242], [-0.262866, 0.951056, -0.162460], [0.000000, 1.000000, 0.000000], [0.000000, 0.955423, 0.295242], [-0.262866, 0.951056, 0.162460], [0.238856, 0.864188, 0.442863], [0.262866, 0.951056, 0.162460], [0.500000, 0.809017, 0.309017], [0.238856, 0.864188, -0.442863], [0.262866, 0.951056, -0.162460], [0.500000, 0.809017, -0.309017], [0.850651, 0.525731, 0.000000], [0.716567, 0.681718, 0.147621], [0.716567, 0.681718, -0.147621], [0.525731, 0.850651, 0.000000], [0.425325, 0.688191, 0.587785], [0.864188, 0.442863, 0.238856], [0.688191, 0.587785, 0.425325], [0.809017, 0.309017, 0.500000], [0.681718, 0.147621, 0.716567], [0.587785, 0.425325, 0.688191], [0.955423, 0.295242, 0.000000], [1.000000, 0.000000, 0.000000], [0.951056, 0.162460, 0.262866], [0.850651, -0.525731, 0.000000], [0.955423, -0.295242, 0.000000], [0.864188, -0.442863, 0.238856], [0.951056, -0.162460, 0.262866], [0.809017, -0.309017, 0.500000], [0.681718, -0.147621, 0.716567], [0.850651, 0.000000, 0.525731], [0.864188, 0.442863, -0.238856], [0.809017, 0.309017, -0.500000], [0.951056, 0.162460, -0.262866], [0.525731, 0.000000, -0.850651], [0.681718, 0.147621, -0.716567], [0.681718, -0.147621, -0.716567], [0.850651, 0.000000, -0.525731], [0.809017, -0.309017, -0.500000], [0.864188, -0.442863, -0.238856], [0.951056, -0.162460, -0.262866], [0.147621, 0.716567, -0.681718], [0.309017, 0.500000, -0.809017], [0.425325, 0.688191, -0.587785], [0.442863, 0.238856, -0.864188], [0.587785, 0.425325, -0.688191], [0.688191, 0.587785, -0.425325], [-0.147621, 0.716567, -0.681718], [-0.309017, 0.500000, -0.809017], [0.000000, 0.525731, -0.850651], [-0.525731, 0.000000, -0.850651], [-0.442863, 0.238856, -0.864188], [-0.295242, 0.000000, -0.955423], [-0.162460, 0.262866, -0.951056], [0.000000, 0.000000, -1.000000], [0.295242, 0.000000, -0.955423], [0.162460, 0.262866, -0.951056], [-0.442863, -0.238856, -0.864188], [-0.309017, -0.500000, -0.809017], [-0.162460, -0.262866, -0.951056], [0.000000, -0.850651, -0.525731], [-0.147621, -0.716567, -0.681718], [0.147621, -0.716567, -0.681718], [0.000000, -0.525731, -0.850651], [0.309017, -0.500000, -0.809017], [0.442863, -0.238856, -0.864188], [0.162460, -0.262866, -0.951056], [0.238856, -0.864188, -0.442863], [0.500000, -0.809017, -0.309017], [0.425325, -0.688191, -0.587785], [0.716567, -0.681718, -0.147621], [0.688191, -0.587785, -0.425325], [0.587785, -0.425325, -0.688191], [0.000000, -0.955423, -0.295242], [0.000000, -1.000000, 0.000000], [0.262866, -0.951056, -0.162460], [0.000000, -0.850651, 0.525731], [0.000000, -0.955423, 0.295242], [0.238856, -0.864188, 0.442863], [0.262866, -0.951056, 0.162460], [0.500000, -0.809017, 0.309017], [0.716567, -0.681718, 0.147621], [0.525731, -0.850651, 0.000000], [-0.238856, -0.864188, -0.442863], [-0.500000, -0.809017, -0.309017], [-0.262866, -0.951056, -0.162460], [-0.850651, -0.525731, 0.000000], [-0.716567, -0.681718, -0.147621], [-0.716567, -0.681718, 0.147621], [-0.525731, -0.850651, 0.000000], [-0.500000, -0.809017, 0.309017], [-0.238856, -0.864188, 0.442863], [-0.262866, -0.951056, 0.162460], [-0.864188, -0.442863, 0.238856], [-0.809017, -0.309017, 0.500000], [-0.688191, -0.587785, 0.425325], [-0.681718, -0.147621, 0.716567], [-0.442863, -0.238856, 0.864188], [-0.587785, -0.425325, 0.688191], [-0.309017, -0.500000, 0.809017], [-0.147621, -0.716567, 0.681718], [-0.425325, -0.688191, 0.587785], [-0.162460, -0.262866, 0.951056], [0.442863, -0.238856, 0.864188], [0.162460, -0.262866, 0.951056], [0.309017, -0.500000, 0.809017], [0.147621, -0.716567, 0.681718], [0.000000, -0.525731, 0.850651], [0.425325, -0.688191, 0.587785], [0.587785, -0.425325, 0.688191], [0.688191, -0.587785, 0.425325], [-0.955423, 0.295242, 0.000000], [-0.951056, 0.162460, 0.262866], [-1.000000, 0.000000, 0.000000], [-0.850651, 0.000000, 0.525731], [-0.955423, -0.295242, 0.000000], [-0.951056, -0.162460, 0.262866], [-0.864188, 0.442863, -0.238856], [-0.951056, 0.162460, -0.262866], [-0.809017, 0.309017, -0.500000], [-0.864188, -0.442863, -0.238856], [-0.951056, -0.162460, -0.262866], [-0.809017, -0.309017, -0.500000], [-0.681718, 0.147621, -0.716567], [-0.681718, -0.147621, -0.716567], [-0.850651, 0.000000, -0.525731], [-0.688191, 0.587785, -0.425325], [-0.587785, 0.425325, -0.688191], [-0.425325, 0.688191, -0.587785], [-0.425325, -0.688191, -0.587785], [-0.587785, -0.425325, -0.688191], [-0.688191, -0.587785, -0.425325]]</TD></TR>
</TABLE>>];
quake2_md2__inst__tex_coords [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="tex_coords_pos">ofs_tex_coords</TD><TD PORT="tex_coords_size">4</TD><TD>TexPoint</TD><TD PORT="tex_coords_type">tex_coords</TD></TR>
<TR><TD COLSPAN="4" PORT="tex_coords__repeat">repeat num_tex_coords times</TD></TR>
</TABLE>>];
quake2_md2__inst__triangles [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="triangles_pos">ofs_triangles</TD><TD PORT="triangles_size">12</TD><TD>Triangle</TD><TD PORT="triangles_type">triangles</TD></TR>
<TR><TD COLSPAN="4" PORT="triangles__repeat">repeat num_triangles times</TD></TR>
</TABLE>>];
quake2_md2__inst__frames [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="frames_pos">ofs_frames</TD><TD PORT="frames_size">bytes_per_frame</TD><TD>Frame</TD><TD PORT="frames_type">frames</TD></TR>
<TR><TD COLSPAN="4" PORT="frames__repeat">repeat num_frames times</TD></TR>
</TABLE>>];
quake2_md2__inst__anim_names [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>anim_names</TD><TD>["stand", "run", "attack", "pain1", "pain2", "pain3", "jump", "flip", "salute", "taunt", "wave", "point", "crstnd", "crwalk", "crattak", "crpain", "crdeath", "death1", "death2", "death3"]</TD></TR>
</TABLE>>];
quake2_md2__inst__gl_cmds [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="gl_cmds_pos">ofs_gl_cmds</TD><TD PORT="gl_cmds_size">(4 * num_gl_cmds)</TD><TD>GlCmdsList</TD><TD PORT="gl_cmds_type">gl_cmds</TD></TR>
</TABLE>>];
quake2_md2__inst__skins [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="skins_pos">ofs_skins</TD><TD PORT="skins_size">64</TD><TD>str(ascii)</TD><TD PORT="skins_type">skins</TD></TR>
<TR><TD COLSPAN="4" PORT="skins__repeat">repeat num_skins times</TD></TR>
</TABLE>>];
quake2_md2__inst__anim_start_indices [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>anim_start_indices</TD><TD>[0, 40, 46, 54, 58, 62, 66, 72, 84, 95, 112, 123, 135, 154, 160, 169, 173, 178, 184, 190].pack('C*')</TD></TR>
</TABLE>>];
subgraph cluster__vertex {
label="Quake2Md2::Vertex";
graph[style=dotted];
vertex__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="position_pos">0</TD><TD PORT="position_size">3</TD><TD>CompressedVec</TD><TD PORT="position_type">position</TD></TR>
<TR><TD PORT="normal_index_pos">3</TD><TD PORT="normal_index_size">1</TD><TD>u1</TD><TD PORT="normal_index_type">normal_index</TD></TR>
</TABLE>>];
vertex__inst__normal [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>normal</TD><TD>_root.anorms_table[normal_index]</TD></TR>
</TABLE>>];
}
subgraph cluster__compressed_vec {
label="Quake2Md2::CompressedVec";
graph[style=dotted];
compressed_vec__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="x_compressed_pos">0</TD><TD PORT="x_compressed_size">1</TD><TD>u1</TD><TD PORT="x_compressed_type">x_compressed</TD></TR>
<TR><TD PORT="y_compressed_pos">1</TD><TD PORT="y_compressed_size">1</TD><TD>u1</TD><TD PORT="y_compressed_type">y_compressed</TD></TR>
<TR><TD PORT="z_compressed_pos">2</TD><TD PORT="z_compressed_size">1</TD><TD>u1</TD><TD PORT="z_compressed_type">z_compressed</TD></TR>
</TABLE>>];
compressed_vec__inst__x [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>x</TD><TD>((x_compressed * _parent._parent.scale.x) + _parent._parent.translate.x)</TD></TR>
</TABLE>>];
compressed_vec__inst__y [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>y</TD><TD>((y_compressed * _parent._parent.scale.y) + _parent._parent.translate.y)</TD></TR>
</TABLE>>];
compressed_vec__inst__z [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>z</TD><TD>((z_compressed * _parent._parent.scale.z) + _parent._parent.translate.z)</TD></TR>
</TABLE>>];
}
subgraph cluster__triangle {
label="Quake2Md2::Triangle";
graph[style=dotted];
triangle__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="vertex_indices_pos">0</TD><TD PORT="vertex_indices_size">2</TD><TD>u2le</TD><TD PORT="vertex_indices_type">vertex_indices</TD></TR>
<TR><TD COLSPAN="4" PORT="vertex_indices__repeat">repeat 3 times</TD></TR>
<TR><TD PORT="tex_point_indices_pos">6</TD><TD PORT="tex_point_indices_size">2</TD><TD>u2le</TD><TD PORT="tex_point_indices_type">tex_point_indices</TD></TR>
<TR><TD COLSPAN="4" PORT="tex_point_indices__repeat">repeat 3 times</TD></TR>
</TABLE>>];
}
subgraph cluster__frame {
label="Quake2Md2::Frame";
graph[style=dotted];
frame__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="scale_pos">0</TD><TD PORT="scale_size">12</TD><TD>Vec3f</TD><TD PORT="scale_type">scale</TD></TR>
<TR><TD PORT="translate_pos">12</TD><TD PORT="translate_size">12</TD><TD>Vec3f</TD><TD PORT="translate_type">translate</TD></TR>
<TR><TD PORT="name_pos">24</TD><TD PORT="name_size">16</TD><TD>str(ascii)</TD><TD PORT="name_type">name</TD></TR>
<TR><TD PORT="vertices_pos">40</TD><TD PORT="vertices_size">4</TD><TD>Vertex</TD><TD PORT="vertices_type">vertices</TD></TR>
<TR><TD COLSPAN="4" PORT="vertices__repeat">repeat _root.vertices_per_frame times</TD></TR>
</TABLE>>];
}
subgraph cluster__gl_cmds_list {
label="Quake2Md2::GlCmdsList";
graph[style=dotted];
gl_cmds_list__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="items_pos">0</TD><TD PORT="items_size">...</TD><TD>GlCmd</TD><TD PORT="items_type">items</TD></TR>
<TR><TD COLSPAN="4" PORT="items__repeat">repeat until _.cmd_num_vertices == 0</TD></TR>
</TABLE>>];
}
subgraph cluster__tex_point {
label="Quake2Md2::TexPoint";
graph[style=dotted];
tex_point__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="s_px_pos">0</TD><TD PORT="s_px_size">2</TD><TD>u2le</TD><TD PORT="s_px_type">s_px</TD></TR>
<TR><TD PORT="t_px_pos">2</TD><TD PORT="t_px_size">2</TD><TD>u2le</TD><TD PORT="t_px_type">t_px</TD></TR>
</TABLE>>];
tex_point__inst__s_normalized [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>s_normalized</TD><TD>((s_px + 0.0) / _root.skin_width_px)</TD></TR>
</TABLE>>];
tex_point__inst__t_normalized [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>t_normalized</TD><TD>((t_px + 0.0) / _root.skin_height_px)</TD></TR>
</TABLE>>];
}
subgraph cluster__vec3f {
label="Quake2Md2::Vec3f";
graph[style=dotted];
vec3f__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="x_pos">0</TD><TD PORT="x_size">4</TD><TD>f4le</TD><TD PORT="x_type">x</TD></TR>
<TR><TD PORT="y_pos">4</TD><TD PORT="y_size">4</TD><TD>f4le</TD><TD PORT="y_type">y</TD></TR>
<TR><TD PORT="z_pos">8</TD><TD PORT="z_size">4</TD><TD>f4le</TD><TD PORT="z_type">z</TD></TR>
</TABLE>>];
}
subgraph cluster__gl_vertex {
label="Quake2Md2::GlVertex";
graph[style=dotted];
gl_vertex__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="tex_coords_normalized_pos">0</TD><TD PORT="tex_coords_normalized_size">4</TD><TD>f4le</TD><TD PORT="tex_coords_normalized_type">tex_coords_normalized</TD></TR>
<TR><TD COLSPAN="4" PORT="tex_coords_normalized__repeat">repeat 2 times</TD></TR>
<TR><TD PORT="vertex_index_pos">8</TD><TD PORT="vertex_index_size">4</TD><TD>u4le</TD><TD PORT="vertex_index_type">vertex_index</TD></TR>
</TABLE>>];
}
subgraph cluster__gl_cmd {
label="Quake2Md2::GlCmd";
graph[style=dotted];
gl_cmd__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="cmd_num_vertices_pos">0</TD><TD PORT="cmd_num_vertices_size">4</TD><TD>s4le</TD><TD PORT="cmd_num_vertices_type">cmd_num_vertices</TD></TR>
<TR><TD PORT="vertices_pos">4</TD><TD PORT="vertices_size">12</TD><TD>GlVertex</TD><TD PORT="vertices_type">vertices</TD></TR>
<TR><TD COLSPAN="4" PORT="vertices__repeat">repeat num_vertices times</TD></TR>
</TABLE>>];
gl_cmd__inst__num_vertices [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>num_vertices</TD><TD>(cmd_num_vertices < 0 ? -(cmd_num_vertices) : cmd_num_vertices)</TD></TR>
</TABLE>>];
gl_cmd__inst__primitive [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">id</TD><TD BGCOLOR="#E0FFE0">value</TD></TR>
<TR><TD>primitive</TD><TD>(cmd_num_vertices < 0 ? :gl_primitive_triangle_fan : :gl_primitive_triangle_strip)</TD></TR>
</TABLE>>];
}
}
quake2_md2__seq:ofs_tex_coords_type -> quake2_md2__inst__tex_coords:tex_coords_pos [color="#404040"];
quake2_md2__inst__tex_coords:tex_coords_type -> tex_point__seq [style=bold];
quake2_md2__seq:num_tex_coords_type -> quake2_md2__inst__tex_coords:tex_coords__repeat [color="#404040"];
quake2_md2__seq:ofs_triangles_type -> quake2_md2__inst__triangles:triangles_pos [color="#404040"];
quake2_md2__inst__triangles:triangles_type -> triangle__seq [style=bold];
quake2_md2__seq:num_triangles_type -> quake2_md2__inst__triangles:triangles__repeat [color="#404040"];
quake2_md2__seq:ofs_frames_type -> quake2_md2__inst__frames:frames_pos [color="#404040"];
quake2_md2__seq:bytes_per_frame_type -> quake2_md2__inst__frames:frames_size [color="#404040"];
quake2_md2__inst__frames:frames_type -> frame__seq [style=bold];
quake2_md2__seq:num_frames_type -> quake2_md2__inst__frames:frames__repeat [color="#404040"];
quake2_md2__seq:ofs_gl_cmds_type -> quake2_md2__inst__gl_cmds:gl_cmds_pos [color="#404040"];
quake2_md2__seq:num_gl_cmds_type -> quake2_md2__inst__gl_cmds:gl_cmds_size [color="#404040"];
quake2_md2__inst__gl_cmds:gl_cmds_type -> gl_cmds_list__seq [style=bold];
quake2_md2__seq:ofs_skins_type -> quake2_md2__inst__skins:skins_pos [color="#404040"];
quake2_md2__seq:num_skins_type -> quake2_md2__inst__skins:skins__repeat [color="#404040"];
vertex__seq:position_type -> compressed_vec__seq [style=bold];
quake2_md2__inst__anorms_table:anorms_table_type -> vertex__inst__normal [color="#404040"];
vertex__seq:normal_index_type -> vertex__inst__normal [color="#404040"];
compressed_vec__seq:x_compressed_type -> compressed_vec__inst__x [color="#404040"];
vec3f__seq:x_type -> compressed_vec__inst__x [color="#404040"];
vec3f__seq:x_type -> compressed_vec__inst__x [color="#404040"];
compressed_vec__seq:y_compressed_type -> compressed_vec__inst__y [color="#404040"];
vec3f__seq:y_type -> compressed_vec__inst__y [color="#404040"];
vec3f__seq:y_type -> compressed_vec__inst__y [color="#404040"];
compressed_vec__seq:z_compressed_type -> compressed_vec__inst__z [color="#404040"];
vec3f__seq:z_type -> compressed_vec__inst__z [color="#404040"];
vec3f__seq:z_type -> compressed_vec__inst__z [color="#404040"];
frame__seq:scale_type -> vec3f__seq [style=bold];
frame__seq:translate_type -> vec3f__seq [style=bold];
frame__seq:vertices_type -> vertex__seq [style=bold];
quake2_md2__seq:vertices_per_frame_type -> frame__seq:vertices__repeat [color="#404040"];
gl_cmds_list__seq:items_type -> gl_cmd__seq [style=bold];
gl_cmd__seq:cmd_num_vertices_type -> gl_cmds_list__seq:items__repeat [color="#404040"];
tex_point__seq:s_px_type -> tex_point__inst__s_normalized [color="#404040"];
quake2_md2__seq:skin_width_px_type -> tex_point__inst__s_normalized [color="#404040"];
tex_point__seq:t_px_type -> tex_point__inst__t_normalized [color="#404040"];
quake2_md2__seq:skin_height_px_type -> tex_point__inst__t_normalized [color="#404040"];
gl_cmd__seq:vertices_type -> gl_vertex__seq [style=bold];
gl_cmd__inst__num_vertices:num_vertices_type -> gl_cmd__seq:vertices__repeat [color="#404040"];
gl_cmd__seq:cmd_num_vertices_type -> gl_cmd__inst__num_vertices [color="#404040"];
gl_cmd__seq:cmd_num_vertices_type -> gl_cmd__inst__num_vertices [color="#404040"];
gl_cmd__seq:cmd_num_vertices_type -> gl_cmd__inst__num_vertices [color="#404040"];
gl_cmd__seq:cmd_num_vertices_type -> gl_cmd__inst__primitive [color="#404040"];
}