Skip to content

GltfReader

Namespace Nfty.Model in assembly Nfty.Model.

public static class GltfReader

Reads back the models ModelWriter writes (GLB, glTF + .bin, embedded glTF) and nothing else. It goes through the same record model the writer serializes, so there is one schema; every member that model does not state is refused by name with UnsupportedModelException instead of being skipped, because a skipped feature (a second mesh, a sparse accessor) would show the reader a different model from the file's.

Methods

Read(ReadOnlySpan<byte>)

public static ReadModel Read(ReadOnlySpan<byte> glb);

Reads a GLB held in memory.

Parameters

  • glb (ReadOnlySpan<byte>) - The whole file.

Returns. The mesh and texture.

Exceptions

Read(string)

public static ReadModel Read(string path);

Reads a model file; the extension (.glb or .gltf) says which.

Parameters

  • path (string) - The file. A .gltf's .bin sits beside it.

Returns. The mesh and texture.

Exceptions