diff options
Diffstat (limited to 'game/scenary')
| -rw-r--r-- | game/scenary/illuminator.h | 8 | ||||
| -rw-r--r-- | game/scenary/light.cpp | 9 | ||||
| -rw-r--r-- | game/scenary/light.h | 2 |
3 files changed, 4 insertions, 15 deletions
diff --git a/game/scenary/illuminator.h b/game/scenary/illuminator.h index 216b536..2373812 100644 --- a/game/scenary/illuminator.h +++ b/game/scenary/illuminator.h @@ -1,7 +1,7 @@ #pragma once #include "assetFactory/asset.h" -#include "assetFactory/lights.h" +#include "game/mixins/lights.h" #include "gfx/gl/instanceVertices.h" #include "gfx/models/texture.h" #include "gfx/renderable.h" @@ -9,7 +9,7 @@ class SceneShader; class Location; -class Illuminator : public Asset, public Renderable, public StdTypeDefs<Illuminator> { +class Illuminator : public Asset, public Renderable, public AssetLights, public StdTypeDefs<Illuminator> { Mesh::Ptr bodyMesh; Texture::Ptr texture; std::shared_ptr<glVertexArray> instanceVAO; @@ -29,8 +29,4 @@ protected: friend Persistence::SelectionPtrBase<std::shared_ptr<Illuminator>>; bool persist(Persistence::PersistenceStore & store) override; void postLoad() override; - -public: - std::vector<SpotLight::Ptr> spotLight; - std::vector<PointLight::Ptr> pointLight; }; diff --git a/game/scenary/light.cpp b/game/scenary/light.cpp index c51efda..455d5b5 100644 --- a/game/scenary/light.cpp +++ b/game/scenary/light.cpp @@ -5,12 +5,5 @@ Light::Light(std::shared_ptr<const Illuminator> 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 auto & spotLight) { - return spotLights->acquire(*spotLight, instance->location.index); - }); - std::ranges::transform(this->type->pointLight, std::back_inserter(pointLightInstances), - [pointLights = Renderable::commonPointLights.lock(), this](const auto & pointLight) { - return pointLights->acquire(*pointLight, instance->location.index); - }); + lightsEnable(this->type, instance->location.index); } diff --git a/game/scenary/light.h b/game/scenary/light.h index b1ea469..0b9320c 100644 --- a/game/scenary/light.h +++ b/game/scenary/light.h @@ -5,7 +5,7 @@ class Location; -class Light : public WorldObject { +class Light : public WorldObject, public InstanceLights { std::shared_ptr<const Illuminator> type; InstanceVertices<Illuminator::InstanceVertex>::InstanceProxy instance; |
