Radium Engine  1.5.20
Loading...
Searching...
No Matches
DefaultLightManager.cpp
1#include <Engine/Scene/DefaultLightManager.hpp>
2
3#include <Engine/RadiumEngine.hpp>
4
5namespace Ra {
6namespace Engine {
7namespace Scene {
8
9DefaultLightManager::DefaultLightManager() {
10 m_data = std::make_unique<DefaultLightStorage>();
11}
12
14 return ( *m_data )[li];
15}
16
18 m_data->add( li );
19}
20
21DefaultLightStorage::DefaultLightStorage() = default;
22
24
26 m_lights.emplace( li->getType(), li );
27}
28
30 auto range = m_lights.equal_range( li->getType() );
31 for ( auto i = range.first; i != range.second; ++i ) {
32 if ( i->second == li ) {
33 m_lights.erase( i );
34 break;
35 }
36 }
37}
38
40 return m_lights.size();
41}
42
44 m_lights.clear();
45}
46
48 auto iterator = m_lights.begin();
49 std::advance( iterator, n );
50 return iterator->second;
51}
52} // namespace Scene
53} // namespace Engine
54} // namespace Ra
T advance(T... args)
const Scene::Light * getLight(size_t li) const override
Get a pointer to the li-th Light.
void addLight(const Scene::Light *li) override
void add(const Scene::Light *i) override
Add a Light to the container.
size_t size() const override
Returns the container size.
void remove(const Scene::Light *li) override
Remove a Light from the container.
const Scene::Light * operator[](unsigned int n) override
Access the container.
void clear() override
Clear the container.
std::unique_ptr< LightStorage > m_data
Stores the object that stores the lights...
const LightType & getType() const
Definition Light.hpp:80
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3