diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/selectable.h | 2 | ||||
-rw-r--r-- | game/vehicles/railVehicle.cpp | 4 | ||||
-rw-r--r-- | game/vehicles/railVehicle.h | 3 | ||||
-rw-r--r-- | game/vehicles/train.cpp | 2 | ||||
-rw-r--r-- | game/vehicles/train.h | 4 |
5 files changed, 6 insertions, 9 deletions
diff --git a/game/selectable.h b/game/selectable.h index 9732dca..c794461 100644 --- a/game/selectable.h +++ b/game/selectable.h @@ -12,5 +12,5 @@ public: virtual ~Selectable() = default; DEFAULT_MOVE_COPY(Selectable); - [[nodiscard]] virtual bool intersectRay(const Ray &, Position2D *, float *) const = 0; + [[nodiscard]] virtual bool intersectRay(const Ray &, BaryPosition &, RelativeDistance &) const = 0; }; diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index 7e4b1ee..6653333 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -44,7 +44,7 @@ RailVehicle::move(const Train * t, float & trailBy) } bool -RailVehicle::intersectRay(const Ray & ray, BaryPosition * baryPos, float * distance) const +RailVehicle::intersectRay(const Ray & ray, BaryPosition & baryPos, RelativeDistance & distance) const { constexpr const auto X = 1350.F; const auto Y = this->rvClass->length / 2.F; @@ -80,6 +80,6 @@ RailVehicle::intersectRay(const Ray & ray, BaryPosition * baryPos, float * dista return std::any_of( 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); + cornerVertices[idx[1]], cornerVertices[idx[2]], baryPos, distance); }); } diff --git a/game/vehicles/railVehicle.h b/game/vehicles/railVehicle.h index 8cbc49d..f6e4764 100644 --- a/game/vehicles/railVehicle.h +++ b/game/vehicles/railVehicle.h @@ -6,7 +6,6 @@ #include <game/selectable.h> #include <glm/glm.hpp> #include <memory> -#include <utility> class Ray; class Train; @@ -17,7 +16,7 @@ public: void move(const Train *, float & trailBy); - [[nodiscard]] bool intersectRay(const Ray &, BaryPosition *, float *) const override; + [[nodiscard]] bool intersectRay(const Ray &, BaryPosition &, RelativeDistance &) const override; RailVehicleClassPtr rvClass; using LV = RailVehicleClass::LocationVertex; diff --git a/game/vehicles/train.cpp b/game/vehicles/train.cpp index 13905a3..05b2d8a 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, BaryPosition * baryPos, float * distance) const +Train::intersectRay(const Ray & ray, BaryPosition & baryPos, RelativeDistance & distance) const { return applyOne(&RailVehicle::intersectRay, ray, baryPos, distance) != end(); } diff --git a/game/vehicles/train.h b/game/vehicles/train.h index c77cd23..bb668ed 100644 --- a/game/vehicles/train.h +++ b/game/vehicles/train.h @@ -10,8 +10,6 @@ #include <collection.h> #include <glm/glm.hpp> #include <location.h> -#include <memory> -#include <vector> class SceneShader; class ShadowMapper; @@ -27,7 +25,7 @@ public: return objects.front()->location; } - [[nodiscard]] bool intersectRay(const Ray &, BaryPosition *, float *) const override; + [[nodiscard]] bool intersectRay(const Ray &, BaryPosition &, RelativeDistance &) const override; void tick(TickDuration elapsed) override; void doActivity(Go *, TickDuration) override; |