123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- #ifndef __MODEL__
- #define __MODEL__
- #include "modelgen.h"
- #include "spritegn.h"
- #define EF_BRIGHTFIELD 1
- #define EF_MUZZLEFLASH 2
- #define EF_BRIGHTLIGHT 4
- #define EF_DIMLIGHT 8
- #define EF_FLAG1 16
- #define EF_FLAG2 32
- #define EF_BLUE 64
- #define EF_RED 128
- typedef struct
- {
- vec3_t position;
- } mvertex_t;
- #define SIDE_FRONT 0
- #define SIDE_BACK 1
- #define SIDE_ON 2
- typedef struct mplane_s
- {
- vec3_t normal;
- float dist;
- byte type;
- byte signbits;
- byte pad[2];
- } mplane_t;
- typedef struct texture_s
- {
- char name[16];
- unsigned width, height;
- int anim_total;
- int anim_min, anim_max;
- struct texture_s *anim_next;
- struct texture_s *alternate_anims;
- unsigned offsets[MIPLEVELS];
- } texture_t;
- #define SURF_PLANEBACK 2
- #define SURF_DRAWSKY 4
- #define SURF_DRAWSPRITE 8
- #define SURF_DRAWTURB 0x10
- #define SURF_DRAWTILED 0x20
- #define SURF_DRAWBACKGROUND 0x40
- typedef struct
- {
- unsigned short v[2];
- unsigned int cachededgeoffset;
- } medge_t;
- typedef struct
- {
- float vecs[2][4];
- float mipadjust;
- texture_t *texture;
- int flags;
- } mtexinfo_t;
- typedef struct msurface_s
- {
- int visframe;
- int dlightframe;
- int dlightbits;
- mplane_t *plane;
- int flags;
- int firstedge;
- int numedges;
-
- struct surfcache_s *cachespots[MIPLEVELS];
- short texturemins[2];
- short extents[2];
- mtexinfo_t *texinfo;
-
- byte styles[MAXLIGHTMAPS];
- byte *samples;
- } msurface_t;
- typedef struct mnode_s
- {
- int contents;
- int visframe;
-
- short minmaxs[6];
- struct mnode_s *parent;
- mplane_t *plane;
- struct mnode_s *children[2];
- unsigned short firstsurface;
- unsigned short numsurfaces;
- } mnode_t;
- typedef struct mleaf_s
- {
- int contents;
- int visframe;
- short minmaxs[6];
- struct mnode_s *parent;
- byte *compressed_vis;
- struct efrag_s *efrags;
- msurface_t **firstmarksurface;
- int nummarksurfaces;
- int key;
- byte ambient_sound_level[NUM_AMBIENTS];
- } mleaf_t;
- typedef struct
- {
- dclipnode_t *clipnodes;
- mplane_t *planes;
- int firstclipnode;
- int lastclipnode;
- vec3_t clip_mins;
- vec3_t clip_maxs;
- } hull_t;
- typedef struct mspriteframe_s
- {
- int width;
- int height;
- void *pcachespot;
- float up, down, left, right;
- byte pixels[4];
- } mspriteframe_t;
- typedef struct
- {
- int numframes;
- float *intervals;
- mspriteframe_t *frames[1];
- } mspritegroup_t;
- typedef struct
- {
- spriteframetype_t type;
- mspriteframe_t *frameptr;
- } mspriteframedesc_t;
- typedef struct
- {
- int type;
- int maxwidth;
- int maxheight;
- int numframes;
- float beamlength;
- void *cachespot;
- mspriteframedesc_t frames[1];
- } msprite_t;
- typedef struct
- {
- aliasframetype_t type;
- trivertx_t bboxmin;
- trivertx_t bboxmax;
- int frame;
- char name[16];
- } maliasframedesc_t;
- typedef struct
- {
- aliasskintype_t type;
- void *pcachespot;
- int skin;
- } maliasskindesc_t;
- typedef struct
- {
- trivertx_t bboxmin;
- trivertx_t bboxmax;
- int frame;
- } maliasgroupframedesc_t;
- typedef struct
- {
- int numframes;
- int intervals;
- maliasgroupframedesc_t frames[1];
- } maliasgroup_t;
- typedef struct
- {
- int numskins;
- int intervals;
- maliasskindesc_t skindescs[1];
- } maliasskingroup_t;
- typedef struct mtriangle_s {
- int facesfront;
- int vertindex[3];
- } mtriangle_t;
- typedef struct {
- int model;
- int stverts;
- int skindesc;
- int triangles;
- maliasframedesc_t frames[1];
- } aliashdr_t;
- typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
- #define EF_ROCKET 1
- #define EF_GRENADE 2
- #define EF_GIB 4
- #define EF_ROTATE 8
- #define EF_TRACER 16
- #define EF_ZOMGIB 32
- #define EF_TRACER2 64
- #define EF_TRACER3 128
- typedef struct model_s
- {
- char name[MAX_QPATH];
- qboolean needload;
- modtype_t type;
- int numframes;
- synctype_t synctype;
-
- int flags;
- vec3_t mins, maxs;
- float radius;
- qboolean clipbox;
- vec3_t clipmins, clipmaxs;
- int firstmodelsurface, nummodelsurfaces;
- int numsubmodels;
- dmodel_t *submodels;
- int numplanes;
- mplane_t *planes;
- int numleafs;
- mleaf_t *leafs;
- int numvertexes;
- mvertex_t *vertexes;
- int numedges;
- medge_t *edges;
- int numnodes;
- mnode_t *nodes;
- int numtexinfo;
- mtexinfo_t *texinfo;
- int numsurfaces;
- msurface_t *surfaces;
- int numsurfedges;
- int *surfedges;
- int numclipnodes;
- dclipnode_t *clipnodes;
- int nummarksurfaces;
- msurface_t **marksurfaces;
- hull_t hulls[MAX_MAP_HULLS];
- int numtextures;
- texture_t **textures;
- byte *visdata;
- byte *lightdata;
- char *entities;
- unsigned checksum;
- unsigned checksum2;
- cache_user_t cache;
- } model_t;
- void Mod_Init (void);
- void Mod_ClearAll (void);
- model_t *Mod_ForName (char *name, qboolean crash);
- void *Mod_Extradata (model_t *mod);
- void Mod_TouchModel (char *name);
- mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
- byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
- #endif
|