Lugdunum  0.1.0
Light.cpp
Go to the documentation of this file.
3 
4 #include <memory>
5 
6 namespace lug {
7 namespace Graphics {
8 namespace Builder {
9 
10 Light::Light(Renderer& renderer) : _renderer(renderer) {}
11 
13  // Constructor of Light is private, we can't use std::make_unique
14  std::unique_ptr<Resource> resource{new Render::Light(_name, _type)};
15  Render::Light* light = static_cast<Render::Light*>(resource.get());
16 
17  light->_name = _name;
18  light->_type = _type;
19  light->_color = _color;
20  light->_direction = _direction;
22  light->_distance = _distance;
27 
28  return _renderer.getResourceManager()->add<::lug::Graphics::Render::Light>(std::move(resource));
29 }
30 
31 } // Builder
32 } // Graphics
33 } // lug
Resource::SharedPtr< T > add(std::unique_ptr< Resource > resource)
Add a resource to the ResourceManager.
Light(Renderer &renderer)
Definition: Light.cpp:10
Dummy class for a shared pointer.
Definition: Resource.hpp:66
Resource::SharedPtr< Render::Light > build()
Definition: Light.cpp:12
ResourceManager * getResourceManager() const
Definition: Renderer.inl:9
Class for Light.
Definition: Light.hpp:26
Render::Light::Type _type
Definition: Light.hpp:54