summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-28 08:38:12 +0100
committerPaul Lemire <paul.lemire@kdab.com>2019-10-28 11:56:01 +0100
commit354c6e58f64a28ce3be5caf12f17bf1d25d55da4 (patch)
tree360ad07ed9b921d2d3a944f31596cfba2c6e4188 /src/render/renderers/opengl
parent9e9ce2de6b93a835c87563614af8e50fc65127f6 (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: I55d5600cdf7c58a65c27bbe59c1a620c58dbb3a3 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/render/renderers/opengl')
-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 7fb1c5fb9..b102de9de 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -1010,7 +1010,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;