fixed voodoo bug (xrwg lines messing with src scaling: always use xrf.add() ) + activated AGPL

This commit is contained in:
Leon van Kammen 2024-08-01 16:25:05 +02:00
parent fbdc373cf8
commit fc3605cb6a
21 changed files with 51950 additions and 420 deletions

1034
LICENSE

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,82 @@
/*
* v0.5.1 generated at Thu Jul 25 09:30:59 AM UTC 2024
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:19:15 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:14:05 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:09:52 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:08:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:58:35 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:54:34 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:50:48 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:47:02 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:46:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:52:22 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:48:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:44:38 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:35:08 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:32:36 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 11:31:12 AM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// Generated by Haxe 4.3.3
var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this;
@ -1937,7 +2012,6 @@ xrf.loadModel = function(model,url,noadd){
let {directory,file,fragment,fileExt} = URI;
model.file = URI.file
xrf.model = model
// xrf.scene = model.scene
if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model
@ -2008,7 +2082,6 @@ xrf.reset = () => {
}
xrf.add = (object) => {
object.isXRF = true // mark for easy deletion when replacing scene
xrf.scene.add(object)
}
@ -2550,13 +2623,14 @@ xrf.frag.src.addModel = (model,url,frag,opts) => {
xrf.portalNonEuclidian({...opts,model,scene:model.scene})
// only add external objects, because
// local scene-objects are already added to scene
if( !opts.isLocal ) xrf.scene.add(scene)
if( !opts.isLocal ) xrf.add(scene)
}else{
xrf.frag.src.scale( scene, opts, url ) // scale scene
mesh.add(scene)
}
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.
@ -2631,6 +2705,7 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
animations: model.animations,
scene: scene.clone()
}
_model.scene.isClone = true
_model.scene.traverse( (n) => n.isXRF = true ) // make sure they respond to xrf.reset()
_model.scenes = [_model.scene]
xrf.frag.src.addModel(_model,url,frag, opts) // current file
@ -2640,7 +2715,6 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
// scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects
xrf.frag.src.scale = function(scene, opts, url){
let { mesh, model, camera, renderer, THREE} = opts
// remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection
let cleanScene = scene.clone()
let remove = []
@ -3560,7 +3634,7 @@ xrf.drawLineToMesh = (opts) => {
xrf.focusLine.lines.push(line)
xrf.focusLine.points.push(from)
xrf.focusLine.opacity = 1
scene.add(line)
xrf.add(line)
})
}
}

80
dist/xrfragment.js vendored
View File

@ -1,3 +1,83 @@
/*
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:19:15 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:14:05 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:09:52 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:08:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:58:35 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:54:34 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:50:48 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:47:02 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:46:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:52:22 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:48:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:44:38 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:35:08 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:32:36 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 11:31:12 AM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// Generated by Haxe 4.3.3
var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this;
(function ($global) { "use strict";

File diff suppressed because one or more lines are too long

50744
dist/xrfragment.module.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,8 @@
/*
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// reactive component for displaying the menu
$editorPopup = (el) => new Proxy({

View File

@ -1,3 +1,8 @@
/*
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
document.head.innerHTML += `
<style type="text/css">
:root {

View File

@ -1,3 +1,8 @@
/*
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
(function(){
// a portable snackbar

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,8 @@
/*
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
(function(){
// this orchestrates multiplayer events from the scene graph

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,82 @@
/*
* v0.5.1 generated at Thu Jul 25 09:30:59 AM UTC 2024
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:19:15 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:14:05 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:09:52 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:08:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:58:35 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:54:34 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:50:48 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:47:02 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:46:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:52:22 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:48:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:44:38 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:35:08 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:32:36 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 11:31:12 AM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// Generated by Haxe 4.3.3
var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this;
@ -1937,7 +2012,6 @@ xrf.loadModel = function(model,url,noadd){
let {directory,file,fragment,fileExt} = URI;
model.file = URI.file
xrf.model = model
// xrf.scene = model.scene
if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model
@ -2008,7 +2082,6 @@ xrf.reset = () => {
}
xrf.add = (object) => {
object.isXRF = true // mark for easy deletion when replacing scene
xrf.scene.add(object)
}
@ -2550,13 +2623,14 @@ xrf.frag.src.addModel = (model,url,frag,opts) => {
xrf.portalNonEuclidian({...opts,model,scene:model.scene})
// only add external objects, because
// local scene-objects are already added to scene
if( !opts.isLocal ) xrf.scene.add(scene)
if( !opts.isLocal ) xrf.add(scene)
}else{
xrf.frag.src.scale( scene, opts, url ) // scale scene
mesh.add(scene)
}
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.
@ -2631,6 +2705,7 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
animations: model.animations,
scene: scene.clone()
}
_model.scene.isClone = true
_model.scene.traverse( (n) => n.isXRF = true ) // make sure they respond to xrf.reset()
_model.scenes = [_model.scene]
xrf.frag.src.addModel(_model,url,frag, opts) // current file
@ -2640,7 +2715,6 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
// scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects
xrf.frag.src.scale = function(scene, opts, url){
let { mesh, model, camera, renderer, THREE} = opts
// remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection
let cleanScene = scene.clone()
let remove = []
@ -3560,7 +3634,7 @@ xrf.drawLineToMesh = (opts) => {
xrf.focusLine.lines.push(line)
xrf.focusLine.points.push(from)
xrf.focusLine.opacity = 1
scene.add(line)
xrf.add(line)
})
}
}

View File

@ -1,7 +1,82 @@
/*
* v0.5.1 generated at Thu Jul 25 09:31:00 AM UTC 2024
* v0.5.1 generated at Thu Aug 1 04:21:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:19:15 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:14:05 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:09:52 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 04:08:30 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:58:35 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:54:34 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:50:48 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:47:02 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 03:46:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:52:22 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:48:18 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:44:38 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:35:08 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 02:32:36 PM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Thu Aug 1 11:31:12 AM CEST 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// Generated by Haxe 4.3.3
var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this;
@ -1937,7 +2012,6 @@ xrf.loadModel = function(model,url,noadd){
let {directory,file,fragment,fileExt} = URI;
model.file = URI.file
xrf.model = model
// xrf.scene = model.scene
if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model
@ -2008,7 +2082,6 @@ xrf.reset = () => {
}
xrf.add = (object) => {
object.isXRF = true // mark for easy deletion when replacing scene
xrf.scene.add(object)
}
@ -2550,13 +2623,14 @@ xrf.frag.src.addModel = (model,url,frag,opts) => {
xrf.portalNonEuclidian({...opts,model,scene:model.scene})
// only add external objects, because
// local scene-objects are already added to scene
if( !opts.isLocal ) xrf.scene.add(scene)
if( !opts.isLocal ) xrf.add(scene)
}else{
xrf.frag.src.scale( scene, opts, url ) // scale scene
mesh.add(scene)
}
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.
@ -2631,6 +2705,7 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
animations: model.animations,
scene: scene.clone()
}
_model.scene.isClone = true
_model.scene.traverse( (n) => n.isXRF = true ) // make sure they respond to xrf.reset()
_model.scenes = [_model.scene]
xrf.frag.src.addModel(_model,url,frag, opts) // current file
@ -2640,7 +2715,6 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
// scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects
xrf.frag.src.scale = function(scene, opts, url){
let { mesh, model, camera, renderer, THREE} = opts
// remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection
let cleanScene = scene.clone()
let remove = []
@ -3560,7 +3634,7 @@ xrf.drawLineToMesh = (opts) => {
xrf.focusLine.lines.push(line)
xrf.focusLine.points.push(from)
xrf.focusLine.opacity = 1
scene.add(line)
xrf.add(line)
})
}
}

4
make
View File

@ -135,12 +135,12 @@ build(){
cat dist/xrfragment.aframe.all.js src/3rd/js/model-viewer/*.js > dist/xrfragment.model-viewer.js
# add license headers
for file in dist/xrfragment.{aframe,module,three,three.module,aframe.all}.js; do
for file in dist/xrfragmen*.js; do
awk 'BEGIN{
print "/*"
print " * '"$(git tag | head -n1)"' generated at '"$(date)"'"
print " * https://xrfragment.org"
print " * SPDX-License-Identifier: MPL-2.0"
print " * SPDX-License-Identifier: AGPL-3.0-or-later"
print " */"
system("cat '$file'")
}' > /tmp/tmp.js

