Castor3D 0.16.0
Multiplatform 3D engine
Classes | Public Member Functions | Protected Attributes | List of all members
castor3d::ComputeParticleSystem Class Reference

#include <ComputeParticleSystem.hpp>

Inheritance diagram for castor3d::ComputeParticleSystem:
Inheritance graph
[legend]
Collaboration diagram for castor3d::ComputeParticleSystem:
Collaboration graph
[legend]

Classes

struct  Configuration
 

Public Member Functions

C3D_API ComputeParticleSystem (ParticleSystem &parent)
 Constructor.
 
C3D_API bool initialise (RenderDevice const &device) override
 Initialises the implementation.
 
C3D_API void cleanup (RenderDevice const &device) override
 Cleans the implementation.
 
C3D_API void update (CpuUpdater &updater) override
 Updates the render pass, CPU wise.
 
C3D_API uint32_t update (GpuUpdater &updater) override
 Updates the render pass, CPU wise.
 
C3D_API void addParticleVariable (castor::String const &name, ParticleFormat type, castor::String const &defaultValue) override
 adds a particle variable.
 
C3D_API void setUpdateProgram (ShaderProgramRPtr program)
 Defines the program used to update the particles.
 
void setGroupSizes (castor::Point3i sizes)
 Defines the workgroup sizes, as defined inside the compute shader.
 
bool hasUpdateProgram () const
 
ShaderProgram const & getUpdateProgram () const
 
- Public Member Functions inherited from castor3d::ParticleSystemImpl
C3D_API ParticleSystemImpl (Type type, ParticleSystem &parent)
 Constructor.
 
virtual C3D_API ~ParticleSystemImpl () noexcept=default
 Destructor.
 
Type getType ()
 
ParticleSystem const & getParent () const
 

Protected Attributes

ParticleDeclaration m_inputs
 
ShaderProgramRPtr m_program {}
 
UniformBufferOffsetT< Configurationm_ubo
 
castor::Array< ashes::BufferPtr< uint8_t >, 2 > m_particlesStorages
 
ashes::BufferPtr< uint32_t > m_generatedCountBuffer
 
ashes::DescriptorSetLayoutPtr m_descriptorLayout
 
ashes::PipelineLayoutPtr m_pipelineLayout
 
ashes::ComputePipelinePtr m_pipeline
 
ashes::DescriptorSetPoolPtr m_descriptorPool
 
castor::Array< ashes::DescriptorSetPtr, 2u > m_descriptorSets
 
ashes::CommandBufferPtr m_commandBuffer
 
ashes::FencePtr m_fence
 
uint32_t m_particlesCount { 0u }
 
castor::Point3i m_worgGroupSizes { 128, 1, 1 }
 
uint32_t m_in { 0 }
 
uint32_t m_out { 1 }
 
- Protected Attributes inherited from castor3d::ParticleSystemImpl
ParticleSystemm_parent
 
Type m_type
 

Additional Inherited Members

- Public Types inherited from castor3d::ParticleSystemImpl
enum class  Type { eCpu = 0 , eComputeShader = 1 , eCount , eMin = eCpu }
 Particle system implementation types enumeration. More...
 

Constructor & Destructor Documentation

◆ ComputeParticleSystem()

C3D_API castor3d::ComputeParticleSystem::ComputeParticleSystem ( ParticleSystem & parent)
explicit

Constructor.

Parameters
[in]parentThe parent particle system.

Member Function Documentation

◆ addParticleVariable()

C3D_API void castor3d::ComputeParticleSystem::addParticleVariable ( castor::String const & name,
ParticleFormat type,
castor::String const & defaultValue )
overridevirtual

adds a particle variable.

Parameters
[in]nameThe variable name.
[in]typeThe variable type.
[in]defaultValueThe variable default value.

Implements castor3d::ParticleSystemImpl.

◆ cleanup()

C3D_API void castor3d::ComputeParticleSystem::cleanup ( RenderDevice const & device)
overridevirtual

