Vixen
02b45cc4
csharp
public static class SpriteGeometry

Turns a sprite into the quads that draw it: one, or the nine a border cuts it into, or the many a tiled fill repeats.

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

Remarks

A pure function of a sprite and an appearance, which is what lets every claim below be checked without a device — the same bargain Vixen.Vfx's expansion makes and the same one UiGeometryBuilder makes on the other side of the engine.

⚠ The nine-slice arithmetic itself is NineSlice's, in Vixen.Core.Mathematics, and it is shared with the interface. A panel stretched by a stylesheet and a sprite stretched by a scene are the same nine pairs of rectangles, and the two assemblies cannot see each other. What this adds on top is everything that needs to know a texture's pixel size: the conversion from texels to world units, and tiling.

Fields and properties (3)

  • public const int VerticesPerQuad

    How many vertices one quad needs.

  • public const int IndicesPerQuad

    How many indices one quad needs.

  • public const int TileLimit

    How many times one strip may repeat before it is stretched instead.

Methods (3)

  • public static int QuadsFor(Sprite sprite, in SpriteAppearance appearance)

    How many quads drawing this sprite will take.

  • public static int Build(Sprite sprite, in SpriteAppearance appearance, Span<SpriteVertex> into)

    Expands a sprite into quads.

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

    Writes the index pattern for a number of quads.

Used by (2)

  • SpriteRenderFeatureVixen.Rendering
  • SpriteTestsVixen.Rendering.Tests