Vixen
dd8b0a81
csharp
public static class ModelGeometry

The copy between a model file's geometry and the mesh kernel that remeshes and unwraps it.

Read the guide page for this →

Remarks

docs/plan/24 § D1 puts this copy in the caller rather than in the kernel, and this is the importer's copy of it. Core/Vixen.Geometry depends on Vixen.Core.Mathematics and nothing else, so it cannot name MeshData; Vixen.Editor.SceneView makes the same six-line trip for the viewport, and this assembly makes it for the import and for vixen remesh. Two short copies on either side of a layering line are the price of the line, and the line is what lets a content build link the remesher without linking a renderer.

⚠ A drawn vertex is a corner and not a position, so the trip out is not the trip in reversed. Going in, a cube's twenty-four entries weld to eight positions. Coming out, eight positions expand to one vertex per corner again, because a normal and a texture coordinate belong to a corner — a cube drawn from eight shared vertices is a cube lit as a very lumpy sphere, and one atlased from eight shared vertices has no seams and therefore no atlas.

⚠ The bounds are recomputed rather than carried across. A remesh moves every vertex, and a Bounds left over from the source is a culling volume that does not contain its mesh — which shows up as an object that disappears when you look at it from the wrong side and never as a geometry bug.

Methods (4)

  • public static EditMesh ToEditMesh(MeshData mesh, float weld = 0.0001)

    Reads a model file's mesh into the kernel.

  • public static MeshData ToMeshData(EditMesh mesh, string name, IReadOnlyList<Vector2>? uvs = null)

    Writes a kernel mesh back out as geometry a renderer or a file can take.

  • public static Vector2[] Atlas(EditMesh mesh, IReadOnlyList<UvIsland> islands, IReadOnlyList<UvPlacement> placements)

    An unwrap's placements applied to its islands, as one coordinate per corner.

  • public static IReadOnlyList<UvIsland> Islands(MeshData mesh)

    The islands a file's existing texture coordinates already describe.

Used by (6)

  • EditorApplicationVixen.Editor.App
  • GeometryCommandTestsVixen.Cli.Tests
  • GeometryRunnerVixen.Cli
  • ModelGeometryIslandTestsVixen.Editor.Assets.Tests
  • ModelRetopologyVixen.Editor.Assets
  • ModelWriterVixen.Editor.Assets