]> icculus.org git repositories - divverent/darkplaces.git/blob - model_shared.h
converted portal building over to use polygon functions instead of winding
[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_brush, 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         // LordHavoc: Q2/ZYM model support
121         int                             aliastype;
122
123         // mdl/md2/md3 models are the same after loading
124         int                             aliasnum_meshes;
125         aliasmesh_t             *aliasdata_meshes;
126
127         int                             aliasnum_tags;
128         int                             aliasnum_tagframes;
129         aliastag_t              *aliasdata_tags;
130
131         // for Zymotic models
132         int                             zymnum_verts;
133         int                             zymnum_tris;
134         int                             zymnum_shaders;
135         int                             zymnum_bones;
136         int                             zymnum_scenes;
137         float                   *zymdata_texcoords;
138         rtexture_t              **zymdata_textures;
139         qbyte                   *zymdata_trizone;
140         zymbone_t               *zymdata_bones;
141         unsigned int    *zymdata_vertbonecounts;
142         zymvertex_t             *zymdata_verts;
143         unsigned int    *zymdata_renderlist;
144         float                   *zymdata_poses;
145 }
146 model_alias_t;
147
148 typedef struct model_sprite_s
149 {
150         int                             sprnum_type;
151         mspriteframe_t  *sprdata_frames;
152 }
153 model_sprite_t;
154
155 struct trace_s;
156
157 typedef struct model_brush_s
158 {
159         // true if this model is a HalfLife .bsp file
160         qboolean ishlbsp;
161         // string of entity definitions (.map format)
162         char *entities;
163         // number of submodels in this map (just used by server to know how many
164         // submodels to load)
165         int numsubmodels;
166
167         // pvs
168         int num_pvsclusters;
169         int num_pvsclusterbytes;
170         unsigned char *data_pvsclusters;
171         // example
172         //pvschain = model->brush.data_pvsclusters + mycluster * model->brush.num_pvsclusterbytes;
173         //if (pvschain[thatcluster >> 3] & (1 << (thatcluster & 7)))
174
175         // a mesh containing all shadow casting geometry for the whole model (including submodels), portions of this are referenced by each surface's num_firstshadowmeshtriangle 
176         shadowmesh_t *shadowmesh;
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         char skybox[64];
191 }
192 model_brush_t;
193
194 typedef struct model_brushq1_s
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
278         mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
279         void (*BuildPVSTextureChains)(struct model_s *model);
280 }
281 model_brushq1_t;
282
283 /* MSVC can't compile empty structs, so this is commented out for now
284 typedef struct model_brushq2_s
285 {
286 }
287 model_brushq2_t;
288 */
289
290 // surfaceflags from bsp
291 #define Q3SURFACEFLAG_NODAMAGE 1
292 #define Q3SURFACEFLAG_SLICK 2
293 #define Q3SURFACEFLAG_SKY 4
294 #define Q3SURFACEFLAG_LADDER 8
295 #define Q3SURFACEFLAG_NOIMPACT 16
296 #define Q3SURFACEFLAG_NOMARKS 32
297 #define Q3SURFACEFLAG_FLESH 64
298 #define Q3SURFACEFLAG_NODRAW 128
299 #define Q3SURFACEFLAG_HINT 256
300 #define Q3SURFACEFLAG_SKIP 512
301 #define Q3SURFACEFLAG_NOLIGHTMAP 1024
302 #define Q3SURFACEFLAG_POINTLIGHT 2048
303 #define Q3SURFACEFLAG_METALSTEPS 4096
304 #define Q3SURFACEFLAG_NOSTEPS 8192
305 #define Q3SURFACEFLAG_NONSOLID 16384
306 #define Q3SURFACEFLAG_LIGHTFILTER 32768
307 #define Q3SURFACEFLAG_ALPHASHADOW 65536
308 #define Q3SURFACEFLAG_NODLIGHT 131072
309 #define Q3SURFACEFLAG_DUST 262144
310
311 // surfaceparms from shaders
312 #define Q3SURFACEPARM_ALPHASHADOW 1
313 #define Q3SURFACEPARM_AREAPORTAL 2
314 #define Q3SURFACEPARM_CLUSTERPORTAL 4
315 #define Q3SURFACEPARM_DETAIL 8
316 #define Q3SURFACEPARM_DONOTENTER 16
317 #define Q3SURFACEPARM_FOG 32
318 #define Q3SURFACEPARM_LAVA 64
319 #define Q3SURFACEPARM_LIGHTFILTER 128
320 #define Q3SURFACEPARM_METALSTEPS 256
321 #define Q3SURFACEPARM_NODAMAGE 512
322 #define Q3SURFACEPARM_NODLIGHT 1024
323 #define Q3SURFACEPARM_NODRAW 2048
324 #define Q3SURFACEPARM_NODROP 4096
325 #define Q3SURFACEPARM_NOIMPACT 8192
326 #define Q3SURFACEPARM_NOLIGHTMAP 16384
327 #define Q3SURFACEPARM_NOMARKS 32768
328 #define Q3SURFACEPARM_NOMIPMAPS 65536
329 #define Q3SURFACEPARM_NONSOLID 131072
330 #define Q3SURFACEPARM_ORIGIN 262144
331 #define Q3SURFACEPARM_PLAYERCLIP 524288
332 #define Q3SURFACEPARM_SKY 1048576
333 #define Q3SURFACEPARM_SLICK 2197152
334 #define Q3SURFACEPARM_SLIME 4194304
335 #define Q3SURFACEPARM_STRUCTURAL 8388608
336 #define Q3SURFACEPARM_TRANS 16777216
337 #define Q3SURFACEPARM_WATER 33554432
338
339 typedef struct q3mtexture_s
340 {
341         char name[Q3PATHLENGTH];
342         int surfaceflags;
343         int nativecontents;
344         int supercontents;
345         int surfaceparms;
346
347         int number;
348         skinframe_t skin;
349 }
350 q3mtexture_t;
351
352 typedef struct q3mnode_s
353 {
354         //this part shared between node and leaf
355         struct mplane_s *plane; // != NULL
356         struct q3mnode_s *parent;
357         vec3_t mins;
358         vec3_t maxs;
359         // this part unique to nodes
360         struct q3mnode_s *children[2];
361 }
362 q3mnode_t;
363
364 typedef struct q3mleaf_s
365 {
366         //this part shared between node and leaf
367         struct mplane_s *plane; // == NULL
368         struct q3mnode_s *parent;
369         vec3_t mins;
370         vec3_t maxs;
371         // this part unique to leafs
372         int clusterindex;
373         int areaindex;
374         int numleaffaces;
375         struct q3mface_s **firstleafface;
376         int numleafbrushes;
377         struct q3mbrush_s **firstleafbrush;
378 }
379 q3mleaf_t;
380
381 typedef struct q3mmodel_s
382 {
383         vec3_t mins;
384         vec3_t maxs;
385         int numfaces;
386         struct q3mface_s *firstface;
387         int numbrushes;
388         struct q3mbrush_s *firstbrush;
389 }
390 q3mmodel_t;
391
392 typedef struct q3mbrush_s
393 {
394         struct colbrushf_s *colbrushf;
395         int numbrushsides;
396         struct q3mbrushside_s *firstbrushside;
397         struct q3mtexture_s *texture;
398 }
399 q3mbrush_t;
400
401 typedef struct q3mbrushside_s
402 {
403         struct mplane_s *plane;
404         struct q3mtexture_s *texture;
405 }
406 q3mbrushside_t;
407
408 typedef struct q3meffect_s
409 {
410         char shadername[Q3PATHLENGTH];
411         struct q3mbrush_s *brush;
412         int unknown; // 5 or -1
413 }
414 q3meffect_t;
415
416 typedef struct q3mface_s
417 {
418         struct q3mtexture_s *texture;
419         struct q3meffect_s *effect;
420         rtexture_t *lightmaptexture;
421         int collisions; // performs per triangle collisions on this surface
422         int collisionmarkframe; // don't collide twice in one trace
423         int type;
424         int firstvertex;
425         int firstelement;
426         int patchsize[2];
427         // used for processing
428         int markframe;
429         // (world only) visframe == r_framecount means it is visible this frame
430         int visframe;
431         // bounding box for culling
432         float mins[3];
433         float maxs[3];
434
435         int num_vertices;
436         int num_triangles;
437         float *data_vertex3f;
438         float *data_texcoordtexture2f;
439         float *data_texcoordlightmap2f;
440         float *data_svector3f;
441         float *data_tvector3f;
442         float *data_normal3f;
443         float *data_color4f;
444         int *data_element3i;
445         int *data_neighbor3i;
446
447         int num_collisionvertices;
448         int num_collisiontriangles;
449         float *data_collisionvertex3f;
450         int *data_collisionelement3i;
451
452         // index into model->brush.shadowmesh
453         int num_firstshadowmeshtriangle;
454         
455         // used for shadow volume generation
456         int shadowmark;
457
458         // temporary use by light processing
459         int lighttemp_castshadow;
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
472         int num_planes;
473         mplane_t *data_planes;
474
475         int num_nodes;
476         q3mnode_t *data_nodes;
477
478         int num_leafs;
479         q3mleaf_t *data_leafs;
480
481         int num_leafbrushes;
482         q3mbrush_t **data_leafbrushes;
483
484         int num_leaffaces;
485         q3msurface_t **data_leaffaces;
486
487         int num_models;
488         q3mmodel_t *data_models;
489         // each submodel gets its own model struct so this is different for each.
490         q3mmodel_t *data_thismodel;
491
492         int num_brushes;
493         q3mbrush_t *data_brushes;
494
495         int num_brushsides;
496         q3mbrushside_t *data_brushsides;
497
498         int num_vertices;
499         float *data_vertex3f;
500         float *data_texcoordtexture2f;
501         float *data_texcoordlightmap2f;
502         float *data_svector3f;
503         float *data_tvector3f;
504         float *data_normal3f;
505         float *data_color4f;
506
507         int num_triangles;
508         int *data_element3i;
509         int *data_neighbor3i;
510
511         int num_effects;
512         q3meffect_t *data_effects;
513
514         int num_faces;
515         q3msurface_t *data_faces;
516
517         // lightmap textures
518         int num_lightmaps;
519         rtexture_t **data_lightmaps;
520
521         // voxel light data with directional shading
522         int num_lightgrid;
523         q3dlightgrid_t *data_lightgrid;
524         // size of each cell (may vary by map, typically 64 64 128)
525         float num_lightgrid_cellsize[3];
526         // 1.0 / num_lightgrid_cellsize
527         float num_lightgrid_scale[3];
528         // dimensions of the world model in lightgrid cells
529         int num_lightgrid_imins[3];
530         int num_lightgrid_imaxs[3];
531         int num_lightgrid_isize[3];
532         // indexing/clamping
533         int num_lightgrid_dimensions[3];
534         // transform modelspace coordinates to lightgrid index
535         matrix4x4_t num_lightgrid_indexfromworld;
536 }
537 model_brushq3_t;
538
539 typedef struct model_s
540 {
541         // name and path of model, for example "progs/player.mdl"
542         char                    name[MAX_QPATH];
543         // model needs to be loaded if this is true
544         qboolean                needload;
545         // set if the model is used in current map, models which are not, are purged
546         qboolean                used;
547         // true if this is the world model (I.E. defines what sky to use, and may contain submodels)
548         qboolean                isworldmodel;
549         // CRC of the file this model was loaded from, to reload if changed
550         unsigned int    crc;
551         // mod_brush, mod_alias, mod_sprite
552         modtype_t               type;
553         // memory pool for allocations
554         mempool_t               *mempool;
555         // all models use textures...
556         rtexturepool_t  *texturepool;
557         // flags from the model file
558         int                             flags;
559         // engine calculated flags, ones that can not be set in the file
560         int                             flags2;
561         // LordHavoc: if true (normally only for sprites) the model/sprite/bmodel is always rendered fullbright
562         int                             fullbright;
563         // number of QC accessible frame(group)s in the model
564         int                             numframes;
565         // number of QC accessible skin(group)s in the model
566         int                             numskins;
567         // whether to randomize animated framegroups
568         synctype_t              synctype;
569         // bounding box at angles '0 0 0'
570         vec3_t                  normalmins, normalmaxs;
571         // bounding box if yaw angle is not 0, but pitch and roll are
572         vec3_t                  yawmins, yawmaxs;
573         // bounding box if pitch or roll are used
574         vec3_t                  rotatedmins, rotatedmaxs;
575         // sphere radius, usable at any angles
576         float                   radius;
577         // squared sphere radius for easier comparisons
578         float                   radius2;
579         // skin animation info
580         animscene_t             *skinscenes; // [numskins]
581         // skin animation info
582         animscene_t             *animscenes; // [numframes]
583         // range of surface numbers in this (sub)model
584         int                             firstmodelsurface;
585         int                             nummodelsurfaces;
586         // list of surface numbers in this (sub)model
587         int                             *surfacelist;
588         // draw the model's sky polygons (only used by brush models)
589         void(*DrawSky)(struct entity_render_s *ent);
590         // draw the model using lightmap/dlight shading
591         void(*Draw)(struct entity_render_s *ent);
592         // gathers info on which clusters and surfaces are lit by light, as well as calculating a bounding box
593         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);
594         // draw a shadow volume for the model based on light source
595         void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist);
596         // draw the lighting on a model (through stencil)
597         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);
598         // trace a box against this model
599         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);
600         // fields belonging to each type of model
601         model_alias_t   alias;
602         model_sprite_t  sprite;
603         model_brush_t   brush;
604         model_brushq1_t brushq1;
605         /* MSVC can't handle an empty struct, so this is commented out for now
606         model_brushq2_t brushq2;
607         */
608         model_brushq3_t brushq3;
609         // skin files can have different tags for each skin
610         overridetagnameset_t    *data_overridetagnamesforskin;
611         // flags this model for offseting sounds to the model center (used by brush models)
612         int soundfromcenter;
613 }
614 model_t;
615
616 //============================================================================
617
618 // this can be used for anything without a valid texture
619 extern rtexture_t *r_notexture;
620 #define NUM_DETAILTEXTURES 1
621 extern rtexture_t *mod_shared_detailtextures[NUM_DETAILTEXTURES];
622 // every texture must be in a pool...
623 extern rtexturepool_t *mod_shared_texturepool;
624
625 extern rtexture_t *mod_shared_distorttexture[64];
626
627 // model loading
628 extern model_t *loadmodel;
629 extern qbyte *mod_base;
630 // sky/water subdivision
631 //extern cvar_t gl_subdivide_size;
632 // texture fullbrights
633 extern cvar_t r_fullbrights;
634
635 void Mod_Init (void);
636 void Mod_CheckLoaded (model_t *mod);
637 void Mod_ClearAll (void);
638 model_t *Mod_FindName (const char *name);
639 model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
640 void Mod_TouchModel (const char *name);
641 void Mod_UnloadModel (model_t *mod);
642
643 void Mod_ClearUsed(void);
644 void Mod_PurgeUnused(void);
645 void Mod_LoadModels(void);
646
647 extern model_t *loadmodel;
648 extern char loadname[32];       // for hunk tags
649
650 void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtriangles);
651 void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline);
652 void Mod_BuildTextureVectorsAndNormals(int numverts, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals);
653
654 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);
655 shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, int light, int neighbors);
656 int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f);
657 void Mod_ShadowMesh_AddTriangle(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex14f);
658 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);
659 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);
660 shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh, int light, int neighbors);
661 void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs, vec3_t center, float *radius);
662 void Mod_ShadowMesh_Free(shadowmesh_t *mesh);
663
664 int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture);
665 int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height);
666
667 // used for talking to the QuakeC mainly
668 int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents);
669 int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents);
670
671 extern cvar_t r_mipskins;
672
673 typedef struct skinfileitem_s
674 {
675         struct skinfileitem_s *next;
676         char name[MAX_QPATH];
677         char replacement[MAX_QPATH];
678 }
679 skinfileitem_t;
680
681 typedef struct skinfile_s
682 {
683         struct skinfile_s *next;
684         skinfileitem_t *items;
685 }
686 skinfile_t;
687
688 skinfile_t *Mod_LoadSkinFiles(void);
689 void Mod_FreeSkinFiles(skinfile_t *skinfile);
690 int Mod_CountSkinFiles(skinfile_t *skinfile);
691
692 int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f);
693
694 #endif  // MODEL_SHARED_H
695