Class ParticleBuffer
The particles simulation data container. Can allocated and used many times. It's designed to hold CPU or GPU particles data for the simulation and rendering.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Particles/ParticlesData.h
Syntax
public class ParticleBuffer
Constructors
~ParticleBuffer()
ParticleBuffer()
Fields
Buffer
The particles data buffer (CPU side).
Declaration
public Array<byte> Buffer
Field Value
Array<byte>
|
BufferSecondary
The particles secondary data buffer (GPU side). Used as a write destination for GPU particles and swapped with Buffer after simulation.
Declaration
public GPUBuffer* BufferSecondary = nullptr
Field Value
GPUBuffer
|
Capacity
The buffer capacity (maximum amount of particles it can hold).
Declaration
public int32 Capacity
Field Value
int32
|
Count
The active particles count.
Declaration
public int32 Count
Field Value
int32
|
CPU
Declaration
public struct ParticleBuffer::@180 CPU
Field Value
struct ParticleBuffer::@180
|
Emitter
GPU
Declaration
public struct ParticleBuffer::@181 GPU
Field Value
struct ParticleBuffer::@181
|
HasValidCount
The flag used to indicate that GPU buffers data contains a valid particles count.
Declaration
public bool HasValidCount
Field Value
bool
|
IndirectDrawArgsBuffer
The indirect draw command arguments buffer used by the GPU particles to invoke drawing on a GPU based on the particles amount (instances count).
Declaration
public GPUBuffer* IndirectDrawArgsBuffer = nullptr
Field Value
GPUBuffer
|
Layout
The layout descriptor.
Declaration
public ParticleLayout* Layout = nullptr
Field Value
ParticleLayout
|
Mode
The simulation mode.
Declaration
public ParticlesSimulationMode Mode
Field Value
ParticlesSimulationMode
|
ParticleCounterOffset
The particle counter (uint type) offset. Located in Buffer and BufferSecondary if GPU particles simulation is used to store the particles count in the buffer. Placed after the particle attributes.
Declaration
public uint32 ParticleCounterOffset
Field Value
uint32
|
ParticlesCountMax
The maximum amount of particles that 'might' be in the buffer. During every simulation update we spawn a certain amount of particles and update existing ones. We can estimate limit for the current particles count to dispatch less threads for particles update.
Declaration
public int32 ParticlesCountMax
Field Value
int32
|
PendingClear
The flag used to indicate that GPU buffers data should be cleared before next simulation.
Declaration
public bool PendingClear
Field Value
bool
|
RibbonIndexBufferDynamic
The ribbon particles rendering index buffer (dynamic GPU access).
Declaration
public DynamicIndexBuffer* RibbonIndexBufferDynamic = nullptr
Field Value
DynamicIndexBuffer
|
RibbonOrder
The sorted ribbon particles indices (CPU side). Cached after system update and reused during rendering (batched for all ribbon modules).
Declaration
public Array<int32> RibbonOrder
Field Value
Array<int32>
|
RibbonVertexBufferDynamic
The ribbon particles rendering vertex buffer (dynamic GPU access).
Declaration
public DynamicVertexBuffer* RibbonVertexBufferDynamic = nullptr
Field Value
DynamicVertexBuffer
|
SortedIndices
The particles indices buffer (GPU side).
Contains sorted particles indices for GPU rendering. Each sorting module from the emitter uses a dedicated range of this buffer.
Declaration
public GPUBuffer* SortedIndices = nullptr
Field Value
GPUBuffer
|
SortingKeysBuffer
The GPU particles sorting buffer. Contains structure of particle index and the sorting key for every particle. Used to sort particles.
Declaration
public GPUBuffer* SortingKeysBuffer = nullptr
Field Value
GPUBuffer
|
Stride
The stride (size of the particle structure data).
Declaration
public int32 Stride
Field Value
int32
|
Version
The emitter graph version (cached on Init). Used to discard pooled buffers that has been created for older emitter graph.
Declaration
public uint32 Version
Field Value
uint32
|
Methods
AllocateSortBuffer()
Allocates the particles sorting indices buffer.
Declaration
public bool AllocateSortBuffer()
Returns
bool
True if failed, otherwise false. |
Clear()
Clears the particles from the buffer (prepares for the simulation).
Declaration
public void Clear()
GetParticleCPU(int32 particleIndex)
Gets the pointer to the particle data.
Declaration
public byte* GetParticleCPU(int32 particleIndex)
Parameters
int32
particleIndex
Index of the particle. |
Returns
byte
The particle data start address. |
Init(ParticleEmitter* emitter)
Initializes the particle buffer for the specified emitter.
Declaration
public bool Init(ParticleEmitter* emitter)
Parameters
ParticleEmitter
emitter
The emitter. |
Returns
bool
True if failed, otherwise false. |