light: avoid doing the trace twice when there is no obstruction
This commit is contained in:
parent
46cbcfd12b
commit
8e29319309
|
|
@ -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 */
|
/* Check against the list of global shadow casters */
|
||||||
for (model = tracelist; *model; model++) {
|
for (model = tracelist; *model; model++) {
|
||||||
|
if (*model == self)
|
||||||
|
continue;
|
||||||
result = TraceLine(*model, traceflags, start, stop, &hitpoint);
|
result = TraceLine(*model, traceflags, start, stop, &hitpoint);
|
||||||
if (result == -TRACE_HIT_SOLID) {
|
if (result == -TRACE_HIT_SOLID) {
|
||||||
VectorCopy(start, hitpoint_out);
|
VectorCopy(start, hitpoint_out);
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
/* Check against the list of global shadow casters */
|
||||||
for (model = tracelist; *model; model++) {
|
for (model = tracelist; *model; model++) {
|
||||||
|
if (*model == self)
|
||||||
|
continue;
|
||||||
result = TraceLine(*model, traceflags, start, stop, NULL);
|
result = TraceLine(*model, traceflags, start, stop, NULL);
|
||||||
if (result != TRACE_HIT_NONE)
|
if (result != TRACE_HIT_NONE)
|
||||||
break;
|
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 */
|
/* If good, check it isn't shadowed by another model */
|
||||||
traceflags = TRACE_HIT_SOLID;
|
traceflags = TRACE_HIT_SOLID;
|
||||||
for (model = tracelist + 1; *model; model++) {
|
for (model = tracelist + 1; *model; model++) {
|
||||||
|
if (*model == self)
|
||||||
|
continue;
|
||||||
result = TraceLine(*model, traceflags, start, hit.point, NULL);
|
result = TraceLine(*model, traceflags, start, hit.point, NULL);
|
||||||
if (result != TRACE_HIT_NONE)
|
if (result != TRACE_HIT_NONE)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue