123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Using babylon.js - How to load a scene</title>
- <script src="babylon.js"></script>
- <style>
- html, body {
- width: 100%;
- height: 100%;
- padding: 0;
- margin: 0;
- overflow: hidden;
- }
- #renderCanvas {
- width: 100%;
- height: 100%;
- }
- </style>
- </head>
- <body>
- <canvas id="renderCanvas"></canvas>
- <script>
- if (BABYLON.Engine.isSupported()) {
- var canvas = document.getElementById("renderCanvas");
- var engine = new BABYLON.Engine(canvas, true);
- BABYLON.SceneLoader.Load("data/", "sundew_engine.babylon", engine, function (newScene) {
- // Wait for textures and shaders to be ready
- newScene.executeWhenReady(function () {
- // Attach camera to canvas inputs
- newScene.activeCamera.attachControl(canvas);
- // Once the scene is loaded, just register a render loop to render it
- engine.runRenderLoop(function() {
- newScene.render();
- });
- });
- }, function (progress) {
- // To do: give progress feedback to user
- });
- }
- </script>
- </body>
- </html>
|