Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Core::Asset::LightData Class Reference

#include <Core/Asset/LightData.hpp>

+ Inheritance diagram for Ra::Core::Asset::LightData:
+ Collaboration diagram for Ra::Core::Asset::LightData:

Classes

struct  LightAttenuation
 

Public Types

enum  LightType {
  UNKNOWN = 1 << 0 , POINT_LIGHT = 1 << 1 , SPOT_LIGHT = 1 << 2 , DIRECTIONAL_LIGHT = 1 << 3 ,
  AREA_LIGHT = 1 << 4
}
 

Public Member Functions

 LightData (const std::string &name="", const LightType &type=UNKNOWN)
 CONSTRUCTOR.
 
 LightData (const LightData &data)
 
 ~LightData ()
 Destructor.
 
void setName (const std::string &name)
 LIGHT DATA ///.
 
const Eigen::Matrix< Scalar, 4, 4 > & getFrame () const
 FRAME.
 
void setFrame (const Eigen::Matrix< Scalar, 4, 4 > &frame)
 
void setLight (const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &direction)
 construct a directional light
 
void setLight (const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &position, LightAttenuation attenuation)
 construct a point light
 
void setLight (const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &position, const Eigen::Matrix< Scalar, 3, 1 > &direction, Scalar inAngle, Scalar outAngle, LightAttenuation attenuation)
 construct a spot light
 
void setLight (const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &cog, const Eigen::Matrix< Scalar, 3, 3 > &spatialCov, const Eigen::Matrix< Scalar, 3, 3 > &normalCov, LightAttenuation attenuation)
 construct an area light
 
LightType getType () const
 TYPE.
 
bool isPointLight () const
 QUERY.
 
bool isSpotLight () const
 
bool isDirectionalLight () const
 
bool isAreaLight () const
 
void displayInfo () const
 DEBUG.
 
- Public Member Functions inherited from Ra::Core::Asset::AssetData
 AssetData (const std::string &name)
 Construct an asset data given its name.
 
 AssetData (const AssetData &other)=default
 Copy constructor. Default here.
 
virtual ~AssetData ()
 Simple delete operator.
 
virtual const std::stringgetName () const
 Acces to the name of the asset.
 

Public Attributes

Core::Utils::Color m_color
 
union { 
 
   DirLight   m_dirlight 
 
   PointLight   m_pointlight 
 
   SpotLight   m_spotlight 
 
   AreaLight   m_arealight 
 
};  
 

Protected Attributes

Eigen::Matrix< Scalar, 4, 4 > m_frame
 VARIABLE.
 
LightType m_type
 
- Protected Attributes inherited from Ra::Core::Asset::AssetData
std::string m_name
 

Detailed Description

Asset defining how lights must be passed to the Radium systems from a loader.

Supported light type are : Point light : a local, punctual, isotropic spherical light. Spot light : a local, punctual, isotropic conical light. Directional light : an infinite, isotropic light. Area light : a local isotropic area light.

Definition at line 25 of file LightData.hpp.

Member Enumeration Documentation

◆ LightType

Supported light type

Definition at line 32 of file LightData.hpp.

Constructor & Destructor Documentation

◆ LightData() [1/2]

Ra::Core::Asset::LightData::LightData ( const std::string & name = "",
const LightType & type = UNKNOWN )
explicit

CONSTRUCTOR.

Light constructor. Must be called explicitely with a name for the light and its type.

Definition at line 8 of file LightData.cpp.

◆ LightData() [2/2]

Ra::Core::Asset::LightData::LightData ( const LightData & data)

Copy constructor. As a Light a a union like object, no default copy constructor could be generated. This will take care of copying the good members of the union.

Parameters
data

Definition at line 11 of file LightData.cpp.

◆ ~LightData()

Ra::Core::Asset::LightData::~LightData ( )

Destructor.

DESTRUCTOR.

Definition at line 33 of file LightData.cpp.

Member Function Documentation

◆ displayInfo()

void Ra::Core::Asset::LightData::displayInfo ( ) const
inline

DEBUG.

For debugging purpose, prints out the formated content of the LightData object.

Definition at line 301 of file LightData.hpp.

◆ getFrame()

const Eigen::Matrix< Scalar, 4, 4 > & Ra::Core::Asset::LightData::getFrame ( ) const
inline

FRAME.

Acces to the local frame of the light.

Returns
the local frame

Definition at line 227 of file LightData.hpp.

◆ getType()

LightData::LightType Ra::Core::Asset::LightData::getType ( ) const
inline

TYPE.

Access to the type of the object

Definition at line 222 of file LightData.hpp.

◆ isAreaLight()

bool Ra::Core::Asset::LightData::isAreaLight ( ) const
inline

Returns true if the light is an AreaLight

Definition at line 296 of file LightData.hpp.

