Vixen
c7401864
csharp
public sealed class WaterEdit

The water mode's editing state: a draw in progress, or a profile handle under the pointer.

Read the guide page for this →

Remarks

No device, no world and no document, on FoliageEdit's terms: everything here is arithmetic over points and a profile, so the gestures are testable with synthetic pointer input and no editor running — which is [§ Part 4](../../docs/plan/35-water.md#part-4--testing)'s "asserting the spline and the profile rather than the pixels".

⚠ A draw commits to a curve and a profile, never to an entity. What the mode does with them is the module's business — a scene component naming a .vxspline the project wrote — and a gesture that created entities could not be run by a test without a world.

Fields and properties (11)

  • public WaterTool Tool

    Which tool a click runs.

  • public WaterBodyKind Kind

    What kind of body the next draw lays.

  • public WaterProfilePoint Profile

    The profile the next body is given, and the one a handle drag edits.

  • public float MinimumSpacing

    How far apart two clicks have to be to be two points, in metres.

  • public IReadOnlyList<Vector3> Points

    The points laid so far, in world space.

  • public bool IsDrawing

    Whether a draw is under way.

  • public WaterHandle Holding

    Which handle a profile drag is holding.

  • public int HoldingPoint

    Which control point that handle belongs to.

  • public bool CarvePreview

    Whether the carve's contribution is being shown.

  • public float CloseRadius

    How near the first point a click has to be to close the curve, in metres.

  • public bool CanCommit

    Whether the points laid so far are enough to make a body of the current kind.

Methods (10)

  • public bool ClosesAt(Vector3 point)

    Whether a click there would close the curve rather than lay another point.

  • public void Begin()

    Starts a draw, discarding whatever was half-laid.

  • public bool Add(Vector3 point)

    Lays one point.

  • public bool Undo()

    Takes the last point back.

  • public void Cancel()

    Drops the draw.

  • public Spline? Commit()

    Turns the points laid into a curve.

  • public void Grab(WaterHandle handle, int point)

    Takes hold of a profile handle.

  • public void Release()

    Lets go.

  • public WaterProfilePoint Drag(in WaterProfilePoint current, float metres)

    The profile a drag of the held handle produces.

  • public static (Vector3 Left, Vector3 Right, Vector3 Depth) HandlesOf(WaterBody body, int index)

    Where a control point's handles sit, in world space.

Used by (4)

  • WaterEditTestsVixen.Editor.Water.Tests
  • WaterModeVixen.Editor.Water
  • WaterModeTestsVixen.Editor.Water.Tests
  • WaterModuleVixen.Editor.Water