From fe8f9775cce008465fcca2d6783bd7be0d64f77c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 Jan 2024 11:49:46 +0000 Subject: Remove legacy Position types from shadowMapper --- gfx/gl/shadowMapper.cpp | 11 +++++------ gfx/gl/shadowMapper.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'gfx') diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp index 74d93bd..6c8400e 100644 --- a/gfx/gl/shadowMapper.cpp +++ b/gfx/gl/shadowMapper.cpp @@ -105,16 +105,15 @@ struct DefinitionsInserter { ShadowMapper::Definitions & out; }; -std::vector> +std::vector> ShadowMapper::getBandViewExtents(const Camera & camera, const glm::mat4 & lightViewDir) { - std::vector> bandViewExtents; + std::vector> bandViewExtents; for (const auto dist : shadowBands) { const auto extents = camera.extentsAtDist(dist); - bandViewExtents.emplace_back( - extents * [&lightViewDir, cameraPos = camera.getPosition()](const auto & e) -> Position3D { - return lightViewDir * RelativePosition4D(e.xyz() - cameraPos, 1); - }); + bandViewExtents.emplace_back(extents * [&lightViewDir, cameraPos = camera.getPosition()](const auto & e) { + return glm::mat3(lightViewDir) * (e.xyz() - cameraPos); + }); if (std::none_of(extents.begin(), extents.end(), [targetDist = dist - 1](const auto & e) { return e.w > targetDist; })) { diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h index 01520ca..bf571f8 100644 --- a/gfx/gl/shadowMapper.h +++ b/gfx/gl/shadowMapper.h @@ -57,7 +57,7 @@ public: } private: - [[nodiscard]] static std::vector> getBandViewExtents( + [[nodiscard]] static std::vector> getBandViewExtents( const Camera &, const glm::mat4 & lightView); glFrameBuffer depthMapFBO; glTexture depthMap; -- cgit v1.2.3