summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowMapper.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-30 22:48:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-30 22:48:33 +0000
commit3c239338f5d1e97e3c0ddd05976e14b20758e07d (patch)
tree7eb3c254b681d2cafbc9ce8f13b285a9313474c4 /gfx/gl/shadowMapper.h
parent3D relative scaling in asset factory (diff)
parentAdjust light view projection matrix upfront (diff)
downloadilt-3c239338f5d1e97e3c0ddd05976e14b20758e07d.tar.bz2
ilt-3c239338f5d1e97e3c0ddd05976e14b20758e07d.tar.xz
ilt-3c239338f5d1e97e3c0ddd05976e14b20758e07d.zip
Merge branch 'geo-shadows'
Diffstat (limited to 'gfx/gl/shadowMapper.h')
-rw-r--r--gfx/gl/shadowMapper.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h
index d1e4e10..a95d4c1 100644
--- a/gfx/gl/shadowMapper.h
+++ b/gfx/gl/shadowMapper.h
@@ -5,6 +5,7 @@
#include "program.h"
#include <gfx/models/texture.h>
#include <glm/vec2.hpp>
+#include <span>
#include <vector>
class SceneProvider;
@@ -16,33 +17,35 @@ public:
static constexpr std::size_t SHADOW_BANDS {4};
- struct Definitions {
- std::array<glm::mat4x4, SHADOW_BANDS> projections {};
- std::array<TextureRelRegion, SHADOW_BANDS> regions {};
- size_t maps {};
- };
+ using Definitions = std::vector<glm::mat4x4>;
[[nodiscard]] Definitions update(const SceneProvider &, const Direction3D & direction, const Camera &) const;
- class FixedPoint : public Program {
+ class ShadowProgram : public Program {
public:
- FixedPoint(const Shader & vs);
- void setViewProjection(const GlobalPosition3D, const glm::mat4 &) const;
+ explicit ShadowProgram(const Shader & vs);
+
+ void setView(const std::span<const glm::mat4>, const GlobalPosition3D) const;
void use() const;
private:
- RequiredUniformLocation viewProjectionLoc, viewPointLoc;
+ RequiredUniformLocation viewProjectionLoc;
+ RequiredUniformLocation viewProjectionsLoc;
+ RequiredUniformLocation viewPointLoc;
+ };
+
+ class FixedPoint : public ShadowProgram {
+ public:
+ explicit FixedPoint(const Shader & vs);
};
- class DynamicPoint : public Program {
+ class DynamicPoint : public ShadowProgram {
public:
DynamicPoint();
- void setViewProjection(const GlobalPosition3D, const glm::mat4 &) const;
void use(const Location &) const;
void setModel(const Location &) const;
private:
- RequiredUniformLocation viewProjectionLoc, viewPointLoc;
RequiredUniformLocation modelLoc;
RequiredUniformLocation modelPosLoc;
};