summaryrefslogtreecommitdiff
path: root/game/vehicles/railloco.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-06 13:43:05 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-06 13:43:16 +0000
commite255ef23c762b0d0588e274b910850abd9a7d2c8 (patch)
tree2f623e19b0729776c4e104d200ea3e89aea735ee /game/vehicles/railloco.h
parentFixing manual camera scrolling, now just a matrix multiplication (diff)
downloadilt-e255ef23c762b0d0588e274b910850abd9a7d2c8.tar.bz2
ilt-e255ef23c762b0d0588e274b910850abd9a7d2c8.tar.xz
ilt-e255ef23c762b0d0588e274b910850abd9a7d2c8.zip
Introduce the rail vehicle class for the definition of the vehicle
Not an instance of the vehicle.
Diffstat (limited to 'game/vehicles/railloco.h')
-rw-r--r--game/vehicles/railloco.h29
1 files changed, 18 insertions, 11 deletions
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 <array>
#include <location.hpp>
#include <memory>
+#include <utility>
#include <vector>
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<Bogie, 2> bogies;
+class RailVehicleClass {
+public:
+ void render(const Shader &, const Location &, const std::array<Location, 2> &) const;
+ std::array<MeshPtr, 2> bogies;
MeshPtr bodyMesh;
std::shared_ptr<Texture> texture;
float wheelBase;
float length;
+};
+using RailVehicleClassPtr = std::shared_ptr<RailVehicleClass>;
+
+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<Location, 2> bogies;
friend class RailLoco;
};