-typedef struct model_brush_lightstyleinfo_s
-{
- int style;
- int value;
- int numsurfaces;
- int *surfacelist;
-}
-model_brush_lightstyleinfo_t;
-
-typedef struct model_brush_s
-{
- // true if this model is a HalfLife .bsp file
- qboolean ishlbsp;
- // true if this model is a BSP2rmqe .bsp file (expanded 32bit bsp format for rmqe)
- qboolean isbsp2rmqe;
- // true if this model is a BSP2 .bsp file (expanded 32bit bsp format for DarkPlaces, others?)
- qboolean isbsp2;
- // true if this model is a Quake2 .bsp file (IBSP38)
- qboolean isq2bsp;
- // true if this model is a Quake3 .bsp file (IBSP46)
- qboolean isq3bsp;
- // true if this model is a Quake1/Quake2 .bsp file where skymasking capability exists
- qboolean skymasking;
- // string of entity definitions (.map format)
- char *entities;
-
- // if not NULL this is a submodel
- struct model_s *parentmodel;
- // (this is the number of the submodel, an index into submodels)
- int submodel;
-
- // number of submodels in this map (just used by server to know how many
- // submodels to load)
- int numsubmodels;
- // pointers to each of the submodels
- struct model_s **submodels;
-
- int num_planes;
- mplane_t *data_planes;
-
- int num_nodes;
- mnode_t *data_nodes;
-
- // visible leafs, not counting 0 (solid)
- int num_visleafs;
- // number of actual leafs (including 0 which is solid)
- int num_leafs;
- mleaf_t *data_leafs;
-
- int num_leafbrushes;
- int *data_leafbrushes;
-
- int num_leafsurfaces;
- int *data_leafsurfaces;
-
- int num_portals;
- mportal_t *data_portals;
-
- int num_portalpoints;
- mvertex_t *data_portalpoints;
-
- int num_brushes;
- q3mbrush_t *data_brushes;
-
- int num_brushsides;
- q3mbrushside_t *data_brushsides;
-
- // pvs
- int num_pvsclusters;
- int num_pvsclusterbytes;
- unsigned char *data_pvsclusters;
- // example
- //pvschain = model->brush.data_pvsclusters + mycluster * model->brush.num_pvsclusterbytes;
- //if (pvschain[thatcluster >> 3] & (1 << (thatcluster & 7)))
-
- // collision geometry for q3 curves
- int num_collisionvertices;
- int num_collisiontriangles;
- float *data_collisionvertex3f;
- int *data_collisionelement3i;
-
- // a mesh containing all shadow casting geometry for the whole model (including submodels), portions of this are referenced by each surface's num_firstshadowmeshtriangle
- shadowmesh_t *shadowmesh;
-
- // a mesh containing all SUPERCONTENTS_SOLID surfaces for this model or submodel, for physics engines to use
- shadowmesh_t *collisionmesh;
-
- // common functions
- int (*SuperContentsFromNativeContents)(int nativecontents);
- int (*NativeContentsFromSuperContents)(int supercontents);
- unsigned char *(*GetPVS)(struct model_s *model, const vec3_t p);
- int (*FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, unsigned char *pvsbuffer, int pvsbufferlength, qboolean merge);
- int (*BoxTouchingPVS)(struct model_s *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs);
- int (*BoxTouchingLeafPVS)(struct model_s *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs);
- int (*BoxTouchingVisibleLeafs)(struct model_s *model, const unsigned char *visibleleafs, const vec3_t mins, const vec3_t maxs);
- int (*FindBoxClusters)(struct model_s *model, const vec3_t mins, const vec3_t maxs, int maxclusters, int *clusterlist);
- void (*LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal);
- void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
- mleaf_t *(*PointInLeaf)(struct model_s *model, const vec3_t p);
- // these are actually only found on brushq1, but NULL is handled gracefully
- void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, unsigned char *out, int outsize);
- void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs);
- // trace a line of sight through this model (returns false if the line if sight is definitely blocked)
- qboolean (*TraceLineOfSight)(struct model_s *model, const vec3_t start, const vec3_t end, const vec3_t acceptmins, const vec3_t acceptmaxs);
-
- char skybox[MAX_QPATH];
-
- skinframe_t *solidskyskinframe;
- skinframe_t *alphaskyskinframe;
-
- qboolean supportwateralpha;
-
- // QuakeWorld
- int qw_md4sum;
- int qw_md4sum2;
-}
-model_brush_t;
-
-typedef struct model_brushq1_s
-{
- mmodel_t *submodels;
-
- int numvertexes;
- mvertex_t *vertexes;
-
- int numedges;
- medge_t *edges;
-
- int numtexinfo;
- mtexinfo_t *texinfo;
-
- int numsurfedges;
- int *surfedges;
-
- int numclipnodes;
- mclipnode_t *clipnodes;
-
- hull_t hulls[MAX_MAP_HULLS];
-
- int num_compressedpvs;
- unsigned char *data_compressedpvs;
-
- int num_lightdata;
- unsigned char *lightdata;
- unsigned char *nmaplightdata; // deluxemap file
-
- // lightmap update chains for light styles
- int num_lightstyles;
- model_brush_lightstyleinfo_t *data_lightstyleinfo;
-
- // this contains bytes that are 1 if a surface needs its lightmap rebuilt
- unsigned char *lightmapupdateflags;
- qboolean firstrender; // causes all surface lightmaps to be loaded in first frame
-}
-model_brushq1_t;
-
-typedef struct model_brushq3_s
-{
- int num_models;
- q3dmodel_t *data_models;
-
- // used only during loading - freed after loading!
- int num_vertices;
- float *data_vertex3f;
- float *data_normal3f;
- float *data_texcoordtexture2f;
- float *data_texcoordlightmap2f;
- float *data_color4f;
-
- // freed after loading!
- int num_triangles;
- int *data_element3i;
-
- int num_effects;
- q3deffect_t *data_effects;
-
- // lightmap textures
- int num_originallightmaps;
- int num_mergedlightmaps;
- int num_lightmapmergedwidthpower;
- int num_lightmapmergedheightpower;
- int num_lightmapmergedwidthheightdeluxepower;
- int num_lightmapmerge;
- rtexture_t **data_lightmaps;
- rtexture_t **data_deluxemaps;
-
- // voxel light data with directional shading - data for cpu sampling of it...
- int num_lightgrid;
- q3dlightgrid_t *data_lightgrid;
- // size of each cell (may vary by map, typically 64 64 128)
- float num_lightgrid_cellsize[3];
- // 1.0 / num_lightgrid_cellsize
- float num_lightgrid_scale[3];
- // dimensions of the world model in lightgrid cells
- int num_lightgrid_imins[3];
- int num_lightgrid_imaxs[3];
- int num_lightgrid_isize[3];
- // transform modelspace coordinates to lightgrid index
- matrix4x4_t num_lightgrid_indexfromworld;
- // parameters for fragment shader to sample the texture version of it:
- int lightgridtexturesize[3]; // 3 layers tall (ambient, lightcolor, lightdir)
- matrix4x4_t lightgridworldtotexturematrix;
- rtexture_t *lightgridtexture;
-
- // true if this q3bsp file has been detected as using deluxemapping
- // (lightmap texture pairs, every odd one is never directly refernced,
- // and contains lighting normals, not colors)
- qboolean deluxemapping;
- // true if the detected deluxemaps are the modelspace kind, rather than
- // the faster tangentspace kind
- qboolean deluxemapping_modelspace;
- // size of lightmaps (128 by default, but may be another poweroftwo if
- // external lightmaps are used (q3map2 -lightmapsize)
- int lightmapsize;
-}
-model_brushq3_t;
-