Lysa  0.0
Lysa 3D Engine
FrustumCulling Class Reference

Detailed Description

Performs frustum culling on a list of mesh instances using a compute shader.

Public Member Functions

 FrustumCulling (bool isForScene, const DeviceMemoryArray &meshInstancesArray, pipeline_id pipelineId)
 
void dispatch (vireo::CommandList &commandList, uint32 drawCommandsCount, const float4x4 &view, const float4x4 &projection, const vireo::Buffer &instances, const vireo::Buffer &input, const vireo::Buffer &output, const vireo::Buffer &counter)
 
uint32 getDrawCommandsCount () const
 
virtual ~FrustumCulling () = default
 
 FrustumCulling (FrustumCulling &) = delete
 
FrustumCulling & operator= (FrustumCulling &) = delete
 

Static Public Member Functions

static void cleanup ()
 

Constructor & Destructor Documentation

FrustumCulling ( bool  isForScene,
const DeviceMemoryArray meshInstancesArray,
pipeline_id  pipelineId 
)

Constructs a new FrustumCulling pipeline.

Parameters
isForSceneTrue if the culling is for a scene, false for shadow maps.
meshInstancesArrayThe array containing all mesh instance data.
pipelineIdThe attached material pipeline id
virtual ~FrustumCulling ( )
virtualdefault
FrustumCulling ( FrustumCulling &  )
delete

Member Function Documentation

static void cleanup ( )
static

Cleans up global resources shared by all FrustumCulling instances.

void dispatch ( vireo::CommandList &  commandList,
uint32  drawCommandsCount,
const float4x4 &  view,
const float4x4 &  projection,
const vireo::Buffer &  instances,
const vireo::Buffer &  input,
const vireo::Buffer &  output,
const vireo::Buffer &  counter 
)

Dispatches the frustum culling compute shader.

Parameters
commandListThe command list to record the dispatch command into.
drawCommandsCountThe total number of draw commands to process.
viewThe camera view matrix.
projectionThe camera projection matrix.
instancesThe buffer containing the instances to cull.
inputThe buffer containing the input indirect draw commands.
outputThe buffer where the visible indirect draw commands will be written.
counterThe buffer containing the counter for the number of visible instances.
uint32 getDrawCommandsCount ( ) const

Gets the number of instances that passed the frustum culling.

Returns
The count of visible instances.
FrustumCulling& operator= ( FrustumCulling &  )
delete