summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-29 12:26:52 +0100
committerPaul Lemire <paul.lemire@kdab.com>2019-10-29 12:28:08 +0100
commit1900fa29926d9b8756250b155ebf92cc4769aecd (patch)
tree82e751ba05841c80c92b39be6da858a303941d43
parent2e8842d1c7cea00a9798930f3d5aacc26293b726 (diff)
Fix the way we compute light positions
We were using worldBoundingVolume->center() but this has been changed recently and a null bounding volume now cannot be transformed. Instead just use the worldMatrix transform to compute the light position. Change-Id: I2d884a4a5a3808ff812eb581f6bb631bbe6ab4c1 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/renderers/opengl/renderer/renderview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index 117aca3c7..dd394b5f7 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -1036,7 +1036,8 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
if (lightIdx == MAX_LIGHTS)
break;
Entity *lightEntity = lightSource.entity;
- const Vector3D worldPos = lightEntity->worldBoundingVolume()->center();
+ const Matrix4x4 lightWorldTransform = *(lightEntity->worldTransform());
+ const Vector3D worldPos = lightWorldTransform * Vector3D(0.0f, 0.0f, 0.0f);
for (Light *light : lightSource.lights) {
if (!light->isEnabled())
continue;