#pragma once #include "config/types.h" #include "lib/glArrays.h" #include "program.h" #include #include #include class SceneProvider; class Camera; class ShadowMapper { public: explicit ShadowMapper(const TextureAbsCoord & size); static constexpr std::size_t SHADOW_BANDS {4}; struct Definitions { std::array projections {}; std::array regions {}; size_t maps {}; }; [[nodiscard]] Definitions update(const SceneProvider &, const Direction3D & direction, const Camera &) const; class FixedPoint : public Program { public: 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: std::array viewProjectionLoc; RequiredUniformLocation viewProjectionsLoc; RequiredUniformLocation viewPointLoc; }; class DynamicPoint : public Program { 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; }; FixedPoint fixedPoint, dynamicPointInst; DynamicPoint dynamicPoint; // NOLINTNEXTLINE(hicpp-explicit-conversions) operator GLuint() const { return depthMap; } private: [[nodiscard]] static std::vector> getBandViewExtents( const Camera &, const glm::mat4 & lightView); glFrameBuffer depthMapFBO; glTexture depthMap; TextureAbsCoord size; };