]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
Fix a potential memory leak with wavefront sounds
[xonotic/darkplaces.git] / model_shared.h
index 68833b800bede1a3f304f1eed057b5cfa5756f6f..38469a560dea575a83d3700d43d6817f36639239 100644 (file)
@@ -409,7 +409,7 @@ typedef enum dptransparentsort_category_e
        TRANSPARENTSORT_HUD,
 }dptransparentsortcategory_t;
 
-typedef struct q3shaderinfo_s
+typedef struct shader_s
 {
        char name[Q3PATHLENGTH];
 #define Q3SHADERINFO_COMPARE_START surfaceparms
@@ -469,7 +469,7 @@ typedef struct q3shaderinfo_s
        float rtlightambient;
 #define Q3SHADERINFO_COMPARE_END rtlightambient
 }
-q3shaderinfo_t;
+shader_t;
 
 typedef struct texture_shaderpass_s
 {
@@ -573,7 +573,8 @@ typedef struct texture_s
        // MATERIALFLAG_MODELLIGHT uses these parameters
        float render_modellight_ambient[3];
        float render_modellight_diffuse[3];
-       float render_modellight_lightdir[3];
+       float render_modellight_lightdir_world[3];
+       float render_modellight_lightdir_local[3];
        float render_modellight_specular[3];
        // lightmap rendering (not MATERIALFLAG_MODELLIGHT)
        float render_lightmap_ambient[3];
@@ -1060,6 +1061,8 @@ typedef struct model_s
        // if set, the model contains light information (lightmap, or vertexlight)
        qboolean lit;
        float lightmapscale;
+
+       qboolean nolerp;
 }
 dp_model_t;
 
@@ -1068,6 +1071,15 @@ dp_model_t;
 // model loading
 extern dp_model_t *loadmodel;
 extern unsigned char *mod_base;
+
+typedef struct modloader_s
+{
+       char *extension;
+       char *header;
+       size_t headersize; // The header might not be NULL terminated
+       void (*Load)(dp_model_t *, void *, void *);
+} modloader_t;
+
 // sky/water subdivision
 //extern cvar_t gl_subdivide_size;
 // texture fullbrights
@@ -1086,7 +1098,6 @@ extern cvar_t mod_q3bsp_lightgrid_texture;
 extern cvar_t mod_q3bsp_lightgrid_world_surfaces;
 extern cvar_t mod_q3bsp_lightgrid_bsp_surfaces;
 
-void Mod_Init_Commands (void);
 void Mod_Init (void);
 void Mod_Reload (void);
 dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk);
@@ -1125,7 +1136,7 @@ void Mod_CreateCollisionMesh(dp_model_t *mod);
 
 void Mod_FreeQ3Shaders(void);
 void Mod_LoadQ3Shaders(void);
-q3shaderinfo_t *Mod_LookupQ3Shader(const char *name);
+shader_t *Mod_LookupQ3Shader(const char *name);
 qboolean Mod_LoadTextureFromQ3Shader(mempool_t *mempool, const char *modelname, texture_t *texture, const char *name, qboolean warnmissing, qboolean fallback, int defaulttexflags, int defaultmaterialflags);
 texture_shaderpass_t *Mod_CreateShaderPass(mempool_t *mempool, skinframe_t *skinframe);
 texture_shaderpass_t *Mod_CreateShaderPassFromQ3ShaderLayer(mempool_t *mempool, const char *modelname, q3shaderinfo_layer_t *layer, int layerindex, int texflags, const char *texturename);
@@ -1193,16 +1204,16 @@ int Mod_Q2BSP_NativeContentsFromSuperContents(int supercontents);
 
 // a lot of model formats use the Q1BSP code, so here are the prototypes...
 struct entity_render_s;
-void R_Q1BSP_DrawAddWaterPlanes(struct entity_render_s *ent);
-void R_Q1BSP_DrawSky(struct entity_render_s *ent);
-void R_Q1BSP_Draw(struct entity_render_s *ent);
-void R_Q1BSP_DrawDepth(struct entity_render_s *ent);
-void R_Q1BSP_DrawDebug(struct entity_render_s *ent);
-void R_Q1BSP_DrawPrepass(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, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs, int numfrustumplanes, const mplane_t *frustumplanes, qboolean noocclusion);
-void R_Q1BSP_CompileShadowMap(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist);
-void R_Q1BSP_DrawShadowMap(int side, struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const unsigned char *surfacesides, const vec3_t lightmins, const vec3_t lightmaxs);
-void R_Q1BSP_DrawLight(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs);
+void R_Mod_DrawAddWaterPlanes(struct entity_render_s *ent);
+void R_Mod_DrawSky(struct entity_render_s *ent);
+void R_Mod_Draw(struct entity_render_s *ent);
+void R_Mod_DrawDepth(struct entity_render_s *ent);
+void R_Mod_DrawDebug(struct entity_render_s *ent);
+void R_Mod_DrawPrepass(struct entity_render_s *ent);
+void R_Mod_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs, int numfrustumplanes, const mplane_t *frustumplanes, qboolean noocclusion);
+void R_Mod_CompileShadowMap(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist);
+void R_Mod_DrawShadowMap(int side, struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const unsigned char *surfacesides, const vec3_t lightmins, const vec3_t lightmaxs);
+void R_Mod_DrawLight(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs);
 
 // dynamic mesh building (every frame) for debugging and other uses
 void Mod_Mesh_Create(dp_model_t *mod, const char *name);
@@ -1240,6 +1251,9 @@ void Mod_Skeletal_FreeBuffers(void);
 void Mod_SpriteInit(void);
 
 // loaders
+void Mod_2PSB_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_BSP2_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_HLBSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
 void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
 void Mod_IBSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
 void Mod_MAP_Load(dp_model_t *mod, void *buffer, void *bufferend);