summaryrefslogtreecommitdiff
path: root/gfx/renderable.h
diff options
context:
space:
mode:
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);
};
+