summaryrefslogtreecommitdiff
path: root/game/mixins/lights.h
blob: c2207a543533f814c534905475e8d3bb8038a780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
};