Vixen
02b45cc4
csharp
public sealed class VfxExtractionSystem

Turns the scene's VfxEmitters into running, drawn particle systems.

Read the guide page for this →

As a system

Phase
PreRender

Remarks

MeshExtractionSystem's shape, and one more job. It reconciles the same way — create for what appeared, destroy for what went, place what stayed — and then does the thing no mesh needs: it steps the simulations. Nothing else in the engine does. ParticleRenderFeature draws whatever it has been handed and never advances it, deliberately, because a renderer that simulated would simulate once per view.

The emitter's transform is the effect's origin. Every opcode that writes a position writes a world-space one, so without this a graph would be nailed to the coordinates its author typed and the same .vxvfx on twenty entities would be twenty identical piles of particles at one point. Origin is read at spawn, so moving an emitter moves where the next particles appear and leaves the live ones where they are — which is what a torch carried across a room does to its smoke.

⚠ In PreRender, after TransformSystem. The order comes from the declared access, exactly as the mesh bridge's does: this reads WorldTransform and that writes it, so an emitter extracted first would spawn a frame behind the entity it is attached to.

⚠ One expansion serves every view, so an emitter must not be in a shadow stage. That is ParticleRenderFeature's constraint rather than this one's, and it is why Stages is a single mask a host sets from the one transparent stage its document declares rather than something derived from what a mesh is extracted into.

Fields and properties (7)

  • public RenderStageMask Stages

    Which stages an extracted emitter appears in.

  • public IVfxEffectSource? Effects

    Where the effect a reference names comes from. Null emits nothing.

  • public Material? Material

    What every emitter is drawn with.

  • public int Running

    How many emitters are running.

  • public int Waiting

    How many emitters are waiting for an effect that has not arrived.

  • public int ParticleCount

    How many particles the running emitters hold between them.

  • public SystemAccess Access

    What this system reads and writes.

Methods (6)

  • public VfxExtractionSystem(RenderSystem system, ParticleRenderFeature particles, MaterialRenderFeature materials)

    Builds the bridge.

  • public override JobHandle Update(in SystemContext context, JobHandle dependency)

    Runs the system.

  • public void Extract(World world, float deltaSeconds)

    Reconciles the render store with the world, and advances what is running.

  • public bool Forget(Entity entity)

    Drops an entity's effect without needing the entity to be alive.

  • public void Clear()

    Drops everything, for a world being torn down.

  • public override void Dispose()

Used by (3)

  • ArenaThirdPersonShooter
  • VfxExtractionTestsVixen.Rendering.Tests
  • WorldRendererVixen.Engine.Renderer