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/light.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/scenary/light.cpp') diff --git a/game/scenary/light.cpp b/game/scenary/light.cpp index 7c38ca2..bd83f04 100644 --- a/game/scenary/light.cpp +++ b/game/scenary/light.cpp @@ -5,4 +5,13 @@ Light::Light(std::shared_ptr type, const Location & position) type {std::move(type)}, instance {this->type->instances.acquire(Renderable::commonLocationData.lock()->acquire(position))} { + std::ranges::transform(this->type->spotLight, std::back_inserter(spotLightInstances), + [spotLights = Renderable::commonSpotLights.lock(), this](const Illuminator::SpotLight::CPtr & spotLight) { + return spotLights->acquire(*spotLight, instance->location.index); + }); + std::ranges::transform(this->type->pointLight, std::back_inserter(pointLightInstances), + [pointLights = Renderable::commonPointLights.lock(), this]( + const Illuminator::PointLight::CPtr & pointLight) { + return pointLights->acquire(*pointLight, instance->location.index); + }); } -- cgit v1.3