123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <html>
- <head>
- <meta charset="UTF-8">
- <title>mesh_parent</title>
- <!-- edit path - name of babylon library as required -->
- <script src="./lib/babylon.js"></script>
- <script src="./lib/mesh_parent_common.js"></script>
- <style>
- html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
- #renderCanvas{ width: 100%; height: 100%; }
- #button {
- color: white; background-color: Dimgray;
- font-size: 14pt; font-weight: bold;
- padding-left:4pt; padding-right:4pt;
-
- border: black outset 2pt; line-height: 2em;
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <div id="buttonbar" style="background-color: Darkorange;">
- <span id="button" onclick="pausePlay()"> Pause - Play </span>
- <span id="button" onclick="orphanConceive()"> Orhpan - Conceive </span>
- </div>
- <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() {
- animate(newScene);
- 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>
|