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 id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
</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-plane id="floor" position="0 0 0" rotation="-90 0 0" width="100" height="100" material="visible:false"></a-plane>
</a-scene> </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) let match = xrf.XRWG.match(id)
if( v.is( xrf.XRF.PV_EXECUTE ) ){ if( v.is( xrf.XRF.PV_EXECUTE ) ){
console.log("pv_execute")
scene.XRF_PV_ORIGIN = v.string scene.XRF_PV_ORIGIN = v.string
// evaluate aliases // evaluate aliases
match.map( (w) => { match.map( (w) => {
@ -70,7 +69,6 @@ pub.XRWG = (opts) => {
}) })
xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene })
}else{ }else{
console.log("non pv_execute")
xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene })
} }
} }

View file

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