]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
no longer uses multiple meshes for model loading, they each use one mesh for all...
[xonotic/darkplaces.git] / model_shared.h
index aa64aa2056ef5c1b537c8778e21a7cbf54e5c2c9..811b4d3cebad48ce846852db37a63a5ca6b33cff 100644 (file)
@@ -144,7 +144,6 @@ shadowmesh_t;
 typedef enum texturelayertype_e
 {
        TEXTURELAYERTYPE_INVALID,
-       TEXTURELAYERTYPE_SKY,
        TEXTURELAYERTYPE_LITTEXTURE_COMBINE,
        TEXTURELAYERTYPE_LITTEXTURE_MULTIPASS,
        TEXTURELAYERTYPE_LITTEXTURE_VERTEX,
@@ -210,6 +209,12 @@ typedef struct texture_s
        // current texture transform matrix (used for water scrolling)
        matrix4x4_t currenttexmatrix;
 
+       qboolean colormapping;
+       rtexture_t *basetexture;
+       rtexture_t *glosstexture;
+       float specularscale;
+       float specularpower;
+
        int currentnumlayers;
        texturelayer_t currentlayers[16];
 
@@ -241,12 +246,13 @@ typedef struct msurface_lightmapinfo_s
        unsigned char styles[MAXLIGHTMAPS]; // q1bsp
        // RGB lighting data [numstyles][height][width][3]
        unsigned char *samples; // q1bsp
+       // RGB normalmap data [numstyles][height][width][3]
+       unsigned char *nmapsamples; // q1bsp
        // stain to apply on lightmap (soot/dirt/blood/whatever)
        unsigned char *stainsamples; // q1bsp
-       // the stride when building lightmaps to comply with fragment update
-       int lightmaptexturestride; // q1bsp
        int texturemins[2]; // q1bsp
        int extents[2]; // q1bsp
+       int lightmaporigin[2]; // q1bsp
 }
 msurface_lightmapinfo_t;
 
@@ -260,6 +266,8 @@ typedef struct msurface_s
        texture_t *texture;
        // the lightmap texture fragment to use on the rendering mesh
        rtexture_t *lightmaptexture;
+       // the lighting direction texture fragment to use on the rendering mesh
+       rtexture_t *deluxemaptexture;
 
        // this surface is part of this mesh
        surfmesh_t *groupmesh;
@@ -377,10 +385,14 @@ typedef struct model_brush_s
        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);
 
-       char skybox[64];
+       char skybox[MAX_QPATH];
 
        rtexture_t *solidskytexture;
        rtexture_t *alphaskytexture;
+
+       // QuakeWorld
+       int qw_md4sum;
+       int qw_md4sum2;
 }
 model_brush_t;
 
@@ -413,9 +425,7 @@ typedef struct model_brushq1_s
 
        int                             num_lightdata;
        unsigned char                   *lightdata;
-
-       int                             numlights;
-       mlight_t                *lights;
+       unsigned char                   *nmaplightdata; // deluxemap file
 
        // lightmap update chains for light styles
        int                             light_styles;
@@ -471,6 +481,14 @@ typedef struct model_brushq3_s
        int num_lightgrid_dimensions[3];
        // transform modelspace coordinates to lightgrid index
        matrix4x4_t num_lightgrid_indexfromworld;
+
+       // true if this q3bsp file has been detected as using deluxemapping
+       // (lightmap texture pairs, every odd one is never directly refernced,
+       //  and contains lighting normals, not colors)
+       qboolean deluxemapping;
+       // true if the detected deluxemaps are the modelspace kind, rather than
+       // the faster tangentspace kind
+       qboolean deluxemapping_modelspace;
 }
 model_brushq3_t;
 
@@ -559,7 +577,7 @@ typedef struct model_s
        // draw the lighting on a model (through stencil)
        void(*DrawLight)(struct entity_render_s *ent, 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);
+       void (*TraceBox)(struct model_s *model, int frame, struct trace_s *trace, const vec3_t start, const vec3_t boxmins, const vec3_t boxmaxs, const vec3_t end, int hitsupercontentsmask);
        // fields belonging to some types of model
        model_sprite_t  sprite;
        model_brush_t   brush;
@@ -587,7 +605,6 @@ extern cvar_t r_fullbrights;
 
 void Mod_Init (void);
 model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
-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_UnloadModel (model_t *mod);
@@ -601,7 +618,7 @@ extern char loadname[32];   // for hunk tags
 
 int Mod_BuildVertexRemapTableFromElements(int numelements, const int *elements, int numvertices, int *remapvertices);
 void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtriangles);
-void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const char *filename, int fileline);
+void Mod_ValidateElements(int *elements, int numtriangles, int firstvertex, int numverts, const char *filename, int fileline);
 void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f, qboolean areaweighting);
 void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals, qboolean areaweighting);