summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowStenciller.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-08-19 23:26:32 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-19 23:26:32 +0100
commitdd452f3e9238be954c3ecd325ed11e97a50ec1c3 (patch)
treeffe8390a875dbd252085ec0ee3ec1cd8cd68a0c7 /gfx/gl/shadowStenciller.cpp
parentShuffle some GL state setting (diff)
downloadilt-dd452f3e9238be954c3ecd325ed11e97a50ec1c3.tar.bz2
ilt-dd452f3e9238be954c3ecd325ed11e97a50ec1c3.tar.xz
ilt-dd452f3e9238be954c3ecd325ed11e97a50ec1c3.zip
Persist a single ShadowStenciller within ShadowMapper
Diffstat (limited to 'gfx/gl/shadowStenciller.cpp')
-rw-r--r--gfx/gl/shadowStenciller.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp
index fc3d77c..ac63b4e 100644
--- a/gfx/gl/shadowStenciller.cpp
+++ b/gfx/gl/shadowStenciller.cpp
@@ -7,8 +7,7 @@
#include "gl_traits.h"
#include <stdexcept>
-ShadowStenciller::ShadowStenciller(const Direction3D & lightDir, const Direction3D & lightDirUp) :
- shadowCaster {shadowStencil_vs, shadowStencil_fs}, lightDirMat {glm::lookAt(-lightDir, {}, lightDirUp)}
+ShadowStenciller::ShadowStenciller() : shadowCaster {shadowStencil_vs, shadowStencil_fs}
{
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glDrawBuffer(GL_NONE);
@@ -16,6 +15,12 @@ ShadowStenciller::ShadowStenciller(const Direction3D & lightDir, const Direction
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
+void
+ShadowStenciller::setLightDirection(const Direction3D & lightDir, const Direction3D & lightDirUp)
+{
+ lightDirMat = glm::lookAt(-lightDir, {}, lightDirUp);
+}
+
glTexture
ShadowStenciller::createStencilTexture(GLsizei width, GLsizei height)
{