15
src/3rd/js/aframe/href.js Normal file
View File

@ -0,0 +1,15 @@
window.AFRAME.registerComponent('href', {
schema: {
},
init: function () {
if( !this.data ) return
this.el.object3D.traverse( (m) => {
if( m.geometry ){
m.userData.href = this.data
}
})
}
});

View File

@ -53,7 +53,6 @@ xrf.loadModel = function(model,url,noadd){
let {directory,file,fragment,fileExt} = URI;
model.file = URI.file
xrf.model = model
// xrf.scene = model.scene
if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model
@ -124,7 +123,6 @@ xrf.reset = () => {
}
xrf.add = (object) => {
object.isXRF = true // mark for easy deletion when replacing scene
xrf.scene.add(object)
}

View File

@ -47,7 +47,7 @@ xrf.drawLineToMesh = (opts) => {
xrf.focusLine.lines.push(line)
xrf.focusLine.points.push(from)
xrf.focusLine.opacity = 1
scene.add(line)
xrf.add(line)
})
}
}

View File

@ -45,7 +45,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => {
xrf.portalNonEuclidian({...opts,model,scene:model.scene})
// only add external objects, because
// local scene-objects are already added to scene
if( !opts.isLocal ) xrf.scene.add(scene)
if( !opts.isLocal ) xrf.add(scene)
}else{
xrf.frag.src.scale( scene, opts, url ) // scale scene
mesh.add(scene)
@ -127,6 +127,7 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
animations: model.animations,
scene: scene.clone()
}
_model.scene.isClone = true
_model.scene.traverse( (n) => n.isXRF = true ) // make sure they respond to xrf.reset()
_model.scenes = [_model.scene]
xrf.frag.src.addModel(_model,url,frag, opts) // current file
@ -136,7 +137,6 @@ xrf.frag.src.localSRC = (url,frag,opts) => {
// scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects
xrf.frag.src.scale = function(scene, opts, url){
let { mesh, model, camera, renderer, THREE} = opts
// remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection
let cleanScene = scene.clone()
let remove = []
@ -155,9 +155,6 @@ 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

View File

@ -6,10 +6,11 @@
<script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
<script src="./../../dist/xrfragment.aframe.js"></script>
<script src="./index.js"></script>
<script src="./pubsub.js"></script>
<script src="./filter.js"></script>
</head>
<body>
<h3>open the browserconsole to see the results</h3>
<script src="./pubsub.js"></script>
<script src="./filter.js"></script>
<script src="./xrf.js"></script>
</body>
</html>

View File

@ -10,6 +10,8 @@
console.assert = ((assert) => (a,b) => {
console.log("\x1b[34m♥ \x1b[36;49mtest: "+b.reason+"\x1B[m")
assert.call( console, a, b )
if( !a ) throw 'abort..'
})(console.assert)
/*