From 69e6b7d2d349dcc42d2d415a72181ba729d5a19d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 Jan 2024 15:53:54 +0000 Subject: Remove more use of legacy types --- gfx/gl/bufferedLocation.cpp | 4 ++-- gfx/gl/camera.cpp | 4 ++-- gfx/gl/shadowMapper.cpp | 2 +- gfx/models/vertex.h | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'gfx') 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 {}; -- cgit v1.2.3