summaryrefslogtreecommitdiff
path: root/gfx/gl/sceneRenderer.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-07 15:41:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-07 15:41:04 +0000
commit839bf2ab51c4ec55f06b4224716c564451758072 (patch)
tree63800794b1bcff504947cde45472d0c893f0aeda /gfx/gl/sceneRenderer.cpp
parentmin/mag filter for shadow mapper depth map texture (diff)
downloadilt-839bf2ab51c4ec55f06b4224716c564451758072.tar.bz2
ilt-839bf2ab51c4ec55f06b4224716c564451758072.tar.xz
ilt-839bf2ab51c4ec55f06b4224716c564451758072.zip
Only generate the first N shadow maps which are useful
Note: we don't yet optimise the use of the shadow map texture, each still renders into its own corner
Diffstat (limited to 'gfx/gl/sceneRenderer.cpp')
-rw-r--r--gfx/gl/sceneRenderer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp
index ee2b1ee..e7ce049 100644
--- a/gfx/gl/sceneRenderer.cpp
+++ b/gfx/gl/sceneRenderer.cpp
@@ -112,7 +112,7 @@ SceneRenderer::setDirectionalLight(
glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);
glViewport(0, 0, size.x, size.y);
dirLight.use();
- dirLight.setDirectionalLight(colour, direction, lvp.projections, lvp.regions);
+ dirLight.setDirectionalLight(colour, direction, lvp.projections, lvp.regions, lvp.maps);
renderQuad();
}
}
@@ -135,13 +135,13 @@ SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() :
void
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
+ const std::span<const glm::mat4x4> lvp, const std::span<const glm::vec4> shadowMapRegions,
+ std::size_t maps) const
{
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, static_cast<GLsizei>(shadowMapRegions.size()),
- glm::value_ptr(shadowMapRegions.front()));
+ glUniform1ui(lightViewProjectionCountLoc, static_cast<GLuint>(maps));
+ glUniformMatrix4fv(lightViewProjectionLoc, static_cast<GLsizei>(maps), GL_FALSE, glm::value_ptr(lvp.front()));
+ glUniform4fv(lightViewShadowMapRegionLoc, static_cast<GLsizei>(maps), glm::value_ptr(shadowMapRegions.front()));
}