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

#include <ParticleSystem.hpp>

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

Public Member Functions

C3D_API ParticleSystem (castor::String const &name, Scene &scene, SceneNode &parent, uint32_t count)
 Constructor.
 
C3D_API bool initialise (RenderDevice const &device)
 Initialises GPU side elements.
 
C3D_API void cleanup (RenderDevice const &device)
 Cleans GPU side elements up.
 
C3D_API void update (CpuUpdater &updater)
 CPU Update.
 
C3D_API void update (GpuUpdater &updater)
 GPU Update.
 
C3D_API void setMaterial (MaterialObs value)
 Sets the material.
 
C3D_API void setDimensions (castor::Point2f const &value)
 Sets the particles dimensions.
 
C3D_API void setParticleType (castor::String const &value)
 Sets the particles type name.
 
C3D_API MaterialObs getMaterial () const
 
C3D_API castor::Point2f const & getDimensions () const
 
C3D_API void addParticleVariable (castor::String const &name, ParticleFormat type, castor::String const &defaultValue)
 adds a particle variable.
 
C3D_API void setCSUpdateProgram (ShaderProgramRPtr program)
 Defines the program used to update the particles through compute shader.
 
C3D_API void setCSGroupSizes (castor::Point3i sizes)
 Defines the workgroup sizes, as defined inside the compute shader.
 
C3D_API uint32_t getParticlesCount () const
 
C3D_API uint32_t getMaxParticlesCount () const
 
BillboardBaseRPtr getBillboards () const
 
castor::StrStrMap const & getDefaultValues () const
 
castor::String const & getParticleType () const
 
ParticleDeclaration const & getParticleVariables () const
 
ComputeParticleSystem const & getCompute () const
 
- Public Member Functions inherited from castor3d::MovableObject
C3D_API MovableObject (castor::String const &name, Scene &scene, MovableType type, SceneNode &node)
 Constructor.
 
C3D_API MovableObject (castor::String const &name, Scene &scene, MovableType type)
 Constructor.
 
virtual C3D_API ~MovableObject () noexcept
 Destructor.
 
C3D_API void detach ()
 Detaches the movable object from it's parent.
 
virtual C3D_API void attachTo (SceneNode &node)
 Attaches the movable object to a node.
 
C3D_API void markDirty ()
 Adds the object to dirty object list in the scene.
 
C3D_API EngineRPtr getEngine () const noexcept
 
SceneNodegetParent () const noexcept
 
MovableType getMovableType () const noexcept
 
- Public Member Functions inherited from castor::OwnedBy< Scene >
Scene * getOwner () const
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Protected Attributes

castor::String m_particleType
 
castor::StrStrMap m_defaultValues
 
ParticleDeclaration m_inputs
 
BillboardBaseUPtr m_particlesBillboard
 
castor::Point2f m_dimensions
 
MaterialObs m_material
 
uint32_t m_particlesCount { 0u }
 
uint32_t m_activeParticlesCount { 0u }
 
castor::PreciseTimer m_timer
 
bool m_firstUpdate { true }
 
castor::Milliseconds m_time { 0 }
 
castor::Milliseconds m_totalTime { 0 }
 
CpuParticleSystemUPtr m_cpuImpl
 
ComputeParticleSystemUPtr m_csImpl
 
ParticleSystemImplm_impl { nullptr }
 
- Protected Attributes inherited from castor3d::MovableObject
MovableType m_type
 
SceneNodem_sceneNode {}
 
OnSceneNodeChangedConnection m_notifyIndex
 
- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Additional Inherited Members

- Protected Member Functions inherited from castor::OwnedBy< Scene >
 OwnedBy (Scene &owner)
 Constructor.
 

Constructor & Destructor Documentation

◆ ParticleSystem()

C3D_API castor3d::ParticleSystem::ParticleSystem ( castor::String const & name,
Scene & scene,
SceneNode & parent,
uint32_t count )

Constructor.

Parameters
[in]nameThe name.
[in]sceneThe parent scene.
[in]parentThe parent scene node.
[in]countThe particles count.

Member Function Documentation

◆ addParticleVariable()

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

adds a particle variable.

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

◆ cleanup()

C3D_API void castor3d::ParticleSystem::cleanup ( RenderDevice const & device)

Cleans GPU side elements up.

Parameters
[in]deviceThe GPU device.

◆ getBillboards()

BillboardBaseRPtr castor3d::ParticleSystem::getBillboards ( ) const
inline
Returns
The billboards.

References m_particlesBillboard.

◆ getCompute()

ComputeParticleSystem const & castor3d::ParticleSystem::getCompute ( ) const
inline
Returns
The compute shader based implementation.

References m_csImpl.

◆ getDefaultValues()

castor::StrStrMap const & castor3d::ParticleSystem::getDefaultValues ( ) const
inline
Returns
The particle's components default values.

