]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
moved d_lightstylevalue into r_refdef.lightstyle
[xonotic/darkplaces.git] / model_shared.h
index 34776b298729df292faa8986a9106016386e5335..3dc5644be7e52b9a527e0b30bb09aa2f5c8a4f15 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef MODEL_SHARED_H
 #define MODEL_SHARED_H
 
-typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
+typedef enum synctype_e {ST_SYNC=0, ST_RAND } synctype_t;
 
 /*
 
@@ -30,7 +30,7 @@ m*_t structures are in-memory
 
 */
 
-typedef enum {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3} modtype_t;
+typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3} modtype_t;
 
 typedef struct animscene_s
 {
@@ -145,14 +145,24 @@ typedef enum texturelayertype_e
 {
        TEXTURELAYERTYPE_INVALID,
        TEXTURELAYERTYPE_SKY,
-       TEXTURELAYERTYPE_LIGHTMAP_DOUBLEMODULATE_TEXTURE,
-       TEXTURELAYERTYPE_LIGHTMAP,
+       TEXTURELAYERTYPE_LITTEXTURE_COMBINE,
+       TEXTURELAYERTYPE_LITTEXTURE_MULTIPASS,
+       TEXTURELAYERTYPE_LITTEXTURE_VERTEX,
        TEXTURELAYERTYPE_TEXTURE,
-       TEXTURELAYERTYPE_VERTEXTEXTURE,
        TEXTURELAYERTYPE_FOG,
 }
 texturelayertype_t;
 
+typedef enum texturelayerflag_e
+{
+       // indicates that the pass should apply fog darkening; used on
+       // transparent surfaces where simply blending an alpha fog as a final
+       // pass would not behave properly, so all the surfaces must be darkened,
+       // and the fog color added as a separate pass
+       TEXTURELAYERFLAG_FOGDARKEN = 1,
+}
+texturelayerflag_t;
+
 typedef struct texturelayer_s
 {
        texturelayertype_t type;
@@ -162,7 +172,7 @@ typedef struct texturelayer_s
        rtexture_t *texture;
        matrix4x4_t texmatrix;
        vec4_t color;
-       int texrgbscale;
+       int flags;
 }
 texturelayer_t;
 
@@ -198,27 +208,6 @@ typedef struct texture_s
        // current texture transform matrix (used for water scrolling)
        matrix4x4_t currenttexmatrix;
 
-       // this is either texture->skin.merged or texture->skin.base depending on colormapping
-       rtexture_t *currentbasetexture;
-       // color to use on the base layer (use instead of ent->colormod and ent->alpha)
-       vec4_t currentcolorbase;
-       // color to use on the pants layer
-       vec4_t currentcolorpants;
-       // color to use on the shirt layer
-       vec4_t currentcolorshirt;
-       // render pants layer
-       qboolean currentdopants;
-       // render shirt layer
-       qboolean currentdoshirt;
-       // render pants as fullbright
-       qboolean currentdofullbrightpants;
-       // render shirt as fullbright
-       qboolean currentdofullbrightshirt;
-       // indicates that all passes should apply fog darkening; used on
-       // transparent surfaces where simply blending an alpha fog as a final
-       // pass would not behave properly
-       qboolean currentfogallpasses;
-
        int currentnumlayers;
        texturelayer_t currentlayers[16];
 
@@ -234,7 +223,7 @@ typedef struct texture_s
 }
 texture_t;
 
-typedef struct
+typedef struct mtexinfo_s
 {
        float vecs[2][4];
        texture_t *texture;
@@ -246,7 +235,7 @@ typedef struct msurface_lightmapinfo_s
 {
        // texture mapping properties used by this surface
        mtexinfo_t *texinfo; // q1bsp
-       // index into d_lightstylevalue array, 255 means not used (black)
+       // index into r_refdef.lightstylevalue array, 255 means not used (black)
        qbyte styles[MAXLIGHTMAPS]; // q1bsp
        // RGB lighting data [numstyles][height][width][3]
        qbyte *samples; // q1bsp
@@ -378,6 +367,7 @@ typedef struct model_brush_s
        int (*BoxTouchingPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs);
        int (*BoxTouchingLeafPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs);
        int (*BoxTouchingVisibleLeafs)(struct model_s *model, const qbyte *visibleleafs, const vec3_t mins, const vec3_t maxs);
+       int (*FindBoxClusters)(struct model_s *model, const vec3_t mins, const vec3_t maxs, int maxclusters, int *clusterlist);
        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);
        mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
@@ -565,7 +555,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, const vec3_t lightmins, const vec3_t lightmaxs);
        // draw the lighting on a model (through stencil)
-       void(*DrawLight)(struct entity_render_s *ent, float *lightcolor, int numsurfaces, const int *surfacelist);
+       void(*DrawLight)(struct entity_render_s *ent, vec3_t lightcolorbase, vec3_t lightcolorpants, vec3_t lightcolorshirt, 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 some types of model
@@ -594,7 +584,6 @@ extern qbyte *mod_base;
 extern cvar_t r_fullbrights;
 
 void Mod_Init (void);
-#define Mod_CheckLoaded(mod) (mod ? (mod->loaded ? (mod->used = true) : (Mod_LoadModel(mod, true, true, mod->isworldmodel), true)) : false)
 model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
 void Mod_ClearAll (void);
 model_t *Mod_FindName (const char *name);
@@ -604,7 +593,6 @@ void Mod_UnloadModel (model_t *mod);
 void Mod_ClearUsed(void);
 void Mod_PurgeUnused(void);
 void Mod_RemoveStaleWorldModels(model_t *skip); // only used during loading!
-void Mod_LoadModels(void);
 
 extern model_t *loadmodel;
 extern char loadname[32];      // for hunk tags
@@ -667,7 +655,7 @@ void R_Q1BSP_Draw(struct entity_render_s *ent);
 void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer);
 void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist);
 void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
-void R_Q1BSP_DrawLight(struct entity_render_s *ent, float *lightcolor, int numsurfaces, const int *surfacelist);
+void R_Q1BSP_DrawLight(struct entity_render_s *ent, vec3_t lightcolorbase, vec3_t lightcolorpants, vec3_t lightcolorshirt, int numsurfaces, const int *surfacelist);
 
 // alias models
 struct frameblend_s;