light: avoid doing the trace twice when there is no obstruction

This commit is contained in:
Eric Wasylishen 2015-09-12 03:49:43 -06:00
parent 46cbcfd12b
commit 8e29319309
2 changed files with 6 additions and 0 deletions

View File

@ -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);

View File

@ -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;