summaryrefslogtreecommitdiff
path: root/game/mixins/lights.h
diff options
context:
space:
mode:
Diffstat (limited to 'game/mixins/lights.h')
-rw-r--r--game/mixins/lights.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/game/mixins/lights.h b/game/mixins/lights.h
new file mode 100644
index 0000000..c2207a5
--- /dev/null
+++ b/game/mixins/lights.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "assetFactory/lights.h"
+#include "gfx/gl/instanceVertices.h"
+#include <flat_map>
+
+class AssetLights {
+protected:
+ bool persist(Persistence::PersistenceStore & store);
+ template<typename T> using LightVec = std::vector<typename T::Ptr>;
+
+ LightVec<SpotLight> spotLight;
+ LightVec<PointLight> pointLight;
+
+ friend class InstanceLights;
+};
+
+class InstanceLights {
+protected:
+ template<typename V> using LightInstanceMap = std::flat_map<size_t, typename InstanceVertices<V>::InstanceProxy>;
+ LightInstanceMap<SpotLightVertex> spotLightInstances;
+ LightInstanceMap<PointLightVertex> pointLightInstances;
+
+ void lightsEnable(AnyPtr<const AssetLights>, uint32_t);
+ void lightsDisable();
+};