public static class ModelWriterWrites meshes back out as a file a DCC opens: OBJ, glTF or GLB.
Remarks
ModelReader's other half, and it is here for the same reason that one is. docs/plan/41 § D16 and docs/plan/42 § D13 both give the batch surface as vixen remesh in.glb out.glb, which is a read through Assimp and a write that Assimp does not do for us. Putting the write beside the read means the CLI links one assembly to do a round trip rather than two that disagree about what a mesh is.
⚠ MeshExport in Vixen.Editor.SceneView writes glTF too, and this is not it. That one takes doc 24's ExportPiece — a kernel mesh, a world transform and a name, straight out of a scene document — and lives in the viewport assembly, which carries the whole UI stack. A batch tool that took that reference to write a file would link a renderer and a control library to run on a build server. The overlap is the glTF envelope and it is about eighty lines; the alternative was moving the exporter down into an assembly the viewport must not depend on, and doc 24's IMeshBaker exists precisely because Vixen.Editor.SceneView does not reference the asset database.
⚠ The format is chosen by extension and an unknown one is refused rather than guessed. Writing glTF into a file called .fbx produces something no tool opens and every tool blames on the mesh.
Fields and properties (1)
public static IReadOnlyList<string> ExtensionsEvery extension this writes, with their dots, in the order a help string wants them.
Methods (7)
public static bool CanWrite(string? path)Whether a path names a format this can write.
public static void Write(string path, IReadOnlyList<MeshData> meshes, string name = "Mesh")Writes meshes in whichever format the path's extension names.
public static void Write(string path, IReadOnlyList<PolygonMesh> meshes, string name = "Mesh", TextWriter? warnings = null)Writes meshes whose faces have however many sides they have.
public static string Obj(IReadOnlyList<MeshData> meshes)Writes meshes as a Wavefront OBJ.
public static string Obj(IReadOnlyList<PolygonMesh> meshes)Writes meshes as a Wavefront OBJ, keeping every face at the number of sides it has.
public static string Gltf(IReadOnlyList<MeshData> meshes, string name = "Mesh")Writes meshes as a self-contained glTF 2.0 document with its buffer inlined.
public static byte[] Glb(IReadOnlyList<MeshData> meshes, string name = "Mesh")Writes meshes as a binary glTF container.
Used by (2)
- GeometryCommandTestsVixen.Cli.Tests
- GeometryRunnerVixen.Cli