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_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
51 #include "model_brush.h"
52 #include "model_sprite.h"
53 #include "model_alias.h"
55 #define MODF_TRANSPARENT 1
57 typedef struct model_s
60 qboolean needload; // bmodels don't cache normally
63 int aliastype; // LordHavoc: Q2 model support
64 int fullbright; // LordHavoc: if true (normally only for sprites) the model/sprite/bmodel is always rendered fullbright
69 int flags2; // engine calculated flags, ones that can not be set in the file
71 // volume occupied by the model graphics
75 // solid volume for clipping
77 vec3_t clipmins, clipmaxs;
80 int firstmodelsurface, nummodelsurfaces;
88 int numleafs; // number of visible leafs, not counting 0
104 msurface_t *surfaces;
110 dclipnode_t *clipnodes;
113 msurface_t **marksurfaces;
115 hull_t hulls[MAX_MAP_HULLS];
118 texture_t **textures;
128 mvertex_t *portalpoints;
130 // LordHavoc: useful for sprites and models
133 int skinanimrange[MAX_SKINS*2]; // array of start and length pairs
134 rtexture_t *skinanim[MAX_SKINS*5]; // texture numbers for each frame (indexed by animrange), note: normal pants shirt glow body (normal contains no shirt/pants/glow colors and body is normal + pants + shirt, but not glow)
135 int ofs_scenes; // offset from Mod_ExtraData(model) memory to array of animscene_t structs
136 // these are used simply to simplify model/sprite/whatever processing and are specific to each type
137 int ofs_frames; // offset from Mod_ExtraData(model) memory to array of model specific frame structs
138 int framesize; // size of model specific frame structs
140 // additional model data
141 cache_user_t cache; // only access through Mod_Extradata
142 int cachesize; // size of cached data (zero if not cached)
146 //============================================================================
148 // used to avoid setting up submodels in non-world bmodels
149 extern qboolean isworldmodel;
151 extern model_t *loadmodel;
152 extern byte *mod_base;
153 // sky/water subdivision
154 extern cvar_t gl_subdivide_size;
155 // texture fullbrights
156 extern cvar_t r_fullbrights;
158 void Mod_Init (void);
159 void Mod_ClearAll (void);
160 model_t *Mod_ForName (char *name, qboolean crash);
161 void *Mod_Extradata (model_t *mod); // handles caching
162 void Mod_TouchModel (char *name);
164 mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
165 byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
167 extern model_t *loadmodel;
168 extern char loadname[32]; // for hunk tags
170 extern model_t *Mod_LoadModel (model_t *mod, qboolean crash);
172 extern float RadiusFromBounds (vec3_t mins, vec3_t maxs);
173 extern model_t *Mod_FindName (char *name);