summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowStenciller.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-07-20 10:57:17 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-10 18:11:55 +0100
commit900d19a41bc1886e7a809d99d6119b12235a4f0a (patch)
tree2e72221ae1a470d448497664a95d4e64acc2e8f1 /gfx/gl/shadowStenciller.h
parentFix texture usage via materials in shadows (diff)
downloadilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.tar.bz2
ilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.tar.xz
ilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.zip
Initial commit of basic shadow depth map creation
Diffstat (limited to 'gfx/gl/shadowStenciller.h')
-rw-r--r--gfx/gl/shadowStenciller.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gfx/gl/shadowStenciller.h b/gfx/gl/shadowStenciller.h
new file mode 100644
index 0000000..460fa68
--- /dev/null
+++ b/gfx/gl/shadowStenciller.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "config/types.h"
+#include "gfx/gl/program.h"
+#include "gfx/models/mesh.h"
+#include "glArrays.h"
+
+class ShadowStenciller {
+public:
+ ShadowStenciller();
+
+ [[nodiscard]]
+ static glTexture createStencilTexture(GLsizei width, GLsizei height);
+ void renderStencil(const glTexture &, const MeshBase &, const RelativePosition3D & mins,
+ const RelativePosition3D & maxs) const;
+
+private:
+ glFrameBuffer fbo;
+ Program shadowCaster;
+ Program::UniformLocation viewProjectionLoc {shadowCaster, "viewProjection"};
+};