fixed predefined views

This commit is contained in:
Leon van Kammen 2023-11-02 21:23:35 +01:00
parent 6512133f86
commit 9a05b32d24
6 changed files with 570 additions and 226 deletions

View file

@ -42,7 +42,7 @@
<a-entity id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
</a-entity>
<a-entity id="home" xrf="index.gltf#pos=0,0,0"></a-entity>
<a-entity id="home" xrf="index.gltf"></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>

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -57,7 +57,6 @@ pub.XRWG = (opts) => {
let match = xrf.XRWG.match(id)
if( v.is( xrf.XRF.PV_EXECUTE ) ){
console.log("pv_execute")
scene.XRF_PV_ORIGIN = v.string
// evaluate aliases
match.map( (w) => {
@ -70,7 +69,6 @@ pub.XRWG = (opts) => {
})
xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene })
}else{
console.log("non pv_execute")
xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene })
}
}

View file

@ -3,7 +3,8 @@ xrf.frag.defaultPredefinedViews = (opts) => {
scene.traverse( (n) => {
if( n.userData && n.userData['#'] ){
let frag = xrf.URI.parse( n.userData['#'] )
xrf.hashbus.pub.XRWG({frag,model,scene})
xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments
xrf.hashbus.pub.XRWG({frag,model,scene}) // evaluate dynamic XR fragment using XRWG (see spec)
}
})
}

View file

@ -29,8 +29,8 @@ let loadAudio = (mimetype) => function(url,opts){
sound.setVolume(1.0);
if( isPositionalAudio ){
sound.setRefDistance( mesh.scale.x);
sound.setRolloffFactor(50.0)
sound.setDirectionalCone( 360, 360, 0.01 );
sound.setRolloffFactor(20.0)
//sound.setDirectionalCone( 360, 360, 0.01 );
}
sound.playXRF = (t) => {
@ -47,9 +47,8 @@ let loadAudio = (mimetype) => function(url,opts){
// setting loop
if( t.z ) sound.setLoop( true )
// apply embedded audio/video samplerate/fps or global mixer fps
return console.warn("TODO: convert samplerate frames to seconds!")
let loopStart = hardcodedLoop ? t.y / buffer.sampleRate : t.y / xrf.model.mixer.loop.fps
let loopEnd = hardcodedLoop ? t.z / buffer.sampleRate : t.z / xrf.model.mixer.loop.fps
let loopStart = hardcodedLoop ? t.y : t.y * buffer.sampleRate;
let loopEnd = hardcodedLoop ? t.z : t.z * buffer.sampleRate;
let timeStart = loopStart > 0 ? loopStart : (t.y == undefined ? xrf.model.mixer.time : t.y)
if( t.z > 0 ) sound.setLoopEnd( loopEnd )
@ -58,7 +57,6 @@ let loadAudio = (mimetype) => function(url,opts){
sound.setLoopStart( loopStart )
sound.offset = loopStart
}
sound.play()
}
}