some lighting fixes. not quite there yet

This commit is contained in:
Bill Currie 2001-08-05 05:07:49 +00:00
parent 647d38fa40
commit 8883bbb369
3 changed files with 9 additions and 3 deletions

View file

@ -335,6 +335,8 @@ void R_cshift_f (void);
void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1); void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1);
void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip); void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip);
void R_SplitEntityOnNode2 (mnode_t *node); 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_MarkLights (vec3_t lightorigin, struct dlight_s *light, int bit, model_t *model);
void R_LoadSkys (const char *); void R_LoadSkys (const char *);

View file

@ -351,7 +351,8 @@ R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model)
mleaf_t *pvsleaf = Mod_PointInLeaf (lightorigin, model); mleaf_t *pvsleaf = Mod_PointInLeaf (lightorigin, model);
if (!pvsleaf->compressed_vis) { 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 { } else {
float radius = light->radius; float radius = light->radius;
vec3_t mins, maxs; vec3_t mins, maxs;
@ -405,6 +406,7 @@ R_PushDlights (vec3_t entorigin)
{ {
int i; int i;
dlight_t *l; dlight_t *l;
vec3_t lightorigin;
if (!gl_dlight_lightmap->int_val) if (!gl_dlight_lightmap->int_val)
return; return;
@ -414,7 +416,8 @@ R_PushDlights (vec3_t entorigin)
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < r_realtime || !l->radius) if (l->die < r_realtime || !l->radius)
continue; 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);
} }
} }

View file

@ -727,7 +727,8 @@ R_DrawBrushModel (entity_t *e)
continue; continue;
VectorSubtract (r_dlights[k].origin, e->origin, lightorigin); 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);
} }
} }