forked from upf-gti/wgpuEngineSample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.html
82 lines (75 loc) · 2.83 KB
/
shell.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
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Digital Locations</title>
<link rel="stylesheet" href="https://cdn.skypack.dev/lexgui/build/lexgui.css">
<script type="importmap">
{
"imports": {
"lexgui": "https://cdn.skypack.dev/lexgui/build/lexgui.module.js"
}
}
</script>
</head>
<body>
<div style="width:50%;font-size:36px;font-weight: 500;text-align: center;margin: 0 auto;margin-top: 25%;">Loading engine, please wait...</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1
style="position:fixed;height:100%;width:100%;top:0%;left:0%;resize:both;"></canvas>
<template id="main-script">
{{{ SCRIPT }}}
</template>
<script type='text/javascript'>
var Module = {
preRun: [],
postRun: [],
onRuntimeInitialized: () => {
},
canvas: (function () {
var canvas = document.getElementById('canvas');
// Event handler to resize the canvas when the document view is changed
window.addEventListener('resize', () => {
canvas.clientWidth = window.innerWidth;
canvas.clientHeight = window.innerHeight;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}, false);
return canvas;
})(),
totalDependencies: 0
};
function loadApp()
{
var script = document.createElement( 'script' );
script.type = 'module';
script.src = "./js/script.js";
script.async = false;
document.getElementsByTagName( 'head' )[ 0 ].appendChild( script );
}
(async () => {
// Custom for WebGPU
if (!navigator.gpu) {
console.error("Sorry, WebGPU is not supported by your browser.");
const msg = document.createElement("div");
Object.assign( msg.style, {
width: "50%",
fontSize: "36px",
fontWeight: "500",
textAlign: "center",
margin: "0 auto",
marginTop: "25%"
} );
msg.innerText = "Sorry, WebGPU is not supported by your browser.";
document.body.appendChild(msg);
return;
} else {
const jsTemplate = document.getElementById("main-script");
const js = jsTemplate.content.cloneNode(true);
document.body.appendChild(js);
}
})();
</script>
<script src=./js/zmq_bundle.js></script>
</body>
</html>