Vixen
02b45cc4
csharp
public sealed class VfxSystem

One running instance of a compiled graph: its particles, its clock, and its seed.

Read the guide page for this →

Remarks

The graph is the effect and this is the effect happening. A graph is shared between every instance of it — the same array of operations, read and never written — and everything that differs between two campfires is here: how far through they are, what their seeds are, and the particles themselves.

Two instances with the same seed and the same steps are identical. Not similar: identical, particle for particle, because nothing in the simulation reads a clock, a thread identifier, or anything else the caller did not hand it. That is what makes an effect reproducible in a replay and testable against a golden image, and it is the reason VfxRandom is stateless.

Time is accumulated, not integrated. A rate spawner keeps its fractional debt across steps, so 2.5 particles a second at sixty hertz emits five particles every two seconds rather than none at all — which is what dropping the fraction would do, and what makes a low-rate emitter mysteriously silent.

Fields and properties (16)

  • public VfxCompiledGraph Graph

    The graph being run.

  • public uint Seed

    The instance's seed.

  • public Vector3 Origin

    Where the emitter is. Added to every position an initializer writes.

  • public ParticleBuffer Particles

    Its particles.

  • public float Time

    How long it has been running, in seconds.

  • public int Count

    How many particles are alive.

  • public bool Emitting

    Whether the spawners are running. Particles already alive keep going either way.

  • public int LastSpawned

    How many particles the last Step spawned.

  • public int FirstSpawned

    Where the particles the last Step spawned begin.

  • public bool RecordDeaths

    Whether to remember where particles died, for a sub-emitter to use.

  • public int LastDied

    How many particles died in the last Step.

  • public ReadOnlySpan<Vector3> Deaths

    Where they were when they died, when RecordDeaths is on.

  • public JobScheduler? Scheduler

    Where the sweeps run, or null to run them on the calling thread.

  • public int ParallelThreshold

    How many particles it takes before Scheduler is used at all.

  • public bool LastStepWasParallel

    Whether the last Step ran its sweeps across threads.

  • public int LastRefused

    How many the last Step could not spawn because the buffer was full.

Methods (4)

  • public VfxSystem(VfxCompiledGraph graph, uint seed = 1)

    Starts an instance of a graph.

  • public void Step(float deltaTime)

    Advances the effect.

  • public void Reset()

    Kills every particle and puts the clock back to zero.

  • public void Dispose()

    Frees the particle storage.

Used by (21)

  • SweepBenchmarksVixen.Benchmarks.Vfx
  • ParticleLightTestsVixen.Rendering.Tests
  • ParticleLightsVixen.Rendering
  • ParticleRenderFeatureVixen.Rendering
  • ParticleRenderFeatureTestsVixen.Rendering.Tests
  • ParticleSpriteDeviceTestsVixen.Graphics.Golden.Tests
  • VfxCustomAttributeTestsVixen.Vfx.Tests
  • VfxExtractionSystemVixen.Rendering
  • VfxExtractionTestsVixen.Rendering.Tests
  • VfxForceTestsVixen.Vfx.Tests
  • VfxGeometryBuilderVixen.Vfx
  • VfxGeometryTestsVixen.Vfx.Tests
  • VfxParallelTestsVixen.Vfx.Tests
  • VfxRibbonTestsVixen.Vfx.Tests
  • VfxSubEmitterVixen.Vfx
  • VfxSubEmitterTestsVixen.Vfx.Tests
  • VfxSystemTestsVixen.Vfx.Tests
  • AuthoringTestsVixen.Editor.AssetEditors.Tests
  • VfxDocumentVixen.Editor.AssetEditors
  • VfxGraphCompilerTestsVixen.Editor.VfxGraph.Tests
  • VfxPreviewViewVixen.Editor.AssetEditors