Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Using babylon.js - How to load a Blender 3D scene</title>
- <script src="http://cdn.babylonjs.com/2-1/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>
- </body>
- <script>
- var scene, camera;
- if (BABYLON.Engine.isSupported()) {
- var canvas = document.getElementById("renderCanvas");
- var engine = new BABYLON.Engine(canvas, true);
- BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) {
- scene=newScene;
- // Wait for textures and shaders to be ready
- newScene.executeWhenReady(function () {
- // Attach camera to canvas inputs
- camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 10, 1, 50, new BABYLON.Vector3(0, 0, 0), scene);
- scene.activeCamera = camera;
- scene.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
- console.log(progress.loaded + " of " + progress.total + " loaded!!!");
- });
- }
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement