|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en-us"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 | + <title>Unity WebGL Player | Unity-WebXR-Export</title> |
| 7 | + <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"> |
| 8 | + <link rel="shortcut icon" href="TemplateData/favicon.ico"> |
| 9 | + <link rel="stylesheet" href="TemplateData/style.css"> |
| 10 | + <script src="TemplateData/UnityProgress.js"></script> |
| 11 | + <script src="Build/UnityLoader.js"></script> |
| 12 | + <script> |
| 13 | + UnityLoader.compatibilityCheck = function (unityInstance, onsuccess, onerror) { |
| 14 | + if (!UnityLoader.SystemInfo.hasWebGL) { |
| 15 | + unityInstance.popup('Your browser does not support WebGL', |
| 16 | + [{text: 'OK', callback: onerror}]); |
| 17 | + } else if (['Edge', 'Firefox', 'Chrome', 'Safari'].indexOf(UnityLoader.SystemInfo.browser) == -1 && UnityLoader.SystemInfo.os != 'iOS') { |
| 18 | + unityInstance.popup([ |
| 19 | + UnityLoader.SystemInfo.os, |
| 20 | + UnityLoader.SystemInfo.browser, |
| 21 | + 'No support for Unity WebGL content' |
| 22 | + ].join(' '), [{text: 'OK', callback: onsuccess}]); |
| 23 | + } else { |
| 24 | + onsuccess(); |
| 25 | + } |
| 26 | + } |
| 27 | + var unityInstance = UnityLoader.instantiate("unityContainer", "Build/Build.json", {onProgress: UnityProgress}); |
| 28 | + </script> |
| 29 | + </head> |
| 30 | + <body> |
| 31 | + <div class="webgl-content"> |
| 32 | + <div id="unityContainer" style="width: 700px; height: 400px"></div> |
| 33 | + <div class="footer"> |
| 34 | + <div class="webgl-logo"></div> |
| 35 | + <button class="entervr" id="entervr" value="Enter VR" disabled>VR</button> |
| 36 | + <button class="enterar" id="enterar" value="Enter AR" disabled>AR</button> |
| 37 | + <div class="webxr-link">Using <a href="https://github.com/De-Panther/unity-webxr-export" target="_blank" title="WebXR Export">WebXR Export</a></div> |
| 38 | + <div class="title">Unity-WebXR-Export</div> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + <script> |
| 42 | + let enterARButton = document.getElementById('enterar'); |
| 43 | + let enterVRButton = document.getElementById('entervr'); |
| 44 | + |
| 45 | + document.addEventListener('onARSupportedCheck', function (event) { |
| 46 | + enterARButton.disabled = !event.detail.supported; |
| 47 | + }, false); |
| 48 | + document.addEventListener('onVRSupportedCheck', function (event) { |
| 49 | + enterVRButton.disabled = !event.detail.supported; |
| 50 | + }, false); |
| 51 | + |
| 52 | + enterARButton.addEventListener('click', function (event) { |
| 53 | + document.dispatchEvent(new CustomEvent('toggleAR', {})); |
| 54 | + }, false); |
| 55 | + enterVRButton.addEventListener('click', function (event) { |
| 56 | + document.dispatchEvent(new CustomEvent('toggleVR', {})); |
| 57 | + }, false); |
| 58 | + </script> |
| 59 | + <script src="gl-matrix-min.js"></script> |
| 60 | + <script src="webxr_ml1.js"></script> |
| 61 | + </body> |
| 62 | +</html> |
0 commit comments