]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
fixed a crash with lights that have no clusters (a light outside the level) by alloca...
[xonotic/darkplaces.git] / model_shared.h
index 830428d7f65adfcc01f1a923d475d960fe26a549..ddb6e1e0f7b2f5df4893bb43c59c46564e766713 100644 (file)
@@ -154,6 +154,8 @@ typedef struct model_brush_s
        // 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 if .isworldmodel is true
+       struct model_s **submodels;
 
        // pvs
        int num_pvsclusters;
@@ -179,6 +181,9 @@ typedef struct model_brush_s
        void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs);
 
        char skybox[64];
+
+       rtexture_t *solidskytexture;
+       rtexture_t *alphaskytexture;
 }
 model_brush_t;
 
@@ -334,6 +339,7 @@ model_brushq2_t;
 #define Q3TEXTUREFLAG_NOPICMIP 8
 #define Q3TEXTUREFLAG_AUTOSPRITE 16
 #define Q3TEXTUREFLAG_AUTOSPRITE2 32
+#define Q3TEXTUREFLAG_ALPHATEST 64
 
 struct q3msurface_s;
 typedef struct q3mtexture_s
@@ -543,8 +549,8 @@ typedef struct model_s
 {
        // name and path of model, for example "progs/player.mdl"
        char                    name[MAX_QPATH];
-       // model needs to be loaded if this is true
-       qboolean                needload;
+       // model needs to be loaded if this is false
+       qboolean                loaded;
        // set if the model is used in current map, models which are not, are purged
        qboolean                used;
        // true if this is the world model (I.E. defines what sky to use, and may contain submodels)
@@ -595,7 +601,7 @@ typedef struct model_s
        // draw a shadow volume for the model based on light source
        void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist);
        // draw the lighting on a model (through stencil)
-       void(*DrawLight)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *lightcubemap, int numsurfaces, const int *surfacelist);
+       void(*DrawLight)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *lightcubemap, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int numsurfaces, const int *surfacelist);
        // trace a box against this model
        void (*TraceBox)(struct model_s *model, int frame, struct trace_s *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs, int hitsupercontentsmask);
        // fields belonging to each type of model
@@ -638,7 +644,6 @@ void Mod_CheckLoaded (model_t *mod);
 void Mod_ClearAll (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);
 void Mod_UnloadModel (model_t *mod);
 
 void Mod_ClearUsed(void);
@@ -692,6 +697,7 @@ skinfile_t *Mod_LoadSkinFiles(void);
 void Mod_FreeSkinFiles(skinfile_t *skinfile);
 int Mod_CountSkinFiles(skinfile_t *skinfile);
 
+void Mod_SnapVertices(int numcomponents, int numvertices, float *vertices, float snap);
 int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f);
 
 #endif // MODEL_SHARED_H