00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __QFILES_H__
00023 #define __QFILES_H__
00024
00025
00026
00027
00028
00029
00030
00031 #define SHADER_MAX_VERTEXES 1000
00032 #define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
00033
00034
00035
00036 #define MAX_QPATH 64
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
00092 #define MD3_VERSION 15
00093
00094
00095 #define MD3_MAX_LODS 4
00096 #define MD3_MAX_TRIANGLES 8192 // per surface
00097 #define MD3_MAX_VERTS 4096 // per surface
00098 #define MD3_MAX_SHADERS 256 // per surface
00099 #define MD3_MAX_FRAMES 1024 // per model
00100 #define MD3_MAX_SURFACES 32 // per model
00101 #define MD3_MAX_TAGS 16 // per frame
00102
00103
00104 #define MD3_XYZ_SCALE (1.0/64)
00105
00106 typedef struct md3Frame_s {
00107 vec3_t bounds[2];
00108 vec3_t localOrigin;
00109 float radius;
00110 char name[16];
00111 } md3Frame_t;
00112
00113 typedef struct md3Tag_s {
00114 char name[MAX_QPATH];
00115 vec3_t origin;
00116 vec3_t axis[3];
00117 } md3Tag_t;
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 typedef struct {
00131 int ident;
00132
00133 char name[MAX_QPATH];
00134
00135 int flags;
00136 int numFrames;
00137
00138 int numShaders;
00139 int numVerts;
00140
00141 int numTriangles;
00142 int ofsTriangles;
00143
00144 int ofsShaders;
00145 int ofsSt;
00146 int ofsXyzNormals;
00147
00148 int ofsEnd;
00149 } md3Surface_t;
00150
00151 typedef struct {
00152 char name[MAX_QPATH];
00153 int shaderIndex;
00154 } md3Shader_t;
00155
00156 typedef struct {
00157 int indexes[3];
00158 } md3Triangle_t;
00159
00160 typedef struct {
00161 float st[2];
00162 } md3St_t;
00163
00164 typedef struct {
00165 short xyz[3];
00166 short normal;
00167 } md3XyzNormal_t;
00168
00169 typedef struct {
00170 int ident;
00171 int version;
00172
00173 char name[MAX_QPATH];
00174
00175 int flags;
00176
00177 int numFrames;
00178 int numTags;
00179 int numSurfaces;
00180
00181 int numSkins;
00182
00183 int ofsFrames;
00184 int ofsTags;
00185 int ofsSurfaces;
00186
00187 int ofsEnd;
00188 } md3Header_t;
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 #define Q3_BSP_IDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I')
00202
00203
00204 #define Q3_BSP_VERSION 46
00205
00206
00207
00208
00209 #define Q3_MAX_MAP_MODELS 0x400
00210 #define Q3_MAX_MAP_BRUSHES 0x8000
00211 #define Q3_MAX_MAP_ENTITIES 0x800
00212 #define Q3_MAX_MAP_ENTSTRING 0x10000
00213 #define Q3_MAX_MAP_SHADERS 0x400
00214
00215 #define Q3_MAX_MAP_AREAS 0x100 // MAX_MAP_AREA_BYTES in q_shared must match!
00216 #define Q3_MAX_MAP_FOGS 0x100
00217 #define Q3_MAX_MAP_PLANES 0x10000
00218 #define Q3_MAX_MAP_NODES 0x10000
00219 #define Q3_MAX_MAP_BRUSHSIDES 0x10000
00220 #define Q3_MAX_MAP_LEAFS 0x10000
00221 #define Q3_MAX_MAP_LEAFFACES 0x10000
00222 #define Q3_MAX_MAP_LEAFBRUSHES 0x10000
00223 #define Q3_MAX_MAP_PORTALS 0x10000
00224 #define Q3_MAX_MAP_LIGHTING 0x400000
00225 #define Q3_MAX_MAP_LIGHTGRID 0x400000
00226 #define Q3_MAX_MAP_VISIBILITY 0x200000
00227
00228 #define Q3_MAX_MAP_DRAW_SURFS 0x20000
00229 #define Q3_MAX_MAP_DRAW_VERTS 0x80000
00230 #define Q3_MAX_MAP_DRAW_INDEXES 0x80000
00231
00232
00233
00234 #define Q3_MAX_KEY 32
00235 #define Q3_MAX_VALUE 1024
00236
00237
00238 #define ANGLE_UP -1
00239 #define ANGLE_DOWN -2
00240
00241 #define LIGHTMAP_WIDTH 128
00242 #define LIGHTMAP_HEIGHT 128
00243
00244
00245
00246
00247
00248 typedef struct {
00249 int fileofs, filelen;
00250 } q3_lump_t;
00251
00252 #define Q3_LUMP_ENTITIES 0
00253 #define Q3_LUMP_SHADERS 1
00254 #define Q3_LUMP_PLANES 2
00255 #define Q3_LUMP_NODES 3
00256 #define Q3_LUMP_LEAFS 4
00257 #define Q3_LUMP_LEAFSURFACES 5
00258 #define Q3_LUMP_LEAFBRUSHES 6
00259 #define Q3_LUMP_MODELS 7
00260 #define Q3_LUMP_BRUSHES 8
00261 #define Q3_LUMP_BRUSHSIDES 9
00262 #define Q3_LUMP_DRAWVERTS 10
00263 #define Q3_LUMP_DRAWINDEXES 11
00264 #define Q3_LUMP_FOGS 12
00265 #define Q3_LUMP_SURFACES 13
00266 #define Q3_LUMP_LIGHTMAPS 14
00267 #define Q3_LUMP_LIGHTGRID 15
00268 #define Q3_LUMP_VISIBILITY 16
00269 #define Q3_HEADER_LUMPS 17
00270
00271 typedef struct {
00272 int ident;
00273 int version;
00274
00275 q3_lump_t lumps[Q3_HEADER_LUMPS];
00276 } q3_dheader_t;
00277
00278 typedef struct {
00279 float mins[3], maxs[3];
00280 int firstSurface, numSurfaces;
00281 int firstBrush, numBrushes;
00282 } q3_dmodel_t;
00283
00284 typedef struct {
00285 char shader[MAX_QPATH];
00286 int surfaceFlags;
00287 int contentFlags;
00288 } q3_dshader_t;
00289
00290
00291
00292 typedef struct {
00293 float normal[3];
00294 float dist;
00295 } q3_dplane_t;
00296
00297 typedef struct {
00298 int planeNum;
00299 int children[2];
00300 int mins[3];
00301 int maxs[3];
00302 } q3_dnode_t;
00303
00304 typedef struct {
00305 int cluster;
00306 int area;
00307
00308 int mins[3];
00309 int maxs[3];
00310
00311 int firstLeafSurface;
00312 int numLeafSurfaces;
00313
00314 int firstLeafBrush;
00315 int numLeafBrushes;
00316 } q3_dleaf_t;
00317
00318 typedef struct {
00319 int planeNum;
00320 int shaderNum;
00321 } q3_dbrushside_t;
00322
00323 typedef struct {
00324 int firstSide;
00325 int numSides;
00326 int shaderNum;
00327 } q3_dbrush_t;
00328
00329 typedef struct {
00330 char shader[MAX_QPATH];
00331 int brushNum;
00332 int visibleSide;
00333 } q3_dfog_t;
00334
00335 typedef struct {
00336 vec3_t xyz;
00337 float st[2];
00338 float lightmap[2];
00339 vec3_t normal;
00340 byte color[4];
00341 } q3_drawVert_t;
00342
00343 typedef enum {
00344 MST_BAD,
00345 MST_PLANAR,
00346 MST_PATCH,
00347 MST_TRIANGLE_SOUP,
00348 MST_FLARE
00349 } q3_mapSurfaceType_t;
00350
00351 typedef struct {
00352 int shaderNum;
00353 int fogNum;
00354 int surfaceType;
00355
00356 int firstVert;
00357 int numVerts;
00358
00359 int firstIndex;
00360 int numIndexes;
00361
00362 int lightmapNum;
00363 int lightmapX, lightmapY;
00364 int lightmapWidth, lightmapHeight;
00365
00366 vec3_t lightmapOrigin;
00367 vec3_t lightmapVecs[3];
00368
00369 int patchWidth;
00370 int patchHeight;
00371 } q3_dsurface_t;
00372
00373
00374 #endif