diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-03 03:41:32 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-03 03:41:32 +0000 |
commit | aa75b018f3b97c72b57de68867417cbda51439c3 (patch) | |
tree | 446efaad2727ae6bff6433e8bfbf590e99d5e310 /gfx/gl/shadowMapper.h | |
parent | Add GL_DEBUG_OUTPUT with boost test error handling to test-render context (diff) | |
download | ilt-aa75b018f3b97c72b57de68867417cbda51439c3.tar.bz2 ilt-aa75b018f3b97c72b57de68867417cbda51439c3.tar.xz ilt-aa75b018f3b97c72b57de68867417cbda51439c3.zip |
Initial commit of the shadow map generator and shadows render interface
Lots of hard coding, buggy in places, far from great, but the basics
work.
Diffstat (limited to 'gfx/gl/shadowMapper.h')
-rw-r--r-- | gfx/gl/shadowMapper.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h new file mode 100644 index 0000000..dcd0a02 --- /dev/null +++ b/gfx/gl/shadowMapper.h @@ -0,0 +1,46 @@ +#pragma once + +#include "lib/glArrays.h" +#include "program.h" +#include <glm/vec2.hpp> + +class SceneProvider; + +class ShadowMapper { +public: + ShadowMapper(const glm::ivec2 & size = {1024, 1024}); + + glm::mat4x4 update(const SceneProvider &, const glm::vec3 & direction) const; + + class FixedPoint : public Program { + public: + FixedPoint(); + void setViewProjection(const glm::mat4 &) const; + void use() const; + + private: + RequiredUniformLocation viewProjectionLoc; + }; + class DynamicPoint : public Program { + public: + DynamicPoint(); + void setViewProjection(const glm::mat4 &) const; + void use(const Location &) const; + + private: + RequiredUniformLocation viewProjectionLoc; + RequiredUniformLocation modelLoc; + }; + FixedPoint fixedPoint; + DynamicPoint dynamicPoint; + + operator GLuint() const + { + return depthMap; + } + +private: + glFrameBuffer depthMapFBO; + glTexture depthMap; + glm::ivec2 size; +}; |