Cleans the implementation.

Parameters
deviceThe current device.

Implements castor3d::ParticleSystemImpl.

◆ getUpdateProgram()

ShaderProgram const & castor3d::ComputeParticleSystem::getUpdateProgram ( ) const
inline
Returns
The update program.

References m_program.

◆ hasUpdateProgram()

bool castor3d::ComputeParticleSystem::hasUpdateProgram ( ) const
inline
Returns
false if the update program has not been set.

References m_program.

◆ initialise()

C3D_API bool castor3d::ComputeParticleSystem::initialise ( RenderDevice const & device)
overridevirtual

Initialises the implementation.

Parameters
deviceThe current device.
Returns
true if all is OK.

Implements castor3d::ParticleSystemImpl.

◆ setGroupSizes()

void castor3d::ComputeParticleSystem::setGroupSizes ( castor::Point3i sizes)
inline

Defines the workgroup sizes, as defined inside the compute shader.

Parameters
[in]sizesThe sizes.

References m_worgGroupSizes.

◆ setUpdateProgram()

C3D_API void castor3d::ComputeParticleSystem::setUpdateProgram ( ShaderProgramRPtr program)

Defines the program used to update the particles.

Parameters
[in]programThe shader program.

◆ update() [1/2]

C3D_API void castor3d::ComputeParticleSystem::update ( CpuUpdater & updater)
overridevirtual

Updates the render pass, CPU wise.

Parameters
[in,out]updaterThe update data.

Implements castor3d::ParticleSystemImpl.

◆ update() [2/2]

C3D_API uint32_t castor3d::ComputeParticleSystem::update ( GpuUpdater & updater)
overridevirtual

Updates the render pass, CPU wise.

Parameters
[in,out]updaterThe update data.

Implements castor3d::ParticleSystemImpl.

Member Data Documentation

◆ m_commandBuffer

ashes::CommandBufferPtr castor3d::ComputeParticleSystem::m_commandBuffer
protected

◆ m_descriptorLayout

ashes::DescriptorSetLayoutPtr castor3d::ComputeParticleSystem::m_descriptorLayout
protected

◆ m_descriptorPool

ashes::DescriptorSetPoolPtr castor3d::ComputeParticleSystem::m_descriptorPool
protected

◆ m_descriptorSets

castor::Array< ashes::DescriptorSetPtr, 2u > castor3d::ComputeParticleSystem::m_descriptorSets
protected

◆ m_fence

ashes::FencePtr castor3d::ComputeParticleSystem::m_fence
protected

◆ m_generatedCountBuffer

ashes::BufferPtr< uint32_t > castor3d::ComputeParticleSystem::m_generatedCountBuffer
protected

◆ m_in

uint32_t castor3d::ComputeParticleSystem::m_in { 0 }
protected

◆ m_inputs

ParticleDeclaration castor3d::ComputeParticleSystem::m_inputs
protected

◆ m_out

uint32_t castor3d::ComputeParticleSystem::m_out { 1 }
protected

◆ m_particlesCount

uint32_t castor3d::ComputeParticleSystem::m_particlesCount { 0u }
protected

◆ m_particlesStorages

castor::Array< ashes::BufferPtr< uint8_t >, 2 > castor3d::ComputeParticleSystem::m_particlesStorages
protected

◆ m_pipeline

ashes::ComputePipelinePtr castor3d::ComputeParticleSystem::m_pipeline
protected

◆ m_pipelineLayout

ashes::PipelineLayoutPtr castor3d::ComputeParticleSystem::m_pipelineLayout
protected

◆ m_program

ShaderProgramRPtr castor3d::ComputeParticleSystem::m_program {}
protected

◆ m_ubo

UniformBufferOffsetT< Configuration > castor3d::ComputeParticleSystem::m_ubo
protected

◆ m_worgGroupSizes

castor::Point3i castor3d::ComputeParticleSystem::m_worgGroupSizes { 128, 1, 1 }
protected

Referenced by setGroupSizes().


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