From 9c2c3f71065c94a18c02440111b6ff8ca977b90e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 9 Nov 2023 00:40:40 +0000 Subject: WIP typedefing all the things - sources --- game/vehicles/railVehicle.cpp | 12 ++++++------ game/vehicles/train.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'game/vehicles') diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index 2d820b6..fc43995 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -14,8 +14,8 @@ RailVehicle::RailVehicle(RailVehicleClassPtr rvc) : RailVehicleClass::Instance {rvc->instances.acquire()}, rvClass {std::move(rvc)}, location {&LV::body, *this}, bogies {{ - {&LV::front, *this, glm::vec3 {0, rvClass->wheelBase / 2.F, 0}}, - {&LV::back, *this, glm::vec3 {0, -rvClass->wheelBase / 2.F, 0}}, + {&LV::front, *this, Position3D {0, rvClass->wheelBase / 2.F, 0}}, + {&LV::back, *this, Position3D {0, -rvClass->wheelBase / 2.F, 0}}, }} { } @@ -32,13 +32,13 @@ RailVehicle::move(const Train * t, float & trailBy) } bool -RailVehicle::intersectRay(const Ray & ray, glm::vec2 * baryPos, float * distance) const +RailVehicle::intersectRay(const Ray & ray, Position2D * baryPos, float * distance) const { constexpr const auto X = 1.35F; const auto Y = this->rvClass->length / 2.F; constexpr const auto Z = 3.9F; const auto moveBy = location.getTransform(); - const std::array cornerVertices {{ + 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 @@ -48,7 +48,7 @@ RailVehicle::intersectRay(const Ray & ray, glm::vec2 * baryPos, float * distance moveBy * glm::vec4 {-X, -Y, Z, 1}, // LBT moveBy * glm::vec4 {X, -Y, Z, 1}, // RBT }}; - static constexpr const std::array triangles {{ + static constexpr const std::array, 10> triangles {{ // Front {0, 1, 2}, {1, 2, 3}, @@ -66,7 +66,7 @@ RailVehicle::intersectRay(const Ray & ray, glm::vec2 * baryPos, float * distance {3, 6, 7}, }}; return std::any_of( - triangles.begin(), triangles.end(), [&cornerVertices, &ray, &baryPos, &distance](const glm::uvec3 idx) { + triangles.begin(), triangles.end(), [&cornerVertices, &ray, &baryPos, &distance](const auto & idx) { return glm::intersectRayTriangle(ray.start, ray.direction, cornerVertices[idx[0]], cornerVertices[idx[1]], cornerVertices[idx[2]], *baryPos, *distance); }); diff --git a/game/vehicles/train.cpp b/game/vehicles/train.cpp index 6f3b036..4aa24dc 100644 --- a/game/vehicles/train.cpp +++ b/game/vehicles/train.cpp @@ -20,7 +20,7 @@ Train::getBogiePosition(float linkDist, float dist) const } bool -Train::intersectRay(const Ray & ray, glm::vec2 * baryPos, float * distance) const +Train::intersectRay(const Ray & ray, Position2D * baryPos, float * distance) const { return applyOne(&RailVehicle::intersectRay, ray, baryPos, distance) != end(); } -- cgit v1.2.3