]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
more q3bsp work (and no it still doesn't work right)
[xonotic/darkplaces.git] / model_shared.h
index a911946dc86fe5ca93552e950f83484105964a1e..1d6b78e55371728bfaed6e799e4ba53d5859d2fe 100644 (file)
@@ -144,33 +144,43 @@ struct trace_s;
 
 typedef struct model_brush_s
 {
+       // true if this model is a HalfLife .bsp file
+       qboolean ishlbsp;
+       // string of entity definitions (.map format)
        char *entities;
+       // number of submodels in this map (just used by server to know how many
+       // submodels to load)
+       int numsubmodels;
+       // common functions
+       int (*SuperContentsFromNativeContents)(struct model_s *model, int nativecontents);
+       int (*NativeContentsFromSuperContents)(struct model_s *model, int supercontents);
+       void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, qbyte *out, int outsize);
        int (*FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbufferlength);
        int (*BoxTouchingPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs);
        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);
-       void (*TraceBox)(struct model_s *model, struct trace_s *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs);
+       void (*TraceBox)(struct model_s *model, struct trace_s *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs, int hitsupercontentsmask);
+       // this is actually only found on brushq1, but NULL is handled gracefully
+       void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs);
 }
 model_brush_t;
 
 typedef struct model_brushq1_s
 {
-       // true if this model is a HalfLife .bsp file
-       qboolean                ishlbsp;
-
        int                             firstmodelsurface, nummodelsurfaces;
 
        // lightmap format, set to r_lightmaprgba when model is loaded
        int                             lightmaprgba;
 
-       int                             numsubmodels;
        dmodel_t                *submodels;
 
        int                             numplanes;
        mplane_t                *planes;
 
-       // number of visible leafs, not counting 0 (solid)
+       // number of actual leafs (including 0 which is solid)
        int                             numleafs;
+       // visible leafs, not counting 0 (solid)
+       int                             visleafs;
        mleaf_t                 *leafs;
 
        int                             numvertexes;
@@ -207,7 +217,11 @@ typedef struct model_brushq1_s
        int                             numtextures;
        texture_t               *textures;
 
-       qbyte                   *visdata;
+       int                             num_compressedpvs;
+       qbyte                   *data_compressedpvs;
+       qbyte                   *data_decompressedpvs;
+
+       int                             num_lightdata;
        qbyte                   *lightdata;
 
        int                             numportals;
@@ -242,7 +256,6 @@ typedef struct model_brushq1_s
        float                   light_ambient;
 
        mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
-       qbyte *(*LeafPVS)(struct model_s *model, mleaf_t *leaf);
        void (*BuildPVSTextureChains)(struct model_s *model);
 }
 model_brushq1_t;
@@ -254,11 +267,15 @@ typedef struct model_brushq2_s
 model_brushq2_t;
 */
 
+#define Q3MTEXTURERENDERFLAGS_NODRAW 1
+
 typedef struct q3mtexture_s
 {
        char name[Q3PATHLENGTH];
        int surfaceflags;
-       int contents;
+       int nativecontents;
+       int supercontents;
+       int renderflags;
 
        int number;
        skinframe_t skin;
@@ -337,8 +354,8 @@ typedef struct q3mface_s
        int patchsize[2];
 
        float *data_vertex3f;
-       float *data_texturetexcoord2f;
-       float *data_lightmaptexcoord2f;
+       float *data_texcoordtexture2f;
+       float *data_texcoordlightmap2f;
        float *data_svector3f;
        float *data_tvector3f;
        float *data_normal3f;
@@ -372,7 +389,7 @@ typedef struct model_brushq3_s
        int num_models;
        q3mmodel_t *data_models;
        // each submodel gets its own model struct so this is different for each.
-       q3mmodel_t data_thismodel;
+       q3mmodel_t *data_thismodel;
 
        int num_brushes;
        q3mbrush_t *data_brushes;
@@ -382,8 +399,8 @@ typedef struct model_brushq3_s
 
        int num_vertices;
        float *data_vertex3f;
-       float *data_texturetexcoord2f;
-       float *data_lightmaptexcoord2f;
+       float *data_texcoordtexture2f;
+       float *data_texcoordlightmap2f;
        float *data_svector3f;
        float *data_tvector3f;
        float *data_normal3f;
@@ -548,6 +565,10 @@ void Mod_ShadowMesh_Free(shadowmesh_t *mesh);
 int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture);
 int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height);
 
+// used for talking to the QuakeC mainly
+int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents);
+int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents);
+
 extern cvar_t r_mipskins;
 
 typedef struct skinfileitem_s