diff options
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; +}; |