Lysa  0.0
Lysa 3D Engine
ShadowMapPass Class Reference

Detailed Description

Render pass for generating shadow maps

+ Inheritance diagram for ShadowMapPass:

Public Member Functions

 ShadowMapPass (const Light *light, const DeviceMemoryArray &meshInstancesDataArray, size_t maxMeshSurfacePerPipeline)
 
void compute (vireo::CommandList &commandList, const std::unordered_map< uint32, std::unique_ptr< GraphicPipelineData >> &pipelinesData) const
 
void updatePipelines (const std::unordered_map< pipeline_id, std::vector< unique_id >> &pipelineIds)
 
void setCurrentCamera (const Camera &camera)
 
void update (uint32 frameIndex) override
 
void render (vireo::CommandList &commandList, const SceneFrameData &scene)
 
auto getShadowMapCount () const
 
auto getShadowMap (const uint32 index) const
 
auto getTransparencyColorMap (const uint32 index) const
 
const auto & getLightSpace (const uint32 index) const
 
auto getCascadeSplitDepth (const uint32 index) const
 
- Public Member Functions inherited from Renderpass
 Renderpass (const RendererConfiguration &config, const std::string &name)
 
virtual void resize (const vireo::Extent &extent, const std::shared_ptr< vireo::CommandList > &commandList)
 
virtual ~Renderpass () = default
 
 Renderpass (Renderpass &) = delete
 
Renderpass & operator= (Renderpass &) = delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Renderpass
static void destroyShaderModules ()
 
- Protected Member Functions inherited from Renderpass
std::shared_ptr< vireo::ShaderModule > loadShader (const std::string &shaderName) const
 
void init (vireo::GraphicPipelineConfiguration &pipelineConfig, vireo::RenderingConfiguration &renderingConfig, const std::shared_ptr< vireo::DescriptorLayout > &descriptorLayout, bool withStencil)
 
void init (vireo::GraphicPipelineConfiguration &pipelineConfig, vireo::RenderingConfiguration &renderingConfig, bool withStencil) const
 
void initRendering (vireo::CommandList &commandList, const std::shared_ptr< vireo::Image > &image, const std::shared_ptr< vireo::GraphicPipeline > &pipeline, const std::shared_ptr< vireo::DescriptorSet > &sceneDescriptorSet, const std::shared_ptr< vireo::DescriptorSet > &descriptorSet)
 
- Protected Attributes inherited from Renderpass
const std::string name
 
const RendererConfigurationconfig
 
- Static Protected Attributes inherited from Renderpass
static std::mutex shaderModulesMutex
 
static std::unordered_map< std::string, std::shared_ptr< vireo::ShaderModule > > shaderModules
 

Constructor & Destructor Documentation

ShadowMapPass ( const Light light,
const DeviceMemoryArray meshInstancesDataArray,
size_t  maxMeshSurfacePerPipeline 
)

Constructs a ShadowMapPass

Parameters
lightPointer to the light source for which shadows are generated
meshInstancesDataArrayArray of mesh instance data in device memory
maxMeshSurfacePerPipelineMaximum number of mesh surfaces per pipeline

Member Function Documentation

void compute ( vireo::CommandList &  commandList,
const std::unordered_map< uint32, std::unique_ptr< GraphicPipelineData >> &  pipelinesData 
) const

Computes frustum culling for shadow map generation

Parameters
commandListThe command list to record compute commands into
pipelinesDataMap of pipeline data for mesh rendering
auto getCascadeSplitDepth ( const uint32  index) const
inline

Gets the cascade split depth for a shadow map

Parameters
indexIndex of the shadow map
Returns
The split depth
const auto& getLightSpace ( const uint32  index) const
inline

Gets the light space matrix for a shadow map

Parameters
indexIndex of the shadow map
Returns
The light space matrix
auto getShadowMap ( const uint32  index) const
inline

Gets a shadow map render target

Parameters
indexIndex of the shadow map
Returns
A shared pointer to the shadow map render target
auto getShadowMapCount ( ) const
inline

Gets the number of shadow maps (subpasses)

Returns
The number of shadow maps
auto getTransparencyColorMap ( const uint32  index) const
inline

Gets a transparency color map render target

Parameters
indexIndex of the shadow map
Returns
A shared pointer to the transparency color map render target
void render ( vireo::CommandList &  commandList,
const SceneFrameData scene 
)

Renders the shadow maps

Parameters
commandListThe command list to record rendering commands into
sceneThe scene frame data
void setCurrentCamera ( const Camera camera)
inline

Sets the current camera for cascaded shadow maps calculation

Parameters
cameraReference to the current camera
void update ( uint32  frameIndex)
overridevirtual

Update any per-frame state (default: no-op).

Reimplemented from lysa::Renderpass::update()

void updatePipelines ( const std::unordered_map< pipeline_id, std::vector< unique_id >> &  pipelineIds)

Updates the graphics pipelines based on active pipeline IDs

Parameters
pipelineIdsMap of pipeline IDs to unique object IDs