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