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