2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
31 d*_t structures are on-disk representations
32 m*_t structures are in-memory
36 typedef enum {mod_invalid, mod_brush, mod_sprite, mod_alias} modtype_t;
38 typedef struct animscene_s
40 char name[32]; // for viewthing support
43 int loop; // true or false
48 typedef struct skinframe_s
50 rtexture_t *base; // original texture minus pants/shirt/glow
51 rtexture_t *pants; // pants only (in greyscale)
52 rtexture_t *shirt; // shirt only (in greyscale)
53 rtexture_t *glow; // glow only
54 rtexture_t *merged; // original texture minus glow
55 rtexture_t *fog; // white texture with alpha of the base texture, NULL if not transparent
62 #include "model_brush.h"
63 #include "model_sprite.h"
64 #include "model_alias.h"
66 typedef struct model_s
69 // model needs to be loaded if this is true
71 // set if the model is used in current map, models which are not, are purged
73 // CRC of the file this model was loaded from, to reload if changed
75 // true if this is the world model (I.E. defines what sky to use, and may contain submodels)
76 qboolean isworldmodel;
77 // true if this model is a HalfLife .bsp file
80 // mod_brush, mod_alias, mod_sprite
82 // LordHavoc: Q2/ZYM model support
84 // LordHavoc: if true (normally only for sprites) the model/sprite/bmodel is always rendered fullbright
86 // number of QC accessable frame(group)s in the model
88 // whether to randomize animated framegroups
91 // used for sprites and models
98 // flags from the model file
100 // engine calculated flags, ones that can not be set in the file
103 // all models use textures...
104 rtexturepool_t *texturepool;
106 // volume occupied by the model
107 // bounding box at angles '0 0 0'
108 vec3_t normalmins, normalmaxs;
109 // bounding box if yaw angle is not 0, but pitch and roll are
110 vec3_t yawmins, yawmaxs;
111 // bounding box if pitch or roll are used
112 vec3_t rotatedmins, rotatedmaxs;
113 // usable at any angles
114 // float modelradius;
116 // brush model specific
117 int firstmodelsurface, nummodelsurfaces;
118 // LordHavoc: sorted surface pointer array, sorted by shader type and then by texture
119 msurface_t **modelsortedsurfaces; // [nummodelsurfaces]
121 // used for surfaces without a valid texture
124 // lightmap format, set to r_lightmaprgba when model is loaded
133 // number of visible leafs, not counting 0 (solid)
150 msurface_t *surfaces;
156 dclipnode_t *clipnodes;
159 msurface_t **marksurfaces;
161 hull_t hulls[MAX_MAP_HULLS];
164 texture_t **textures;
174 mvertex_t *portalpoints;
179 // skin animation info
180 animscene_t *skinscenes; // [numskins]
182 skinframe_t *skinframes;
184 animscene_t *animscenes; // [numframes]
186 // Q1 and Q2 models are the same after loading
187 int *mdlmd2data_indices;
188 float *mdlmd2data_texcoords;
189 md2frame_t *mdlmd2data_frames;
190 trivertx_t *mdlmd2data_pose;
192 // for Zymotic models
193 void *zymdata_header;
196 mspriteframe_t *sprdata_frames;
198 // adds a box (or individual polygons) to the clipping engine,
199 // which will mark the entity visible if seen
200 void(*SERAddEntity)(void);
203 // draw the model's sky polygons (only used by brush models)
204 void(*DrawSky)(void);
205 // draw the model's shadows
206 void(*DrawShadow)(void);
208 // memory pool for allocations
213 //============================================================================
216 extern model_t *loadmodel;
217 extern qbyte *mod_base;
218 // sky/water subdivision
219 extern cvar_t gl_subdivide_size;
220 // texture fullbrights
221 extern cvar_t r_fullbrights;
223 void Mod_Init (void);
224 void Mod_CheckLoaded (model_t *mod);
225 void Mod_ClearAll (void);
226 model_t *Mod_ForName (char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
227 void Mod_TouchModel (char *name);
228 void Mod_UnloadModel (model_t *mod);
230 mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
231 qbyte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
233 void Mod_ClearUsed(void);
234 void Mod_PurgeUnused(void);
236 extern model_t *loadmodel;
237 extern char loadname[32]; // for hunk tags
239 //extern model_t *Mod_LoadModel (model_t *mod, qboolean crash);
241 //extern float RadiusFromBounds (vec3_t mins, vec3_t maxs);
242 extern model_t *Mod_FindName (char *name);