Vixen
02b45cc4
csharp
public static class MeshShapes

Builds the shapes doc 24's Creation table names, as editable meshes.

Read the guide page for this →

Remarks

Quads wherever a quad is what the shape is made of, which is nearly everywhere. EditMeshes.From(PrimitiveKind) exists and welds a triangle soup back into a mesh; what it cannot do is give back the four-sided faces the soup was built from, and an edge loop, an edge ring and a loop cut are all statements about four-sided faces — see EdgeRing. A cylinder made editable through the renderer's primitive has no rings to cut; one built here does.

⚠ Face groups are assigned by what the face is, not by which way it points. A staircase's treads are group 0 and its risers group 1 whatever angle the flight is at, so "select every tread" is one click and a material assigned to the treads survives the flight being made steeper. Regroup is the other answer and is the right one for a mesh that arrived from somewhere else; a generator knows better than a tolerance can.

⚠ Nothing here sets normals or texture coordinates. A generated shape is flat shaded by EditMeshes.ToMeshData from the faces themselves, and its UVs are MeshSurfaces' — which projects them in world space by default, so a wall and the floor it stands on have squares of the same size without either of them carrying a mapping the generator guessed at.

Fields and properties (8)

  • public const int GroupTop

    The face group a shape's top surface goes in.

  • public const int GroupBottom

    The group a shape's underside goes in.

  • public const int GroupSide

    The group its sides go in — a cylinder's wall, a staircase's cheeks.

  • public const int GroupFront

    The group its front goes in: −Z, and a staircase's risers.

  • public const int GroupBack

    And its back: +Z, and the tall end of a flight of steps.

  • public const int GroupLeft

    Its −X face.

  • public const int GroupRight

    Its +X face.

  • public const int GroupBore

    The inside of a hole through it: a pipe's bore, a doorway's reveal.

Methods (4)

  • public static EditMesh Create(in ShapeParameters parameters)

    Builds a shape.

  • public static EditMesh Create(ShapeKind kind)

    Builds a shape of a kind at its default size.

  • public static EditMesh Sweep(ReadOnlySpan<Vector2> outline, Vector3 origin, Vector3 across, Vector3 up, Vector3 along, int capGroup = 0, ReadOnlySpan<int> sides = default(ReadOnlySpan<int>))

    Sweeps a closed outline along a straight line and caps both ends.

  • public static void StairProfile(float run, float rise, int steps, List<Vector2> into)

    The outline of a flight of steps, in run and rise.

Used by (8)

  • MeshBooleanPropertyTestsVixen.Geometry.Tests
  • MeshBooleanTestsVixen.Geometry.Tests
  • MeshShapeTestsVixen.Geometry.Tests
  • MeshSurfaceTestsVixen.Geometry.Tests
  • BlockoutCreateVixen.Editor.Blockout
  • BlockoutCreateTestsVixen.Editor.Blockout.Tests
  • BlockoutSurfaceTestsVixen.Editor.Blockout.Tests
  • SceneDocumentVixen.Editor.SceneView