From 6d9d393ae60bfc6b2625a5540cd60ffed478aa13 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 12 Mar 2026 01:15:26 +0000 Subject: 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. --- game/vehicles/railVehicleClass.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'game/vehicles/railVehicleClass.h') 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 bogies; @@ -38,10 +42,10 @@ protected: friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; void postLoad() override; + void renderAllParts(size_t count) const; private: glVertexArray instanceVAO; - std::array instancesBogiesVAO; }; using RailVehicleClassPtr = std::shared_ptr; -- cgit v1.3