summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuclid Linden <euclid@lindenlab.com>2021-11-12 21:32:40 +0000
committerEuclid Linden <euclid@lindenlab.com>2021-11-12 21:32:40 +0000
commitaa580c0452584a639a5c9d4921b17d7d454e594e (patch)
tree583537a1c8db13f71d391d5153c7711a59f08215
parent7ce17542d46ff7cb6b88d33d4cad5ba4808c6c58 (diff)
parentb7a7bcdc22addf49867bd522f239f0bc87a31891 (diff)
Merged in revert-pr-496 (pull request #772)
Revert "SL-14895, point light atten should move inversely light radius (pull request #496)"
-rw-r--r--indra/newview/pipeline.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 9924b02a95..cd1b9c7c69 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6387,19 +6387,21 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
continue;
}
- LLVector3 light_pos(light->getRenderPosition());
- LLVector4 light_pos_gl(light_pos, 1.0f);
+ 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);
- F32 adjusted_radius = light->getLightRadius() * (sRenderDeferred ? 1.5f : 1.0f);
- if (adjusted_radius <= 0.001f)
+ if (size <= 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 / adjusted_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 / (light_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);
@@ -6408,7 +6410,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
light_state->setConstantAttenuation(0.f);
if (sRenderDeferred)
{
- light_state->setLinearAttenuation(linatten);
+ light_state->setLinearAttenuation(size);
light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
}
else