summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-10-17 18:14:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-10-17 18:14:20 +0100
commitc94bfd67c7dc2aea719288b2f2457e7397a439e5 (patch)
tree5b89e23e8507137a5e3e22e84079ac88ffc9080e
parentDon't assume size of stencil texture (diff)
downloadilt-c94bfd67c7dc2aea719288b2f2457e7397a439e5.tar.bz2
ilt-c94bfd67c7dc2aea719288b2f2457e7397a439e5.tar.xz
ilt-c94bfd67c7dc2aea719288b2f2457e7397a439e5.zip
Remove magic number for stencil view angles
-rw-r--r--gfx/gl/shadowStenciller.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp
index 68b12ae..55ad8e1 100644
--- a/gfx/gl/shadowStenciller.cpp
+++ b/gfx/gl/shadowStenciller.cpp
@@ -10,6 +10,8 @@
#include "maths.h"
#include <stdexcept>
+template<typename T> constexpr T STENCIL_ANGLES = 8;
+
ShadowStenciller::ShadowStenciller() :
shadowCaster {shadowStencil_vs, shadowStencil_gs, shadowStencil_fs}, viewProjections {}
{
@@ -39,8 +41,8 @@ ShadowStenciller::createStencilTexture(GLsizei width, GLsizei height)
glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, width, height, 8, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,
- nullptr);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, width, height, STENCIL_ANGLES<GLint>, 0,
+ GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, nullptr);
return stencil;
}