diff --git a/media/gltf/.DS_Store b/media/gltf/.DS_Store new file mode 100644 index 0000000..5a3da9c Binary files /dev/null and b/media/gltf/.DS_Store differ diff --git a/proposals/plane-detection.html b/proposals/plane-detection.html index f44f859..e1a941a 100644 --- a/proposals/plane-detection.html +++ b/proposals/plane-detection.html @@ -21,12 +21,15 @@ including implementation of synchronous hit test in JavaScript leveraging obtained plane data and anchors API to position objects.

- +

+ +
+ Back

@@ -69,6 +72,8 @@ let camera, scene, renderer; let controller1, controller2; let controllerGrip1, controllerGrip2; + let startTime; + let launchedCapture = false; const intersected = []; const tempMatrix = new THREE.Matrix4(); @@ -217,15 +222,24 @@ }); } + function onVisibilityChange(event) { + console.log("Visibility change for " + + (event.session.isImmersive ? "immersive" : "non-immersive") + + " session: " + + event.session.visibilityState); + } + function onSessionStarted(session) { useDomOverlay.disabled = true; session.addEventListener('end', onSessionEnded); session.addEventListener('select', onSelect); + session.addEventListener('visibilitychange', onVisibilityChange); renderer.xr.setReferenceSpaceType('local'); renderer.xr.setSession(session); renderer.setAnimationLoop(render); + startTime = new Date(); } function onEndSession(session) { @@ -535,6 +549,13 @@ } function render(timestamp, frame) { + + if ((frame.detectedPlanes.size === 0) && useRoomCapture.checked && ((new Date() - startTime) > 1000) && (launchedCapture === false)) { + if (frame.session.initiateRoomCapture) { + frame.session.initiateRoomCapture(); + } + launchedCapture = true; + } if (frame) { cached_frame = frame; processAnchors(timestamp, frame);