Blue Brain BioExplorer
LightManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  *
5  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 3.0 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
26 
27 #include <map>
28 #include <unordered_map>
29 
30 namespace core
31 {
40 class LightManager : public BaseObject
41 {
42 public:
49  PLATFORM_API size_t addLight(LightPtr light);
50 
56  PLATFORM_API void removeLight(const size_t id);
57 
63  PLATFORM_API void removeLight(LightPtr light);
64 
73  PLATFORM_API LightPtr getLight(const size_t id);
74 
80  PLATFORM_API const std::map<size_t, LightPtr>& getLights() const;
81 
87 
88 private:
89  std::map<size_t, LightPtr> _lights; // Map containing all light sources.
90  std::unordered_map<LightPtr, size_t> _lightsInverse; // Inverse mapping of light sources to their IDs.
91  size_t _IDctr{0}; // Internal counter for assigning IDs to new light sources.
92 };
93 } // namespace core
#define PLATFORM_API
Definition: Api.h:37
Manages light sources in a scene.
Definition: LightManager.h:41
PLATFORM_API void clearLights()
clearLights Removes all light sources managed by the LightManager object.
PLATFORM_API void removeLight(const size_t id)
removeLight Removes a light source from the scene for a given ID.
PLATFORM_API const std::map< size_t, LightPtr > & getLights() const
getLights Gets all light sources currently managed by the LightManager object.
PLATFORM_API size_t addLight(LightPtr light)
addLight Attaches a light source to the scene.
PLATFORM_API LightPtr getLight(const size_t id)
getLight Gets a light source from the scene for a given ID. Note: If changing the light then call mar...
std::shared_ptr< Light > LightPtr
Definition: Types.h:163