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. --- game/scenary/illuminator.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'game/scenary/illuminator.h') diff --git a/game/scenary/illuminator.h b/game/scenary/illuminator.h index c342bd4..b99a19e 100644 --- a/game/scenary/illuminator.h +++ b/game/scenary/illuminator.h @@ -2,7 +2,7 @@ #include "assetFactory/asset.h" #include "gfx/gl/instanceVertices.h" -#include "gfx/gl/lights.h" +#include "gfx/models/lights.h" #include "gfx/models/texture.h" #include "gfx/renderable.h" @@ -12,19 +12,19 @@ class Location; class Illuminator : public Asset, public Renderable, public StdTypeDefs { Mesh::Ptr bodyMesh; Texture::Ptr texture; - std::shared_ptr instanceVAO, instancesSpotLightVAO, instancesPointLightVAO; - static std::weak_ptr commonInstanceVAO, commonInstancesSpotLightVAO, commonInstancesPointLightVAO; + std::shared_ptr instanceVAO; + static std::weak_ptr commonInstanceVAO; public: [[nodiscard]] std::any createAt(const Location &) const override; - struct SpotLight : Persistence::Persistable, SpotLightVertex, StdTypeDefs { + struct SpotLight : Persistence::Persistable, SpotLightDef, StdTypeDefs { private: friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; }; - struct PointLight : Persistence::Persistable, PointLightVertex, StdTypeDefs { + struct PointLight : Persistence::Persistable, PointLightDef, StdTypeDefs { private: friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; @@ -35,18 +35,14 @@ public: }; mutable InstanceVertices instances; - mutable InstanceVertices instancesSpotLight; - mutable InstanceVertices instancesPointLight; void render(const SceneShader &, const Frustum &) const override; - void lights(const SceneShader &) const override; protected: friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; void postLoad() override; +public: std::vector spotLight; std::vector pointLight; - std::vector::InstanceProxy> spotLightInstances; - std::vector::InstanceProxy> pointLightInstances; }; -- cgit v1.3