summaryrefslogtreecommitdiff
path: root/game/vehicles/railVehicle.h
blob: be8814238253129c17945afd39a1a7615d1aec92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "gfx/gl/bufferedLocation.h"
#include "railVehicleClass.h"
#include <array>
#include <game/selectable.h>
#include <glm/glm.hpp>
#include <memory>
#include <utility>

class Ray;
class Train;

class RailVehicle : Selectable, RailVehicleClass::Instance {
public:
	explicit RailVehicle(RailVehicleClassPtr rvc);

	void move(const Train *, float & trailBy);

	[[nodiscard]] bool intersectRay(const Ray &, glm::vec2 *, float *) const override;

	RailVehicleClassPtr rvClass;
	using LV = RailVehicleClass::LocationVertex;
	using BLocation = BufferedLocationT<glm::mat4 LV::*, RailVehicleClass::Instance &>;
	BLocation location;
	std::array<BLocation, 2> bogies;
};

using RailVehiclePtr = std::unique_ptr<RailVehicle>;