UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qfiles.h
Go to the documentation of this file.
1 
9 /*
10 Copyright (C) 1997-2001 Id Software, Inc.
11 
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 
21 See the GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 
27 */
28 
29 #pragma once
30 
31 #include "../shared/defines.h"
32 
33 #define IDMDXHEADER "UFOMDX"
34 #define MDX_VERSION 1
35 
36 /*========================================================================
37 .MD2 triangle model file format
38 ========================================================================*/
39 
40 #define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
41 #define IDTAGHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'J')
42 #define MD2_ALIAS_VERSION 8
43 #define TAG_VERSION 1
44 
45 #define MD2_MAX_TRIANGLES 4096
46 #define MD2_MAX_VERTS 2048
47 #define MD2_MAX_FRAMES 1024
48 #define MD2_MAX_SKINS 32
49 #define MD2_MAX_SKINNAME 64
50 #define MD2_MAX_TAGNAME 64
51 
57 typedef struct {
58  uint16_t s;
59  uint16_t t;
60 } dMD2Coord_t;
61 
62 typedef struct {
63  uint16_t index_verts[3];
69  uint16_t index_st[3];
71 
72 typedef struct {
73  byte v[3];
85 
90 typedef struct dAliasFrame_s {
91  float scale[3];
92  float translate[3];
93  char name[16];
95 } dMD2Frame_t;
96 
97 
109 typedef struct {
110  uint32_t ident;
115  uint32_t version;
117  uint32_t skinwidth;
118  uint32_t skinheight;
119  uint32_t framesize;
121  uint32_t num_skins;
122  uint32_t num_verts;
123  uint32_t num_st;
124  uint32_t num_tris;
125  uint32_t num_glcmds;
126  uint32_t num_frames;
128  uint32_t ofs_skins;
129  uint32_t ofs_st;
130  uint32_t ofs_tris;
131  uint32_t ofs_frames;
132  uint32_t ofs_glcmds;
133  uint32_t ofs_end;
134 } dMD2Model_t;
135 
136 
141 typedef struct {
142  uint32_t ident;
143  uint32_t version;
145  uint32_t num_tags;
146  uint32_t num_frames;
149  uint32_t ofs_names;
150  uint32_t ofs_tags;
151  uint32_t ofs_end;
152  uint32_t ofs_extractend;
153 } dMD2tag_t;
154 
155 /*========================================================================
156 .MD3 model file format
157 ========================================================================*/
158 
159 #define IDMD3HEADER (('3'<<24)+('P'<<16)+('D'<<8)+'I')
160 
161 #define MD3_ALIAS_VERSION 15
162 #define MD3_ALIAS_MAX_LODS 4
163 
164 #define MD3_MAX_TRIANGLES 8192 /* per mesh */
165 #define MD3_MAX_VERTS 4096 /* per mesh */
166 #define MD3_MAX_SHADERS 256 /* per mesh */
167 #define MD3_MAX_FRAMES 1024 /* per model */
168 #define MD3_MAX_MESHES 32 /* per model */
169 #define MD3_MAX_TAGS 16 /* per frame */
170 #define MD3_MAX_PATH 64
171 
173 #define MD3_XYZ_SCALE (1.0f/64.0f)
174 
175 typedef struct {
176  float st[2];
177 } dmd3coord_t;
178 
179 typedef struct {
180  int16_t point[3];
181  int16_t norm;
182 } dmd3vertex_t;
183 
184 typedef struct {
185  float mins[3];
186  float maxs[3];
187  float translate[3];
188  float radius;
189  char creator[16];
190 } dmd3frame_t;
191 
192 typedef struct {
193  float origin[3];
194  float axis[3][3];
196 
197 typedef struct {
200 } dmd3tag_t;
201 
202 typedef struct {
204  uint32_t unused;
205 } dmd3skin_t;
206 
207 typedef struct {
208  char id[4];
209 
211 
212  uint32_t flags;
213 
214  uint32_t num_frames;
215  uint32_t num_skins;
216  uint32_t num_verts;
217  uint32_t num_tris;
218 
219  uint32_t ofs_tris;
220  uint32_t ofs_skins;
221  uint32_t ofs_tcs;
222  uint32_t ofs_verts;
223 
224  uint32_t meshsize;
225 } dmd3mesh_t;
226 
227 typedef struct {
228  uint32_t id;
229  uint32_t version;
230 
232 
233  uint32_t flags;
234 
235  uint32_t num_frames;
236  uint32_t num_tags;
237  uint32_t num_meshes;
238  uint32_t num_skins;
239 
240  uint32_t ofs_frames;
241  uint32_t ofs_tags;
242  uint32_t ofs_meshes;
243  uint32_t ofs_end;
244 } dmd3_t;
245 
246 /*==============================================================================
247 .BSP file format
248 ==============================================================================*/
249 
251 #define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
252 
253 #define BSPVERSION 79
254 
256 typedef struct {
257  uint32_t fileofs;
258  uint32_t filelen;
259 } lump_t;
260 
262 typedef struct {
263  uint32_t ident;
264  uint32_t version;
266 } dBspHeader_t;
267 
268 
269 #define BSP_SwapHeader(header, name) { \
270  unsigned int i; \
271  (header)->ident = LittleLong((header)->ident); \
272  (header)->version = LittleLong((header)->version); \
273  for (i = 0; i < HEADER_LUMPS; i++) { \
274  lump_t* l = &(header)->lumps[i]; \
275  l->filelen = LittleLong(l->filelen); \
276  l->fileofs = LittleLong(l->fileofs); \
277  if (l->fileofs == (uint32_t) -1) \
278  Sys_Error("Invalid bsp header found (lump overflow %i): '%s'", i, (name)); \
279  } \
280 }
uint32_t skinheight
Definition: qfiles.h:118
uint32_t version
Definition: qfiles.h:264
Definition: qfiles.h:227
uint32_t num_skins
Definition: qfiles.h:121
uint32_t ident
Definition: qfiles.h:263
char name[16]
Definition: qfiles.h:93
uint32_t num_tris
Definition: qfiles.h:124
uint32_t ofs_skins
Definition: qfiles.h:220
uint32_t ofs_verts
Definition: qfiles.h:222
#define HEADER_LUMPS
Definition: defines.h:184
is a variable sized structure, however all frame_t structures within the same file will have the same...
Definition: qfiles.h:90
uint32_t ofs_extractend
Definition: qfiles.h:152
float radius
Definition: qfiles.h:188
uint32_t num_frames
Definition: qfiles.h:146
uint32_t flags
Definition: qfiles.h:233
uint16_t t
Definition: qfiles.h:59
voidpf uLong int origin
Definition: ioapi.h:45
uint32_t version
Definition: qfiles.h:229
These two shorts are used to map a vertex onto a skin The horizontal axis position is given by s...
Definition: qfiles.h:57
const char * filename
Definition: ioapi.h:41
uint32_t flags
Definition: qfiles.h:212
uint32_t num_frames
Definition: qfiles.h:235
Tag file header structure - 32 byte A tag for a model must have the same amount of frames as the mode...
Definition: qfiles.h:141
uint32_t ofs_tcs
Definition: qfiles.h:221
uint32_t num_st
Definition: qfiles.h:123
uint32_t num_meshes
Definition: qfiles.h:237
uint32_t filelen
Definition: qfiles.h:258
float translate[3]
Definition: qfiles.h:92
uint32_t ofs_end
Definition: qfiles.h:151
uint32_t ofs_end
Definition: qfiles.h:133
uint32_t ident
Definition: qfiles.h:142
uint32_t version
Definition: qfiles.h:143
uint32_t num_glcmds
Definition: qfiles.h:125
uint32_t num_tags
Definition: qfiles.h:236
Directory of the different data blocks.
Definition: qfiles.h:256
uint32_t num_skins
Definition: qfiles.h:238
uint32_t framesize
Definition: qfiles.h:119
int16_t norm
Definition: qfiles.h:181
uint32_t fileofs
Definition: qfiles.h:257
uint32_t ofs_tags
Definition: qfiles.h:150
uint32_t ofs_glcmds
Definition: qfiles.h:132
uint32_t ofs_skins
Definition: qfiles.h:128
float scale[3]
Definition: qfiles.h:91
uint32_t ofs_names
Definition: qfiles.h:149
uint32_t ofs_frames
Definition: qfiles.h:240
uint32_t num_tags
Definition: qfiles.h:145
uint32_t num_frames
Definition: qfiles.h:126
uint32_t num_frames
Definition: qfiles.h:214
uint32_t ofs_frames
Definition: qfiles.h:131
uint32_t ofs_end
Definition: qfiles.h:243
uint32_t ofs_tris
Definition: qfiles.h:130
uint32_t ofs_meshes
Definition: qfiles.h:242
#define MD3_MAX_PATH
Definition: qfiles.h:170
uint32_t ofs_tags
Definition: qfiles.h:241
The BSP header definition with the data block directory.
Definition: qfiles.h:262
struct dAliasFrame_s dMD2Frame_t
is a variable sized structure, however all frame_t structures within the same file will have the same...
uint32_t meshsize
Definition: qfiles.h:224
the glcmd format: a positive integer starts a tristrip command, followed by that many vertex structur...
Definition: qfiles.h:109
uint32_t ofs_st
Definition: qfiles.h:129
dorientation_t orient
Definition: qfiles.h:199
uint32_t id
Definition: qfiles.h:228
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
uint32_t version
Definition: qfiles.h:115
uint32_t ofs_tris
Definition: qfiles.h:219
uint32_t num_skins
Definition: qfiles.h:215
uint16_t s
Definition: qfiles.h:58
uint32_t num_verts
Definition: qfiles.h:122
uint8_t byte
Definition: ufotypes.h:34
QGL_EXTERN int GLboolean GLfloat * v
Definition: r_gl.h:120
uint32_t skinwidth
Definition: qfiles.h:117
uint32_t num_tris
Definition: qfiles.h:217
uint32_t ident
Definition: qfiles.h:110
uint32_t num_verts
Definition: qfiles.h:216
uint32_t unused
Definition: qfiles.h:204
dMD2TriangleVertex_t verts[1]
Definition: qfiles.h:94