summaryrefslogtreecommitdiff
path: root/game/scenary/light.cpp
blob: bd83f045a4f7eb6621f2e0c40e5ae6f7deb42517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "light.h"
#include "location.h"

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 Illuminator::SpotLight::CPtr & spotLight) {
				return spotLights->acquire(*spotLight, instance->location.index);
			});
	std::ranges::transform(this->type->pointLight, std::back_inserter(pointLightInstances),
			[pointLights = Renderable::commonPointLights.lock(), this](
					const Illuminator::PointLight::CPtr & pointLight) {
				return pointLights->acquire(*pointLight, instance->location.index);
			});
}