npm i webxrscene --save
import {webXRscene} from 'webxrscene';
import * as THREE from 'three';
const webXRScene = new webXRScene("element");
webXRScene.Loader.loadStack({
progress: (percentage,singleProgress)=>{
console.log(percentage,singleProgress);
},
stack : [{
url: "URL TO YOUR GLTF MODEL",
name:"Name of your model"
}]
}).then((library)=>{
console.log("library", library);
Object.keys(library).map((elements, index)=>{
console.log(library[elements].scene);
});
});
webXRScene.Loader.load({
url : "URL TO YOUR GLTF MODEL",
progress : (percentage)=>{
console.log(percentage);
},
}).then((gltf)=>{
console.log(gltf.scene);
}).catch((err)=>{
console.log("error: " , err );
}).finally(()=>{
console.log("load complete");
});
webXRScene.Update.AddUpdateMethod("common", ()=>{
renderer.instance.render( scene, camera.instance );
});
//start the loop
webXRScene.Update.start();
//stop the loop
webXRScene.Update.stop();