public sealed class TerrainWeightStrokeOne paint stroke, recorded so it can be undone.
Remarks
The third stroke record, and the one that costs the most per sample. TerrainStroke holds one short per sample because a sculpt tool writes one layer's delta; TerrainWeightStroke holds every layer's weight, because painting one layer lowers all the others proportionally. A six-layer terrain records six bytes per sample rather than one — still less than the sculpt record's two shorts, which is a coincidence worth not relying on.
⚠ Recording only the target layer is the bug this type exists to prevent. An undo that restored one channel would leave the other five holding what the redistribution gave them, so the sum at every touched sample would come out above 255 — and Verify would report a drift whose cause is three operations in the past.
⚠ The before image is captured lazily and never re-captured, exactly as Extend does it: a drag crossing the same ground forty times records it once, holding the weights it had before the first crossing.
Fields and properties (5)
public TerrainRect RectEverything the stroke has touched.
public int RecordedSamplesHow many samples the record holds.
public long BytesHow many bytes it occupies, both images together.
public bool IsEmptyWhether anything has been recorded.
public int LayerCountHow many layers the record covers.
Methods (5)
public TerrainWeightStroke(Terrain terrain)Begins recording a paint stroke.
public TerrainRect Record(in TerrainBrush brush, in BrushStamp stamp)Records the weights a stamp is about to change, and says which samples those are.
public void Extend(TerrainRect rect)Records the weights a rectangle covers. Call before applying the kernel.
public TerrainRect Undo()Puts the weights back the way they were before the stroke.
public TerrainWeightRedo Capture()Captures what the stroke left, so it can be redone.
Used by (3)
- TerrainPaintTestsVixen.Terrain.Tests
- TerrainEditVixen.Editor.Terrain
- TerrainPaintCommandVixen.Editor.Terrain