X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=model_shared.h;h=5c38de4d3f0c789fbdd03f5dcd71f76bf58367d3;hb=81adc28fdb9410cde521da2bb320488dc3900c8c;hp=0226e7015ead54ea9326f6985e11822d387634b5;hpb=a51a70c2254b27a68e5fe74cc5985b02dc36e1e9;p=xonotic%2Fdarkplaces.git diff --git a/model_shared.h b/model_shared.h index 0226e701..5c38de4d 100644 --- a/model_shared.h +++ b/model_shared.h @@ -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 +{ + 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 @@ -1124,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); @@ -1192,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); @@ -1239,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);