MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::DirectionalLight Class Reference

#include <directional_light.hpp>

Inheritance diagram for mage::rendering::DirectionalLight:
mage::Component

Public Member Functions

 DirectionalLight () noexcept
 
 DirectionalLight (const DirectionalLight &light) noexcept
 
 DirectionalLight (DirectionalLight &&light) noexcept
 
virtual ~DirectionalLight ()
 
DirectionalLightoperator= (const DirectionalLight &light) noexcept
 
DirectionalLightoperator= (DirectionalLight &&light) noexcept
 
RGBGetBaseColor () noexcept
 
const RGBGetBaseColor () const noexcept
 
F32 GetIrradiance () const noexcept
 
void SetIrradiance (F32 irradiance) noexcept
 
const RGB GetIrradianceSpectrum () const noexcept
 
const AABBGetAABB () const noexcept
 
F32 GetRange () const noexcept
 
F32 GetWorldRange () const noexcept
 
void SetRange (F32 range) noexcept
 
bool UseShadows () const noexcept
 
void EnableShadows () noexcept
 
void DissableShadows () noexcept
 
void ToggleShadows () noexcept
 
void SetShadows (bool shadows) noexcept
 
const F32x2 GetClippingPlanes () const noexcept
 
void SetClippingPlanes (F32x2 clipping_planes) noexcept
 
const F32x2 GetSize () const noexcept
 
void SetSize (F32x2 size) noexcept
 
const XMMATRIX XM_CALLCONV GetLightToProjectionMatrix () const noexcept
 
- Public Member Functions inherited from mage::Component
virtual ~Component ()
 
Componentoperator= (const Component &component) noexcept
 
Componentoperator= (Component &&component) noexcept
 
State GetState () const noexcept
 
void SetState (State state) noexcept
 
U64 GetGuid () const noexcept
 
bool HasOwner () const noexcept
 
ProxyPtr< NodeGetOwner () noexcept
 
ProxyPtr< const NodeGetOwner () const noexcept
 

Private Member Functions

void UpdateBoundingVolumes () noexcept
 

Private Attributes

bool m_shadows
 
F32x2 m_clipping_planes
 
F32x2 m_size
 
AABB m_aabb
 
RGB m_base_color
 
F32 m_irradiance
 

Additional Inherited Members

- Protected Member Functions inherited from mage::Component
 Component () noexcept
 
 Component (const Component &component) noexcept
 
 Component (Component &&component) noexcept
 

Detailed Description

A class of directional lights.

Constructor & Destructor Documentation

◆ DirectionalLight() [1/3]

mage::rendering::DirectionalLight::DirectionalLight ( )
noexcept

Constructs a directional light.

◆ DirectionalLight() [2/3]

mage::rendering::DirectionalLight::DirectionalLight ( const DirectionalLight light)
defaultnoexcept

Constructs a directional light from the given directional light.

Parameters
[in]lightA reference to the directional light to copy.

◆ DirectionalLight() [3/3]

mage::rendering::DirectionalLight::DirectionalLight ( DirectionalLight &&  light)
defaultnoexcept

Constructs a directional light by moving the given directional light.

Parameters
[in]lightA reference to the directional light to move.

◆ ~DirectionalLight()

mage::rendering::DirectionalLight::~DirectionalLight ( )
virtualdefault

Destructs this directional light.

Member Function Documentation

◆ DissableShadows()

void mage::rendering::DirectionalLight::DissableShadows ( )
noexcept

Dissables shadows for this directional light.

◆ EnableShadows()

void mage::rendering::DirectionalLight::EnableShadows ( )
noexcept

Enables shadows for this directional light.

◆ GetAABB()

const AABB& mage::rendering::DirectionalLight::GetAABB ( ) const
noexcept

Returns the AABB of this directional light.

Returns
A reference to the AABB of this directional light.

◆ GetBaseColor() [1/2]

RGB& mage::rendering::DirectionalLight::GetBaseColor ( )
noexcept

Returns the (linear) base color of this directional light.

Returns
A reference to the sRGB base color of this directional light.

◆ GetBaseColor() [2/2]

const RGB& mage::rendering::DirectionalLight::GetBaseColor ( ) const
noexcept

Returns the (linear) base color of this directional light.

Returns
A reference to the sRGB base color of this directional light.

◆ GetClippingPlanes()

const F32x2 mage::rendering::DirectionalLight::GetClippingPlanes ( ) const
noexcept

Returns the clipping planes of this directional light expressed in light space.

Returns
The clipping planes of this directional light expressed in light space.

◆ GetIrradiance()

F32 mage::rendering::DirectionalLight::GetIrradiance ( ) const
noexcept

