#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 ShadowProgram : public Program { public: 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; private: std::array viewProjectionLoc; RequiredUniformLocation viewProjectionsLoc; RequiredUniformLocation viewPointLoc; }; class FixedPoint : public ShadowProgram { public: explicit FixedPoint(const Shader & vs); }; class DynamicPoint : public ShadowProgram { public: DynamicPoint(); void use(const Location &) const; void setModel(const Location &) const; private: 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; };