]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
lightmap update checking is now handled very differently; each brush model has a...
[xonotic/darkplaces.git] / model_shared.h
index cebb49d9f6b1fc843973db46ce76f5808e84ab62..8f504282cf19d0fdf506e18caaa2a7d3b1e7163d 100644 (file)
@@ -60,6 +60,13 @@ skinframe_t;
 
 #define MAX_SKINS 256
 
+#define SHADOWMESHVERTEXHASH 1024
+typedef struct shadowmeshvertexhash_s
+{
+       struct shadowmeshvertexhash_s *next;
+}
+shadowmeshvertexhash_t;
+
 typedef struct shadowmesh_s
 {
        struct shadowmesh_s *next;
@@ -68,6 +75,9 @@ typedef struct shadowmesh_s
        float *verts;
        int *elements;
        int *neighbors;
+       // these are NULL after Mod_ShadowMesh_Finish is performed, only used
+       // while building meshes
+       shadowmeshvertexhash_t **vertexhashtable, *vertexhashentries;
 }
 shadowmesh_t;
 
@@ -89,6 +99,8 @@ typedef struct model_s
        qboolean                isworldmodel;
        // true if this model is a HalfLife .bsp file
        qboolean                ishlbsp;
+       // true if this model was not successfully loaded and should be purged
+       qboolean                error;
 
        // mod_brush, mod_alias, mod_sprite
        modtype_t               type;
@@ -176,8 +188,6 @@ typedef struct model_s
        int                             numtextures;
        texture_t               *textures;
 
-       msurface_t              **texturesurfacechains;
-
        qbyte                   *visdata;
        qbyte                   *lightdata;
        char                    *entities;
@@ -191,11 +201,6 @@ typedef struct model_s
        int                             numlights;
        mlight_t                *lights;
 
-       // used only for casting dynamic shadow volumes
-       shadowmesh_t    *shadowmesh;
-       vec3_t                  shadowmesh_mins, shadowmesh_maxs, shadowmesh_center;
-       float                   shadowmesh_radius;
-
        // pvs visibility marking
        mleaf_t                 *pvsviewleaf;
        int                             pvsviewleafnovis;
@@ -203,6 +208,20 @@ typedef struct model_s
        mleaf_t                 *pvsleafchain;
        int                             *pvssurflist;
        int                             pvssurflistlength;
+       // these get rebuilt as the player moves around if this is the world,
+       // otherwise they are left alone (no pvs for bmodels)
+       msurface_t              ***pvstexturechains;
+       msurface_t              **pvstexturechainsbuffer;
+       int                             *pvstexturechainslength;
+
+       // lightmap update chains for light styles
+       int                             light_styles;
+       qbyte                   *light_style;
+       int                             *light_stylevalue;
+       msurface_t              ***light_styleupdatechains;
+       msurface_t              **light_styleupdatechainsbuffer;
+       int                             light_scalebit;
+       float                   light_ambient;
 
        // skin animation info
        animscene_t             *skinscenes; // [numskins]
@@ -276,6 +295,7 @@ extern cvar_t r_fullbrights;
 void Mod_Init (void);
 void Mod_CheckLoaded (model_t *mod);
 void Mod_ClearAll (void);
+void Mod_ClearErrorModels (void);
 model_t *Mod_FindName (const char *name);
 model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
 void Mod_TouchModel (const char *name);