]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
Experimental restoration of GLES2 support. It *might* compile.
[xonotic/darkplaces.git] / model_shared.h
index 2e0052eed15e7f725d444ff53dbabcc7b0141b74..5c38de4d3f0c789fbdd03f5dcd71f76bf58367d3 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
 {
@@ -487,9 +487,10 @@ texture_shaderpass_t;
 
 typedef struct texture_s
 {
-       // q1bsp
        // name
-       //char name[16];
+       char name[64];
+
+       // q1bsp
        // size
        unsigned int width, height;
        // SURF_ flags
@@ -572,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];
@@ -590,7 +592,6 @@ typedef struct texture_s
        int customblendfunc[2];
 
        // q3bsp
-       char name[64];
        int surfaceflags;
        int supercontents;
 
@@ -687,10 +688,6 @@ typedef struct msurface_s
        struct q3deffect_s *effect; // q3bsp
        // mesh information for collisions (only used by q3bsp curves)
        int num_firstcollisiontriangle;
-       int *deprecatedq3data_collisionelement3i; // q3bsp
-       float *deprecatedq3data_collisionvertex3f; // q3bsp
-       float *deprecatedq3data_collisionbbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles
-       float *deprecatedq3data_bbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles
 
        // surfaces own ranges of vertices and triangles in the model->surfmesh
        int num_triangles; // number of triangles
@@ -701,10 +698,6 @@ typedef struct msurface_s
        // mesh information for collisions (only used by q3bsp curves)
        int num_collisiontriangles; // q3bsp
        int num_collisionvertices; // q3bsp
-       int deprecatedq3num_collisionbboxstride;
-       int deprecatedq3num_bboxstride;
-       // FIXME: collisionmarkframe should be kept in a separate array
-       int deprecatedq3collisionmarkframe; // q3bsp // don't collide twice in one trace
 
        // used by Mod_Mesh_Finalize when building sortedmodelsurfaces
        qboolean included;
@@ -883,12 +876,6 @@ typedef struct model_brushq1_s
 }
 model_brushq1_t;
 
-typedef struct model_brushq2_s
-{
-       int dummy; // MSVC can't handle an empty struct
-}
-model_brushq2_t;
-
 typedef struct model_brushq3_s
 {
        int num_models;
@@ -1067,7 +1054,6 @@ typedef struct model_s
        model_sprite_t  sprite;
        model_brush_t   brush;
        model_brushq1_t brushq1;
-       model_brushq2_t brushq2;
        model_brushq3_t brushq3;
        // flags this model for offseting sounds to the model center (used by brush models)
        int soundfromcenter;
@@ -1075,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;
 
@@ -1083,6 +1071,15 @@ dp_model_t;
 // model loading
 extern dp_model_t *loadmodel;
 extern unsigned char *mod_base;
+
+typedef struct modloader_s
+{
+       const char *extension;
+       const 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
@@ -1139,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);
@@ -1207,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);
@@ -1254,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);