From 30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 1 Apr 2026 20:21:23 +0100 Subject: Have Renderable manage all instance lights Spot and point lights now existing in Renderable, the vertex data contains the owning parent object's index in CommonLocationData, the render step is just a single draw call. --- gfx/renderable.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gfx/renderable.h') diff --git a/gfx/renderable.h b/gfx/renderable.h index b0a42f2..7f4f52e 100644 --- a/gfx/renderable.h +++ b/gfx/renderable.h @@ -1,6 +1,8 @@ #pragma once +#include "gfx/gl/glVertexArray.h" #include "gfx/gl/instanceVertices.h" +#include "gfx/models/lights.h" #include "gl_traits.h" #include #include @@ -20,7 +22,7 @@ public: virtual void preFrame(const Frustum &, const Frustum &); virtual void render(const SceneShader & shader, const Frustum &) const = 0; - virtual void lights(const SceneShader & shader) const; + static void lights(const SceneShader & shader); virtual void shadows(const ShadowMapper & shadowMapper, const Frustum &) const; virtual void updateStencil(const ShadowStenciller & lightDir) const; @@ -37,10 +39,17 @@ public: using CommonLocationData = InstanceVertices; using CommonLocationInstance = CommonLocationData::InstanceProxy; - std::shared_ptr locationData; - static std::weak_ptr commonLocationData; + + using CommonSpotLights = InstanceVertices; + std::shared_ptr spotLights; + static std::weak_ptr commonSpotLights; + using CommonPointLights = InstanceVertices; + std::shared_ptr pointLights; + static std::weak_ptr commonPointLights; + std::shared_ptr instancesSpotLightVAO, instancesPointLightVAO; + static std::weak_ptr commonInstancesSpotLightVAO, commonInstancesPointLightVAO; }; template<> struct gl_traits::InstanceProxy> { -- cgit v1.3