References m_defaultValues.

◆ getDimensions()

C3D_API castor::Point2f const & castor3d::ParticleSystem::getDimensions ( ) const
Returns
The billboards dimensions.

◆ getMaterial()

C3D_API MaterialObs castor3d::ParticleSystem::getMaterial ( ) const
Returns
The material.

◆ getMaxParticlesCount()

C3D_API uint32_t castor3d::ParticleSystem::getMaxParticlesCount ( ) const
inline
Returns
The maximum particles count.

References m_particlesCount.

◆ getParticlesCount()

C3D_API uint32_t castor3d::ParticleSystem::getParticlesCount ( ) const
inline
Returns
The particles written at last update.

References m_activeParticlesCount.

◆ getParticleType()

castor::String const & castor3d::ParticleSystem::getParticleType ( ) const
inline
Returns
The particles type name.

References m_particleType.

◆ getParticleVariables()

ParticleDeclaration const & castor3d::ParticleSystem::getParticleVariables ( ) const
inline
Returns
The particles variables.

References m_inputs.

◆ initialise()

C3D_API bool castor3d::ParticleSystem::initialise ( RenderDevice const & device)

Initialises GPU side elements.

Parameters
[in]deviceThe GPU device.
Returns
true if all is OK.

◆ setCSGroupSizes()

C3D_API void castor3d::ParticleSystem::setCSGroupSizes ( castor::Point3i sizes)

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

Parameters
[in]sizesThe sizes.

◆ setCSUpdateProgram()

C3D_API void castor3d::ParticleSystem::setCSUpdateProgram ( ShaderProgramRPtr program)

Defines the program used to update the particles through compute shader.

Parameters
[in]programThe program.

◆ setDimensions()

C3D_API void castor3d::ParticleSystem::setDimensions ( castor::Point2f const & value)

Sets the particles dimensions.

Parameters
[in]valueThe new value.

◆ setMaterial()

C3D_API void castor3d::ParticleSystem::setMaterial ( MaterialObs value)

Sets the material.

Parameters
[in]valueThe new value

◆ setParticleType()

C3D_API void castor3d::ParticleSystem::setParticleType ( castor::String const & value)

Sets the particles type name.

Parameters
[in]valueThe new value.

◆ update() [1/2]

C3D_API void castor3d::ParticleSystem::update ( CpuUpdater & updater)

CPU Update.

Parameters
[in,out]updaterThe update data.

◆ update() [2/2]

C3D_API void castor3d::ParticleSystem::update ( GpuUpdater & updater)

GPU Update.

Parameters
[in,out]updaterThe update data.

Member Data Documentation

◆ m_activeParticlesCount

uint32_t castor3d::ParticleSystem::m_activeParticlesCount { 0u }
protected

The active particles count.

Referenced by getParticlesCount().

◆ m_cpuImpl

CpuParticleSystemUPtr castor3d::ParticleSystem::m_cpuImpl
protected

The CPU implementation.

◆ m_csImpl

ComputeParticleSystemUPtr castor3d::ParticleSystem::m_csImpl
protected

The implementation using compute shader.

Referenced by getCompute().

◆ m_defaultValues

castor::StrStrMap castor3d::ParticleSystem::m_defaultValues
protected

The map of default value per variable name.

Referenced by getDefaultValues().

◆ m_dimensions

castor::Point2f castor3d::ParticleSystem::m_dimensions
protected

The billboards dimensions.

◆ m_firstUpdate

bool castor3d::ParticleSystem::m_firstUpdate { true }
protected

Tells that the next update is the first one.

◆ m_impl

ParticleSystemImpl* castor3d::ParticleSystem::m_impl { nullptr }
protected

The implementation chosen after initialisation.

◆ m_inputs

ParticleDeclaration castor3d::ParticleSystem::m_inputs
protected

The particle elements description.

Referenced by getParticleVariables().

◆ m_material

MaterialObs castor3d::ParticleSystem::m_material
protected

The Material.

◆ m_particlesBillboard

BillboardBaseUPtr castor3d::ParticleSystem::m_particlesBillboard
protected

The billboards containing the particles.

Referenced by getBillboards().

◆ m_particlesCount

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

The particles count.

Referenced by getMaxParticlesCount().

◆ m_particleType

castor::String castor3d::ParticleSystem::m_particleType
protected

The particles type name.

Referenced by getParticleType().

◆ m_time

castor::Milliseconds castor3d::ParticleSystem::m_time { 0 }
protected

The time elapsed since last frame.

◆ m_timer

castor::PreciseTimer castor3d::ParticleSystem::m_timer
protected

The timer, for the particles update.

◆ m_totalTime

castor::Milliseconds castor3d::ParticleSystem::m_totalTime { 0 }
protected

The total elapsed time.


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