diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-28 19:29:53 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-28 19:29:53 +0000 |
commit | aaff59af171545cc16632881aefb19449a7c491a (patch) | |
tree | ab7923c987bdd8c4f95bf310abcb5171283f08c9 /gfx/gl/sceneRenderer.cpp | |
parent | Light camera centre not required, view camera position suffices (diff) | |
download | ilt-aaff59af171545cc16632881aefb19449a7c491a.tar.bz2 ilt-aaff59af171545cc16632881aefb19449a7c491a.tar.xz ilt-aaff59af171545cc16632881aefb19449a7c491a.zip |
Generate a single shadow band and region definition
Diffstat (limited to 'gfx/gl/sceneRenderer.cpp')
-rw-r--r-- | gfx/gl/sceneRenderer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp index 0fcf471..b13da35 100644 --- a/gfx/gl/sceneRenderer.cpp +++ b/gfx/gl/sceneRenderer.cpp @@ -119,7 +119,7 @@ SceneRenderer::setDirectionalLight( glBindFramebuffer(GL_FRAMEBUFFER, gBuffer); glViewport(0, 0, size.x, size.y); dirLight.use(); - dirLight.setDirectionalLight(colour, direction, lvp); + dirLight.setDirectionalLight(colour, direction, lvp.projections, lvp.regions); glBindVertexArray(displayVAO); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindVertexArray(0); @@ -136,14 +136,14 @@ SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() : } void -SceneRenderer::DirectionalLightProgram::setDirectionalLight( - const glm::vec3 & c, const glm::vec3 & d, const std::span<const glm::mat4x4> lvp) const +SceneRenderer::DirectionalLightProgram::setDirectionalLight(const glm::vec3 & c, const glm::vec3 & d, + const std::span<const glm::mat4x4> lvp, const std::span<const glm::vec4> shadowMapRegions) const { - constexpr glm::vec4 shadowMapRegions {0.5F, 0.5F, 0.5F, 0.5F}; glUniform3fv(colourLoc, 1, glm::value_ptr(c)); const auto nd = glm::normalize(d); glUniform3fv(directionLoc, 1, glm::value_ptr(nd)); glUniform1ui(lightViewProjectionCountLoc, static_cast<GLuint>(lvp.size())); glUniformMatrix4fv(lightViewProjectionLoc, static_cast<GLsizei>(lvp.size()), GL_FALSE, glm::value_ptr(lvp.front())); - glUniform4fv(lightViewShadowMapRegionLoc, 1, glm::value_ptr(shadowMapRegions)); + glUniform4fv(lightViewShadowMapRegionLoc, static_cast<GLsizei>(shadowMapRegions.size()), + glm::value_ptr(shadowMapRegions.front())); } |