diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-04-01 20:21:23 +0100 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-04-01 20:21:23 +0100 |
| commit | 30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb (patch) | |
| tree | 7e782f51affa8a2a40cf47e6ba69335a1289b2be /gfx/renderable.h | |
| parent | Fix VertexArrayConfigurator with derived classes (diff) | |
| download | ilt-30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb.tar.bz2 ilt-30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb.tar.xz ilt-30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb.zip | |
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.
Diffstat (limited to 'gfx/renderable.h')
| -rw-r--r-- | gfx/renderable.h | 15 |
1 files changed, 12 insertions, 3 deletions
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 <glm/mat3x3.hpp> #include <special_members.h> @@ -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<CommonLocation>; using CommonLocationInstance = CommonLocationData::InstanceProxy; - std::shared_ptr<CommonLocationData> locationData; - static std::weak_ptr<CommonLocationData> commonLocationData; + + using CommonSpotLights = InstanceVertices<SpotLightVertex>; + std::shared_ptr<CommonSpotLights> spotLights; + static std::weak_ptr<CommonSpotLights> commonSpotLights; + using CommonPointLights = InstanceVertices<PointLightVertex>; + std::shared_ptr<CommonPointLights> pointLights; + static std::weak_ptr<CommonPointLights> commonPointLights; + std::shared_ptr<glVertexArray> instancesSpotLightVAO, instancesPointLightVAO; + static std::weak_ptr<glVertexArray> commonInstancesSpotLightVAO, commonInstancesPointLightVAO; }; template<> struct gl_traits<InstanceVertices<Renderable::CommonLocation>::InstanceProxy> { |
