summaryrefslogtreecommitdiff
path: root/game/vehicles/railVehicleClass.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
commit4f34ed9c949785784f0006f971b5fd2bb9508553 (patch)
tree20f6627a2f441212365d05d04160a5a6a97063e7 /game/vehicles/railVehicleClass.h
parentMerge remote-tracking branch 'origin/assimp-normals' (diff)
parentRevert "Export mesh size and primitive type" (diff)
downloadilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.bz2
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.xz
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.zip
Merge branch 'instancing-pt2'
Diffstat (limited to 'game/vehicles/railVehicleClass.h')
-rw-r--r--game/vehicles/railVehicleClass.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/game/vehicles/railVehicleClass.h b/game/vehicles/railVehicleClass.h
index 1a52e2b..2fda8f7 100644
--- a/game/vehicles/railVehicleClass.h
+++ b/game/vehicles/railVehicleClass.h
@@ -1,7 +1,9 @@
#pragma once
#include "assetFactory/asset.h"
+#include "gfx/gl/instanceVertices.h"
#include "gfx/models/mesh.h"
+#include "gfx/renderable.h"
#include <array>
#include <memory>
#include <string>
@@ -11,10 +13,10 @@ class ShadowMapper;
class Texture;
class Location;
-class RailVehicleClass : public Asset {
+class RailVehicleClass : public Renderable, public Asset {
public:
- void render(const SceneShader &, const Location &, const std::array<Location, 2> &) const;
- void shadows(const ShadowMapper &, const Location &, const std::array<Location, 2> &) const;
+ void render(const SceneShader & shader) const override;
+ void shadows(const ShadowMapper & shadowMapper) const override;
std::array<Mesh::Ptr, 2> bogies;
Mesh::Ptr bodyMesh;
@@ -23,9 +25,16 @@ public:
float length;
float maxSpeed;
+ mutable InstanceVertices<glm::mat4> instancesBody;
+ mutable std::array<InstanceVertices<glm::mat4>, 2> instancesBogies;
+
protected:
friend Persistence::SelectionPtrBase<std::shared_ptr<RailVehicleClass>>;
bool persist(Persistence::PersistenceStore & store) override;
void postLoad() override;
+
+private:
+ glVertexArray instanceVAO;
+ std::array<glVertexArray, 2> instancesBogiesVAO;
};
using RailVehicleClassPtr = std::shared_ptr<RailVehicleClass>;