Module NodeTreeBuilder
Module for building scene nodes from a loaded gltf format.
Functions
create (gltf, callback) | Creates a node tree from glTF data. |
Functions
- create (gltf, callback)
-
Creates a node tree from glTF data.
Processes glTF data and builds a complete scene hierarchy with meshes, materials,
animations, and skinning information.
Parameters:
- gltf table Data obtained with glTFLoader.load containing meshes, materials, nodes, scenes, etc.
- callback function[opt] Optional callback function called for each built scene with params (scene, builder)
Returns:
-
table
An array of scenes, where each scene is a menori.Node object representing the root of a scene hierarchy
Usage:
-- Basic usage local gltf_data = menori.glTFLoader.load("model.gltf") local scenes = menori.NodeTreeBuilder.create(gltf_data) local main_scene = scenes[1] -- With callback for post-processing local scenes = menori.NodeTreeBuilder.create(gltf_data, function(scene, builder) print("Built scene:", scene.name) print("Animations available:", #builder.animations) -- Access builder.meshes, builder.materials, builder.nodes, builder.animations scene:traverse(function(node, index) print("Processing node:", node.name) -- Access extra data from glTF if node.extras then print(" - Has extra data:", node.extras) end end) end) -- The builder table contains: -- builder.meshes - array of mesh arrays (one per gltf mesh) -- builder.materials - array of Material objects -- builder.nodes - array of Node objects -- builder.animations - array of animation data