summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRye Mutt <lightdrake@gmail.com>2020-04-01 00:25:07 +0000
committerDave Houlton <euclid@lindenlab.com>2020-04-01 00:25:07 +0000
commit6058c49bb4c4753712d958e5436348218439b911 (patch)
tree077623f8f1c19dac105d8bba9bbac32455cfa02c /indra/newview
parentc77e4e7a57ecfece08d1fddb179ca512539660ba (diff)
parent516ca236597e9e76193dd597edddc6a2fd7b0912 (diff)
Merged in eep-fix-falloff-edit (pull request #54)
Fix light falloff being corrupted when editing value via build floater spinner Approved-by: Dave Houlton
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvovolume.cpp4
-rw-r--r--indra/newview/llvovolume.h2
-rw-r--r--indra/newview/pipeline.cpp14
3 files changed, 9 insertions, 11 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index fe9d770f39..2ffd462ac3 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3376,12 +3376,12 @@ F32 LLVOVolume::getLightRadius() const
}
}
-F32 LLVOVolume::getLightFalloff() const
+F32 LLVOVolume::getLightFalloff(const F32 fudge_factor) const
{
const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
if (param_block)
{
- return param_block->getFalloff() * 0.5f;
+ return param_block->getFalloff() * fudge_factor;
}
else
{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 776b6a16b0..de00ef494e 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -279,7 +279,7 @@ public:
LLViewerTexture* getLightTexture();
F32 getLightIntensity() const;
F32 getLightRadius() const;
- F32 getLightFalloff() const;
+ F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
F32 getLightCutoff() const;
// Flexible Objects
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 563b45273e..f0ed303f66 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -211,6 +211,7 @@ LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
+const F32 DEFERRED_LIGHT_FALLOFF = 0.5f;
const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
extern S32 gBoxFrame;
@@ -6366,9 +6367,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
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
- // get falloff to match for forward deferred rendering lights
- F32 falloff = light->getLightFalloff() + (sRenderDeferred ? 1.0 : 0.f);
-
mHWLightColors[cur_light] = light_color;
LLLightState* light_state = gGL.getLight(cur_light);
@@ -6379,7 +6377,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (sRenderDeferred)
{
light_state->setLinearAttenuation(size);
- light_state->setQuadraticAttenuation(falloff);
+ light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
}
else
{
@@ -8810,7 +8808,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
- gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff());
+ gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8830,7 +8828,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
mat.mult_matrix_vec(tc);
fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s));
- light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()));
+ light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF)));
}
}
unbindDeferredShader(gDeferredLightProgram);
@@ -8867,7 +8865,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
- gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff());
+ gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8942,7 +8940,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
LLVector3 center = drawablep->getPositionAgent();
F32* c = center.mV;
F32 light_size_final = volume->getLightRadius()*1.5f;
- F32 light_falloff_final = volume->getLightFalloff();
+ F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF);
sVisibleLightCount++;