Returns the irradiance of this directional light.

Returns
The irradiance in watts per square meter of this directional light.

◆ GetIrradianceSpectrum()

const RGB mage::rendering::DirectionalLight::GetIrradianceSpectrum ( ) const
noexcept

Returns the irradiance spectrum of this directional light.

Returns
The irradiance spectrum of this directional light.

◆ GetLightToProjectionMatrix()

const XMMATRIX XM_CALLCONV mage::rendering::DirectionalLight::GetLightToProjectionMatrix ( ) const
noexcept

Returns the light-to-projection matrix of the light camera of this directional light.

Returns
The light-to-projection matrix of the light camera of this directional light.

◆ GetRange()

F32 mage::rendering::DirectionalLight::GetRange ( ) const
noexcept

Returns the range of this directional light expressed in light space.

Returns
The range of this directional light expressed in light space.

◆ GetSize()

const F32x2 mage::rendering::DirectionalLight::GetSize ( ) const
noexcept

Returns the size of the projection plane of this directional light expressed in directional light.

Returns
The size of the projection plane of this directional light expressed in light space.

◆ GetWorldRange()

F32 mage::rendering::DirectionalLight::GetWorldRange ( ) const
noexcept

Returns the range of this directional light expressed in world space.

Returns
The range of this directional light expressed in world space.
Note
Non-uniform scaling is not supported for directional lights.

◆ operator=() [1/2]

DirectionalLight & mage::rendering::DirectionalLight::operator= ( const DirectionalLight light)
defaultnoexcept

Copies the given directional light to this directional light.

Parameters
[in]lightA reference to the directional light to copy.
Returns
A reference to the copy of the given directional light (i.e. this directional light).

◆ operator=() [2/2]

DirectionalLight & mage::rendering::DirectionalLight::operator= ( DirectionalLight &&  light)
defaultnoexcept

Moves the given directional light to this directional light.

Parameters
[in]lightA reference to the directional light to move.
Returns
A reference to the moved directional light (i.e. this directional light).

◆ SetClippingPlanes()

void mage::rendering::DirectionalLight::SetClippingPlanes ( F32x2  clipping_planes)
noexcept

Sets the clipping planes of this directional light expressed in light space to the given clipping planes.

Parameters
[in]clipping_planesThe clipping planes.

◆ SetIrradiance()

void mage::rendering::DirectionalLight::SetIrradiance ( F32  irradiance)
noexcept

Sets the irradiance of this directional light to the given irradiance.

Parameters
[in]irradianceThe irradiance in watts per square meter.

◆ SetRange()

void mage::rendering::DirectionalLight::SetRange ( F32  range)
noexcept

Sets the range of this directional light to the given value expressed in light space.

Parameters
[in]rangeThe range expressed in light space.

◆ SetShadows()

void mage::rendering::DirectionalLight::SetShadows ( bool  shadows)
noexcept

Sets shadows for this directional light to the given value.

Parameters
[in]shadowstrue if shadows should be used for this directional light. false otherwise.

◆ SetSize()

void mage::rendering::DirectionalLight::SetSize ( F32x2  size)
noexcept

Sets the size of the projection plane of this directional light expressed in light space to the given size.

Parameters
[in]sizeThe size.

◆ ToggleShadows()

void mage::rendering::DirectionalLight::ToggleShadows ( )
noexcept

Toggles shadows for this directional light.

◆ UpdateBoundingVolumes()

void mage::rendering::DirectionalLight::UpdateBoundingVolumes ( )
privatenoexcept

Updates the bounding volumes of this omni light.

◆ UseShadows()

bool mage::rendering::DirectionalLight::UseShadows ( ) const
noexcept

Checks whether shadows should be used for this directional light.

Returns
true if shadows should be used for this directional light. false otherwise.

Member Data Documentation

◆ m_aabb

AABB mage::rendering::DirectionalLight::m_aabb
private

The AABB of this directional light.

◆ m_base_color

RGB mage::rendering::DirectionalLight::m_base_color
private

The (linear) base color of this directional light.

◆ m_clipping_planes

F32x2 mage::rendering::DirectionalLight::m_clipping_planes
private

The clipping planes of this directional light expressed in light space.

◆ m_irradiance

F32 mage::rendering::DirectionalLight::m_irradiance
private

The irradiance (which is equal to the exitant radiance/radiosity) in watts per square meter of this directional light.

◆ m_shadows

bool mage::rendering::DirectionalLight::m_shadows
private

A flag indicating whether shadows should be calculated or not not for this directional light.

◆ m_size

F32x2 mage::rendering::DirectionalLight::m_size
private

The size of the projection plane of this directional light expressed in light space.