summaryrefslogtreecommitdiff
path: root/gfx/renderable.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-30 13:04:36 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-31 00:37:24 +0100
commitfb78c88576d9fed90ee69dfa35a9fbd3179ff486 (patch)
tree3666e8c7a7ebf56b5d9e6919093c3a9c7766a750 /gfx/renderable.h
parentUse uint32_t for indexes in InstanceVertices (diff)
downloadilt-fb78c88576d9fed90ee69dfa35a9fbd3179ff486.tar.bz2
ilt-fb78c88576d9fed90ee69dfa35a9fbd3179ff486.tar.xz
ilt-fb78c88576d9fed90ee69dfa35a9fbd3179ff486.zip
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)
Diffstat (limited to 'gfx/renderable.h')
-rw-r--r--gfx/renderable.h27
1 files changed, 26 insertions, 1 deletions
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 <glm/mat3x3.hpp>
#include <special_members.h>
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<CommonLocation>;
+ using CommonLocationInstance = CommonLocationData::InstanceProxy;
+
+ std::shared_ptr<CommonLocationData> locationData;
+
+ static std::weak_ptr<CommonLocationData> commonLocationData;
+};
+
+template<> struct gl_traits<InstanceVertices<Renderable::CommonLocation>::InstanceProxy> {
+ static GLuint vertexArrayAttribFormat(GLuint vao, GLuint index, GLuint offset);
};
+