Loading [MathJax]/extensions/tex2jax.js
Radium Engine  1.5.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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. More...
 
 LightData (const LightData &data)
 
 ~LightData ()
 Destructor. More...
 
void setName (const std::string &name)
 LIGHT DATA ///. More...
 
const Eigen::Matrix< Scalar, 4, 4 > & getFrame () const
 FRAME. More...
 
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 More...
 
void setLight (const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &position, LightAttenuation attenuation)
 construct a point light More...
 
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 More...
 
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 More...
 
LightType getType () const
 TYPE. More...
 
bool isPointLight () const
 QUERY. More...
 
bool isSpotLight () const
 
bool isDirectionalLight () const
 
bool isAreaLight () const
 
void displayInfo () const
 DEBUG. More...
 
- 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::string & getName () 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 34 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 303 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 229 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 224 of file LightData.hpp.

◆ isAreaLight()

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

Returns true if the light is an AreaLight

Definition at line 298 of file LightData.hpp.

◆ isDirectionalLight()

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

Returns true if the light is a DirectionalLight

Definition at line 294 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 286 of file LightData.hpp.

◆ isSpotLight()

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

Returns true if the light is a SpotLight

Definition at line 290 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 233 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 272 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 238 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 256 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 246 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 219 of file LightData.hpp.


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