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

#include <spot_light.hpp>

Inheritance diagram for mage::rendering::SpotLight:
mage::Component

Public Member Functions

 SpotLight () noexcept
 
 SpotLight (const SpotLight &light) noexcept
 
 SpotLight (SpotLight &&light) noexcept
 
virtual ~SpotLight ()
 
SpotLightoperator= (const SpotLight &light) noexcept
 
SpotLightoperator= (SpotLight &&light) noexcept
 
RGBGetBaseColor () noexcept
 
const RGBGetBaseColor () const noexcept
 
F32 GetPower () const noexcept
 
void SetPower (F32 power) noexcept
 
const RGB GetPowerSpectrum () const noexcept
 
F32 GetIntensity () const noexcept
 
void SetIntensity (F32 intensity) noexcept
 
const RGB GetIntensitySpectrum () const noexcept
 
const AABBGetAABB () const noexcept
 
const BoundingSphereGetBoundingSphere () const noexcept
 
F32 GetRange () const noexcept
 
F32 GetWorldRange () const noexcept
 
void SetRange (F32 range) noexcept
 
F32 GetStartAngularCutoff () const noexcept
 
void SetStartAngularCutoff (F32 cos_penumbra) noexcept
 
F32 GetEndAngularCutoff () const noexcept
 
void SetEndAngularCutoff (F32 cos_umbra) noexcept
 
void SetAngularCutoff (F32 cos_penumbra, F32 cos_umbra) noexcept
 
F32 GetRangeAngularCutoff () const noexcept
 
F32 GetPenumbraAngle () const noexcept
 
void SetPenumbraAngle (F32 penumbra) noexcept
 
F32 GetUmbraAngle () const noexcept
 
void SetUmbraAngle (F32 umbra) noexcept
 
void SetPenumbraAndUmbraAngles (F32 penumbra, F32 umbra) 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
 
F32 GetFOV () const 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
 
AABB m_aabb
 
BoundingSphere m_sphere
 
RGB m_base_color
 
F32 m_intensity
 
F32x2 m_clipping_planes
 
F32 m_cos_penumbra
 
F32 m_cos_umbra
 

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 spotlights.

Constructor & Destructor Documentation

◆ SpotLight() [1/3]

mage::rendering::SpotLight::SpotLight ( )
noexcept

Constructs a spotlight.

◆ SpotLight() [2/3]

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

Constructs a spotlight from the given spotlight.

Parameters
[in]lightA reference to the spotlight to copy.

◆ SpotLight() [3/3]

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

Constructs a spotlight by moving the given spotlight.

Parameters
[in]lightA reference to the spotlight to move.

◆ ~SpotLight()

mage::rendering::SpotLight::~SpotLight ( )
virtualdefault

Destructs this spotlight.

Member Function Documentation

◆ DissableShadows()

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

Dissables shadows for this spotlight.

◆ EnableShadows()

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

Enables shadows for this spotlight.

◆ GetAABB()

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

Returns the AABB of this spotlight.

Returns
A reference to the AABB of this spotlight.

◆ GetBaseColor() [1/2]

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

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

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

◆ GetBaseColor() [2/2]

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

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

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

◆ GetBoundingSphere()

const BoundingSphere& mage::rendering::SpotLight::GetBoundingSphere ( ) const
noexcept

Returns the BoundingSphere of this spotlight.

Returns
A reference to the BoundingSphere of this spotlight.

◆ GetClippingPlanes()

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

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

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

◆ GetEndAngularCutoff()

F32 mage::rendering::SpotLight::GetEndAngularCutoff ( ) const
noexcept

Returns the cosine of the umbra angle of this spotlight.

Returns
The cosine of the umbra angle of this spotlight.

◆ GetFOV()

F32 mage::rendering::SpotLight::GetFOV ( ) const
noexcept

Returns the (horizontal and vertical) field-of-view of this spotlight.

Returns
The (horizontal and vertical) field-of-view of this spotlight.

◆ GetIntensity()

F32 mage::rendering::SpotLight::GetIntensity ( ) const
noexcept

Returns the radiant intensity of this spotlight.

Returns
The radiant intensity in watts per steradians of this spotlight.

◆ GetIntensitySpectrum()

const RGB mage::rendering::SpotLight::GetIntensitySpectrum ( ) const
noexcept

Returns the radiant intensity spectrum of this spotlight.

Returns
The radiant intensity spectrum of this spotlight.

◆ GetLightToProjectionMatrix()

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

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

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

◆ GetPenumbraAngle()

F32 mage::rendering::SpotLight::GetPenumbraAngle ( ) const
noexcept

Returns the penumbra angle (in radians) of this spotlight.

Returns
The penumbra angle (in radians) of this spotlight.

◆ GetPower()

F32 mage::rendering::SpotLight::GetPower ( ) const
noexcept

Returns the power of this spotlight.

Returns
The power in watts of this spotlight.

◆ GetPowerSpectrum()

const RGB mage::rendering::SpotLight::GetPowerSpectrum ( ) const
noexcept

Returns the power spectrum of this spotlight.

Returns
The power spectrum of this spotlight.

◆ GetRange()

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

Returns the range of this spotlight expressed in light space.

Returns
The range of this spotlight expressed in light space.

