Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::Scene::Light Class Reference

#include <Engine/Scene/Light.hpp>

+ Inheritance diagram for Ra::Engine::Scene::Light:
+ Collaboration diagram for Ra::Engine::Scene::Light:

Classes

struct  Attenuation
 

Public Types

enum  LightType : int { DIRECTIONAL = 0 , POINT , SPOT , POLYGONAL }
 

Public Member Functions

 Light (Entity *entity, const LightType &type, const std::string &name="light")
 
const Core::Utils::ColorgetColor () const
 
void setColor (const Core::Utils::Color &color)
 
virtual void setDirection (const Eigen::Matrix< Scalar, 3, 1 > &)
 
virtual void setPosition (const Eigen::Matrix< Scalar, 3, 1 > &)
 
const LightTypegetType () const
 
void getRenderParameters (Data::RenderParameters &params) const
 Extract the set of parameters that must be given to a shader for rendering and lighting with this light.
 
const Data::RenderParametersgetRenderParameters () const
 Gives read-only access to the renderParameters of the light.
 
Data::RenderParametersgetRenderParameters ()
 Gives read-write access to the renderParameters of the light.
 
virtual std::string getShaderInclude () const
 
void initialize () override
 
- Public Member Functions inherited from Ra::Engine::Scene::Component
 Component (const std::string &name, Entity *entity)
 CONSTRUCTOR.
 
virtual ~Component ()
 DESTRUCTOR.
 
virtual void setEntity (Entity *entity)
 Set entity the component is part of. This method is called by the entity.
 
virtual EntitygetEntity () const
 Return the entity the component belongs to.
 
virtual const std::stringgetName () const
 Return the component's name.
 
virtual void setSystem (System *system)
 Set the system to which the component belongs.
 
virtual SystemgetSystem () const
 Returns the system to which the component belongs.
 
Core::Utils::Index addRenderObject (Rendering::RenderObject *renderObject)
 Add a new render object to the component. This adds the RO to the manager for drawing.
 
void removeRenderObject (const Core::Utils::Index &roIdx)
 Remove the render object from the component.
 
virtual bool canEdit (const Core::Utils::Index &) const
 Returns true if a transform can be edited with the render object index given as a key.
 
virtual Core::Transform getTransform (const Core::Utils::Index &) const
 Get the transform associated with the given RO index key.
 
virtual void setTransform (const Core::Utils::Index &, const Core::Transform &)
 Set the new transform associated with the RO index key.
 
void notifyRenderObjectExpired (const Core::Utils::Index &idx)
 
virtual Core::Aabb computeAabb ()
 
void invalidateAabb ()
 
const std::vector< Core::Utils::Index > & getRenderObjects ()
 

Additional Inherited Members

- Public Attributes inherited from Ra::Engine::Scene::Component
std::vector< Core::Utils::Index > m_renderObjects
 
- Static Protected Member Functions inherited from Ra::Engine::Scene::Component
static Rendering::RenderObjectManager * getRoMgr ()
 Shortcut to access the render object manager.
 
- Protected Attributes inherited from Ra::Engine::Scene::Component
std::string m_name {}
 
Entitym_entity { nullptr }
 
Systemm_system { nullptr }
 

Detailed Description

Light base class for rendering

Definition at line 20 of file Light.hpp.

Member Enumeration Documentation

◆ LightType

supported light type.

Note
POLYGONAL is not really supported.
Todo
: replace this enum by something extensible as we plan to add new light type by plugins

Definition at line 27 of file Light.hpp.

Constructor & Destructor Documentation

◆ Light()

Ra::Engine::Scene::Light::Light ( Scene::Entity * entity,
const LightType & type,
const std::string & name = "light" )

Create a new light. The new light is a component attached to the given entity

Parameters
entity
type
name

Definition at line 10 of file Light.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ getColor()

const Core::Utils::Color & Ra::Engine::Scene::Light::getColor ( ) const
inline
Returns
the color of the light

Definition at line 55 of file Light.hpp.

◆ getRenderParameters() [1/3]

Data::RenderParameters & Ra::Engine::Scene::Light::getRenderParameters ( )
inline

Gives read-write access to the renderParameters of the light.

Returns
a const reference to the light parameters for rendering

Definition at line 99 of file Light.hpp.

◆ getRenderParameters() [2/3]

const Data::RenderParameters & Ra::Engine::Scene::Light::getRenderParameters ( ) const
inline

Gives read-only access to the renderParameters of the light.

Returns
a const reference to the light parameters for rendering

Definition at line 93 of file Light.hpp.

◆ getRenderParameters() [3/3]

void Ra::Engine::Scene::Light::getRenderParameters ( Data::RenderParameters & params) const

Extract the set of parameters that must be given to a shader for rendering and lighting with this light.

Parameters
paramsparameters to be filled (using merge-replace) with the one of the light

Definition at line 16 of file Light.cpp.

+ Here is the call graph for this function:

◆ getShaderInclude()

std::string Ra::Engine::Scene::Light::getShaderInclude ( ) const
virtual

Abstract method that define the glsl code that manage this light type For the moment, this is not use (except by experimental plugins) but will be part of the shader composition process of radium v2

Returns

Reimplemented in Ra::Engine::Scene::DirectionalLight, Ra::Engine::Scene::PointLight, and Ra::Engine::Scene::SpotLight.

Definition at line 24 of file Light.cpp.

◆ getType()

const LightType & Ra::Engine::Scene::Light::getType ( ) const
inline
Returns
the type (an enum Light::LightType member) of the light source

Definition at line 80 of file Light.hpp.

◆ initialize()

void Ra::Engine::Scene::Light::initialize ( )
overridevirtual

Nothing to initialize here ...

Implements Ra::Engine::Scene::Component.

Definition at line 20 of file Light.cpp.

◆ setColor()

void Ra::Engine::Scene::Light::setColor ( const Core::Utils::Color & color)
inline

Set the color of the light

Parameters
color

Definition at line 122 of file Light.hpp.

+ Here is the call graph for this function:

◆ setDirection()

virtual void Ra::Engine::Scene::Light::setDirection ( const Eigen::Matrix< Scalar, 3, 1 > & )
inlinevirtual

set the direction of lighting

Todo
put this only on directional and spot light sources
Parameters
dir

Reimplemented in Ra::Engine::Scene::DirectionalLight, and Ra::Engine::Scene::SpotLight.

Definition at line 67 of file Light.hpp.

◆ setPosition()

virtual void Ra::Engine::Scene::Light::setPosition ( const Eigen::Matrix< Scalar, 3, 1 > & )
inlinevirtual

Set the position of the light source

Todo
put this only on point and spot light sources
Parameters
pos

Reimplemented in Ra::Engine::Scene::PointLight, and Ra::Engine::Scene::SpotLight.

Definition at line 73 of file Light.hpp.


The documentation for this class was generated from the following files: