Install with luarocks: $ luarocks install lua-gltf
local gltf = require("gltf")
local asset = gltf.new("/path/to/file.gltf")
The returned table is identical to a standard glTF asset with the following differences:
- Any fields which hold an index, now instead hold the object referenced by that index
- To get the original numerical index, call
asset:IndexOf(object)
. Keep in mind that these values will begin from 0, as they correspond to the indices in the glTF file.
- To get the original numerical index, call
- Each
node
has the fieldnode.parent
- Buffers, buffer views, accessors, and images have a
:get()
method- When called on an accessor, an additional boolean argument
packed
is accepted (defaults tofalse
). Iftrue
, the value returned will be the raw string which holds the accessor data. Otherwise, this method returns the values contained in the accessor.
- When called on an accessor, an additional boolean argument