natiny_mesh_load

C
NatinyMesh natiny_mesh_load(NatinyResource mesh_resource);

Loads glTF 2.0 geometry from a resource.

Both binary (.glb) and text (.gltf + external .bin) glTF are accepted. The model is split into parts: one part per material, so every part has its own texture. Material textures are loaded automatically through natiny_resource_load(), relative to the model's own path.

Parameters

Name Type Description
mesh_resource NatinyResource Resource handle produced by natiny_resource_load(path) (a .gltf or .glb file)

Returns

Type Description
NatinyMesh Mesh handle (0 on failure)

Example

C
NatinyMesh mesh = natiny_mesh_load(mesh_resource);

Notes

  • External files (.bin buffers, image URIs) are resolved relative to the path used to load the source resource. A resource created from memory has no base path, so its external references cannot be resolved.