diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-20 11:59:00 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-23 18:38:46 +0000 |
commit | 52742badf8b28dd956e3b0a2a6d6e9b41c223367 (patch) | |
tree | 7fffe0b5f29fbf69a903f2eda2473949614c749b /ui | |
parent | Separate out the illumation of the scene (diff) | |
download | ilt-52742badf8b28dd956e3b0a2a6d6e9b41c223367.tar.bz2 ilt-52742badf8b28dd956e3b0a2a6d6e9b41c223367.tar.xz ilt-52742badf8b28dd956e3b0a2a6d6e9b41c223367.zip |
Don't render zero directional light
Diffstat (limited to 'ui')
-rw-r--r-- | ui/sceneRenderer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
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() : |