-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (54 loc) · 2.49 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Unity-WebXR-Export</title>
<meta name="description" content="Complete interactive 3D scene demo made in Unity and exported to WebXR with the WebXR template of the Unity WebXR Export">
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
UnityLoader.compatibilityCheck = function (unityInstance, onsuccess, onerror) {
if (!UnityLoader.SystemInfo.hasWebGL) {
unityInstance.popup('Your browser does not support WebGL',
[{text: 'OK', callback: onerror}]);
} else {
onsuccess();
}
}
var unityInstance = UnityLoader.instantiate("unityContainer", "Build/Build.json", {onProgress: UnityProgress});
</script>
</head>
<body>
<div class="webgl-content">
<div id="unityContainer" style="width: 700px; height: 400px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<button class="entervr" id="entervr" value="Enter VR" disabled>VR</button>
<button class="enterar" id="enterar" value="Enter AR" disabled>AR</button>
<div class="webxr-link">Using <a href="https://github.com/De-Panther/unity-webxr-export" target="_blank" title="WebXR Export">WebXR Export</a></div>
<div class="title">Unity-WebXR-Export</div>
</div>
</div>
<script>
let enterARButton = document.getElementById('enterar');
let enterVRButton = document.getElementById('entervr');
document.addEventListener('onARSupportedCheck', function (event) {
enterARButton.disabled = !event.detail.supported;
}, false);
document.addEventListener('onVRSupportedCheck', function (event) {
enterVRButton.disabled = !event.detail.supported;
}, false);
enterARButton.addEventListener('click', function (event) {
document.dispatchEvent(new CustomEvent('toggleAR', {}));
}, false);
enterVRButton.addEventListener('click', function (event) {
document.dispatchEvent(new CustomEvent('toggleVR', {}));
}, false);
</script>
<script src="gl-matrix-min.js"></script>
<script src="webxr.js"></script>
</body>
</html>