summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-05-25 07:37:17 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-05-25 19:51:10 +0000
commitcc8cc05f873aa64ee3c4e1ea6e7a662b15c57723 (patch)
tree06bd93ba205e51c73adb77e009ff35fb2c75146b
parent4025b815cc629b18c0517fd83aef9c41256d30b9 (diff)
Default constant of attenuation to 1.0
Without this, the default was 0 for the constant attenuation factor. This is bad because if the user only sets the linear and/or quadratic constants, then when the distance gets small, the denominator in the lighting equation gets very large causing a lot of saturation of the renderered meshes. Change-Id: Ie1b8b2d24702090879cb1429912eb51aeb002f68 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
-rw-r--r--src/render/lights/qpointlight.cpp2
-rw-r--r--src/render/lights/qspotlight.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp
index 1936ef4f4..c94078995 100644
--- a/src/render/lights/qpointlight.cpp
+++ b/src/render/lights/qpointlight.cpp
@@ -64,7 +64,7 @@ namespace Qt3DRender {
QPointLightPrivate::QPointLightPrivate()
: QAbstractLightPrivate(QAbstractLight::PointLight)
{
- m_shaderData->setProperty("constantAttenuation", 0.0f);
+ m_shaderData->setProperty("constantAttenuation", 1.0f);
m_shaderData->setProperty("linearAttenuation", 0.0f);
m_shaderData->setProperty("quadraticAttenuation", 0.0f);
}
diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp
index aa2c8c201..a3dd91a6f 100644
--- a/src/render/lights/qspotlight.cpp
+++ b/src/render/lights/qspotlight.cpp
@@ -68,7 +68,7 @@ namespace Qt3DRender {
QSpotLightPrivate::QSpotLightPrivate()
: QAbstractLightPrivate(QAbstractLight::SpotLight)
{
- m_shaderData->setProperty("constantAttenuation", 0.0f);
+ m_shaderData->setProperty("constantAttenuation", 1.0f);
m_shaderData->setProperty("linearAttenuation", 0.0f);
m_shaderData->setProperty("quadraticAttenuation", 0.0f);
m_shaderData->setProperty("direction", QVector3D(0.0f, -1.0f, 0.0f));