From dad6fe3b6227b5d3e78913e164b1f688de1605a8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 27 Jan 2024 22:49:54 +0000 Subject: Set light view point uniform once Not once per shadow pass --- gfx/gl/shadowMapper.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gfx/gl/shadowMapper.h') diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index d1e4e10..065db4f 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -27,7 +27,8 @@ public: class FixedPoint : public Program { public: FixedPoint(const Shader & vs); - void setViewProjection(const GlobalPosition3D, const glm::mat4 &) const; + void setViewPoint(const GlobalPosition3D) const; + void setViewProjection(const glm::mat4 &) const; void use() const; private: @@ -37,7 +38,8 @@ public: class DynamicPoint : public Program { public: DynamicPoint(); - void setViewProjection(const GlobalPosition3D, const glm::mat4 &) const; + void setViewPoint(const GlobalPosition3D) const; + void setViewProjection(const glm::mat4 &) const; void use(const Location &) const; void setModel(const Location &) const; -- cgit v1.2.3 From 892513f81ed68e05d4dedb99f51de5bc46cab6b2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 28 Jan 2024 02:25:11 +0000 Subject: Geometry shader for single pass shadow maps 2D array texture, 4 levels, geometry shader outputs to each layer for a specific band, single scene rendering. Pending massive tidy up. --- gfx/gl/shadowMapper.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gfx/gl/shadowMapper.h') diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index 065db4f..421e6a5 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -26,25 +26,29 @@ public: class FixedPoint : public Program { public: - FixedPoint(const Shader & vs); - void setViewPoint(const GlobalPosition3D) const; - void setViewProjection(const glm::mat4 &) const; + FixedPoint(const Shader & vs, const Shader & gs); + void setViewPoint(const GlobalPosition3D, size_t n) const; + void setViewProjection(const glm::mat4 &, size_t n) const; void use() const; private: - RequiredUniformLocation viewProjectionLoc, viewPointLoc; + std::array viewProjectionLoc; + RequiredUniformLocation viewProjectionsLoc; + RequiredUniformLocation viewPointLoc; }; class DynamicPoint : public Program { public: DynamicPoint(); - void setViewPoint(const GlobalPosition3D) const; - void setViewProjection(const glm::mat4 &) const; + void setViewPoint(const GlobalPosition3D, size_t n) const; + void setViewProjection(const glm::mat4 &, size_t n) const; void use(const Location &) const; void setModel(const Location &) const; private: - RequiredUniformLocation viewProjectionLoc, viewPointLoc; + std::array viewProjectionLoc; + RequiredUniformLocation viewProjectionsLoc; + RequiredUniformLocation viewPointLoc; RequiredUniformLocation modelLoc; RequiredUniformLocation modelPosLoc; }; -- cgit v1.2.3 From a18ea136a540d271687fd88831bc14394107dba5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 29 Jan 2024 00:18:02 +0000 Subject: Merge common parts of shadow programs into a base class --- gfx/gl/shadowMapper.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gfx/gl/shadowMapper.h') diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index 421e6a5..4f81e58 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -24,9 +24,10 @@ public: [[nodiscard]] Definitions update(const SceneProvider &, const Direction3D & direction, const Camera &) const; - class FixedPoint : public Program { + class ShadowProgram : public Program { public: - FixedPoint(const Shader & vs, const Shader & gs); + explicit ShadowProgram(const Shader & vs); + void setViewPoint(const GlobalPosition3D, size_t n) const; void setViewProjection(const glm::mat4 &, size_t n) const; void use() const; @@ -37,18 +38,18 @@ public: RequiredUniformLocation viewPointLoc; }; - class DynamicPoint : public Program { + class FixedPoint : public ShadowProgram { + public: + explicit FixedPoint(const Shader & vs); + }; + + class DynamicPoint : public ShadowProgram { public: DynamicPoint(); - void setViewPoint(const GlobalPosition3D, size_t n) const; - void setViewProjection(const glm::mat4 &, size_t n) const; void use(const Location &) const; void setModel(const Location &) const; private: - std::array viewProjectionLoc; - RequiredUniformLocation viewProjectionsLoc; - RequiredUniformLocation viewPointLoc; RequiredUniformLocation modelLoc; RequiredUniformLocation modelPosLoc; }; -- cgit v1.2.3 From 83c43ea9e39f4e6ed5e50ccced66700af39987be Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 29 Jan 2024 01:02:51 +0000 Subject: Set shadow program uniforms all in one function, merge setting of view projections --- gfx/gl/shadowMapper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gfx/gl/shadowMapper.h') diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index 4f81e58..b948f50 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -5,6 +5,7 @@ #include "program.h" #include #include +#include #include class SceneProvider; @@ -28,12 +29,11 @@ public: public: explicit ShadowProgram(const Shader & vs); - void setViewPoint(const GlobalPosition3D, size_t n) const; - void setViewProjection(const glm::mat4 &, size_t n) const; + void setView(const std::span, const GlobalPosition3D) const; void use() const; private: - std::array viewProjectionLoc; + RequiredUniformLocation viewProjectionLoc; RequiredUniformLocation viewProjectionsLoc; RequiredUniformLocation viewPointLoc; }; -- cgit v1.2.3 From a01f1d9e834719046fbdec02a5147d2e55722bac Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 29 Jan 2024 01:56:42 +0000 Subject: Remove the complications from previously storing several shadow maps in the texture --- gfx/gl/shadowMapper.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'gfx/gl/shadowMapper.h') diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index b948f50..a95d4c1 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -17,11 +17,7 @@ public: static constexpr std::size_t SHADOW_BANDS {4}; - struct Definitions { - std::array projections {}; - std::array regions {}; - size_t maps {}; - }; + using Definitions = std::vector; [[nodiscard]] Definitions update(const SceneProvider &, const Direction3D & direction, const Camera &) const; -- cgit v1.2.3