light: avoid bouncing negative lights

This commit is contained in:
Eric Wasylishen 2016-09-19 12:15:26 -06:00
parent b4e30032a3
commit 1045505670
2 changed files with 10 additions and 2 deletions

View File

@ -914,7 +914,9 @@ MakeBounceLightsThread (void *arg)
static void
AddBounceLight(const vec3_t pos, const vec3_t color, const vec3_t surfnormal, vec_t area, const bsp2_t *bsp)
{
Q_assert(!isnan(color[0]));
Q_assert(color[0] >= 0);
Q_assert(color[1] >= 0);
Q_assert(color[2] >= 0);
Q_assert(area > 0);
bouncelight_t l = {0};

View File

@ -1250,7 +1250,8 @@ GetDirectLighting(const globalconfig_t &cfg, raystream_t *rs, const vec3_t origi
const float dirt = Dirt_GetScaleFactor(cfg, occlusion, &entity, /* FIXME: pass */ nullptr);
VectorScale(color, dirt, color);
if (fabs(LightSample_Brightness(color)) <= fadegate) {
// NOTE: Skip negative lights, which would make no sense to bounce!
if (LightSample_Brightness(color) <= fadegate) {
continue;
}
@ -1262,6 +1263,11 @@ GetDirectLighting(const globalconfig_t &cfg, raystream_t *rs, const vec3_t origi
}
for (const sun_t &sun : GetSuns()) {
// NOTE: Skip negative lights, which would make no sense to bounce!
if (sun.sunlight < 0)
continue;
vec3_t originLightDir;
VectorCopy(sun.sunvec, originLightDir);
VectorNormalize(originLightDir);