I need to create a generic advanced viewer in three js which could generate Gltf files. How could I get every information about each component of the model?
I try to search into the loader class with loader.load() of THREE.GLTFLOADER, I found the information ( in scene.children which are the models' components) but I can't make it generic.
Is there any libraries or function that give you each component? like the function .getElementById, something like .GetAllComponents or .GetMaterialsTextures (like i need to get every path for texture and model'components)
I don't ask u to give me the answer I will not learn.
var dracoLoader = new THREE.DRACOLoader();
dracoLoader.setDecoderPath( 'js/draco_decoder.js' );
let loader = new THREE.GLTFLoader(); // I use this as all the video i saw but i you coud explain it (does it help to pack data or just to encode?)
loader.setDRACOLoader( dracoLoader );
loader.load('assets/BM1294_EOS_TABLE_220X280_OUVERT/BM1294.gltf',
function(gltf){
console.log(gltf);
let mesh = gltf.scene.children[0]; //one of my model
renderer.gammaOutput = true;
renderer.gammaFactor = 2.2;
scene.add(mesh);
});
Thank you If you help :)
gltf.scene
and query single components of your asset by (node) names. – Mugen87glTF
components like meshes, materials etc.. – Mugen87