From 3200eb41d60595813dca751fe15193ba0b44dddf Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 25 Nov 2023 14:32:56 +0000 Subject: Remove getTransform --- game/vehicles/railVehicle.cpp | 18 +++++++++--------- gfx/gl/bufferedLocation.cpp | 6 ------ gfx/gl/bufferedLocation.h | 1 - lib/location.cpp | 6 ------ lib/location.h | 1 - 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index 26536f5..bee0dd0 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -49,16 +49,16 @@ RailVehicle::intersectRay(const Ray & ray, Position2D * baryPos, float * distanc constexpr const auto X = 1350.F; const auto Y = this->rvClass->length / 2.F; constexpr const auto Z = 3900.F; - const auto moveBy = location.getTransform(); + const auto moveBy = location.getRotationTransform(); const std::array cornerVertices {{ - moveBy * glm::vec4 {-X, Y, 0, 1}, // LFB - moveBy * glm::vec4 {X, Y, 0, 1}, // RFB - moveBy * glm::vec4 {-X, Y, Z, 1}, // LFT - moveBy * glm::vec4 {X, Y, Z, 1}, // RFT - moveBy * glm::vec4 {-X, -Y, 0, 1}, // LBB - moveBy * glm::vec4 {X, -Y, 0, 1}, // RBB - moveBy * glm::vec4 {-X, -Y, Z, 1}, // LBT - moveBy * glm::vec4 {X, -Y, Z, 1}, // RBT + location.position() + (moveBy * glm::vec4 {-X, Y, 0, 1}).xyz(), // LFB + location.position() + (moveBy * glm::vec4 {X, Y, 0, 1}).xyz(), // RFB + location.position() + (moveBy * glm::vec4 {-X, Y, Z, 1}).xyz(), // LFT + location.position() + (moveBy * glm::vec4 {X, Y, Z, 1}).xyz(), // RFT + location.position() + (moveBy * glm::vec4 {-X, -Y, 0, 1}).xyz(), // LBB + location.position() + (moveBy * glm::vec4 {X, -Y, 0, 1}).xyz(), // RBB + location.position() + (moveBy * glm::vec4 {-X, -Y, Z, 1}).xyz(), // LBT + location.position() + (moveBy * glm::vec4 {X, -Y, Z, 1}).xyz(), // RBT }}; static constexpr const std::array, 10> triangles {{ // Front diff --git a/gfx/gl/bufferedLocation.cpp b/gfx/gl/bufferedLocation.cpp index 412e3ab..2a2e723 100644 --- a/gfx/gl/bufferedLocation.cpp +++ b/gfx/gl/bufferedLocation.cpp @@ -57,12 +57,6 @@ BufferedLocation::setLocation(Position3D p, Rotation3D r) updateBuffer(); } -glm::mat4 -BufferedLocation::getTransform() const -{ - return loc.getTransform(); -} - glm::mat4 BufferedLocation::getRotationTransform() const { diff --git a/gfx/gl/bufferedLocation.h b/gfx/gl/bufferedLocation.h index a5cd23e..30967e3 100644 --- a/gfx/gl/bufferedLocation.h +++ b/gfx/gl/bufferedLocation.h @@ -22,7 +22,6 @@ public: void setRotation(Rotation3D, bool update = true); void setLocation(Position3D, Rotation3D); - [[nodiscard]] glm::mat4 getTransform() const; [[nodiscard]] glm::mat4 getRotationTransform() const; private: diff --git a/lib/location.cpp b/lib/location.cpp index 9a31402..ff7cfa6 100644 --- a/lib/location.cpp +++ b/lib/location.cpp @@ -2,12 +2,6 @@ #include "maths.h" #include -glm::mat4 -Location::getTransform() const -{ - return glm::translate(pos) * rotate_ypr(rot); -} - glm::mat4 Location::getRotationTransform() const { diff --git a/lib/location.h b/lib/location.h index 55737ae..85834a0 100644 --- a/lib/location.h +++ b/lib/location.h @@ -9,7 +9,6 @@ public: explicit Location(Position3D pos = {}, Rotation3D rot = {}) : pos {pos}, rot {rot} { } #endif - [[nodiscard]] glm::mat4 getTransform() const; [[nodiscard]] glm::mat4 getRotationTransform() const; Position3D pos; -- cgit v1.2.3