]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
q3bsp is still not working yet, but getting closer
[xonotic/darkplaces.git] / model_shared.h
index fd989b5ca72a80b262f2856f62df2f1af9d4ca3a..05075887a82908dfeb141c5822bf6e3b50746619 100644 (file)
@@ -144,30 +144,41 @@ 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
+       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);
+       // 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;
@@ -204,7 +215,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;
@@ -239,7 +254,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;
@@ -334,8 +348,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;
@@ -369,7 +383,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;
@@ -379,8 +393,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;