12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <html>
- <head>
- <meta charset="UTF-8">
- <title>mesh_parent</title>
- <!-- edit path - name of babylon library as required -->
- <script src="./lib/babylon.js"></script>
- <style>
- html, body { width: 100%; height: 100%; margin: 0; padding: 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);
- console.log("Babylon version: " + BABYLON.Engine.Version);
- var url = "./TOB-out/"; // edit when .babylon / texture files in a different dir than html
- BABYLON.SceneLoader.Load(url, "mesh_parent.babylon", engine,
- function (newScene) {
- newScene.executeWhenReady(function () {
- // Attach camera to canvas inputs
- newScene.activeCamera.attachControl(canvas);
- // Once the scene is loaded, register a render loop
- engine.runRenderLoop(function() {
- newScene.render();
- });
- });
- },
- function (progress) {
- // To do: give progress feedback to user
- }
- );
- }else{
- alert("WebGL not supported in this browser.\n\n" +
- "If in Safari browser, check 'Show Develop menu in menu bar' on the Advanced tab of Preferences. " +
- "On the 'Develop' menu, check the 'Enable WebGL' menu item.");
- }
- //Resize
- window.addEventListener("resize", function () {
- engine.resize();
- });
- </script>
- </body>
- </html>
|