bugfix: mark embedded scene as XRF to force cleanup during reset()

This commit is contained in:
Leon van Kammen 2024-07-26 11:56:07 +00:00
parent bfcaacc099
commit 92370b4548
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => {
}
xrf.frag.src.enableSourcePortation({...opts, scene,mesh,url,model})
// flag everything isSRC & isXRF
mesh.isXRF = scene.isXRF = true
mesh.traverse( (n) => { n.isSRC = n.isXRF = n[ opts.isLocal ? 'isSRCLocal' : 'isSRCExternal' ] = true })
xrf.emit('parseModel', {...opts, isSRC:true, mesh, model}) // this will execute all embedded metadata/fragments e.g.
@ -154,6 +155,9 @@ xrf.frag.src.scale = function(scene, opts, url){
new THREE.Box3().setFromObject(mesh).getSize(sizeTo)
new THREE.Box3().setFromObject(cleanScene).getSize(sizeFrom)
let ratio = sizeFrom.divide(sizeTo)
if( mesh.userData.src && mesh.userData.src.match(/other/) ){
debugger
}
scene.scale.multiplyScalar( 1.0 / Math.max(ratio.x, ratio.y, ratio.z));
}else{
// spec 4 of https://xrfragment.org/#src