GLTF Parser documentation

Are there any docs for the GLTF Parser? I don’t mean the loader I mean the object available in the onload event

gltf => {
   const parser = gltf.parser;
}

Hey Nik, there’s not the broadest range of documentation on the parse method of GLTFLoader have a look at this answer I recently gave for what’s needed to use both GLTFLoader.parse and GLTFExporter.parse, I hope this helps

I was looking for some docs that help explain this variants code.

     object.material = await parser.getDependency( 'material', mapping.material );
     parser.assignFinalMaterial( object );

I’m assuming getDependency finds the material from the mapping.material index. And assignFinalMaterial has some confirmation purpose. But without docs it is guess work. Why doesn’t setting the material then using needsUpdate not suffice?

Even when the documentation is incomplete, the source code is always complete, but it might take much more efforts to understand what it does.

Here is the source of getDependency.

As for assignFinalMaterial, the source code has this documentation:

Assigns final material to a Mesh, Line, or Points instance. The instance
already has a material (generated from the glTF material options alone)
but reuse of the same glTF material may require multiple threejs materials
to accommodate different primitive types, defines, etc. New materials will
be created if necessary, and reused from a cache.

2 Likes