diff options
-rw-r--r-- | game/vehicles/railVehicle.cpp | 18 | ||||
-rw-r--r-- | gfx/gl/bufferedLocation.cpp | 6 | ||||
-rw-r--r-- | gfx/gl/bufferedLocation.h | 1 | ||||
-rw-r--r-- | lib/location.cpp | 6 | ||||
-rw-r--r-- | 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<Position3D, 8> 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<glm::vec<3, uint8_t>, 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 @@ -58,12 +58,6 @@ BufferedLocation::setLocation(Position3D p, Rotation3D r) } glm::mat4 -BufferedLocation::getTransform() const -{ - return loc.getTransform(); -} - -glm::mat4 BufferedLocation::getRotationTransform() const { return loc.getRotationTransform(); 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 @@ -3,12 +3,6 @@ #include <glm/gtx/transform.hpp> glm::mat4 -Location::getTransform() const -{ - return glm::translate(pos) * rotate_ypr(rot); -} - -glm::mat4 Location::getRotationTransform() const { return rotate_ypr(rot); 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; |