diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-12 01:15:26 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-12 01:15:26 +0000 |
| commit | 6d9d393ae60bfc6b2625a5540cd60ffed478aa13 (patch) | |
| tree | bfb184ff995f03c998129e79f786208586fa9360 /game/vehicles/railVehicleClass.h | |
| parent | Reuse vertex array objects for common structures with DSA (diff) | |
| download | ilt-6d9d393ae60bfc6b2625a5540cd60ffed478aa13.tar.bz2 ilt-6d9d393ae60bfc6b2625a5540cd60ffed478aa13.tar.xz ilt-6d9d393ae60bfc6b2625a5540cd60ffed478aa13.zip | |
Shared VAO for all 3 parts of RailVehicleClass
Rearranges its LocationVertex to be 3 repeated Parts. Adds helpers to
glvglVertexArray for useBuffer with various offsets. Render is then an
iteration of the meshes and the location data at the nth offset.
Diffstat (limited to 'game/vehicles/railVehicleClass.h')
| -rw-r--r-- | game/vehicles/railVehicleClass.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/game/vehicles/railVehicleClass.h b/game/vehicles/railVehicleClass.h index ccff3e2..fe27230 100644 --- a/game/vehicles/railVehicleClass.h +++ b/game/vehicles/railVehicleClass.h @@ -20,8 +20,12 @@ public: [[nodiscard]] std::any createAt(const Location &) const override; struct LocationVertex { - glm::mat3 body, front, back; - GlobalPosition3D bodyPos, frontPos, backPos; + struct Part { + glm::mat3 rotation; + GlobalPosition3D position; + }; + + Part body, front, back; }; std::array<Mesh::Ptr, 2> bogies; @@ -38,10 +42,10 @@ protected: friend Persistence::SelectionPtrBase<std::shared_ptr<RailVehicleClass>>; bool persist(Persistence::PersistenceStore & store) override; void postLoad() override; + void renderAllParts(size_t count) const; private: glVertexArray instanceVAO; - std::array<glVertexArray, 2> instancesBogiesVAO; }; using RailVehicleClassPtr = std::shared_ptr<RailVehicleClass>; |
