-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.html
49 lines (43 loc) · 1.5 KB
/
default.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
<!Doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>BabyJS Demo</title>
<style>
#canvas {
width:100%;
height:100%;
}
</style>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
document.addEventListener('DOMContentLoaded', startGame, false);
function startGame() {
if (BABYLON.Engine.isSupported()) {
canvas = document.getElementById("canvas");
engine = new BABYLON.Engine(canvas, true);
BABYLON.SceneLoader.Load("Espilit/", "home.babylon", engine, function (loadedScene) {
scene = loadedScene;
// create collistion detection
scene.collisionsEnabled = true;
scene.activeCamera.checkCollisions = true;
// Wait for textures and shaders to be ready
scene.executeWhenReady(function () {
// Attach camera to canvas inputs
scene.activeCamera.attachControl(canvas);
// Once the scene is loaded, just register a render loop to render it
engine.runRenderLoop(function () {
scene.render();
});
});
}, function (progress) {
// To do: give progress feedback to user
});
}
}
</script>
</body>
</html>