From 52742badf8b28dd956e3b0a2a6d6e9b41c223367 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 20 Nov 2022 11:59:00 +0000 Subject: Don't render zero directional light --- ui/sceneRenderer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ui/sceneRenderer.cpp') diff --git a/ui/sceneRenderer.cpp b/ui/sceneRenderer.cpp index c3cff7a..2202906 100644 --- a/ui/sceneRenderer.cpp +++ b/ui/sceneRenderer.cpp @@ -107,11 +107,13 @@ SceneRenderer::setAmbientLight(const glm::vec3 & colour) const void SceneRenderer::setDirectionalLight(const glm::vec3 & colour, const glm::vec3 & direction) const { - dirLight.use(); - dirLight.setDirectionalLight(colour, direction); - glBindVertexArray(displayVAO); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - glBindVertexArray(0); + if (colour.r > 0 || colour.g > 0 || colour.b > 0) { + dirLight.use(); + dirLight.setDirectionalLight(colour, direction); + glBindVertexArray(displayVAO); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glBindVertexArray(0); + } } SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() : -- cgit v1.2.3