diff options
Diffstat (limited to 'game/scenary/illuminator.h')
| -rw-r--r-- | game/scenary/illuminator.h | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/game/scenary/illuminator.h b/game/scenary/illuminator.h index 7b6e7ad..216b536 100644 --- a/game/scenary/illuminator.h +++ b/game/scenary/illuminator.h @@ -1,6 +1,7 @@ #pragma once #include "assetFactory/asset.h" +#include "assetFactory/lights.h" #include "gfx/gl/instanceVertices.h" #include "gfx/models/texture.h" #include "gfx/renderable.h" @@ -11,51 +12,25 @@ class Location; class Illuminator : public Asset, public Renderable, public StdTypeDefs<Illuminator> { Mesh::Ptr bodyMesh; Texture::Ptr texture; - std::shared_ptr<glVertexArray> instanceVAO, instancesSpotLightVAO, instancesPointLightVAO; - static std::weak_ptr<glVertexArray> commonInstanceVAO, commonInstancesSpotLightVAO, commonInstancesPointLightVAO; + std::shared_ptr<glVertexArray> instanceVAO; + static std::weak_ptr<glVertexArray> commonInstanceVAO; public: [[nodiscard]] std::any createAt(const Location &) const override; - struct LightCommonVertex { - RelativePosition3D position; - RGB colour; - RelativeDistance kq; + struct InstanceVertex { + CommonLocationInstance location; }; - struct SpotLightVertex : LightCommonVertex { - Direction3D direction; - Angle arc; - }; - - struct PointLightVertex : LightCommonVertex { }; - - struct SpotLight : Persistence::Persistable, SpotLightVertex, StdTypeDefs<SpotLight> { - private: - friend Persistence::SelectionPtrBase<std::shared_ptr<SpotLight>>; - bool persist(Persistence::PersistenceStore & store) override; - }; - - struct PointLight : Persistence::Persistable, PointLightVertex, StdTypeDefs<PointLight> { - private: - friend Persistence::SelectionPtrBase<std::shared_ptr<PointLight>>; - bool persist(Persistence::PersistenceStore & store) override; - }; - - using LocationVertex = std::pair<glm::mat3, GlobalPosition3D>; - mutable InstanceVertices<LocationVertex> instances; - mutable InstanceVertices<SpotLightVertex> instancesSpotLight; - mutable InstanceVertices<PointLightVertex> instancesPointLight; + mutable InstanceVertices<InstanceVertex> instances; void render(const SceneShader &, const Frustum &) const override; - void lights(const SceneShader &) const override; 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; - std::vector<InstanceVertices<SpotLightVertex>::InstanceProxy> spotLightInstances; - std::vector<InstanceVertices<PointLightVertex>::InstanceProxy> pointLightInstances; }; |
