-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
117 lines (110 loc) · 5.35 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- These tags are needed for enabling experimental Chrome APIs via Chrome's Origin-Trial program (Android, Windows): https://github.com/GoogleChrome/OriginTrials/blob/gh-pages/available-trials.md#current-experimental-features -->
<!-- Origin Trial Token, feature = Generic Sensors, origin = https://github.io, expires = 2018-04-10 -->
<meta http-equiv="origin-trial" data-feature="Generic Sensors" data-expires="2018-04-10" content="Aokv0ODVMUPIswIBi6DnpAIjhWefEd8gD8GpVgdYgETj0C5+/3kKMzZE/FOrBwHcpBO6LHuVRrIw3yOT8EMmJAYAAABQeyJvcmlnaW4iOiJodHRwczovL2dpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiR2VuZXJpY1NlbnNvciIsImV4cGlyeSI6MTUyMzMxODQwMH0=">
<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://github.io, expires = 2018-05-07 -->
<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-05-07" content="AgINztgDnjFV8da2D9SSzIITBRlHX8mduCR7DXfENxjr9ALduKOxBDdn2n66auQSlljVyhnRWWerxC0BWbE8pAoAAABOeyJvcmlnaW4iOiJodHRwczovL2dpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViVlIxLjFNNjIiLCJleHBpcnkiOjE1MjU3MjU4MDh9">
<title>WebVR Coaster | VR Roller-Coaster Experience | Virtual Reality Game</title>
<meta name="description" content="WebVR Virtual Reality Roller Coaster Experience">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="styles/webvr.css">
<script src="lib/telemetry.js"></script>
<script>
MozillaResearch.telemetry.start({
analytics: true,
errorLogging: true,
performance: true
});
MozillaResearch.telemetry.performance.mark('LoaderParsingStart');
</script>
<script src="Build/UnityLoader.js"></script>
<script>
/* global UnityLoader, MozillaResearch */
MozillaResearch.telemetry.performance.measure('LoaderParsing', 'LoaderParsingStart');
(function () {
UnityLoader.SystemInfo.mobile = false; // Workaround to force `UnityLoader` to actually load on mobile.
MozillaResearch.telemetry.performance.mark('LoadingStart');
window.gameInstance = UnityLoader.instantiate('gameContainer', 'Build/test-1.json', {
Module: {
// `preserveDrawingBuffer` is needed for WebVR content to be mirrored to the `<canvas>`.
webglContextAttributes: {
preserveDrawingBuffer: true
}
},
onProgress: unityProgress
});
function onActivate (evt) {
return new Promise(function (resolve, reject) {
if (!evt.display) {
return reject(new Error('No `display` property found on event'));
}
if (evt.reason && evt.reason !== 'navigation') {
return reject(new Error("Unexpected `reason` (expected to be 'navigation')"));
}
if (!evt.display.capabilities || !evt.display.capabilities.canPresent) {
return reject(new Error('VR display is not capable of presenting'));
}
gameInstance.vrDisplay = evt.display;
return evt.display.requestPresent([{source: gameInstance.Module.canvas}]).then(function () {
console.log('Entered VR mode');
}).catch(function (err) {
console.error('Unable to enter VR mode:', err);
});
});
}
window.addEventListener('vrdisplayactivate', onActivate);
function unityProgress (gameInstance, progress) {
if (!gameInstance.progress) {
gameInstance.loader = document.getElementById('loader');
gameInstance.progress = document.getElementById('progress');
gameInstance.loading = document.getElementById('loading');
}
gameInstance.progress.style.width = (100 * progress) + '%';
if (progress === 1) {
document.dispatchEvent(new CustomEvent('UnityLoaded'));
}
}
})();
</script>
<link rel="manifest" href="manifest.webmanifest">
</head>
<body>
<div id="loader">
<div id="loading" class="loading">Loading</div>
<div id="progress" class="progress"></div>
</div>
<div id="game">
<div id="gameContainer"></div>
</div>
<div id="instruction">
<div id="novr" class="panel center">
<h3>You’ll need a <a href="https://webvr.rocks/">WebVR-enabled browser</a> and VR headset to fully enjoy this experience.</h3>
<p><img src="mousedrag.png" width="70" alt="Click-and-drag your mouse"></p>
<p>In the meantime, <strong><em>click and drag</em></strong> to have a look around!</p>
<p>
<button class="confirm">Continue</button>
</p>
</div>
</div>
<div id="vr">
<div id="status">
<strong>Ready!</strong>
<div id="icons">
<img src="vr.png" height="36" alt="VR icon">
<template id="motion-controller">
<img src="motion-controllers.png" height="33" alt="Motion Controller icon">
</template>
</div>
<small><a href="https://vr.lol/">Not working?</a></small>
</div>
<button id="entervr" value="Enter VR"></button>
</div>
<script src="vendor/gl-matrix-min.js"></script>
<script src="vendor/webvr-polyfill.min.js"></script>
<script src="webvr.js"></script>
</body>
</html>