]> icculus.org git repositories - divverent/darkplaces.git/blob - model_shared.h
fixed GL_Scissor call in rtlight code (apparently I need to feed it a top to bottom...
[divverent/darkplaces.git] / model_shared.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
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.
8
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.
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20
21 #ifndef __MODEL__
22 #define __MODEL__
23
24 #ifndef SYNCTYPE_T
25 #define SYNCTYPE_T
26 typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
27 #endif
28
29 /*
30
31 d*_t structures are on-disk representations
32 m*_t structures are in-memory
33
34 */
35
36 typedef enum {mod_invalid, mod_brush, mod_sprite, mod_alias, mod_brushq2, mod_brushq3} modtype_t;
37
38 typedef struct animscene_s
39 {
40         char name[32]; // for viewthing support
41         int firstframe;
42         int framecount;
43         int loop; // true or false
44         float framerate;
45 }
46 animscene_t;
47
48 typedef struct skinframe_s
49 {
50         rtexture_t *base; // original texture without 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 (fullbrights)
54         rtexture_t *merged; // original texture without glow
55         rtexture_t *fog; // alpha of the base texture (if not opaque)
56         rtexture_t *nmap; // normalmap (bumpmap for dot3)
57         rtexture_t *gloss; // glossmap (for dot3)
58         rtexture_t *detail; // detail texture (silly bumps for non-dot3)
59 }
60 skinframe_t;
61
62 #define MAX_SKINS 256
63
64 typedef struct overridetagname_s
65 {
66         char name[MAX_QPATH];
67 }
68 overridetagname_t;
69
70 // a replacement set of tag names, per skin
71 typedef struct overridetagnameset_s
72 {
73         int num_overridetagnames;
74         overridetagname_t *data_overridetagnames;
75 }
76 overridetagnameset_t;
77
78 #define SHADOWMESHVERTEXHASH 1024
79 typedef struct shadowmeshvertexhash_s
80 {
81         struct shadowmeshvertexhash_s *next;
82 }
83 shadowmeshvertexhash_t;
84
85 typedef struct shadowmesh_s
86 {
87         // next mesh in chain
88         struct shadowmesh_s *next;
89         // used for light mesh (NULL on shadow mesh)
90         rtexture_t *map_diffuse;
91         rtexture_t *map_specular;
92         rtexture_t *map_normal;
93         // buffer sizes
94         int numverts, maxverts;
95         int numtriangles, maxtriangles;
96         // used always
97         float *vertex3f;
98         // used for light mesh (NULL on shadow mesh)
99         float *svector3f;
100         float *tvector3f;
101         float *normal3f;
102         float *texcoord2f;
103         // used always
104         int *element3i;
105         // used for shadow mesh (NULL on light mesh)
106         int *neighbor3i;
107         // these are NULL after Mod_ShadowMesh_Finish is performed, only used
108         // while building meshes
109         shadowmeshvertexhash_t **vertexhashtable, *vertexhashentries;
110 }
111 shadowmesh_t;
112
113
114 #include "matrixlib.h"
115
116 #include "model_brush.h"
117 #include "model_sprite.h"
118 #include "model_alias.h"
119
120 typedef struct model_alias_s
121 {
122         // LordHavoc: Q2/ZYM model support
123         int                             aliastype;
124
125         // mdl/md2/md3 models are the same after loading
126         int                             aliasnum_meshes;
127         aliasmesh_t             *aliasdata_meshes;
128
129         int                             aliasnum_tags;
130         int                             aliasnum_tagframes;
131         aliastag_t              *aliasdata_tags;
132
133         // for Zymotic models
134         int                             zymnum_verts;
135         int                             zymnum_tris;
136         int                             zymnum_shaders;
137         int                             zymnum_bones;
138         int                             zymnum_scenes;
139         float                   *zymdata_texcoords;
140         rtexture_t              **zymdata_textures;
141         qbyte                   *zymdata_trizone;
142         zymbone_t               *zymdata_bones;
143         unsigned int    *zymdata_vertbonecounts;
144         zymvertex_t             *zymdata_verts;
145         unsigned int    *zymdata_renderlist;
146         float                   *zymdata_poses;
147 }
148 model_alias_t;
149
150 typedef struct model_sprite_s
151 {
152         int                             sprnum_type;
153         mspriteframe_t  *sprdata_frames;
154 }
155 model_sprite_t;
156
157 struct trace_s;
158
159 typedef struct model_brush_s
160 {
161         // true if this model is a HalfLife .bsp file
162         qboolean ishlbsp;
163         // string of entity definitions (.map format)
164         char *entities;
165         // number of submodels in this map (just used by server to know how many
166         // submodels to load)
167         int numsubmodels;
168         // common functions
169         int (*SuperContentsFromNativeContents)(struct model_s *model, int nativecontents);
170         int (*NativeContentsFromSuperContents)(struct model_s *model, int supercontents);
171         qbyte *(*GetPVS)(struct model_s *model, const vec3_t p);
172         int (*FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbufferlength);
173         int (*BoxTouchingPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs);
174         void (*LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal);
175         void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
176         // these are actually only found on brushq1, but NULL is handled gracefully
177         void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, qbyte *out, int outsize);
178         void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs);
179 }
180 model_brush_t;
181
182 typedef struct model_brushq1_s
183 {
184         int                             firstmodelsurface, nummodelsurfaces;
185
186         // lightmap format, set to r_lightmaprgba when model is loaded
187         int                             lightmaprgba;
188
189         dmodel_t                *submodels;
190
191         int                             numplanes;
192         mplane_t                *planes;
193
194         // number of actual leafs (including 0 which is solid)
195         int                             num_leafs;
196         // visible leafs, not counting 0 (solid)
197         int                             num_visleafs;
198         mleaf_t                 *data_leafs;
199
200         int                             numvertexes;
201         mvertex_t               *vertexes;
202
203         int                             numedges;
204         medge_t                 *edges;
205
206         int                             numnodes;
207         mnode_t                 *nodes;
208
209         int                             numtexinfo;
210         mtexinfo_t              *texinfo;
211
212         int                             numsurfaces;
213         msurface_t              *surfaces;
214         int                             *surfacevisframes;
215         int                             *surfacepvsframes;
216         msurface_t              *surfacepvsnext;
217         surfmesh_t              *entiremesh;
218
219         int                             numsurfedges;
220         int                             *surfedges;
221
222         int                             numclipnodes;
223         dclipnode_t             *clipnodes;
224
225         int                             nummarksurfaces;
226         int                             *marksurfaces;
227
228         hull_t                  hulls[MAX_MAP_HULLS];
229
230         int                             numtextures;
231         texture_t               *textures;
232
233         int                             num_compressedpvs;
234         qbyte                   *data_compressedpvs;
235         int num_pvsclusters;
236         int num_pvsclusterbytes;
237         unsigned char *data_pvsclusters;
238
239         int                             num_lightdata;
240         qbyte                   *lightdata;
241
242         int                             numportals;
243         mportal_t               *portals;
244
245         int                             numportalpoints;
246         mvertex_t               *portalpoints;
247
248         int                             numlights;
249         mlight_t                *lights;
250
251         // pvs visibility marking
252         mleaf_t                 *pvsviewleaf;
253         int                             pvsviewleafnovis;
254         int                             pvsframecount;
255         mleaf_t                 *pvsleafchain;
256         int                             *pvssurflist;
257         int                             pvssurflistlength;
258         // these get rebuilt as the player moves around if this is the world,
259         // otherwise they are left alone (no pvs for bmodels)
260         msurface_t              ***pvstexturechains;
261         msurface_t              **pvstexturechainsbuffer;
262         int                             *pvstexturechainslength;
263
264         // lightmap update chains for light styles
265         int                             light_styles;
266         qbyte                   *light_style;
267         int                             *light_stylevalue;
268         msurface_t              ***light_styleupdatechains;
269         msurface_t              **light_styleupdatechainsbuffer;
270         float                   light_ambient;
271
272         mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
273         void (*BuildPVSTextureChains)(struct model_s *model);
274 }
275 model_brushq1_t;
276
277 /* MSVC can't compile empty structs, so this is commented out for now
278 typedef struct model_brushq2_s
279 {
280 }
281 model_brushq2_t;
282 */
283
284 // surfaceflags from bsp
285 #define Q3SURFACEFLAG_NODAMAGE 1
286 #define Q3SURFACEFLAG_SLICK 2
287 #define Q3SURFACEFLAG_SKY 4
288 #define Q3SURFACEFLAG_LADDER 8
289 #define Q3SURFACEFLAG_NOIMPACT 16
290 #define Q3SURFACEFLAG_NOMARKS 32
291 #define Q3SURFACEFLAG_FLESH 64
292 #define Q3SURFACEFLAG_NODRAW 128
293 #define Q3SURFACEFLAG_HINT 256
294 #define Q3SURFACEFLAG_SKIP 512
295 #define Q3SURFACEFLAG_NOLIGHTMAP 1024
296 #define Q3SURFACEFLAG_POINTLIGHT 2048
297 #define Q3SURFACEFLAG_METALSTEPS 4096
298 #define Q3SURFACEFLAG_NOSTEPS 8192
299 #define Q3SURFACEFLAG_NONSOLID 16384
300 #define Q3SURFACEFLAG_LIGHTFILTER 32768
301 #define Q3SURFACEFLAG_ALPHASHADOW 65536
302 #define Q3SURFACEFLAG_NODLIGHT 131072
303 #define Q3SURFACEFLAG_DUST 262144
304
305 // surfaceparms from shaders
306 #define Q3SURFACEPARM_ALPHASHADOW 1
307 #define Q3SURFACEPARM_AREAPORTAL 2
308 #define Q3SURFACEPARM_CLUSTERPORTAL 4
309 #define Q3SURFACEPARM_DETAIL 8
310 #define Q3SURFACEPARM_DONOTENTER 16
311 #define Q3SURFACEPARM_FOG 32
312 #define Q3SURFACEPARM_LAVA 64
313 #define Q3SURFACEPARM_LIGHTFILTER 128
314 #define Q3SURFACEPARM_METALSTEPS 256
315 #define Q3SURFACEPARM_NODAMAGE 512
316 #define Q3SURFACEPARM_NODLIGHT 1024
317 #define Q3SURFACEPARM_NODRAW 2048
318 #define Q3SURFACEPARM_NODROP 4096
319 #define Q3SURFACEPARM_NOIMPACT 8192
320 #define Q3SURFACEPARM_NOLIGHTMAP 16384
321 #define Q3SURFACEPARM_NOMARKS 32768
322 #define Q3SURFACEPARM_NOMIPMAPS 65536
323 #define Q3SURFACEPARM_NONSOLID 131072
324 #define Q3SURFACEPARM_ORIGIN 262144
325 #define Q3SURFACEPARM_PLAYERCLIP 524288
326 #define Q3SURFACEPARM_SKY 1048576
327 #define Q3SURFACEPARM_SLICK 2197152
328 #define Q3SURFACEPARM_SLIME 4194304
329 #define Q3SURFACEPARM_STRUCTURAL 8388608
330 #define Q3SURFACEPARM_TRANS 16777216
331 #define Q3SURFACEPARM_WATER 33554432
332
333 typedef struct q3mtexture_s
334 {
335         char name[Q3PATHLENGTH];
336         int surfaceflags;
337         int nativecontents;
338         int supercontents;
339         int surfaceparms;
340
341         int number;
342         skinframe_t skin;
343 }
344 q3mtexture_t;
345
346 typedef struct q3mnode_s
347 {
348         //this part shared between node and leaf
349         struct mplane_s *plane; // != NULL
350         struct q3mnode_s *parent;
351         vec3_t mins;
352         vec3_t maxs;
353         // this part unique to nodes
354         struct q3mnode_s *children[2];
355 }
356 q3mnode_t;
357
358 typedef struct q3mleaf_s
359 {
360         //this part shared between node and leaf
361         struct mplane_s *plane; // == NULL
362         struct q3mnode_s *parent;
363         vec3_t mins;
364         vec3_t maxs;
365         // this part unique to leafs
366         int clusterindex;
367         int areaindex;
368         int numleaffaces;
369         struct q3mface_s **firstleafface;
370         int numleafbrushes;
371         struct q3mbrush_s **firstleafbrush;
372 }
373 q3mleaf_t;
374
375 typedef struct q3mmodel_s
376 {
377         vec3_t mins;
378         vec3_t maxs;
379         int numfaces;
380         struct q3mface_s *firstface;
381         int numbrushes;
382         struct q3mbrush_s *firstbrush;
383 }
384 q3mmodel_t;
385
386 typedef struct q3mbrush_s
387 {
388         struct colbrushf_s *colbrushf;
389         int numbrushsides;
390         struct q3mbrushside_s *firstbrushside;
391         struct q3mtexture_s *texture;
392 }
393 q3mbrush_t;
394
395 typedef struct q3mbrushside_s
396 {
397         struct mplane_s *plane;
398         struct q3mtexture_s *texture;
399 }
400 q3mbrushside_t;
401
402 typedef struct q3meffect_s
403 {
404         char shadername[Q3PATHLENGTH];
405         struct q3mbrush_s *brush;
406         int unknown; // 5 or -1
407 }
408 q3meffect_t;
409
410 typedef struct q3mface_s
411 {
412         struct q3mtexture_s *texture;
413         struct q3meffect_s *effect;
414         rtexture_t *lightmaptexture;
415         int collisions; // performs per triangle collisions on this surface
416         int collisionmarkframe; // don't collide twice in one trace
417         int type;
418         int firstvertex;
419         int firstelement;
420         int patchsize[2];
421         // used for processing
422         int markframe;
423         // (world only) visframe == r_framecount means it is visible this frame
424         int visframe;
425         // bounding box for culling
426         float mins[3];
427         float maxs[3];
428
429         int num_vertices;
430         int num_triangles;
431         float *data_vertex3f;
432         float *data_texcoordtexture2f;
433         float *data_texcoordlightmap2f;
434         float *data_svector3f;
435         float *data_tvector3f;
436         float *data_normal3f;
437         float *data_color4f;
438         int *data_element3i;
439         int *data_neighbor3i;
440
441         // temporary use by light processing
442         int lighttemp_castshadow;
443 }
444 q3mface_t;
445
446 typedef struct model_brushq3_s
447 {
448         // if non-zero this is a submodel
449         // (this is the number of the submodel, an index into data_models)
450         int submodel;
451
452         int num_textures;
453         q3mtexture_t *data_textures;
454
455         int num_planes;
456         mplane_t *data_planes;
457
458         int num_nodes;
459         q3mnode_t *data_nodes;
460
461         int num_leafs;
462         q3mleaf_t *data_leafs;
463
464         int num_leafbrushes;
465         q3mbrush_t **data_leafbrushes;
466
467         int num_leaffaces;
468         q3mface_t **data_leaffaces;
469
470         int num_models;
471         q3mmodel_t *data_models;
472         // each submodel gets its own model struct so this is different for each.
473         q3mmodel_t *data_thismodel;
474
475         int num_brushes;
476         q3mbrush_t *data_brushes;
477
478         int num_brushsides;
479         q3mbrushside_t *data_brushsides;
480
481         int num_vertices;
482         float *data_vertex3f;
483         float *data_texcoordtexture2f;
484         float *data_texcoordlightmap2f;
485         float *data_svector3f;
486         float *data_tvector3f;
487         float *data_normal3f;
488         float *data_color4f;
489
490         int num_triangles;
491         int *data_element3i;
492         int *data_neighbor3i;
493
494         int num_effects;
495         q3meffect_t *data_effects;
496
497         int num_faces;
498         q3mface_t *data_faces;
499
500         // lightmap textures
501         int num_lightmaps;
502         rtexture_t **data_lightmaps;
503
504         // voxel light data with directional shading
505         int num_lightgrid;
506         q3dlightgrid_t *data_lightgrid;
507         // size of each cell (may vary by map, typically 64 64 128)
508         float num_lightgrid_cellsize[3];
509         // 1.0 / num_lightgrid_cellsize
510         float num_lightgrid_scale[3];
511         // dimensions of the world model in lightgrid cells
512         int num_lightgrid_imins[3];
513         int num_lightgrid_imaxs[3];
514         int num_lightgrid_isize[3];
515         // indexing/clamping
516         int num_lightgrid_dimensions[3];
517         // transform modelspace coordinates to lightgrid index
518         matrix4x4_t num_lightgrid_indexfromworld;
519
520         // pvs
521         int num_pvsclusters;
522         int num_pvsclusterbytes;
523         unsigned char *data_pvsclusters;
524         // example
525         //pvschain = model->brushq3.data_pvsclusters + mycluster * model->brushq3.num_pvsclusterbytes;
526         //if (pvschain[thatcluster >> 3] & (1 << (thatcluster & 7)))
527 }
528 model_brushq3_t;
529
530 typedef struct model_s
531 {
532         // name and path of model, for example "progs/player.mdl"
533         char                    name[MAX_QPATH];
534         // model needs to be loaded if this is true
535         qboolean                needload;
536         // set if the model is used in current map, models which are not, are purged
537         qboolean                used;
538         // true if this is the world model (I.E. defines what sky to use, and may contain submodels)
539         qboolean                isworldmodel;
540         // CRC of the file this model was loaded from, to reload if changed
541         unsigned int    crc;
542         // mod_brush, mod_alias, mod_sprite
543         modtype_t               type;
544         // memory pool for allocations
545         mempool_t               *mempool;
546         // all models use textures...
547         rtexturepool_t  *texturepool;
548         // flags from the model file
549         int                             flags;
550         // engine calculated flags, ones that can not be set in the file
551         int                             flags2;
552         // LordHavoc: if true (normally only for sprites) the model/sprite/bmodel is always rendered fullbright
553         int                             fullbright;
554         // number of QC accessible frame(group)s in the model
555         int                             numframes;
556         // number of QC accessible skin(group)s in the model
557         int                             numskins;
558         // whether to randomize animated framegroups
559         synctype_t              synctype;
560         // bounding box at angles '0 0 0'
561         vec3_t                  normalmins, normalmaxs;
562         // bounding box if yaw angle is not 0, but pitch and roll are
563         vec3_t                  yawmins, yawmaxs;
564         // bounding box if pitch or roll are used
565         vec3_t                  rotatedmins, rotatedmaxs;
566         // sphere radius, usable at any angles
567         float                   radius;
568         // squared sphere radius for easier comparisons
569         float                   radius2;
570         // skin animation info
571         animscene_t             *skinscenes; // [numskins]
572         // skin animation info
573         animscene_t             *animscenes; // [numframes]
574         // draw the model's sky polygons (only used by brush models)
575         void(*DrawSky)(struct entity_render_s *ent);
576         // draw the model using lightmap/dlight shading
577         void(*Draw)(struct entity_render_s *ent);
578         // draw a shadow volume for the model based on light source
579         void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius);
580         // draw the lighting on a model (through stencil)
581         void(*DrawLight)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *lightcubemap);
582         // trace a box against this model
583         void (*TraceBox)(struct model_s *model, int frame, struct trace_s *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs, int hitsupercontentsmask);
584         // fields belonging to each type of model
585         model_alias_t   alias;
586         model_sprite_t  sprite;
587         model_brush_t   brush;
588         model_brushq1_t brushq1;
589         /* MSVC can't handle an empty struct, so this is commented out for now
590         model_brushq2_t brushq2;
591         */
592         model_brushq3_t brushq3;
593         // skin files can have different tags for each skin
594         overridetagnameset_t    *data_overridetagnamesforskin;
595         // flags this model for offseting sounds to the model center (used by brush models)
596         int soundfromcenter;
597 }
598 model_t;
599
600 //============================================================================
601
602 // this can be used for anything without a valid texture
603 extern rtexture_t *r_notexture;
604 #define NUM_DETAILTEXTURES 1
605 extern rtexture_t *mod_shared_detailtextures[NUM_DETAILTEXTURES];
606 // every texture must be in a pool...
607 extern rtexturepool_t *mod_shared_texturepool;
608
609 extern rtexture_t *mod_shared_distorttexture[64];
610
611 // model loading
612 extern model_t *loadmodel;
613 extern qbyte *mod_base;
614 // sky/water subdivision
615 //extern cvar_t gl_subdivide_size;
616 // texture fullbrights
617 extern cvar_t r_fullbrights;
618
619 void Mod_Init (void);
620 void Mod_CheckLoaded (model_t *mod);
621 void Mod_ClearAll (void);
622 model_t *Mod_FindName (const char *name);
623 model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
624 void Mod_TouchModel (const char *name);
625 void Mod_UnloadModel (model_t *mod);
626
627 void Mod_ClearUsed(void);
628 void Mod_PurgeUnused(void);
629 void Mod_LoadModels(void);
630
631 extern model_t *loadmodel;
632 extern char loadname[32];       // for hunk tags
633
634 void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtriangles);
635 void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline);
636 void Mod_BuildTextureVectorsAndNormals(int numverts, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals);
637
638 shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int neighbors, int expandable);
639 shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, int light, int neighbors);
640 int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f);
641 void Mod_ShadowMesh_AddTriangle(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex14f);
642 void Mod_ShadowMesh_AddMesh(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, int numtris, int *element3i);
643 shadowmesh_t *Mod_ShadowMesh_Begin(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int neighbors, int expandable);
644 shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh, int light, int neighbors);
645 void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs, vec3_t center, float *radius);
646 void Mod_ShadowMesh_Free(shadowmesh_t *mesh);
647
648 int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture);
649 int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height);
650
651 // used for talking to the QuakeC mainly
652 int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents);
653 int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents);
654
655 extern cvar_t r_mipskins;
656
657 typedef struct skinfileitem_s
658 {
659         struct skinfileitem_s *next;
660         char name[MAX_QPATH];
661         char replacement[MAX_QPATH];
662 }
663 skinfileitem_t;
664
665 typedef struct skinfile_s
666 {
667         struct skinfile_s *next;
668         skinfileitem_t *items;
669 }
670 skinfile_t;
671
672 skinfile_t *Mod_LoadSkinFiles(void);
673 void Mod_FreeSkinFiles(skinfile_t *skinfile);
674 int Mod_CountSkinFiles(skinfile_t *skinfile);
675
676 int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f);
677
678 #endif  // __MODEL__
679