various bugfixes
This commit is contained in:
parent
d3eb478223
commit
f08c0acfd4
17 changed files with 9972 additions and 3579 deletions
32
dist/xrfragment.aframe.js
vendored
32
dist/xrfragment.aframe.js
vendored
|
|
@ -725,7 +725,7 @@ XRWG.generate = (opts) => {
|
||||||
if( node ){
|
if( node ){
|
||||||
node.nodes.push(spatialNode)
|
node.nodes.push(spatialNode)
|
||||||
}else{
|
}else{
|
||||||
node = { word: XRWG.cleankey(key), key: key.toLowerCase(), nodes:[spatialNode] }
|
node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] }
|
||||||
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
||||||
node[type] = true
|
node[type] = true
|
||||||
xrf.emit('XRWG',node)
|
xrf.emit('XRWG',node)
|
||||||
|
|
@ -857,13 +857,16 @@ xrf.parseModel = function(model,url){
|
||||||
|
|
||||||
let tmp = new xrf.THREE.Vector3()
|
let tmp = new xrf.THREE.Vector3()
|
||||||
model.render = function(){
|
model.render = function(){
|
||||||
model.mixer.update( model.clock.getDelta() )
|
let time = model.clock.getDelta()
|
||||||
|
model.mixer.update( time )
|
||||||
|
|
||||||
// update focusline
|
// update focusline
|
||||||
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
||||||
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
||||||
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
||||||
xrf.focusLine.material.opacity = 0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )
|
xrf.focusLine.material.opacity = (0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )) * xrf.focusLine.opacity;
|
||||||
|
if( xrf.focusLine.opacity > 0.0 ) xrf.focusLine.opacity -= time*0.3
|
||||||
|
if( xrf.focusLine.opacity < 0.0 ) xrf.focusLine.opacity = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1407,6 +1410,7 @@ xrf.frag.href = function(v, opts){
|
||||||
|
|
||||||
let isLocal = v.string[0] == '#'
|
let isLocal = v.string[0] == '#'
|
||||||
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
||||||
|
console.dir(lastPos)
|
||||||
|
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
|
|
@ -1414,8 +1418,7 @@ xrf.frag.href = function(v, opts){
|
||||||
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||||
// always keep a trail of last positions before we navigate
|
// always keep a trail of last positions before we navigate
|
||||||
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
if( !document.location.hash.match(lastPos) ) xrf.navigator.to(`#${lastPos}`)
|
||||||
if( !document.location.hash.match(/pos=/) ) xrf.navigator.to(`#${lastPos}`,flags)
|
|
||||||
xrf.navigator.to(v.string) // let's surf to HREF!
|
xrf.navigator.to(v.string) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
.catch( console.error )
|
.catch( console.error )
|
||||||
|
|
@ -1512,6 +1515,7 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
line.computeLineDistances();
|
line.computeLineDistances();
|
||||||
xrf.focusLine.lines.push(line)
|
xrf.focusLine.lines.push(line)
|
||||||
xrf.focusLine.points.push(from)
|
xrf.focusLine.points.push(from)
|
||||||
|
xrf.focusLine.opacity = 1
|
||||||
scene.add(line)
|
scene.add(line)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1553,6 +1557,10 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
remove.map( (n) => scene.remove(n.selection) )
|
remove.map( (n) => scene.remove(n.selection) )
|
||||||
// create new selections
|
// create new selections
|
||||||
match.map( (w) => {
|
match.map( (w) => {
|
||||||
|
if( w.key == `#${id}` && w.value && w.value[0] == '#' ){
|
||||||
|
// if value is alias, execute fragment value
|
||||||
|
xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR )
|
||||||
|
}
|
||||||
w.nodes.map( (mesh) => {
|
w.nodes.map( (mesh) => {
|
||||||
if( mesh.material )
|
if( mesh.material )
|
||||||
selectionOfInterest( v, scene, mesh )
|
selectionOfInterest( v, scene, mesh )
|
||||||
|
|
@ -1619,8 +1627,10 @@ xrf.frag.q = function(v, opts){
|
||||||
xrf.frag.q.filter = function(scene,frag){
|
xrf.frag.q.filter = function(scene,frag){
|
||||||
// spec: https://xrfragment.org/#queries
|
// spec: https://xrfragment.org/#queries
|
||||||
let q = frag.q.query
|
let q = frag.q.query
|
||||||
|
console.dir(q)
|
||||||
scene.traverse( (mesh) => {
|
scene.traverse( (mesh) => {
|
||||||
for ( let i in q ) {
|
for ( let i in q ) {
|
||||||
|
if( i == '' ) continue
|
||||||
let isMeshId = q[i].id != undefined
|
let isMeshId = q[i].id != undefined
|
||||||
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
||||||
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
||||||
|
|
@ -1658,6 +1668,7 @@ xrf.frag.src = function(v, opts){
|
||||||
xrf.frag.src.scale( src, opts, url )
|
xrf.frag.src.scale( src, opts, url )
|
||||||
xrf.frag.src.eval( src, opts, url )
|
xrf.frag.src.eval( src, opts, url )
|
||||||
mesh.add(src)
|
mesh.add(src)
|
||||||
|
mesh.traverse( (n) => n.isSRC = n.isXRF = true )
|
||||||
if( mesh.material ) mesh.material.visible = false
|
if( mesh.material ) mesh.material.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1687,7 +1698,6 @@ xrf.frag.src.eval = function(scene, opts, url){
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
||||||
if( url ){
|
if( url ){
|
||||||
console.log(mesh.name+" url="+url)
|
console.log(mesh.name+" url="+url)
|
||||||
console.dir(mesh)
|
|
||||||
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
||||||
//let frag = xrfragment.URI.parse(url)
|
//let frag = xrfragment.URI.parse(url)
|
||||||
//// scale URI XR Fragments (queries) inside src-value
|
//// scale URI XR Fragments (queries) inside src-value
|
||||||
|
|
@ -1739,7 +1749,6 @@ xrf.frag.src.scale = function(scene, opts, url){
|
||||||
xrf.frag.src.filterScene = (scene,opts) => {
|
xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
||||||
let obj, src
|
let obj, src
|
||||||
console.dir(frag)
|
|
||||||
// cherrypicking of object(s)
|
// cherrypicking of object(s)
|
||||||
if( !frag.q ){
|
if( !frag.q ){
|
||||||
src = new THREE.Group()
|
src = new THREE.Group()
|
||||||
|
|
@ -1751,18 +1760,15 @@ xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
||||||
}
|
}
|
||||||
}else src = scene.clone(true)
|
}else src = scene.clone(true)
|
||||||
console.dir({name: mesh.name, scene, frag})
|
|
||||||
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// filtering of objects using query
|
// filtering of objects using query
|
||||||
if( frag.q ){
|
if( frag.q ){
|
||||||
src = scene.clone(true);
|
src = scene.clone(true);
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
xrf.frag.q.filter(src,frag)
|
xrf.frag.q.filter(src,frag)
|
||||||
}
|
}
|
||||||
src.traverse( (m) => {
|
src.traverse( (m) => {
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
||||||
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
||||||
})
|
})
|
||||||
|
|
@ -1881,9 +1887,7 @@ xrf.frag.t = function(v, opts){
|
||||||
|
|
||||||
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
||||||
|
|
||||||
console.dir(mixer)
|
// update loop when needed
|
||||||
|
|
||||||
// update loop jump
|
|
||||||
if( !mixer.update.patched ){
|
if( !mixer.update.patched ){
|
||||||
let update = mixer.update
|
let update = mixer.update
|
||||||
mixer.update = function(time){
|
mixer.update = function(time){
|
||||||
|
|
@ -2036,7 +2040,7 @@ window.AFRAME.registerComponent('xrf-button', {
|
||||||
el.setAttribute('material', {
|
el.setAttribute('material', {
|
||||||
color: this.color,
|
color: this.color,
|
||||||
transparent:true,
|
transparent:true,
|
||||||
opacity:0.5
|
opacity:0.7
|
||||||
});
|
});
|
||||||
el.setAttribute('pressable', '');
|
el.setAttribute('pressable', '');
|
||||||
labelEl.setAttribute('position', '0 0 0.01');
|
labelEl.setAttribute('position', '0 0 0.01');
|
||||||
|
|
|
||||||
30
dist/xrfragment.three.js
vendored
30
dist/xrfragment.three.js
vendored
|
|
@ -725,7 +725,7 @@ XRWG.generate = (opts) => {
|
||||||
if( node ){
|
if( node ){
|
||||||
node.nodes.push(spatialNode)
|
node.nodes.push(spatialNode)
|
||||||
}else{
|
}else{
|
||||||
node = { word: XRWG.cleankey(key), key: key.toLowerCase(), nodes:[spatialNode] }
|
node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] }
|
||||||
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
||||||
node[type] = true
|
node[type] = true
|
||||||
xrf.emit('XRWG',node)
|
xrf.emit('XRWG',node)
|
||||||
|
|
@ -857,13 +857,16 @@ xrf.parseModel = function(model,url){
|
||||||
|
|
||||||
let tmp = new xrf.THREE.Vector3()
|
let tmp = new xrf.THREE.Vector3()
|
||||||
model.render = function(){
|
model.render = function(){
|
||||||
model.mixer.update( model.clock.getDelta() )
|
let time = model.clock.getDelta()
|
||||||
|
model.mixer.update( time )
|
||||||
|
|
||||||
// update focusline
|
// update focusline
|
||||||
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
||||||
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
||||||
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
||||||
xrf.focusLine.material.opacity = 0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )
|
xrf.focusLine.material.opacity = (0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )) * xrf.focusLine.opacity;
|
||||||
|
if( xrf.focusLine.opacity > 0.0 ) xrf.focusLine.opacity -= time*0.3
|
||||||
|
if( xrf.focusLine.opacity < 0.0 ) xrf.focusLine.opacity = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1407,6 +1410,7 @@ xrf.frag.href = function(v, opts){
|
||||||
|
|
||||||
let isLocal = v.string[0] == '#'
|
let isLocal = v.string[0] == '#'
|
||||||
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
||||||
|
console.dir(lastPos)
|
||||||
|
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
|
|
@ -1414,8 +1418,7 @@ xrf.frag.href = function(v, opts){
|
||||||
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||||
// always keep a trail of last positions before we navigate
|
// always keep a trail of last positions before we navigate
|
||||||
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
if( !document.location.hash.match(lastPos) ) xrf.navigator.to(`#${lastPos}`)
|
||||||
if( !document.location.hash.match(/pos=/) ) xrf.navigator.to(`#${lastPos}`,flags)
|
|
||||||
xrf.navigator.to(v.string) // let's surf to HREF!
|
xrf.navigator.to(v.string) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
.catch( console.error )
|
.catch( console.error )
|
||||||
|
|
@ -1512,6 +1515,7 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
line.computeLineDistances();
|
line.computeLineDistances();
|
||||||
xrf.focusLine.lines.push(line)
|
xrf.focusLine.lines.push(line)
|
||||||
xrf.focusLine.points.push(from)
|
xrf.focusLine.points.push(from)
|
||||||
|
xrf.focusLine.opacity = 1
|
||||||
scene.add(line)
|
scene.add(line)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1553,6 +1557,10 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
remove.map( (n) => scene.remove(n.selection) )
|
remove.map( (n) => scene.remove(n.selection) )
|
||||||
// create new selections
|
// create new selections
|
||||||
match.map( (w) => {
|
match.map( (w) => {
|
||||||
|
if( w.key == `#${id}` && w.value && w.value[0] == '#' ){
|
||||||
|
// if value is alias, execute fragment value
|
||||||
|
xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR )
|
||||||
|
}
|
||||||
w.nodes.map( (mesh) => {
|
w.nodes.map( (mesh) => {
|
||||||
if( mesh.material )
|
if( mesh.material )
|
||||||
selectionOfInterest( v, scene, mesh )
|
selectionOfInterest( v, scene, mesh )
|
||||||
|
|
@ -1619,8 +1627,10 @@ xrf.frag.q = function(v, opts){
|
||||||
xrf.frag.q.filter = function(scene,frag){
|
xrf.frag.q.filter = function(scene,frag){
|
||||||
// spec: https://xrfragment.org/#queries
|
// spec: https://xrfragment.org/#queries
|
||||||
let q = frag.q.query
|
let q = frag.q.query
|
||||||
|
console.dir(q)
|
||||||
scene.traverse( (mesh) => {
|
scene.traverse( (mesh) => {
|
||||||
for ( let i in q ) {
|
for ( let i in q ) {
|
||||||
|
if( i == '' ) continue
|
||||||
let isMeshId = q[i].id != undefined
|
let isMeshId = q[i].id != undefined
|
||||||
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
||||||
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
||||||
|
|
@ -1658,6 +1668,7 @@ xrf.frag.src = function(v, opts){
|
||||||
xrf.frag.src.scale( src, opts, url )
|
xrf.frag.src.scale( src, opts, url )
|
||||||
xrf.frag.src.eval( src, opts, url )
|
xrf.frag.src.eval( src, opts, url )
|
||||||
mesh.add(src)
|
mesh.add(src)
|
||||||
|
mesh.traverse( (n) => n.isSRC = n.isXRF = true )
|
||||||
if( mesh.material ) mesh.material.visible = false
|
if( mesh.material ) mesh.material.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1687,7 +1698,6 @@ xrf.frag.src.eval = function(scene, opts, url){
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
||||||
if( url ){
|
if( url ){
|
||||||
console.log(mesh.name+" url="+url)
|
console.log(mesh.name+" url="+url)
|
||||||
console.dir(mesh)
|
|
||||||
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
||||||
//let frag = xrfragment.URI.parse(url)
|
//let frag = xrfragment.URI.parse(url)
|
||||||
//// scale URI XR Fragments (queries) inside src-value
|
//// scale URI XR Fragments (queries) inside src-value
|
||||||
|
|
@ -1739,7 +1749,6 @@ xrf.frag.src.scale = function(scene, opts, url){
|
||||||
xrf.frag.src.filterScene = (scene,opts) => {
|
xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
||||||
let obj, src
|
let obj, src
|
||||||
console.dir(frag)
|
|
||||||
// cherrypicking of object(s)
|
// cherrypicking of object(s)
|
||||||
if( !frag.q ){
|
if( !frag.q ){
|
||||||
src = new THREE.Group()
|
src = new THREE.Group()
|
||||||
|
|
@ -1751,18 +1760,15 @@ xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
||||||
}
|
}
|
||||||
}else src = scene.clone(true)
|
}else src = scene.clone(true)
|
||||||
console.dir({name: mesh.name, scene, frag})
|
|
||||||
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// filtering of objects using query
|
// filtering of objects using query
|
||||||
if( frag.q ){
|
if( frag.q ){
|
||||||
src = scene.clone(true);
|
src = scene.clone(true);
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
xrf.frag.q.filter(src,frag)
|
xrf.frag.q.filter(src,frag)
|
||||||
}
|
}
|
||||||
src.traverse( (m) => {
|
src.traverse( (m) => {
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
||||||
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
||||||
})
|
})
|
||||||
|
|
@ -1881,9 +1887,7 @@ xrf.frag.t = function(v, opts){
|
||||||
|
|
||||||
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
||||||
|
|
||||||
console.dir(mixer)
|
// update loop when needed
|
||||||
|
|
||||||
// update loop jump
|
|
||||||
if( !mixer.update.patched ){
|
if( !mixer.update.patched ){
|
||||||
let update = mixer.update
|
let update = mixer.update
|
||||||
mixer.update = function(time){
|
mixer.update = function(time){
|
||||||
|
|
|
||||||
30
dist/xrfragment.three.module.js
vendored
30
dist/xrfragment.three.module.js
vendored
|
|
@ -725,7 +725,7 @@ XRWG.generate = (opts) => {
|
||||||
if( node ){
|
if( node ){
|
||||||
node.nodes.push(spatialNode)
|
node.nodes.push(spatialNode)
|
||||||
}else{
|
}else{
|
||||||
node = { word: XRWG.cleankey(key), key: key.toLowerCase(), nodes:[spatialNode] }
|
node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] }
|
||||||
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
||||||
node[type] = true
|
node[type] = true
|
||||||
xrf.emit('XRWG',node)
|
xrf.emit('XRWG',node)
|
||||||
|
|
@ -857,13 +857,16 @@ xrf.parseModel = function(model,url){
|
||||||
|
|
||||||
let tmp = new xrf.THREE.Vector3()
|
let tmp = new xrf.THREE.Vector3()
|
||||||
model.render = function(){
|
model.render = function(){
|
||||||
model.mixer.update( model.clock.getDelta() )
|
let time = model.clock.getDelta()
|
||||||
|
model.mixer.update( time )
|
||||||
|
|
||||||
// update focusline
|
// update focusline
|
||||||
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
||||||
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
||||||
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
||||||
xrf.focusLine.material.opacity = 0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )
|
xrf.focusLine.material.opacity = (0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )) * xrf.focusLine.opacity;
|
||||||
|
if( xrf.focusLine.opacity > 0.0 ) xrf.focusLine.opacity -= time*0.3
|
||||||
|
if( xrf.focusLine.opacity < 0.0 ) xrf.focusLine.opacity = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1407,6 +1410,7 @@ xrf.frag.href = function(v, opts){
|
||||||
|
|
||||||
let isLocal = v.string[0] == '#'
|
let isLocal = v.string[0] == '#'
|
||||||
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
||||||
|
console.dir(lastPos)
|
||||||
|
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
|
|
@ -1414,8 +1418,7 @@ xrf.frag.href = function(v, opts){
|
||||||
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||||
// always keep a trail of last positions before we navigate
|
// always keep a trail of last positions before we navigate
|
||||||
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
if( !document.location.hash.match(lastPos) ) xrf.navigator.to(`#${lastPos}`)
|
||||||
if( !document.location.hash.match(/pos=/) ) xrf.navigator.to(`#${lastPos}`,flags)
|
|
||||||
xrf.navigator.to(v.string) // let's surf to HREF!
|
xrf.navigator.to(v.string) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
.catch( console.error )
|
.catch( console.error )
|
||||||
|
|
@ -1512,6 +1515,7 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
line.computeLineDistances();
|
line.computeLineDistances();
|
||||||
xrf.focusLine.lines.push(line)
|
xrf.focusLine.lines.push(line)
|
||||||
xrf.focusLine.points.push(from)
|
xrf.focusLine.points.push(from)
|
||||||
|
xrf.focusLine.opacity = 1
|
||||||
scene.add(line)
|
scene.add(line)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1553,6 +1557,10 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
remove.map( (n) => scene.remove(n.selection) )
|
remove.map( (n) => scene.remove(n.selection) )
|
||||||
// create new selections
|
// create new selections
|
||||||
match.map( (w) => {
|
match.map( (w) => {
|
||||||
|
if( w.key == `#${id}` && w.value && w.value[0] == '#' ){
|
||||||
|
// if value is alias, execute fragment value
|
||||||
|
xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR )
|
||||||
|
}
|
||||||
w.nodes.map( (mesh) => {
|
w.nodes.map( (mesh) => {
|
||||||
if( mesh.material )
|
if( mesh.material )
|
||||||
selectionOfInterest( v, scene, mesh )
|
selectionOfInterest( v, scene, mesh )
|
||||||
|
|
@ -1619,8 +1627,10 @@ xrf.frag.q = function(v, opts){
|
||||||
xrf.frag.q.filter = function(scene,frag){
|
xrf.frag.q.filter = function(scene,frag){
|
||||||
// spec: https://xrfragment.org/#queries
|
// spec: https://xrfragment.org/#queries
|
||||||
let q = frag.q.query
|
let q = frag.q.query
|
||||||
|
console.dir(q)
|
||||||
scene.traverse( (mesh) => {
|
scene.traverse( (mesh) => {
|
||||||
for ( let i in q ) {
|
for ( let i in q ) {
|
||||||
|
if( i == '' ) continue
|
||||||
let isMeshId = q[i].id != undefined
|
let isMeshId = q[i].id != undefined
|
||||||
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
||||||
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
||||||
|
|
@ -1658,6 +1668,7 @@ xrf.frag.src = function(v, opts){
|
||||||
xrf.frag.src.scale( src, opts, url )
|
xrf.frag.src.scale( src, opts, url )
|
||||||
xrf.frag.src.eval( src, opts, url )
|
xrf.frag.src.eval( src, opts, url )
|
||||||
mesh.add(src)
|
mesh.add(src)
|
||||||
|
mesh.traverse( (n) => n.isSRC = n.isXRF = true )
|
||||||
if( mesh.material ) mesh.material.visible = false
|
if( mesh.material ) mesh.material.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1687,7 +1698,6 @@ xrf.frag.src.eval = function(scene, opts, url){
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
||||||
if( url ){
|
if( url ){
|
||||||
console.log(mesh.name+" url="+url)
|
console.log(mesh.name+" url="+url)
|
||||||
console.dir(mesh)
|
|
||||||
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
||||||
//let frag = xrfragment.URI.parse(url)
|
//let frag = xrfragment.URI.parse(url)
|
||||||
//// scale URI XR Fragments (queries) inside src-value
|
//// scale URI XR Fragments (queries) inside src-value
|
||||||
|
|
@ -1739,7 +1749,6 @@ xrf.frag.src.scale = function(scene, opts, url){
|
||||||
xrf.frag.src.filterScene = (scene,opts) => {
|
xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
||||||
let obj, src
|
let obj, src
|
||||||
console.dir(frag)
|
|
||||||
// cherrypicking of object(s)
|
// cherrypicking of object(s)
|
||||||
if( !frag.q ){
|
if( !frag.q ){
|
||||||
src = new THREE.Group()
|
src = new THREE.Group()
|
||||||
|
|
@ -1751,18 +1760,15 @@ xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
||||||
}
|
}
|
||||||
}else src = scene.clone(true)
|
}else src = scene.clone(true)
|
||||||
console.dir({name: mesh.name, scene, frag})
|
|
||||||
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// filtering of objects using query
|
// filtering of objects using query
|
||||||
if( frag.q ){
|
if( frag.q ){
|
||||||
src = scene.clone(true);
|
src = scene.clone(true);
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
xrf.frag.q.filter(src,frag)
|
xrf.frag.q.filter(src,frag)
|
||||||
}
|
}
|
||||||
src.traverse( (m) => {
|
src.traverse( (m) => {
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
||||||
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
||||||
})
|
})
|
||||||
|
|
@ -1881,9 +1887,7 @@ xrf.frag.t = function(v, opts){
|
||||||
|
|
||||||
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
||||||
|
|
||||||
console.dir(mixer)
|
// update loop when needed
|
||||||
|
|
||||||
// update loop jump
|
|
||||||
if( !mixer.update.patched ){
|
if( !mixer.update.patched ){
|
||||||
let update = mixer.update
|
let update = mixer.update
|
||||||
mixer.update = function(time){
|
mixer.update = function(time){
|
||||||
|
|
|
||||||
1
example/aframe/sandbox/index.gltf
Symbolic link
1
example/aframe/sandbox/index.gltf
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
assets/index.gltf
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
<a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
|
<a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
|
||||||
</a-entity>
|
</a-entity>
|
||||||
|
|
||||||
<a-entity id="home" xrf="example.gltf#pos=0,0,0"></a-entity>
|
<a-entity id="home" xrf="index.gltf#pos=0,0,0"></a-entity>
|
||||||
<a-entity id="floor" xrf-get="floor"></a-entity>
|
<a-plane id="floor" position="0 0 0" rotation="-90 0 0" width="100" height="100" material="visible:false"></a-plane>
|
||||||
</a-scene>
|
</a-scene>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
8305
example/assets/index.gltf
Normal file
8305
example/assets/index.gltf
Normal file
File diff suppressed because one or more lines are too long
1
example/threejs/sandbox/index.gltf
Symbolic link
1
example/threejs/sandbox/index.gltf
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
assets/index.gltf
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<a class="btn-foot" id="source" target="_blank" href="https://github.com/coderofsalvation/xrfragment-helloworld">➕ clone project</a>
|
<a class="btn-foot" id="source" target="_blank" href="https://github.com/coderofsalvation/xrfragment-helloworld">➕ clone project</a>
|
||||||
<a class="btn-foot" id="embed" target="_blank" onclick="embed()">📺 embed</a>
|
<a class="btn-foot" id="embed" target="_blank" onclick="embed()">📺 embed</a>
|
||||||
<a class="btn-foot" id="model" target="_blank" href="example.gltf">⬇️ model</a>
|
<a class="btn-foot" id="model" target="_blank" href="index.gltf">⬇️ model</a>
|
||||||
<textarea style="display:none"></textarea>
|
<textarea style="display:none"></textarea>
|
||||||
|
|
||||||
<script async src="./../../assets/js/alpine.min.js"></script>
|
<script async src="./../../assets/js/alpine.min.js"></script>
|
||||||
|
|
@ -118,7 +118,7 @@
|
||||||
|
|
||||||
window.XRF = XRF // expose to form
|
window.XRF = XRF // expose to form
|
||||||
|
|
||||||
let file = document.location.search.length > 2 ? document.location.search.substr(1) + document.location.hash : 'example.gltf#pos=0,1,20'
|
let file = document.location.search.length > 2 ? document.location.search.substr(1) + document.location.hash : 'index.gltf#pos=0,1,20'
|
||||||
|
|
||||||
// optional decoration of href event
|
// optional decoration of href event
|
||||||
XRF.addEventListener('href',(e) => {
|
XRF.addEventListener('href',(e) => {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ XRWG.generate = (opts) => {
|
||||||
if( node ){
|
if( node ){
|
||||||
node.nodes.push(spatialNode)
|
node.nodes.push(spatialNode)
|
||||||
}else{
|
}else{
|
||||||
node = { word: XRWG.cleankey(key), key: key.toLowerCase(), nodes:[spatialNode] }
|
node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] }
|
||||||
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
if( spatialNode.userData[key] ) node.value = spatialNode.userData[key]
|
||||||
node[type] = true
|
node[type] = true
|
||||||
xrf.emit('XRWG',node)
|
xrf.emit('XRWG',node)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ window.AFRAME.registerComponent('xrf-button', {
|
||||||
el.setAttribute('material', {
|
el.setAttribute('material', {
|
||||||
color: this.color,
|
color: this.color,
|
||||||
transparent:true,
|
transparent:true,
|
||||||
opacity:0.5
|
opacity:0.7
|
||||||
});
|
});
|
||||||
el.setAttribute('pressable', '');
|
el.setAttribute('pressable', '');
|
||||||
labelEl.setAttribute('position', '0 0 0.01');
|
labelEl.setAttribute('position', '0 0 0.01');
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,16 @@ xrf.parseModel = function(model,url){
|
||||||
|
|
||||||
let tmp = new xrf.THREE.Vector3()
|
let tmp = new xrf.THREE.Vector3()
|
||||||
model.render = function(){
|
model.render = function(){
|
||||||
model.mixer.update( model.clock.getDelta() )
|
let time = model.clock.getDelta()
|
||||||
|
model.mixer.update( time )
|
||||||
|
|
||||||
// update focusline
|
// update focusline
|
||||||
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
xrf.focusLine.material.color.r = (1.0 + Math.sin( model.clock.getElapsedTime()*10 ))/2
|
||||||
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
xrf.focusLine.material.dashSize = 0.2 + 0.02*Math.sin( model.clock.getElapsedTime() )
|
||||||
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
xrf.focusLine.material.gapSize = 0.1 + 0.02*Math.sin( model.clock.getElapsedTime() *3 )
|
||||||
xrf.focusLine.material.opacity = 0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )
|
xrf.focusLine.material.opacity = (0.25 + 0.15*Math.sin( model.clock.getElapsedTime() * 3 )) * xrf.focusLine.opacity;
|
||||||
|
if( xrf.focusLine.opacity > 0.0 ) xrf.focusLine.opacity -= time*0.3
|
||||||
|
if( xrf.focusLine.opacity < 0.0 ) xrf.focusLine.opacity = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,8 @@ xrf.frag.href = function(v, opts){
|
||||||
.then( () => {
|
.then( () => {
|
||||||
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||||
let url = v.string
|
|
||||||
// always keep a trail of last positions before we navigate
|
// always keep a trail of last positions before we navigate
|
||||||
if( v.string.match(/pos=/) == null ) {
|
if( !document.location.hash.match(lastPos) ) xrf.navigator.to(`#${lastPos}`)
|
||||||
url += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
|
||||||
}
|
|
||||||
xrf.navigator.to(v.string) // let's surf to HREF!
|
xrf.navigator.to(v.string) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
.catch( console.error )
|
.catch( console.error )
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
line.computeLineDistances();
|
line.computeLineDistances();
|
||||||
xrf.focusLine.lines.push(line)
|
xrf.focusLine.lines.push(line)
|
||||||
xrf.focusLine.points.push(from)
|
xrf.focusLine.points.push(from)
|
||||||
|
xrf.focusLine.opacity = 1
|
||||||
scene.add(line)
|
scene.add(line)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -81,6 +82,10 @@ xrf.frag.updatePredefinedView = (opts) => {
|
||||||
remove.map( (n) => scene.remove(n.selection) )
|
remove.map( (n) => scene.remove(n.selection) )
|
||||||
// create new selections
|
// create new selections
|
||||||
match.map( (w) => {
|
match.map( (w) => {
|
||||||
|
if( w.key == `#${id}` && w.value && w.value[0] == '#' ){
|
||||||
|
// if value is alias, execute fragment value
|
||||||
|
xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR )
|
||||||
|
}
|
||||||
w.nodes.map( (mesh) => {
|
w.nodes.map( (mesh) => {
|
||||||
if( mesh.material )
|
if( mesh.material )
|
||||||
selectionOfInterest( v, scene, mesh )
|
selectionOfInterest( v, scene, mesh )
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@ xrf.frag.q = function(v, opts){
|
||||||
xrf.frag.q.filter = function(scene,frag){
|
xrf.frag.q.filter = function(scene,frag){
|
||||||
// spec: https://xrfragment.org/#queries
|
// spec: https://xrfragment.org/#queries
|
||||||
let q = frag.q.query
|
let q = frag.q.query
|
||||||
|
console.dir(q)
|
||||||
scene.traverse( (mesh) => {
|
scene.traverse( (mesh) => {
|
||||||
for ( let i in q ) {
|
for ( let i in q ) {
|
||||||
|
if( i == '' ) continue
|
||||||
let isMeshId = q[i].id != undefined
|
let isMeshId = q[i].id != undefined
|
||||||
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
let isMeshProperty = q[i].rules != undefined && q[i].rules.length && !isMeshId
|
||||||
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
if( q[i].root && mesh.isSRC ) continue; // ignore nested object for root-items (queryseletor '/foo' e.g.)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ xrf.frag.src = function(v, opts){
|
||||||
xrf.frag.src.scale( src, opts, url )
|
xrf.frag.src.scale( src, opts, url )
|
||||||
xrf.frag.src.eval( src, opts, url )
|
xrf.frag.src.eval( src, opts, url )
|
||||||
mesh.add(src)
|
mesh.add(src)
|
||||||
|
mesh.traverse( (n) => n.isSRC = n.isXRF = true )
|
||||||
if( mesh.material ) mesh.material.visible = false
|
if( mesh.material ) mesh.material.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,7 +46,6 @@ xrf.frag.src.eval = function(scene, opts, url){
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus} = opts
|
||||||
if( url ){
|
if( url ){
|
||||||
console.log(mesh.name+" url="+url)
|
console.log(mesh.name+" url="+url)
|
||||||
console.dir(mesh)
|
|
||||||
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
//let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
|
||||||
//let frag = xrfragment.URI.parse(url)
|
//let frag = xrfragment.URI.parse(url)
|
||||||
//// scale URI XR Fragments (queries) inside src-value
|
//// scale URI XR Fragments (queries) inside src-value
|
||||||
|
|
@ -97,7 +97,6 @@ xrf.frag.src.scale = function(scene, opts, url){
|
||||||
xrf.frag.src.filterScene = (scene,opts) => {
|
xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts
|
||||||
let obj, src
|
let obj, src
|
||||||
console.dir(frag)
|
|
||||||
// cherrypicking of object(s)
|
// cherrypicking of object(s)
|
||||||
if( !frag.q ){
|
if( !frag.q ){
|
||||||
src = new THREE.Group()
|
src = new THREE.Group()
|
||||||
|
|
@ -109,18 +108,15 @@ xrf.frag.src.filterScene = (scene,opts) => {
|
||||||
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
hashbus.pub.fragment(i, Object.assign(opts,{frag, model,scene}))
|
||||||
}
|
}
|
||||||
}else src = scene.clone(true)
|
}else src = scene.clone(true)
|
||||||
console.dir({name: mesh.name, scene, frag})
|
|
||||||
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
if( src.children.length == 1 ) obj.position.set(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// filtering of objects using query
|
// filtering of objects using query
|
||||||
if( frag.q ){
|
if( frag.q ){
|
||||||
src = scene.clone(true);
|
src = scene.clone(true);
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
xrf.frag.q.filter(src,frag)
|
xrf.frag.q.filter(src,frag)
|
||||||
}
|
}
|
||||||
src.traverse( (m) => {
|
src.traverse( (m) => {
|
||||||
src.isSRC = src.isXRF = true;
|
|
||||||
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
if( m.userData && (m.userData.src || m.userData.href) ) return ; // prevent infinite recursion
|
||||||
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
hashbus.pub.mesh(m,{scene,recursive:true}) // cool idea: recursion-depth based distance between face & src
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,7 @@ xrf.frag.t = function(v, opts){
|
||||||
|
|
||||||
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
if( v.y > 0 || v.z > 0 ) updateTime( mixer.loop.timeStart )
|
||||||
|
|
||||||
console.dir(mixer)
|
// update loop when needed
|
||||||
|
|
||||||
// update loop jump
|
|
||||||
if( !mixer.update.patched ){
|
if( !mixer.update.patched ){
|
||||||
let update = mixer.update
|
let update = mixer.update
|
||||||
mixer.update = function(time){
|
mixer.update = function(time){
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue