+typedef struct model_brush_s
+{
+ // true if this model is a HalfLife .bsp file
+ qbool ishlbsp;
+ // true if this model is a BSP2rmqe .bsp file (expanded 32bit bsp format for rmqe)
+ qbool isbsp2rmqe;
+ // true if this model is a BSP2 .bsp file (expanded 32bit bsp format for DarkPlaces, others?)
+ qbool isbsp2;
+ // true if this model is a Quake2 .bsp file (IBSP38)
+ qbool isq2bsp;
+ // true if this model is a Quake3 .bsp file (IBSP46)
+ qbool isq3bsp;
+ // true if this model is a Quake1/Quake2 .bsp file where skymasking capability exists
+ qbool 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;
+ struct q3mbrush_s *data_brushes;
+
+ int num_brushsides;
+ struct q3mbrushside_s *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
+ struct shadowmesh_s *shadowmesh;
+
+ // a mesh containing all SUPERCONTENTS_SOLID surfaces for this model or submodel, for physics engines to use
+ struct shadowmesh_s *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, qbool 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)
+ qbool (*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];
+
+ struct skinframe_s *solidskyskinframe;
+ struct skinframe_s *alphaskyskinframe;
+
+ qbool supportwateralpha;
+
+ // QuakeWorld
+ int qw_md4sum;
+ int qw_md4sum2;
+}
+model_brush_t;