From 8e29319309afcf99b23773b4c1ba09f174095739 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 12 Sep 2015 03:49:43 -0600 Subject: [PATCH] light: avoid doing the trace twice when there is no obstruction --- light/ltface.c | 2 ++ light/trace.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/light/ltface.c b/light/ltface.c index c47b5846..53427a1e 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -1109,6 +1109,8 @@ DirtTrace(const vec3_t start, const vec3_t stop, const dmodel_t *self, vec3_t hi /* Check against the list of global shadow casters */ for (model = tracelist; *model; model++) { + if (*model == self) + continue; result = TraceLine(*model, traceflags, start, stop, &hitpoint); if (result == -TRACE_HIT_SOLID) { VectorCopy(start, hitpoint_out); diff --git a/light/trace.c b/light/trace.c index bdc0bbfb..4f34cf84 100644 --- a/light/trace.c +++ b/light/trace.c @@ -461,6 +461,8 @@ TestLight(const vec3_t start, const vec3_t stop, const dmodel_t *self) /* Check against the list of global shadow casters */ for (model = tracelist; *model; model++) { + if (*model == self) + continue; result = TraceLine(*model, traceflags, start, stop, NULL); if (result != TRACE_HIT_NONE) break; @@ -491,6 +493,8 @@ TestSky(const vec3_t start, const vec3_t dirn, const dmodel_t *self) /* If good, check it isn't shadowed by another model */ traceflags = TRACE_HIT_SOLID; for (model = tracelist + 1; *model; model++) { + if (*model == self) + continue; result = TraceLine(*model, traceflags, start, hit.point, NULL); if (result != TRACE_HIT_NONE) return false;