summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 15:53:54 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 15:53:54 +0000
commit69e6b7d2d349dcc42d2d415a72181ba729d5a19d (patch)
tree5d7dff2f2775701069806eceb4eaef23b22eba3f /gfx
parentRemove legacy Position types from shadowMapper (diff)
downloadilt-69e6b7d2d349dcc42d2d415a72181ba729d5a19d.tar.bz2
ilt-69e6b7d2d349dcc42d2d415a72181ba729d5a19d.tar.xz
ilt-69e6b7d2d349dcc42d2d415a72181ba729d5a19d.zip
Remove more use of legacy types
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gl/bufferedLocation.cpp4
-rw-r--r--gfx/gl/camera.cpp4
-rw-r--r--gfx/gl/shadowMapper.cpp2
-rw-r--r--gfx/models/vertex.h9
4 files changed, 10 insertions, 9 deletions
diff --git a/gfx/gl/bufferedLocation.cpp b/gfx/gl/bufferedLocation.cpp
index d6a63b9..f1bedfe 100644
--- a/gfx/gl/bufferedLocation.cpp
+++ b/gfx/gl/bufferedLocation.cpp
@@ -25,7 +25,7 @@ BufferedLocation::position() const
return loc.pos;
}
-Position3D
+Rotation3D
BufferedLocation::rotation() const
{
return loc.rot;
@@ -41,7 +41,7 @@ BufferedLocation::setPosition(GlobalPosition3D p, bool update)
}
void
-BufferedLocation::setRotation(Position3D r, bool update)
+BufferedLocation::setRotation(Rotation3D r, bool update)
{
loc.rot = r;
if (update) {
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 9f40998..d362b94 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -17,14 +17,14 @@ Ray
Camera::unProject(const ScreenRelCoord & mouse) const
{
static constexpr const glm::vec4 screen {0, 0, 1, 1};
- const auto mouseProjection = glm::lookAt(::origin, forward, up);
+ const auto mouseProjection = glm::lookAt({}, forward, up);
return {position, glm::normalize(glm::unProject(mouse || 1.F, mouseProjection, projection, screen))};
}
void
Camera::updateView()
{
- viewProjection = projection * glm::lookAt(origin, forward, up);
+ viewProjection = projection * glm::lookAt({}, forward, up);
inverseViewProjection = glm::inverse(viewProjection);
}
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp
index 6c8400e..1498bb0 100644
--- a/gfx/gl/shadowMapper.cpp
+++ b/gfx/gl/shadowMapper.cpp
@@ -130,7 +130,7 @@ ShadowMapper::update(const SceneProvider & scene, const Direction3D & dir, const
glClear(GL_DEPTH_BUFFER_BIT);
glCullFace(GL_FRONT);
- const auto lightViewDir = glm::lookAt(origin, dir, up);
+ const auto lightViewDir = glm::lookAt({}, dir, up);
const auto lightViewPoint = camera.getPosition();
const auto bandViewExtents = getBandViewExtents(camera, lightViewDir);
diff --git a/gfx/models/vertex.h b/gfx/models/vertex.h
index 5635fa1..3c6215f 100644
--- a/gfx/models/vertex.h
+++ b/gfx/models/vertex.h
@@ -6,16 +6,17 @@
class Vertex {
public:
#ifndef __cpp_aggregate_paren_init
- constexpr Vertex(Position3D pos, TextureRelCoord texCoord, Normal3D normal, RGBA colour = {}, GLuint material = 0) :
- pos {std::move(pos)}, texCoord {std::move(texCoord)}, normal {std::move(normal)}, colour {std::move(colour)},
- material {material}
+ constexpr Vertex(
+ RelativePosition3D pos, TextureRelCoord texCoord, Normal3D normal, RGBA colour = {}, GLuint material = 0) :
+ pos {std::move(pos)},
+ texCoord {std::move(texCoord)}, normal {std::move(normal)}, colour {std::move(colour)}, material {material}
{
}
#endif
bool operator==(const Vertex &) const = default;
- Position3D pos {};
+ RelativePosition3D pos {};
TextureRelCoord texCoord {};
Normal3D normal {};
RGBA colour {};