Vixen
02b45cc4
csharp
public record struct ShapeParameters

What a parametric shape is made of: a kind and the handful of numbers behind it.

Read the guide page for this →

Remarks

Doc 24's D6 in one struct. A shape is created with live parameters and editing one rebuilds it, because the overwhelmingly common blockout edit is "that corridor should be a metre wider" — one number, not a face selection.

⚠ Six fields for twelve shapes, rather than a record per kind. A discriminated union would be tidier in the type system and worse in every other place this has to exist: the scene file would carry a tagged variant per shape, the inspector would need a drawer per shape, and adding a kind would touch all of them. What the fields mean is per kind and is documented on each; what they are is a fixed record that reads, writes and diffs the same way whatever the kind is.

⚠ Size is the whole extent in world units, and the geometry carries it. MeshPrimitives builds everything to fit the unit cube so that a transform's scale is the size, which is right when a thousand entities share one upload. It is wrong here: a wall built as a unit cube scaled 8 3 0.2 has a non-uniform transform, so every bevel it is given afterwards is wider on one axis than another and every texel on it is stretched — which is the complaint doc 24's P5 opens with. A parametric shape is one mesh per entity anyway, so the size goes in the mesh and the transform stays uniform.

⚠ Centred in X and Z, and sitting on the origin in Y. Everything a blockout tool makes is placed on the work plane, and a shape whose origin is its centre is one that arrives half-buried in the floor. It also makes the parameter mean what it says for the shapes that have no meaningful centre: a stair's rise is measured from the floor it starts on.

Fields and properties (9)

  • public ShapeKind Kind

    Which shape.

  • public Vector3 Size

    How big it is, across each axis, in world units.

  • public int Sides

    How many divisions around an axis, for the shapes that have one.

  • public int Steps

    How many divisions along it.

  • public float Thickness

    How much solid material is left, in world units.

  • public float Inner

    A ratio from zero to one, for the shapes that have a hole in them.

  • public const float MinimumSize

    The smallest extent a shape may have on any axis.

  • public const float MaximumSize

    And the largest.

  • public const int MaximumDivisions

    The most divisions any one parameter may ask for.

Methods (2)

  • public static ShapeParameters Default(ShapeKind kind)

    The values a freshly created shape of a kind should have.

  • public readonly ShapeParameters Clamped()

    The same parameters, with everything a generator cannot survive brought into range.

Used by (15)

  • MeshBooleanPropertyTestsVixen.Geometry.Tests
  • MeshBooleanTestsVixen.Geometry.Tests
  • MeshShapeTestsVixen.Geometry.Tests
  • MeshShapesVixen.Geometry
  • MeshSurfaceTestsVixen.Geometry.Tests
  • BlockoutBooleanTestsVixen.Editor.Blockout.Tests
  • BlockoutCreateVixen.Editor.Blockout
  • BlockoutCreateTestsVixen.Editor.Blockout.Tests
  • BlockoutCubeGridVixen.Editor.Blockout
  • BlockoutHistoryTestsVixen.Editor.Blockout.Tests
  • BlockoutSurfaceTestsVixen.Editor.Blockout.Tests
  • EditMeshesVixen.Editor.SceneView
  • SceneDocumentVixen.Editor.SceneView
  • ShapeCommandVixen.Editor.SceneView
  • ShapeDragVixen.Editor.Blockout