From e255ef23c762b0d0588e274b910850abd9a7d2c8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 6 Mar 2021 13:43:05 +0000 Subject: Introduce the rail vehicle class for the definition of the vehicle Not an instance of the vehicle. --- game/vehicles/railloco.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'game/vehicles/railloco.h') diff --git a/game/vehicles/railloco.h b/game/vehicles/railloco.h index f08de05..88f9503 100644 --- a/game/vehicles/railloco.h +++ b/game/vehicles/railloco.h @@ -5,26 +5,33 @@ #include #include #include +#include #include class Shader; - class Texture; -class RailVehicle : public Vehicle { -public: - struct Bogie { - Location location; - MeshPtr mesh; - }; - using Vehicle::Vehicle; - void render(const Shader & shader) const override; - - std::array bogies; +class RailVehicleClass { +public: + void render(const Shader &, const Location &, const std::array &) const; + std::array bogies; MeshPtr bodyMesh; std::shared_ptr texture; float wheelBase; float length; +}; +using RailVehicleClassPtr = std::shared_ptr; + +class RailVehicle : public Vehicle { +public: + explicit RailVehicle(RailVehicleClassPtr rvc, const LinkPtr & link, float linkDist = 0) : + Vehicle {link, linkDist}, rvClass {std::move(rvc)} + { + } + void render(const Shader & shader) const override; + + RailVehicleClassPtr rvClass; + std::array bogies; friend class RailLoco; }; -- cgit v1.2.3