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
72 vec3_t normalmins, normalmaxs; // bounding box at angles '0 0 0'
73 vec3_t yawmins, yawmaxs; // bounding box if yaw angle is not 0, but pitch and roll are
74 vec3_t rotatedmins, rotatedmaxs; // bounding box if pitch or roll are used
75 // float modelradius; // usable at any angles
77 // solid volume for clipping
79 vec3_t clipmins, clipmaxs;
82 int firstmodelsurface, nummodelsurfaces;
90 int numleafs; // number of visible leafs, not counting 0
106 msurface_t *surfaces;
112 dclipnode_t *clipnodes;
115 msurface_t **marksurfaces;
117 hull_t hulls[MAX_MAP_HULLS];
120 texture_t **textures;
130 mvertex_t *portalpoints;
132 // LordHavoc: useful for sprites and models
136 int skinanimrange[MAX_SKINS*2]; // array of start and length pairs
137 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)
139 int ofs_scenes; // offset from Mod_ExtraData(model) memory to array of animscene_t structs
140 // these are used simply to simplify model/sprite/whatever processing and are specific to each type
141 int ofs_frames; // offset from Mod_ExtraData(model) memory to array of model specific frame structs
142 int framesize; // size of model specific frame structs
144 void (*SERAddEntity)(void);
145 void (*DrawEarly)(void);
146 void (*DrawLate)(void);
147 void (*DrawShadow)(void);
149 // additional model data
150 cache_user_t cache; // only access through Mod_Extradata
151 int cachesize; // size of cached data (zero if not cached)
155 //============================================================================
157 // used to avoid setting up submodels in non-world bmodels
158 extern qboolean isworldmodel;
160 extern model_t *loadmodel;
161 extern byte *mod_base;
162 // sky/water subdivision
163 extern cvar_t gl_subdivide_size;
164 // texture fullbrights
165 extern cvar_t r_fullbrights;
167 void Mod_Init (void);
168 void Mod_ClearAll (void);
169 model_t *Mod_ForName (char *name, qboolean crash);
170 void *Mod_Extradata (model_t *mod); // handles caching
171 void Mod_TouchModel (char *name);
173 mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
174 byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
176 extern model_t *loadmodel;
177 extern char loadname[32]; // for hunk tags
179 extern model_t *Mod_LoadModel (model_t *mod, qboolean crash);
181 extern float RadiusFromBounds (vec3_t mins, vec3_t maxs);
182 extern model_t *Mod_FindName (char *name);