From 8883bbb36952545045d06d0d5b7cafd563ad7781 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 5 Aug 2001 05:07:49 +0000 Subject: [PATCH] some lighting fixes. not quite there yet --- include/r_local.h | 2 ++ libs/video/renderer/gl/gl_rlight.c | 7 +++++-- libs/video/renderer/gl/gl_rsurf.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/r_local.h b/include/r_local.h index 67dfbf94a..200cbf901 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -335,6 +335,8 @@ void R_cshift_f (void); void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1); void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip); void R_SplitEntityOnNode2 (mnode_t *node); +void R_RecursiveMarkLights (vec3_t lightorigin, struct dlight_s *light, int bit, + mnode_t *node); void R_MarkLights (vec3_t lightorigin, struct dlight_s *light, int bit, model_t *model); void R_LoadSkys (const char *); diff --git a/libs/video/renderer/gl/gl_rlight.c b/libs/video/renderer/gl/gl_rlight.c index c4ab26067..32300eab9 100644 --- a/libs/video/renderer/gl/gl_rlight.c +++ b/libs/video/renderer/gl/gl_rlight.c @@ -351,7 +351,8 @@ R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model) mleaf_t *pvsleaf = Mod_PointInLeaf (lightorigin, model); if (!pvsleaf->compressed_vis) { - R_RecursiveMarkLights (lightorigin, light, bit, model->nodes); + mnode_t *node = model->nodes + model->hulls[0].firstclipnode; + R_RecursiveMarkLights (lightorigin, light, bit, node); } else { float radius = light->radius; vec3_t mins, maxs; @@ -405,6 +406,7 @@ R_PushDlights (vec3_t entorigin) { int i; dlight_t *l; + vec3_t lightorigin; if (!gl_dlight_lightmap->int_val) return; @@ -414,7 +416,8 @@ R_PushDlights (vec3_t entorigin) for (i = 0; i < MAX_DLIGHTS; i++, l++) { if (l->die < r_realtime || !l->radius) continue; - R_MarkLights (l->origin, l, 1 << i, r_worldentity.model); + VectorSubtract (l->origin, entorigin, lightorigin); + R_MarkLights (lightorigin, l, 1 << i, r_worldentity.model); } } diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index c29ce6145..56440fe8c 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -727,7 +727,8 @@ R_DrawBrushModel (entity_t *e) continue; VectorSubtract (r_dlights[k].origin, e->origin, lightorigin); - R_MarkLights (lightorigin, &r_dlights[k], 1 << k, clmodel); + R_RecursiveMarkLights (lightorigin, &r_dlights[k], 1 << k, + clmodel->nodes + clmodel->hulls[0].firstclipnode); } }