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

#include <voxelization_pass.hpp>

Public Member Functions

 VoxelizationPass (ID3D11Device &device, ID3D11DeviceContext &device_context, StateManager &state_manager, ResourceManager &resource_manager)
 
 VoxelizationPass (const VoxelizationPass &pass)=delete
 
 VoxelizationPass (VoxelizationPass &&pass) noexcept
 
 ~VoxelizationPass ()
 
VoxelizationPassoperator= (const VoxelizationPass &pass)=delete
 
VoxelizationPassoperator= (VoxelizationPass &&pass) noexcept
 
void XM_CALLCONV Render (const World &world, FXMMATRIX world_to_projection, std::size_t resolution)
 

Private Member Functions

void SetupRasterizerState (ID3D11Device &device)
 
void SetupVoxelGrid (std::size_t resolution)
 
void BindFixedState () const noexcept
 
void XM_CALLCONV Render (const World &world, FXMMATRIX world_to_projection) const
 
void XM_CALLCONV Render (const Model &model, FXMMATRIX world_to_projection) const noexcept
 
void Dispatch () const noexcept
 

Private Attributes

std::reference_wrapper< ID3D11DeviceContext > m_device_context
 
std::reference_wrapper< StateManagerm_state_manager
 
std::reference_wrapper< ResourceManagerm_resource_manager
 
ComPtr< ID3D11RasterizerState2 > m_rs
 
VertexShaderPtr m_vs
 
GeometryShaderPtr m_gs
 
ComputeShaderPtr m_cs
 
UniquePtr< VoxelGridm_voxel_grid
 

Detailed Description

A class of voxelization passes for rendering models using a variable (material dependent) shading.

Constructor & Destructor Documentation

◆ VoxelizationPass() [1/3]

mage::rendering::VoxelizationPass::VoxelizationPass ( ID3D11Device &  device,
ID3D11DeviceContext &  device_context,
StateManager state_manager,
ResourceManager resource_manager 
)
explicit

Constructs a voxelization pass.

Parameters
[in,out]deviceA reference to the device.
[in,out]device_contextA reference to the device context.
[in,out]state_managerA reference to the state manager.
[in,out]resource_managerA reference to the resource manager.

◆ VoxelizationPass() [2/3]

mage::rendering::VoxelizationPass::VoxelizationPass ( const VoxelizationPass pass)
delete

Constructs a voxelization pass from the given voxelization pass.

Parameters
[in]passA reference to the voxelization pass to copy.

◆ VoxelizationPass() [3/3]

mage::rendering::VoxelizationPass::VoxelizationPass ( VoxelizationPass &&  pass)
defaultnoexcept

Constructs a voxelization pass by moving the given variable shading pass.

Parameters
[in]passA reference to the voxelization pass to move.

◆ ~VoxelizationPass()

mage::rendering::VoxelizationPass::~VoxelizationPass ( )
default

Destructs this voxelization pass.

Member Function Documentation

◆ BindFixedState()

void mage::rendering::VoxelizationPass::BindFixedState ( ) const
privatenoexcept

Binds the fixed state of this voxelization pass.

◆ Dispatch()

void mage::rendering::VoxelizationPass::Dispatch ( ) const
privatenoexcept

Dispatches this voxelization pass.

◆ operator=() [1/2]

VoxelizationPass& mage::rendering::VoxelizationPass::operator= ( const VoxelizationPass pass)
delete

Copies the given voxelization pass to this voxelization pass.

Parameters
[in]passA reference to the voxelization pass to copy.
Returns
A reference to the copy of the given voxelization pass (i.e. this voxelization pass).

◆ operator=() [2/2]

VoxelizationPass & mage::rendering::VoxelizationPass::operator= ( VoxelizationPass &&  pass)
defaultnoexcept

Moves the given voxelization pass to this voxelization pass.

Parameters
[in]passA reference to the voxelization pass to move.
Returns
A reference to the moved voxelization pass (i.e. this voxelization pass).

◆ Render() [1/3]

void XM_CALLCONV mage::rendering::VoxelizationPass::Render ( const World world,
FXMMATRIX  world_to_projection,
std::size_t  resolution 
)

Renders the world.

Parameters
[in]worldA reference to the world.
[in]world_to_projectionThe world-to-projection transformation matrix.
[in]resolutionThe resolution of the regular voxel grid.
Exceptions
ExceptionFailed to render the world.

◆ Render() [2/3]

void XM_CALLCONV mage::rendering::VoxelizationPass::Render ( const World world,
FXMMATRIX  world_to_projection 
) const
private

Renders the given world.

Parameters
[in]worldA reference to the world.
[in]world_to_projectionThe world-to-projection transformation matrix.
Exceptions
ExceptionFailed to render the world.

◆ Render() [3/3]

void XM_CALLCONV mage::rendering::VoxelizationPass::Render ( const Model model,
FXMMATRIX  world_to_projection 
) const
privatenoexcept

Renders the given model.

Parameters
[in]modelA reference to the model.
[in]world_to_projectionThe world-to-projection transformation matrix.

◆ SetupRasterizerState()

void mage::rendering::VoxelizationPass::SetupRasterizerState ( ID3D11Device &  device)
private

◆ SetupVoxelGrid()

void mage::rendering::VoxelizationPass::SetupVoxelGrid ( std::size_t  resolution)
private

Sets up the voxel grid of this voxelization pass.

Parameters
[in]resolutionThe resolution of the regular voxel grid.
Exceptions
ExceptionFailed to render the world.

Member Data Documentation

◆ m_cs

ComputeShaderPtr mage::rendering::VoxelizationPass::m_cs
private

A pointer to the compute shader of this voxelization pass.

◆ m_device_context

std::reference_wrapper< ID3D11DeviceContext > mage::rendering::VoxelizationPass::m_device_context
private

A reference to the device context of this voxelization pass.

◆ m_gs

GeometryShaderPtr mage::rendering::VoxelizationPass::m_gs
private

A pointer to the geometry shader of this voxelization pass.

◆ m_resource_manager

std::reference_wrapper< ResourceManager > mage::rendering::VoxelizationPass::m_resource_manager
private

A reference to the resource manager of this voxelization pass.

◆ m_rs

ComPtr< ID3D11RasterizerState2 > mage::rendering::VoxelizationPass::m_rs
private

A pointer to the rasterizer state of this voxelization pass.

◆ m_state_manager

std::reference_wrapper< StateManager > mage::rendering::VoxelizationPass::m_state_manager
private

A reference to the state manager of this voxelization pass.

◆ m_voxel_grid

UniquePtr< VoxelGrid > mage::rendering::VoxelizationPass::m_voxel_grid
private

The voxel grid of this voxelization pass.

◆ m_vs

VertexShaderPtr mage::rendering::VoxelizationPass::m_vs
private

A pointer to the vertex shader of this voxelization pass.