natiny.mesh.load

Lua
natiny.mesh.load(mesh_resource) -> mesh

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 number Resource handle produced by natiny.resource.load(path) (a .gltf or .glb file)

Returns

Type Description
number Mesh handle (0 on failure)

Example

Lua
local 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.