Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::ShadowPass Class Reference

Renders a depth-only shadow map from the scene's directional light. More...

#include <ShadowPass.h>

Public Member Functions

FRAMEWORK_API void Init ()
 Allocates the shadow map and associated GPU resources at the default resolution.
FRAMEWORK_API void Shutdown ()
 Releases all GPU resources owned by this pass.
FRAMEWORK_API bool Execute (Ref< Scene > scene, const std::vector< StaticMeshSubmission > &meshes)
 Builds the light-space matrix and renders all opaque meshes into the shadow map.
FRAMEWORK_API void RequestResize (u32 newSize)
 Schedules a shadow map resolution change for the next frame boundary.
Ref< Image2DGetShadowMap () const
 Returns the shadow depth map produced by this pass.
Ref< UniformBufferGetLightSpaceUBO () const
 Returns the light-space matrix UBO consumed by GeometryPass.
ShadowSettingsGetSettings ()
 Returns a mutable reference to the shadow configuration.
bool ShouldRecreate () const
 Returns true if dependent passes must recreate resources this frame.
void ResetRecreateState ()
 Clears the recreate flag after dependent passes have been rebuilt.
template<typename... Args>
void UpdateInput (Args &&... args)
 Updates a named input binding and rebakes the render pass descriptor set.

Detailed Description

Renders a depth-only shadow map from the scene's directional light.

The light-space matrix is derived from the directional light component's azimuth and elevation each frame. The resulting shadow map is consumed by GeometryPass for PCF shadow sampling.

Shadow map resolution can be changed at runtime via RequestResize; the actual GPU resource recreation is deferred to the next frame boundary and signalled to SceneRenderer via ShouldRecreate.

Member Function Documentation

◆ Execute()

bool Raven::ShadowPass::Execute ( Ref< Scene > scene,
const std::vector< StaticMeshSubmission > & meshes )

Builds the light-space matrix and renders all opaque meshes into the shadow map.

Parameters
sceneActive scene, queried for the directional light component.
meshesStatic mesh submissions to shadow-cast.
Returns
true if a directional light was found and the pass executed; false otherwise.

◆ GetLightSpaceUBO()

Ref< UniformBuffer > Raven::ShadowPass::GetLightSpaceUBO ( ) const
inline

Returns the light-space matrix UBO consumed by GeometryPass.

◆ GetSettings()

ShadowSettings & Raven::ShadowPass::GetSettings ( )
inline

Returns a mutable reference to the shadow configuration.

◆ GetShadowMap()

Ref< Image2D > Raven::ShadowPass::GetShadowMap ( ) const
inline

Returns the shadow depth map produced by this pass.

◆ Init()

void Raven::ShadowPass::Init ( )

Allocates the shadow map and associated GPU resources at the default resolution.

◆ RequestResize()

void Raven::ShadowPass::RequestResize ( u32 newSize)

Schedules a shadow map resolution change for the next frame boundary.

Sets ShouldRecreate to true so SceneRenderer can recreate dependent passes (e.g. GeometryPass) before Execute runs again.

Parameters
newSizeNew shadow map resolution in pixels (square).

◆ ResetRecreateState()

void Raven::ShadowPass::ResetRecreateState ( )
inline

Clears the recreate flag after dependent passes have been rebuilt.

◆ ShouldRecreate()

bool Raven::ShadowPass::ShouldRecreate ( ) const
inline

Returns true if dependent passes must recreate resources this frame.

◆ Shutdown()

void Raven::ShadowPass::Shutdown ( )

Releases all GPU resources owned by this pass.

◆ UpdateInput()

template<typename... Args>
void Raven::ShadowPass::UpdateInput ( Args &&... args)
inline

Updates a named input binding and rebakes the render pass descriptor set.

Template Parameters
ArgsForwarded to RenderPass::SetInput.

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