forked from immersive-web/webxr-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures.html
49 lines (41 loc) · 1.54 KB
/
features.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
<body>https://github.com/patrto/patrto.github.io/blob/main/features.html
<button onclick="viewer()">viewer</button>
<button onclick="local()">local</button>
<button onclick="localFloor()">local-floor</button>
<button onclick="boundedFloor()">bounded-floor</button>
<button onclick="unbounded()">unbounded</button>
<button onclick="endSession()">end</button>
<script>
let xrSession = null;
function onFrame() {
xrSession.requestAnimationFrame(onFrame);
}
function beginXRSession(feature) {
navigator.xr.requestSession('immersive-vr', { requiredFeatures: [ feature ] }).then((session) => {
xrSession = session;
session.requestAnimationFrame(onFrame);
});
}
function endSession() {
xrSession.end();
xrSession = null;
}
function viewer() {
beginXRSession('viewer');
}
function local() {
beginXRSession('local');
}
function localFloor() {
beginXRSession('local-floor');
}
function boundedFloor() {
beginXRSession('bounded-floor');
}
function unbounded() {
beginXRSession('unbounded');
}
</script>
</body>
</html>