Class EmitterSimulator
A class that manages a single particle emitter simulator.
Namespace: Evergine.Framework.Particles
Assembly: Evergine.Framework.dll
Syntax
public abstract class EmitterSimulator
Constructors
EmitterSimulator(ParticlesComponent, ParticlesEmitter)
Initializes a new instance of the EmitterSimulator class.
Declaration
public EmitterSimulator(ParticlesComponent component, ParticlesEmitter emitter)
Parameters
| Type | Name | Description |
|---|---|---|
| ParticlesComponent | component | The particle system component. |
| ParticlesEmitter | emitter | The particle emitter. |
Fields
assets
The asset scene manager.
Declaration
protected AssetSceneManager assets
Field Value
| Type | Description |
|---|---|
| AssetSceneManager |
clock
The application clock.
Declaration
protected Clock clock
Field Value
| Type | Description |
|---|---|
| Clock |
deadParticles
The number of dead particles in this frame.
Declaration
protected uint deadParticles
Field Value
| Type | Description |
|---|---|
| uint |
description
Describes the particle system.
Declaration
protected ParticleEmitterDescription description
Field Value
| Type | Description |
|---|---|
| ParticleEmitterDescription |
emitter
The emitter from the asset.
Declaration
protected ParticlesEmitter emitter
Field Value
| Type | Description |
|---|---|
| ParticlesEmitter |
forceComputeDictionary
The dictionary of computed forces.
Declaration
protected Dictionary<BaseForce, ComputeTaskDecorator> forceComputeDictionary
Field Value
| Type | Description |
|---|---|
| Dictionary<BaseForce, ComputeTaskDecorator> |
forceMask
The force mask.
Declaration
protected List<uint> forceMask
Field Value
| Type | Description |
|---|---|
| List<uint> |
forcesDirty
Indicates whether the force values are outdated.
Declaration
protected bool forcesDirty
Field Value
| Type | Description |
|---|---|
| bool |
forcesList
The list of forces.
Declaration
protected List<BaseForce> forcesList
Field Value
| Type | Description |
|---|---|
| List<BaseForce> |
graphicsContext
The graphical content.
Declaration
protected GraphicsContext graphicsContext
Field Value
| Type | Description |
|---|---|
| GraphicsContext |
initColorLineal
The initial color value.
Declaration
protected Vector4 initColorLineal
Field Value
| Type | Description |
|---|---|
| Vector4 |
initColorLineal2
The initial color value.
Declaration
protected Vector4 initColorLineal2
Field Value
| Type | Description |
|---|---|
| Vector4 |
invNoiseSize
The inverse of the noise size.
Declaration
protected float invNoiseSize
Field Value
| Type | Description |
|---|---|
| float |
isRefreshingResources
Indicates if the particle system is refreshing resources.
Declaration
protected bool isRefreshingResources
Field Value
| Type | Description |
|---|---|
| bool |
isSizeDirty
Indicates if the particle size is dirty.
Declaration
protected bool isSizeDirty
Field Value
| Type | Description |
|---|---|
| bool |
lifeFactor
The life factor.
Declaration
protected float lifeFactor
Field Value
| Type | Description |
|---|---|
| float |
materialDirectivesDirty
Determines if we need to update the material directives.
Declaration
protected bool materialDirectivesDirty
Field Value
| Type | Description |
|---|---|
| bool |
maxParticles
The maximum number of particles.
Declaration
protected uint maxParticles
Field Value
| Type | Description |
|---|---|
| uint |
mesh
The particle system's mesh.
Declaration
protected Mesh mesh
Field Value
| Type | Description |
|---|---|
| Mesh |
mustResetData
Whether the data must be reset.
Declaration
protected bool mustResetData
Field Value
| Type | Description |
|---|---|
| bool |
newParticles
The number of new particles to be emitted in this frame.
Declaration
protected uint newParticles
Field Value
| Type | Description |
|---|---|
| uint |
particleBufferA
The particle buffer.
Declaration
protected Buffer particleBufferA
Field Value
| Type | Description |
|---|---|
| Buffer |
particleBufferQuad
The quad buffer for the particles.
Declaration
protected Buffer particleBufferQuad
Field Value
| Type | Description |
|---|---|
| Buffer |
particlesComponent
The particle system component.
Declaration
protected ParticlesComponent particlesComponent
Field Value
| Type | Description |
|---|---|
| ParticlesComponent |
particlesManager
The particle manager.
Declaration
protected ParticlesManager particlesManager
Field Value
| Type | Description |
|---|---|
| ParticlesManager |
propertiesDirty
Indicates if the properties of the emitter have changed.
Declaration
protected bool propertiesDirty
Field Value
| Type | Description |
|---|---|
| bool |
renderManager
The Render Manager.
Declaration
protected BaseRenderManager renderManager
Field Value
| Type | Description |
|---|---|
| BaseRenderManager |
timeFactor
The time factor.
Declaration
protected float timeFactor
Field Value
| Type | Description |
|---|---|
| float |
Properties
Component
Gets the particle component.
Declaration
public ParticlesComponent Component { get; }
Property Value
| Type | Description |
|---|---|
| ParticlesComponent |
ComputeResolved
Gets a value indicating whether the emitter is using a compute shader.
Declaration
public abstract bool ComputeResolved { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Info
Gets the particle system emitter.
Declaration
public ParticlesEmitter Info { get; }
Property Value
| Type | Description |
|---|---|
| ParticlesEmitter |
IsEmitting
Gets a value indicating whether the particle system is emitting.
Declaration
public bool IsEmitting { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsInitialized
Gets a value indicating whether the emitter has been initialized.
Declaration
public bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsSimulating
Gets a value indicating whether the particle system is emitting particles this frame or has some alive particles.
Declaration
public bool IsSimulating { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Material
Gets the particle material.
Declaration
public ParticlesEffect Material { get; }
Property Value
| Type | Description |
|---|---|
| ParticlesEffect |
Mesh
Gets or sets the particle mesh.
Declaration
public Mesh Mesh { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Mesh |
Methods
BaseUnitialize()
Uninitializes the emitter.
Declaration
public void BaseUnitialize()
ClearResources()
Clears the emitter's resources.
Declaration
protected abstract void ClearResources()
CreateResources()
Creates the emitter's resources.
Declaration
protected abstract void CreateResources()
Initialize(ParticlesManager, RenderManager, AssetSceneManager)
Initializes the emitter.
Declaration
public void Initialize(ParticlesManager particlesManager, RenderManager renderManager, AssetSceneManager assets)
Parameters
| Type | Name | Description |
|---|---|---|
| ParticlesManager | particlesManager | The particles manager. |
| RenderManager | renderManager | The render manager. |
| AssetSceneManager | assets | The assets manager. |
RefreshCounters()
Refreshes all the counters that the emitter may have.
Declaration
protected abstract void RefreshCounters()
RefreshParticles()
Refreshes the particles.
Declaration
protected virtual void RefreshParticles()
RefreshProperties()
Refreshes the particles' properties.
Declaration
protected virtual void RefreshProperties()
RefreshResources()
Refreshes the emitter's resources.
Declaration
protected void RefreshResources()
Reset()
Resets the state of the particle system.
Declaration
public void Reset()
ResetData(CommandBuffer)
Resets the emitter data.
Declaration
protected abstract void ResetData(CommandBuffer commandBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | The command buffer. |
StartEmitting()
Starts the particle emission.
Declaration
public void StartEmitting()
StopEmitting()
Stops the particle emissions.
Declaration
public void StopEmitting()
Unitialize()
Uninitializes the emitter.
Declaration
protected abstract void Unitialize()
UpdateParticlesMethod(CommandBuffer, TimeSpan)
The method that updates the particle system.
Declaration
protected abstract void UpdateParticlesMethod(CommandBuffer commandBuffer, TimeSpan elapsedTime)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | The command buffer. |
| TimeSpan | elapsedTime | The elapsed time. |
Events
MeshChanged
Event raised when the mesh changes.
Declaration
public event EventHandler<Mesh> MeshChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<Mesh> |