Rebel Fork Framework
Urho3D::ParticleGraphLayerInstance Class Reference

Instance of particle graph layer in emitter. More...

#include <Urho3D/Particles/ParticleGraphLayerInstance.h>

Public Member Functions

 ParticleGraphLayerInstance ()
 Construct.
 
 ~ParticleGraphLayerInstance ()
 Destruct.
 
void Apply (const SharedPtr< ParticleGraphLayer > &layer)
 Apply layer settings to the layer instance.
 
unsigned GetNumActiveParticles () const
 Return number of active particles.
 
void RemoveAllParticles ()
 Remove all current particles.
 
bool EmitNewParticles (float numParticles=1.0f)
 Create a new particles. Return true if there was room.
 
void Update (float timeStep, bool emitting)
 Run update step.
 
unsigned GetNumAttributes () const
 Get number of attributes.
 
template<typename T >
SparseSpan< T > GetAttributeValues (unsigned attributeIndex)
 Get attribute values.
 
template<typename ValueType >
SparseSpan< ValueType > GetSparse (unsigned attributeIndex, const ea::span< unsigned > &indices)
 
template<typename ValueType >
SparseSpan< ValueType > GetScalar (unsigned pinIndex)
 
template<typename ValueType >
SparseSpan< ValueType > GetSpan (unsigned pinIndex)
 
ParticleGraphEmitter * GetEmitter () const
 Get emitter.
 
void MarkForDeletion (unsigned particleIndex)
 Mark a particle for deletion.
 
unsigned GetUniformIndex (const StringHash &string_hash, VariantType variant)
 Get uniform index. Creates new uniform slot on demand.
 
Variant & GetUniform (unsigned index)
 Get uniform variant by index.
 
void Reset ()
 
void UpdateDrawables ()
 Update all drawable attributes. Executed by ParticleGraphEmitter.
 
ParticleGraphLayer * GetLayer () const
 Get effect layer.
 

Protected Member Functions

void OnSceneSet (Scene *scene)
 Handle scene change in instance.
 
void SetEmitter (ParticleGraphEmitter *emitter)
 Set emitter reference.
 
UpdateContext MakeUpdateContext (float timeStep)
 Initialize update context.
 
void RunGraph (ea::span< ParticleGraphNodeInstance * > &nodes, UpdateContext &updateContext)
 Run graph.
 
void DestroyParticles ()
 Destroy particles.
 
ea::span< uint8_t > InitNodeInstances (ea::span< uint8_t > nodeInstanceBuffer, ea::span< ParticleGraphNodeInstance * > &nodeInstances, const ParticleGraph &particle_graph)
 

Private Attributes

float emitCounterReminder_ {}
 Emit counter reminder. When reminder value get over 1 the layer emits particle.
 
ea::vector< uint8_t > attributes_
 Memory used to store all layer related arrays: nodes, indices, attributes.
 
ea::vector< uint8_t > temp_
 
ea::span< ParticleGraphNodeInstance * > emitNodeInstances_
 Node instances for emit graph.
 
ea::span< ParticleGraphNodeInstance * > initNodeInstances_
 Node instances for initialization graph.
 
ea::span< ParticleGraphNodeInstance * > updateNodeInstances_
 Node instances for update graph.
 
ea::span< unsigned > indices_
 All indices of the particle system.
 
ea::span< unsigned > scalarIndices_
 All indices set to 0.
 
ea::span< unsigned > naturalIndices_
 All indices going in natural order (0, 1, ...).
 
ea::span< unsigned > destructionQueue_
 Particle indices to be removed.
 
unsigned destructionQueueSize_
 Number of particles to destroy at end of the frame.
 
unsigned activeParticles_
 Number of active particles.
 
SharedPtr< ParticleGraphLayer > layer_
 Reference to layer.
 
ParticleGraphEmitter * emitter_ {}
 Emitter that owns the layer instance.
 
float time_ {}
 Time since emitter start.
 

Friends

class ParticleGraphEmitter
 

Detailed Description

Instance of particle graph layer in emitter.

Member Function Documentation

◆ Reset()

void Urho3D::ParticleGraphLayerInstance::Reset ( )

Reset the particle emitter layer completely. Removes current particles, sets emitting state on, and resets the emission timer.

Member Data Documentation

◆ temp_

ea::vector<uint8_t> Urho3D::ParticleGraphLayerInstance::temp_
private

Temp memory needed for graph calculation. TODO: Should be replaced with memory pool as it could be shared between multiple emitter instances.


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