◆ isDirectionalLight()

bool Ra::Core::Asset::LightData::isDirectionalLight ( ) const
inline

Returns true if the light is a DirectionalLight

Definition at line 292 of file LightData.hpp.

◆ isPointLight()

bool Ra::Core::Asset::LightData::isPointLight ( ) const
inline

QUERY.

Returns true if the light is a PointLight

Definition at line 284 of file LightData.hpp.

◆ isSpotLight()

bool Ra::Core::Asset::LightData::isSpotLight ( ) const
inline

Returns true if the light is a SpotLight

Definition at line 288 of file LightData.hpp.

◆ setFrame()

void Ra::Core::Asset::LightData::setFrame ( const Eigen::Matrix< Scalar, 4, 4 > & frame)
inline

Set the local frame of the light.

Parameters
framethe local frame

Definition at line 231 of file LightData.hpp.

◆ setLight() [1/4]

void Ra::Core::Asset::LightData::setLight ( const Core::Utils::Color & color,
const Eigen::Matrix< Scalar, 3, 1 > & cog,
const Eigen::Matrix< Scalar, 3, 3 > & spatialCov,
const Eigen::Matrix< Scalar, 3, 3 > & normalCov,
LightAttenuation attenuation )
inline

construct an area light

Construct a area light. An area light, (isotropic with constant emision defined by its color) is approximated by its center and the covariance matrices modelling the spatial extent as well as the elliptical distribution of normals.

Note
The object on which this method is called is unconditionally promoted to AREA_LIGHT light, whatever it was before the call and only the directional light part of the union is consistent after the call

Definition at line 270 of file LightData.hpp.

◆ setLight() [2/4]

void Ra::Core::Asset::LightData::setLight ( const Core::Utils::Color & color,
const Eigen::Matrix< Scalar, 3, 1 > & direction )
inline

construct a directional light

Construct a directional light. A directional light is only defined by its color and its lighting direction. No attenuation on directional.

Note
The object on which this method is called is unconditionally promoted to DIRECTIONAL_LIGHT light, whatever it was before the call and only the directional light part of the union is consistent after the call

Definition at line 236 of file LightData.hpp.

◆ setLight() [3/4]

void Ra::Core::Asset::LightData::setLight ( const Core::Utils::Color & color,
const Eigen::Matrix< Scalar, 3, 1 > & position,
const Eigen::Matrix< Scalar, 3, 1 > & direction,
Scalar inAngle,
Scalar outAngle,
LightAttenuation attenuation )
inline

construct a spot light

Construct a spot light. A spot light is defined by its color, its position, the cone axis and light distribution (constant inside inangle, quadratically deacreasing toward 0 fron inAngle to ouAngle) and its attenuation.

Note
The object on which this method is called is unconditionally promoted to SPOT_LIGHT light, whatever it was before the call and only the directional light part of the union is consistent after the call

Definition at line 254 of file LightData.hpp.

◆ setLight() [4/4]

void Ra::Core::Asset::LightData::setLight ( const Core::Utils::Color & color,
const Eigen::Matrix< Scalar, 3, 1 > & position,
LightAttenuation attenuation )
inline

construct a point light

Construct a point light. A point light is defined by its color, its position and its attenuation.

Note
The object on which this method is called is unconditionally promoted to POINT_LIGHT light, whatever it was before the call and only the directional light part of the union is consistent after the call

Definition at line 244 of file LightData.hpp.

◆ setName()

void Ra::Core::Asset::LightData::setName ( const std::string & name)
inline

LIGHT DATA ///.

Extension of of the AssetData interface so that we can modify an abcet afeter ts creation. This has no impact on the coherence of the LightData object and could be used without restriction.

NAME

Definition at line 217 of file LightData.hpp.

Member Data Documentation

◆ m_arealight

AreaLight Ra::Core::Asset::LightData::m_arealight

Definition at line 208 of file LightData.hpp.

◆ m_color

Core::Utils::Color Ra::Core::Asset::LightData::m_color

Definition at line 180 of file LightData.hpp.

◆ m_dirlight

DirLight Ra::Core::Asset::LightData::m_dirlight

Definition at line 205 of file LightData.hpp.

◆ m_frame

Eigen::Matrix<Scalar, 4, 4> Ra::Core::Asset::LightData::m_frame
protected

VARIABLE.

Definition at line 174 of file LightData.hpp.

◆ m_pointlight

PointLight Ra::Core::Asset::LightData::m_pointlight

Definition at line 206 of file LightData.hpp.

◆ m_spotlight

SpotLight Ra::Core::Asset::LightData::m_spotlight

Definition at line 207 of file LightData.hpp.

◆ m_type

LightType Ra::Core::Asset::LightData::m_type
protected

Definition at line 175 of file LightData.hpp.


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