2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #ifndef __MODEL_MD3_H__
30 #define __MODEL_MD3_H__
33 ========================================================================
35 .MD3 triangle model file format
37 Private structures used by the MD3 loader.
39 ========================================================================
42 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
43 #define MD3_VERSION 15
45 // surface geometry should not exceed these limits
46 #define SHADER_MAX_VERTEXES 1000
47 #define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
50 #define MD3_MAX_LODS 4
51 #define MD3_MAX_TRIANGLES 8192 // per surface
52 #define MD3_MAX_VERTS 4096 // per surface
53 #define MD3_MAX_SHADERS 256 // per surface
54 #define MD3_MAX_FRAMES 1024 // per model
55 #define MD3_MAX_SURFACES 32 // per model
56 #define MD3_MAX_TAGS 16 // per frame
57 #define MAX_MD3PATH 64 // from quake3
60 #define MD3_XYZ_SCALE (1.0/64)
62 typedef struct md3Frame_s {
69 typedef struct md3Tag_s {
70 char name[MAX_MD3PATH]; // tag name
79 ** header sizeof( md3Surface_t )
80 ** shaders sizeof( md3Shader_t ) * numShaders
81 ** triangles[0] sizeof( md3Triangle_t ) * numTriangles
82 ** st sizeof( md3St_t ) * numVerts
83 ** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames
86 typedef struct md3Surface_s {
89 char name[MAX_MD3PATH]; // polyset name
92 int numFrames; // all surfaces in a model should have the same
94 int numShaders; // all surfaces in a model should have the same
100 int ofsShaders; // offset from start of md3Surface_t
101 int ofsSt; // texture coords are common for all frames
102 int ofsXyzNormals; // numVerts * numFrames
104 int ofsEnd; // next surface follows
108 char name[MAX_MD3PATH];
109 const idMaterial * shader; // for in-game use
125 typedef struct md3Header_s {
129 char name[MAX_MD3PATH]; // model name
139 int ofsFrames; // offset for first frame
140 int ofsTags; // numFrames * numTags
141 int ofsSurfaces; // first surface, others follow
143 int ofsEnd; // end of file
146 #endif /* !__MODEL_MD3_H__ */