Luanti 5.11.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 update_frustum (const Camera *cam, Client *client, bool force=false)
 
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}
 

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 )

◆ ~DirectionalLight()

DirectionalLight::~DirectionalLight ( )
default

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, shadowFrustum::camera_offset, direction, future_frustum, Camera::getCameraNode(), Camera::getDirection(), Camera::getFovX(), Camera::getFovY(), Camera::getOffset(), Camera::getPosition(), last_cam_pos_world, last_look, shadowFrustum::length, shadowFrustum::player, shadowFrustum::position, shadowFrustum::ProjOrthMat, quantizeDirection(), shadowFrustum::radius, shadowFrustum::ViewMat, shadowFrustum::zFar, and shadowFrustum::zNear.

Referenced by update_frustum().

+ 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 update_frustum().

+ 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, and shadowFrustum::zFar.

◆ getFuturePlayerPos()

v3f DirectionalLight::getFuturePlayerPos ( ) const

◆ getFutureProjectionMatrix()

const m4f & DirectionalLight::getFutureProjectionMatrix ( ) const

References future_frustum, and shadowFrustum::ProjOrthMat.

Referenced by ShadowRenderer::renderShadowMap().

+ Here is the caller graph for this function:

◆ getFutureViewMatrix()

const m4f & DirectionalLight::getFutureViewMatrix ( ) const

References future_frustum, and shadowFrustum::ViewMat.

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 update_frustum().

+ Here is the caller graph for this function:

◆ getPlayerPos()

v3f DirectionalLight::getPlayerPos ( ) const

◆ getPosition()

v3f DirectionalLight::getPosition ( ) const

References shadowFrustum::position, and shadow_frustum.

Referenced by update_frustum().

+ Here is the caller graph for this function:

◆ getProjectionMatrix()

const m4f & DirectionalLight::getProjectionMatrix ( ) const

References shadowFrustum::ProjOrthMat, and 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, and shadowFrustum::ViewMat.

Referenced by ShadowRenderer::renderShadowObjects().

+ Here is the caller graph for this function:

◆ getViewProjMatrix()

m4f DirectionalLight::getViewProjMatrix ( )

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

◆ update_frustum()

void DirectionalLight::update_frustum ( const Camera * cam,
Client * client,
bool force = false )

References BS, shadowFrustum::camera_offset, createSplitMatrices(), dirty, future_frustum, Camera::getCameraNode(), getDirection(), getMaxFarValue(), Camera::getOffset(), getPosition(), intToFloat(), shadowFrustum::length, MYMIN, shadowFrustum::player, shadowFrustum::radius, shadow_frustum, should_update_map_shadow, shadowFrustum::ViewMat, shadowFrustum::zFar, and shadowFrustum::zNear.

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

Referenced by getLightColor(), and setLightColor().

◆ direction

v3f DirectionalLight::direction {0}
private

◆ dirty

bool DirectionalLight::dirty {false}
private

Referenced by commitFrustum(), and update_frustum().

◆ farPlane

f32 DirectionalLight::farPlane
private

Referenced by 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

Referenced by getMapResolution().

◆ pos

v3f DirectionalLight::pos
private

◆ shadow_frustum

◆ should_update_map_shadow

bool DirectionalLight::should_update_map_shadow {true}

Referenced by update_frustum().


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