#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); void setViewPoint(const GlobalPosition3D) const; void setViewProjection(const glm::mat4 &) const; void use() const; private: RequiredUniformLocation viewProjectionLoc, viewPointLoc; }; class DynamicPoint : public Program { public: DynamicPoint(); void setViewPoint(const GlobalPosition3D) const; void setViewProjection(const glm::mat4 &) const; void use(const Location &) const; void setModel(const Location &) const; private: RequiredUniformLocation viewProjectionLoc, 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; };