From 1900fa29926d9b8756250b155ebf92cc4769aecd Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 29 Oct 2019 12:26:52 +0100 Subject: 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 --- src/render/renderers/opengl/renderer/renderview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/render') 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; -- cgit v1.2.3