From fb78c88576d9fed90ee69dfa35a9fbd3179ff486 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 30 Mar 2026 13:04:36 +0100 Subject: Use a single buffer for the location/rotation data of all renderable objects Removes the BufferedLocation and BufferedLocationUpdater mess. Note: appears to break bogie rendering in asset factory test only, same symptom as broken network render test? (out of date buffer data) --- gfx/renderable.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'gfx/renderable.h') diff --git a/gfx/renderable.h b/gfx/renderable.h index d0870ad..b0a42f2 100644 --- a/gfx/renderable.h +++ b/gfx/renderable.h @@ -1,5 +1,8 @@ #pragma once +#include "gfx/gl/instanceVertices.h" +#include "gl_traits.h" +#include #include class SceneShader; @@ -7,10 +10,11 @@ class Frustum; class ShadowMapper; class ShadowStenciller; class BillboardPainter; +class Location; class Renderable { public: - Renderable() = default; + Renderable(); virtual ~Renderable() = default; DEFAULT_MOVE_COPY(Renderable); @@ -21,4 +25,25 @@ public: virtual void updateStencil(const ShadowStenciller & lightDir) const; virtual void updateBillboard(const BillboardPainter &) const; + + struct CommonLocation { + CommonLocation(const Location &); + CommonLocation & operator=(const Location &); + + glm::ivec4 position; + glm::vec4 rotation; + glm::mat3x4 rotationMatrix; + }; + + using CommonLocationData = InstanceVertices; + using CommonLocationInstance = CommonLocationData::InstanceProxy; + + std::shared_ptr locationData; + + static std::weak_ptr commonLocationData; +}; + +template<> struct gl_traits::InstanceProxy> { + static GLuint vertexArrayAttribFormat(GLuint vao, GLuint index, GLuint offset); }; + -- cgit v1.3