◆ GetRangeAngularCutoff()

F32 mage::rendering::SpotLight::GetRangeAngularCutoff ( ) const
noexcept

Returns the cosine range where intensity attenuation occurs of this spotlight.

Returns
The cosine range where intensity attenuation occurs of this spotlight. GetStartAngularCutoff() - GetEndAngularCutoff().

◆ GetStartAngularCutoff()

F32 mage::rendering::SpotLight::GetStartAngularCutoff ( ) const
noexcept

Returns the cosine of the penumbra angle of this spotlight.

Returns
The cosine of the penumbra angle of this spotlight.

◆ GetUmbraAngle()

F32 mage::rendering::SpotLight::GetUmbraAngle ( ) const
noexcept

Returns the umbra angle (in radians) of this spotlight.

Returns
The umbra angle (in radians) of this spotlight.

◆ GetWorldRange()

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

Returns the range of this spotlight expressed in world space.

Returns
The range of this spotlight expressed in world space.
Note
Non-uniform scaling is not supported for spotlights.

◆ operator=() [1/2]

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

Copies the given spotlight to this spotlight.

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

◆ operator=() [2/2]

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

Moves the given spotlight to this spotlight.

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

◆ SetAngularCutoff()

void mage::rendering::SpotLight::SetAngularCutoff ( F32  cos_penumbra,
F32  cos_umbra 
)
noexcept

Sets the cosine of the penumbra and umbra angles of this spotlight to the given values.

Parameters
[in]cos_penumbraThe cosine of the penumbra angle.
[in]cos_umbraThe cosine of the umbra angle.

◆ SetClippingPlanes()

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

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

Parameters
[in]clipping_planesThe clipping planes.

◆ SetEndAngularCutoff()

void mage::rendering::SpotLight::SetEndAngularCutoff ( F32  cos_umbra)
noexcept

Sets the cosine of the umbra angle of this spotlight to the given value.

Parameters
[in]cos_umbraThe cosine of the umbra angle.

◆ SetIntensity()

void mage::rendering::SpotLight::SetIntensity ( F32  intensity)
noexcept

Sets the radiant intensity of this spotlight to the given radial intensity.

Parameters
[in]intensityThe radiant intensity in watts per steradians.

◆ SetPenumbraAndUmbraAngles()

void mage::rendering::SpotLight::SetPenumbraAndUmbraAngles ( F32  penumbra,
F32  umbra 
)
noexcept

Sets the penumbra and umbra angles (in radians) of this spotlight to the given values.

Precondition
cos(umbra) must be greater than 0.
Parameters
[in]penumbraThe penumbra angle (in radians).
[in]umbraThe umbra angle (in radians).

◆ SetPenumbraAngle()

void mage::rendering::SpotLight::SetPenumbraAngle ( F32  penumbra)
noexcept

Sets the penumbra angle (in radians) of this spotlight to the given value (in radians).

Parameters
[in]penumbraThe penumbra angle (in radians).

◆ SetPower()

void mage::rendering::SpotLight::SetPower ( F32  power)
noexcept

Sets the power of this omni light to the given radiance.

Parameters
[in]powerThe power in watts.

◆ SetRange()

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

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

Parameters
[in]rangeThe range expressed in light space.

◆ SetShadows()

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

Sets shadows for this spotlight to the given value.

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

◆ SetStartAngularCutoff()

void mage::rendering::SpotLight::SetStartAngularCutoff ( F32  cos_penumbra)
noexcept

Sets the cosine of the penumbra angle of this spotlight to the given value.

Parameters
[in]cos_penumbraThe cosine of the penumbra angle.

◆ SetUmbraAngle()

void mage::rendering::SpotLight::SetUmbraAngle ( F32  umbra)
noexcept

Sets the umbra angle (in radians) of this spotlight to the given value.

Precondition
cos(umbra) must be greater than 0.
Parameters
[in]umbraThe umbra angle (in radians).

◆ ToggleShadows()

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

Toggles shadows for this spotlight.

◆ UpdateBoundingVolumes()

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

Updates the bounding volumes of this spotlight.

◆ UseShadows()

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

Checks whether shadows should be used for this spotlight.

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

Member Data Documentation

◆ m_aabb

AABB mage::rendering::SpotLight::m_aabb
private

The AABB of this spotlight.

◆ m_base_color

RGB mage::rendering::SpotLight::m_base_color
private

The (linear) base color of this spotlight.

◆ m_clipping_planes

F32x2 mage::rendering::SpotLight::m_clipping_planes
private

The clipping planes of this spotlight expressed in light space.

◆ m_cos_penumbra

F32 mage::rendering::SpotLight::m_cos_penumbra
private

The cosine of the penumbra angle of this spotlight.

◆ m_cos_umbra

F32 mage::rendering::SpotLight::m_cos_umbra
private

The cosine of the umbra angle of this spotlight.

◆ m_intensity

F32 mage::rendering::SpotLight::m_intensity
private

The radiant intensity in watts per steradians of this spotlight.

◆ m_shadows

bool mage::rendering::SpotLight::m_shadows
private

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

◆ m_sphere

BoundingSphere mage::rendering::SpotLight::m_sphere
private

The BoundingSphere of this spotlight.