From dd907a12c173b52bdc7a81baec63d112f91203a6 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 15 Jun 2007 02:33:49 +0000 Subject: [PATCH] added r_polygonoffset_submodel_offset support in submodel shadow rendering, fixing a bug that kept dlights from affecting submodels git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7425 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rsurf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gl_rsurf.c b/gl_rsurf.c index db9cc545..0333beff 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -930,6 +930,8 @@ void R_Q1BSP_CompileShadowVolume(entity_render_t *ent, vec3_t relativelightorigi r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Finish(r_main_mempool, r_shadow_compilingrtlight->static_meshchain_shadow, false, false, true); } +extern cvar_t r_polygonoffset_submodel_factor; +extern cvar_t r_polygonoffset_submodel_offset; void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const vec3_t lightmins, const vec3_t lightmaxs) { model_t *model = ent->model; @@ -940,6 +942,7 @@ void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, if (!BoxesOverlap(model->normalmins, model->normalmaxs, lightmins, lightmaxs)) return; R_UpdateAllTextureInfo(ent); + GL_PolygonOffset(r_refdef.shadowpolygonfactor + r_polygonoffset_submodel_factor.value, r_refdef.shadowpolygonoffset + r_polygonoffset_submodel_offset.value);CHECKGLERROR if (model->brush.shadowmesh) { R_Shadow_PrepareShadowMark(model->brush.shadowmesh->numtriangles); @@ -968,6 +971,7 @@ void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, } R_Shadow_VolumeFromList(model->surfmesh.num_vertices, model->surfmesh.num_triangles, rsurface.vertex3f, model->surfmesh.data_element3i, model->surfmesh.data_neighbor3i, relativelightorigin, relativelightdirection, projectdistance, numshadowmark, shadowmarklist); } + GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR } #define BATCHSIZE 1024 -- 2.39.2