Luanti 5.16.0-dev
Loading...
Searching...
No Matches
DirectionalLight Class Reference

#include <dynamicshadows.h>

Collaboration diagram for DirectionalLight:

Public Member Functions

 DirectionalLight (const u32 shadowMapResolution, const v3f &position, video::SColorf lightColor=video::SColor(0xffffffff), f32 farValue=100.0f)
 ~DirectionalLight ()=default
void updateCameraOffset (const Camera *cam)
void updateFrustum (const Camera *cam, Client *client)
void setDirection (v3f dir)
v3f getDirection () const
v3f getPosition () const
v3f getPlayerPos () const
v3f getFuturePlayerPos () const
const core::matrix4 & getViewMatrix () const
 Gets the light's matrices.
const core::matrix4 & getProjectionMatrix () const
const core::matrix4 & getFutureViewMatrix () const
const core::matrix4 & getFutureProjectionMatrix () const
core::matrix4 getViewProjMatrix ()
f32 getMaxFarValue () const
 Gets the light's maximum far value, i.e. the shadow boundary.
f32 getFarValue () const
 Gets the current far value of the light.
const video::SColorf & getLightColor () const
 Gets the light's color.
void setLightColor (const video::SColorf &lightColor)
 Sets the light's color.
u32 getMapResolution () const
 Gets the shadow map resolution for this light.
void commitFrustum ()

Public Attributes

bool should_update_map_shadow {true}
 If true, shadow map needs to be invalidated due to frustum change.

Private Member Functions

void createSplitMatrices (const Camera *cam)

Private Attributes

video::SColorf diffuseColor
f32 farPlane
u32 mapRes
v3f pos
v3f direction {0}
v3f last_cam_pos_world {0,0,0}
v3f last_look {0,1,0}
shadowFrustum shadow_frustum
shadowFrustum future_frustum
bool dirty {false}

Constructor & Destructor Documentation

◆ DirectionalLight()

DirectionalLight::DirectionalLight ( const u32 shadowMapResolution,
const v3f & position,
video::SColorf lightColor = video::SColor(0xffffffff),
f32 farValue = 100.0f )

References diffuseColor, farPlane, mapRes, and pos.

◆ ~DirectionalLight()

DirectionalLight::~DirectionalLight ( )
default

References dir().

Here is the call graph for this function:

Member Function Documentation

◆ commitFrustum()

void DirectionalLight::commitFrustum ( )

References dirty, future_frustum, and shadow_frustum.

◆ createSplitMatrices()

void DirectionalLight::createSplitMatrices ( const Camera * cam)
private

References adjustDist(), BS, direction, future_frustum, Camera::getCameraNode(), Camera::getDirection(), Camera::getFovX(), Camera::getFovY(), Camera::getOffset(), Camera::getPosition(), last_cam_pos_world, and last_look.

Referenced by updateCameraOffset(), and updateFrustum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDirection()

v3f DirectionalLight::getDirection ( ) const
inline

References direction.

Referenced by updateFrustum().

Here is the caller graph for this function:

◆ getFarValue()

f32 DirectionalLight::getFarValue ( ) const
inline

Gets the current far value of the light.

References shadow_frustum.

◆ getFuturePlayerPos()

v3f DirectionalLight::getFuturePlayerPos ( ) const

References future_frustum.

◆ getFutureProjectionMatrix()

const m4f & DirectionalLight::getFutureProjectionMatrix ( ) const

References future_frustum.

Referenced by ShadowRenderer::renderShadowMap().

Here is the caller graph for this function:

◆ getFutureViewMatrix()

const m4f & DirectionalLight::getFutureViewMatrix ( ) const

References future_frustum.

Referenced by ShadowRenderer::renderShadowMap().

Here is the caller graph for this function:

◆ getLightColor()

const video::SColorf & DirectionalLight::getLightColor ( ) const
inline

Gets the light's color.

References diffuseColor.

◆ getMapResolution()

u32 DirectionalLight::getMapResolution ( ) const
inline

Gets the shadow map resolution for this light.

References mapRes.

◆ getMaxFarValue()

f32 DirectionalLight::getMaxFarValue ( ) const
inline

Gets the light's maximum far value, i.e. the shadow boundary.

References BS, and farPlane.

Referenced by updateFrustum().

Here is the caller graph for this function:

◆ getPlayerPos()

v3f DirectionalLight::getPlayerPos ( ) const

References shadow_frustum.

◆ getPosition()

v3f DirectionalLight::getPosition ( ) const

References shadow_frustum.

Referenced by updateFrustum().

Here is the caller graph for this function:

◆ getProjectionMatrix()

const m4f & DirectionalLight::getProjectionMatrix ( ) const

References shadow_frustum.

Referenced by ShadowRenderer::renderShadowObjects().

Here is the caller graph for this function:

◆ getViewMatrix()

const m4f & DirectionalLight::getViewMatrix ( ) const

Gets the light's matrices.

References shadow_frustum.

Referenced by ShadowRenderer::renderShadowObjects().

Here is the caller graph for this function:

◆ getViewProjMatrix()

m4f DirectionalLight::getViewProjMatrix ( )

References shadow_frustum.

◆ setDirection()

void DirectionalLight::setDirection ( v3f dir)

References dir(), and direction.

Referenced by Game::updateShadows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLightColor()

void DirectionalLight::setLightColor ( const video::SColorf & lightColor)
inline

Sets the light's color.

References diffuseColor.

◆ updateCameraOffset()

void DirectionalLight::updateCameraOffset ( const Camera * cam)

References createSplitMatrices(), dirty, future_frustum, and should_update_map_shadow.

Here is the call graph for this function:

◆ updateFrustum()

void DirectionalLight::updateFrustum ( const Camera * cam,
Client * client )

References BS, createSplitMatrices(), dirty, future_frustum, Camera::getCameraNode(), getDirection(), getMaxFarValue(), getPosition(), MYMIN, and should_update_map_shadow.

Referenced by Game::updateShadows().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ diffuseColor

video::SColorf DirectionalLight::diffuseColor
private

◆ direction

v3f DirectionalLight::direction {0}
private

◆ dirty

bool DirectionalLight::dirty {false}
private

◆ farPlane

f32 DirectionalLight::farPlane
private

Referenced by DirectionalLight(), and getMaxFarValue().

◆ future_frustum

◆ last_cam_pos_world

v3f DirectionalLight::last_cam_pos_world {0,0,0}
private

Referenced by createSplitMatrices().

◆ last_look

v3f DirectionalLight::last_look {0,1,0}
private

Referenced by createSplitMatrices().

◆ mapRes

u32 DirectionalLight::mapRes
private

◆ pos

v3f DirectionalLight::pos
private

Referenced by DirectionalLight().

◆ shadow_frustum

◆ should_update_map_shadow

bool DirectionalLight::should_update_map_shadow {true}

If true, shadow map needs to be invalidated due to frustum change.

Referenced by updateCameraOffset(), and updateFrustum().


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