Class GPUParticles
The GPU particles execution utility.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Particles/Graph/GPU/GPUParticles.h
Syntax
public class GPUParticles
Fields
CustomDataSize
The custom data size (in bytes) required by the nodes to store the additional global state for the simulation in the particles buffer on a GPU.
Declaration
public int32 CustomDataSize
Field Value
int32
|
Methods
CopyParticlesCount(GPUContext* context, ParticleEmitter* emitter, ParticleEffect* effect, ParticleEmitterInstance& data, GPUBuffer* dstBuffer, uint32 dstOffset)
Copies the GPU particles count from the particles data on a GPU to another GPU buffer (counter value is uint32).
Declaration
public void CopyParticlesCount(GPUContext* context, ParticleEmitter* emitter, ParticleEffect* effect, ParticleEmitterInstance& data, GPUBuffer* dstBuffer, uint32 dstOffset)
Parameters
GPUContext
context
The GPU context that supports Compute. |
ParticleEmitter
emitter
The owning emitter. |
ParticleEffect
effect
The instance effect. |
ParticleEmitterInstance
data
The instance data. |
GPUBuffer
dstBuffer
The destination buffer to copy the counter (uint32). |
uint32
dstOffset
The destination buffer offset from start (in bytes) to copy the counter (uint32). |
Dispose()
Releases the resources.
Declaration
public void Dispose()
Execute(GPUContext* context, ParticleEmitter* emitter, ParticleEffect* effect, int32 emitterIndex, ParticleEmitterInstance& data)
Performs the GPU particles simulation update using the graphics device.
Declaration
public void Execute(GPUContext* context, ParticleEmitter* emitter, ParticleEffect* effect, int32 emitterIndex, ParticleEmitterInstance& data)
Parameters
GPUContext
context
The GPU context that supports Compute. |
ParticleEmitter
emitter
The owning emitter. |
ParticleEffect
effect
The instance effect. |
int32
emitterIndex
The index of the emitter in the particle system. |
ParticleEmitterInstance
data
The instance data. |
Init(ParticleEmitter* owner, MemoryReadStream& shaderCacheStream, ReadStream* materialParamsStream, int32 customDataSize)
Initializes the GPU particles simulation runtime.
Declaration
public bool Init(ParticleEmitter* owner, MemoryReadStream& shaderCacheStream, ReadStream* materialParamsStream, int32 customDataSize)
Parameters
ParticleEmitter
owner
The owning emitter. |
MemoryReadStream
shaderCacheStream
The stream with the compiled shader data. |
ReadStream
materialParamsStream
The stream with the parameters data. |
int32
customDataSize
The custom data size (in bytes) required by the nodes to store the additional global state for the simulation in the particles buffer on a GPU. |
Returns
bool
True if failed, otherwise false. |
IsInitialized()
Determines whether this instance is initialized.
Declaration
public bool IsInitialized() const
Returns
bool
|
Update(ParticleEmitter* emitter, ParticleEffect* effect, ParticleEmitterInstance& data, float dt, bool canSpawn)
Updates the particles simulation (the GPU simulation). The actual simulation is performed during Execute during rendering. This method accumulates the simulation delta time and other properties.
Declaration
public void Update(ParticleEmitter* emitter, ParticleEffect* effect, ParticleEmitterInstance& data, float dt, bool canSpawn)
Parameters
ParticleEmitter
emitter
The owning emitter. |
ParticleEffect
effect
The instance effect. |
ParticleEmitterInstance
data
The instance data. |
float
dt
The delta time (in seconds). |
bool
canSpawn
True if can spawn new particles, otherwise will just perform an update. |