forked from adam-zethraeus/xylem.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (43 loc) · 1.24 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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Some Rendering</title>
<style>
#render_canvas {
background: #000;
display: block;
margin: 5px auto;
}
</style>
<script src="libraries/gl-matrix.js"></script>
<script src="libraries/CallbackBarrier.js"></script>
<script src="libraries/browserVersionOf.js"></script>
<script src="libraries/degreesToRadians.js"></script>
<script src="Xylem.js"></script>
<script>
window.onload = function(){
var x = new Xylem(document.getElementById("render_canvas")),
sceneUrl = "scenes/cornell.scene.json",
scene = null;
httpRequest = new XMLHttpRequest();
httpRequest.addEventListener("readystatechange",function(){
if (httpRequest.readyState !== 4) {
return null;
}
if (httpRequest.status === 200) {
scene = JSON.parse(httpRequest.responseText);
} else {
throw "Failure loading scene file.";
}
});
httpRequest.open("GET", sceneUrl, false); // sync
httpRequest.send();
x.loadScene(scene, function(){x.draw();});
}
</script>
</head>
<body>
<canvas id="render_canvas" width="640" height="480"></canvas>
</body>
</html>