summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 11:49:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 11:49:46 +0000
commitfe8f9775cce008465fcca2d6783bd7be0d64f77c (patch)
tree83d2c4def31ed7478e0f6872b9c04f40303fa396 /gfx/gl
parentSimplify and 'fix' the wave cycle (diff)
downloadilt-fe8f9775cce008465fcca2d6783bd7be0d64f77c.tar.bz2
ilt-fe8f9775cce008465fcca2d6783bd7be0d64f77c.tar.xz
ilt-fe8f9775cce008465fcca2d6783bd7be0d64f77c.zip
Remove legacy Position types from shadowMapper
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/shadowMapper.cpp11
-rw-r--r--gfx/gl/shadowMapper.h2
2 files changed, 6 insertions, 7 deletions
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::array<Position3D, 4>>
+std::vector<std::array<RelativePosition3D, 4>>
ShadowMapper::getBandViewExtents(const Camera & camera, const glm::mat4 & lightViewDir)
{
- std::vector<std::array<Position3D, 4>> bandViewExtents;
+ std::vector<std::array<RelativePosition3D, 4>> 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<std::array<Position3D, 4>> getBandViewExtents(
+ [[nodiscard]] static std::vector<std::array<RelativePosition3D, 4>> getBandViewExtents(
const Camera &, const glm::mat4 & lightView);
glFrameBuffer depthMapFBO;
glTexture depthMap;