summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowStenciller.cpp
diff options
context:
space:
mode:
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)
{