diff options
author | Dave Houlton <euclid@lindenlab.com> | 2021-03-17 14:12:04 -0600 |
---|---|---|
committer | Dave Houlton <euclid@lindenlab.com> | 2021-11-12 14:28:36 -0700 |
commit | a08a45c00f99e89439ecfe7ae03137c59571e16c (patch) | |
tree | 4bf72307c7ca3725ee8a5668cb8497fa5438543e /indra/newview | |
parent | 5188a26a8521251dda07ac0140bb129f28417e49 (diff) |
SL-14895, point light atten should move inversely light radius
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/pipeline.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index de95eb1a87..cb54b1eaed 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6349,21 +6349,19 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) continue; } - LLVector3 light_pos(light->getRenderPosition()); - LLVector4 light_pos_gl(light_pos, 1.0f); - - F32 light_radius = llmax(light->getLightRadius(), 0.001f); - F32 size = light_radius * (sRenderDeferred ? 1.5f : 1.0f); + LLVector3 light_pos(light->getRenderPosition()); + LLVector4 light_pos_gl(light_pos, 1.0f); - if (size <= 0.001f) + F32 adjusted_radius = light->getLightRadius() * (sRenderDeferred ? 1.5f : 1.0f); + if (adjusted_radius <= 0.001f) { continue; } - F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior. - F32 linatten = x / (light_radius); // % of brightness at radius + F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior. + F32 linatten = x / adjusted_radius; // % of brightness at radius - mHWLightColors[cur_light] = light_color; + mHWLightColors[cur_light] = light_color; LLLightState* light_state = gGL.getLight(cur_light); light_state->setPosition(light_pos_gl); @@ -6372,7 +6370,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light_state->setConstantAttenuation(0.f); if (sRenderDeferred) { - light_state->setLinearAttenuation(size); + light_state->setLinearAttenuation(linatten); light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights } else |