Vixen
02b45cc4
csharp
public static class MeshSurfaces

Doc 24's Surfaces table: what a face is mapped with and how its normals are computed.

Read the guide page for this →

Remarks

The arithmetic half of P5, and it is deliberately all of the half that needs no renderer. A projection is a function of a position and a normal; a smoothing group is a rule for averaging; the per-face transform is two-by-two matrix arithmetic. What is not here is the material a face is assigned and the checker it is drawn with, both of which are statements about a viewport.

⚠ Coordinates are per corner, not per position. A cube's corner is three corners in three faces with three different UVs, which is exactly why the drawing structure and the position graph are different graphs — see EditMesh's own remarks. A projection that wrote per position could not map two faces of one box differently, which is the whole point of a box projection.

Fields and properties (2)

  • public const float DefaultScale

    How many world units one repeat of a texture covers, unless a caller says otherwise.

  • public const float DefaultSmoothingAngle

    The angle below which AutoSmooth treats two faces as one surface.

Methods (6)

  • public static int Project(EditMesh mesh, IReadOnlyCollection<int>? faces, UvProjection projection = World, float scale = 1, Matrix4x4? toWorld = null, Vector3 axis = default(Vector3))

    Maps faces by projecting them.

  • public static int Transform(EditMesh mesh, IReadOnlyCollection<int>? faces, Vector2 offset = default(Vector2), float rotation = 0, Vector2 scale = default(Vector2))

    Moves, turns and scales the coordinates of faces, about their own centre.

  • public static int Fit(EditMesh mesh, IReadOnlyCollection<int>? faces)

    Stretches each face's coordinates so that it exactly covers one repeat.

  • public static int Smooth(EditMesh mesh, IReadOnlyCollection<int>? faces, int group = 1)

    Puts faces in a smoothing group, or takes them out of one.

  • public static int AutoSmooth(EditMesh mesh, float angle = 0.5235988)

    Groups faces by how sharply they meet, so that curves are smooth and corners are not.

  • public static Vector3[] Normals(EditMesh mesh)

    One normal per corner, honouring the smoothing groups.

Used by (5)

  • MeshBooleanTestsVixen.Geometry.Tests
  • MeshSurfaceTestsVixen.Geometry.Tests
  • BlockoutModeVixen.Editor.Blockout
  • BlockoutSurfacesVixen.Editor.Blockout
  • EditMeshesVixen.Editor.SceneView