summaryrefslogtreecommitdiff
path: root/game/scenary/illuminator.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-04-01 20:21:23 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2026-04-01 20:21:23 +0100
commit30fcb8bce7b60b6754a0d35f2f15b627d0fba4cb (patch)
tree7e782f51affa8a2a40cf47e6ba69335a1289b2be /game/scenary/illuminator.h
parentFix VertexArrayConfigurator with derived classes (diff)
downloadilt-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 'game/scenary/illuminator.h')
-rw-r--r--game/scenary/illuminator.h16
1 files changed, 6 insertions, 10 deletions
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<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 SpotLight : Persistence::Persistable, SpotLightVertex, StdTypeDefs<SpotLight> {
+ struct SpotLight : Persistence::Persistable, SpotLightDef, StdTypeDefs<SpotLight> {
private:
friend Persistence::SelectionPtrBase<std::shared_ptr<SpotLight>>;
bool persist(Persistence::PersistenceStore & store) override;
};
- struct PointLight : Persistence::Persistable, PointLightVertex, StdTypeDefs<PointLight> {
+ struct PointLight : Persistence::Persistable, PointLightDef, StdTypeDefs<PointLight> {
private:
friend Persistence::SelectionPtrBase<std::shared_ptr<PointLight>>;
bool persist(Persistence::PersistenceStore & store) override;
@@ -35,18 +35,14 @@ public:
};
mutable InstanceVertices<InstanceVertex> instances;
- mutable InstanceVertices<SpotLightVertex> instancesSpotLight;
- mutable InstanceVertices<PointLightVertex> instancesPointLight;
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;
};