Vixen
02b45cc4

VfxGeometryBuilder

class Core/Vixen.Vfx/VfxGeometry.cs:88
csharp
public sealed class VfxGeometryBuilder

Turns particles into quads.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The last step before something is drawn, and the last one that is pure arithmetic — what happens to the vertices afterwards belongs to a render feature in Vixen.Rendering, which is where the pipelines and descriptor sets live. Keeping the expansion here means Vixen.Vfx depends on no graphics at all and every one of these decisions can be checked against a number rather than against a screenshot.

Four vertices a particle, not six. The two triangles share an edge, and the index pattern that joins them is the same for every particle in every effect ever — so it is a buffer built once by whoever draws, not two repeated vertices per particle forever. WriteQuadIndices is that pattern.

Fields and properties (6)

  • public const int VerticesPerParticle

    How many vertices one particle needs.

  • public const int IndicesPerParticle

    How many indices one particle needs.

  • public const int VerticesPerRibbonParticle

    How many vertices one particle of a ribbon needs: one each side of the strip.

  • public const int IndicesPerRibbonSegment

    How many indices one length of ribbon needs — two triangles between two particles.

  • public ReadOnlySpan<int> Order

    The order the last Build drew the particles in.

  • public int LastCount

    How many particles the last Build wrote.

Methods (4)

  • public static int WriteQuadIndices(Span<uint> indices, int particles)

    Writes the index pattern for a number of particles.

  • public int Build(VfxSystem system, in VfxCamera camera, Span<ParticleVertex> vertices)

    Expands a system's live particles into quads.

  • public int BuildInstances(VfxSystem system, in VfxCamera camera, Span<ParticleInstance> instances)

    Expands a system's live particles into per-instance transforms.

  • public int BuildRibbons(VfxSystem system, in VfxCamera camera, Span<ParticleVertex> vertices, Span<uint> indices, out int indexCount)

    Joins the particles of each ribbon into a strip.

Used by (4)

  • ParticleRenderFeatureVixen.Rendering
  • ParticleRenderFeatureTestsVixen.Rendering.Tests
  • VfxGeometryTestsVixen.Vfx.Tests
  • VfxRibbonTestsVixen.Vfx.Tests