spawn(elements:in:using:)
Spawns new elements into the simulation with the given initial parameters.
Declaration
final func spawn(elements: borrowing [ElementSpawnParameters], in systemID: Int?, using encoder: any MTLComputeCommandEncoder)Parameters
- elements:
The initial state for each element to spawn.
- systemID:
The index of the particle simulation stage to spawn into, or
nilto spawn into all simulations. - encoder:
The compute command encoder to encode the spawn operation with.
Discussion
Each entry in elements produces one new element. The initialization stage of the simulation graph runs on the newly spawned elements before they participate in subsequent simulation steps, and may read or overwrite the values supplied here.