wip
This commit is contained in:
parent
ee3d430261
commit
39463736e1
9 changed files with 3516 additions and 2906 deletions
File diff suppressed because one or more lines are too long
BIN
example/assets/podcast.mp3
Normal file
BIN
example/assets/podcast.mp3
Normal file
Binary file not shown.
BIN
example/assets/test.mp3
Normal file
BIN
example/assets/test.mp3
Normal file
Binary file not shown.
Binary file not shown.
10
index.html
10
index.html
File diff suppressed because one or more lines are too long
|
|
@ -67,6 +67,21 @@ window.AFRAME.registerComponent('xrf', {
|
||||||
}
|
}
|
||||||
xrf.addEventListener('interactionReady', AFRAME.XRF.clickableMeshToEntity )
|
xrf.addEventListener('interactionReady', AFRAME.XRF.clickableMeshToEntity )
|
||||||
|
|
||||||
|
// xrf.addEventListener('interactionReady', () => {
|
||||||
|
// let raycasters = [ ...document.querySelectorAll('[raycaster]') ]
|
||||||
|
// raycasters.map( (rc) => {
|
||||||
|
// rc = rc.components['raycaster']
|
||||||
|
// rc.refreshObjects = () => {
|
||||||
|
// rc.objects = xrf.interactive.objects.map( (o) => ({ ...o, el:{} }) ) // AFRAME raycaster requires 'el' property
|
||||||
|
// console.log("refreshing")
|
||||||
|
// rc.dirty = false
|
||||||
|
// }
|
||||||
|
// rc.dirty = true
|
||||||
|
// rc.refreshObjects()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
// cleanup xrf-get objects when resetting scene
|
// cleanup xrf-get objects when resetting scene
|
||||||
xrf.reset = ((reset) => () => {
|
xrf.reset = ((reset) => () => {
|
||||||
reset()
|
reset()
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@ window.AFRAME.registerComponent('xrf-get', {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// convert to worldcoordinates
|
// convert to worldcoordinates
|
||||||
mesh.getWorldPosition(mesh.position)
|
// mesh.getWorldPosition(mesh.position)
|
||||||
mesh.getWorldScale(mesh.scale)
|
// mesh.getWorldScale(mesh.scale)
|
||||||
mesh.getWorldQuaternion(mesh.quaternion)
|
// mesh.getWorldQuaternion(mesh.quaternion)
|
||||||
mesh.isXRF = true // mark for deletion by xrf
|
mesh.isXRF = true // mark for deletion by xrf
|
||||||
|
this.el.object3D.add = (a) => a // dummy
|
||||||
this.el.setObject3D('mesh',mesh)
|
this.el.setObject3D('mesh',mesh)
|
||||||
// normalize position
|
// normalize position
|
||||||
//this.el.object3D.position.copy( mesh.position )
|
//this.el.object3D.position.copy( mesh.position )
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,9 @@ xrf.InteractiveGroup = function(THREE,renderer,camera){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(obj){
|
add(obj, unparent){
|
||||||
Group.prototype.add.call( this, obj )
|
if( unparent ) Group.prototype.add.call( this, obj )
|
||||||
this.objects = ([]).concat( this.children )
|
this.objects.push(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,12 +131,12 @@ xrf.frag.href = function(v, opts){
|
||||||
|
|
||||||
// lazy add mesh (because we're inside a recursive traverse)
|
// lazy add mesh (because we're inside a recursive traverse)
|
||||||
setTimeout( (mesh) => {
|
setTimeout( (mesh) => {
|
||||||
mesh.getWorldPosition(world.pos)
|
//mesh.getWorldPosition(world.pos)
|
||||||
mesh.getWorldScale(world.scale)
|
//mesh.getWorldScale(world.scale)
|
||||||
mesh.getWorldQuaternion(world.quat);
|
//mesh.getWorldQuaternion(world.quat);
|
||||||
mesh.position.copy(world.pos)
|
//mesh.position.copy(world.pos)
|
||||||
mesh.scale.copy(world.scale)
|
//mesh.scale.copy(world.scale)
|
||||||
mesh.setRotationFromQuaternion(world.quat);
|
//mesh.setRotationFromQuaternion(world.quat);
|
||||||
xrf.interactive.add(mesh)
|
xrf.interactive.add(mesh)
|
||||||
xrf.emit('interactionReady', {mesh,xrf:v,clickHandler: mesh.userData.XRF.href.exec })
|
xrf.emit('interactionReady', {mesh,xrf:v,clickHandler: mesh.userData.XRF.href.exec })
|
||||||
}, 0, mesh )
|
}, 0, mesh )
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue