Vixen
02b45cc4
csharp
public sealed class BrushStroke

One drag, turned into evenly spaced stamps.

Read the guide page for this →

Remarks

A stroke is not the pointer samples. A pointer arrives at whatever rate the frame does, so stamping one per event makes a brush that is dense when the frame rate is high and sparse when the artist moves quickly — the same drag producing a different result on a different machine. Spacing the stamps by distance instead makes a stroke a property of the path, and the leftover distance carried between segments is what keeps the spacing even across pointer events rather than only within one.

It is a struct that accumulates, not a function over a polyline. A drag is fed to it one segment at a time as the pointer moves, and it yields the stamps that segment earned. The alternative — collecting the path and stamping at the end — would mean the viewport showed nothing until the artist let go.

⚠ Deterministic, including the random rotation. The angle for Random comes from a hash of the stamp's index and the stroke's seed, not from a shared generator — so replaying a recorded stroke, or undoing and redoing one, produces the same stamps. A stroke whose randomness came from Random.Shared would be a stroke that could not be replayed, which is the same property [docs/plan/31 § D8] needs of the scatter.

Fields and properties (3)

  • public int StampCount

    How many stamps the stroke has produced.

  • public BrushFootprint Footprint

    Everything the stroke has touched so far.

  • public bool IsEmpty

    Whether anything has been stamped yet.

Methods (2)

  • public BrushStroke(TerrainBrush brush, uint seed = 2654435769)

    Begins a stroke.

  • public void MoveTo(Vector2 position, ICollection<BrushStamp> stamps)

    Moves the pointer to a place, appending whatever stamps that earned.

Used by (3)

  • BrushStrokeTestsVixen.Terrain.Tests
  • TerrainStrokeTestsVixen.Terrain.Tests
  • TerrainEditVixen.Editor.Terrain