mesh_parent_JSON.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title>mesh_parent</title>
  5. <!-- edit path - name of babylon library as required -->
  6. <script src="./lib/babylon.js"></script>
  7. <script src="./lib/mesh_parent_common.js"></script>
  8. <style>
  9. html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
  10. #renderCanvas{ width: 100%; height: 100%; }
  11. #button {
  12. color: white; background-color: Dimgray;
  13. font-size: 14pt; font-weight: bold;
  14. padding-left:4pt; padding-right:4pt;
  15. border: black outset 2pt; line-height: 2em;
  16. cursor: pointer;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div id="buttonbar" style="background-color: Darkorange;">
  22. <span id="button" onclick="pausePlay()"> Pause - Play </span>
  23. <span id="button" onclick="orphanConceive()"> Orhpan - Conceive </span>
  24. </div>
  25. <canvas id="renderCanvas"></canvas>
  26. <script>
  27. if (BABYLON.Engine.isSupported()) {
  28. var canvas = document.getElementById("renderCanvas");
  29. var engine = new BABYLON.Engine(canvas, true);
  30. console.log("Babylon version: " + BABYLON.Engine.Version);
  31. var url = "./TOB-out/"; // edit when .babylon / texture files in a different dir than html
  32. BABYLON.SceneLoader.Load(url, "mesh_parent.babylon", engine,
  33. function (newScene) {
  34. newScene.executeWhenReady(function () {
  35. // Attach camera to canvas inputs
  36. newScene.activeCamera.attachControl(canvas);
  37. // Once the scene is loaded, register a render loop
  38. engine.runRenderLoop(function() {
  39. animate(newScene);
  40. newScene.render();
  41. });
  42. });
  43. },
  44. function (progress) {
  45. // To do: give progress feedback to user
  46. }
  47. );
  48. }else{
  49. alert("WebGL not supported in this browser.\n\n" +
  50. "If in Safari browser, check 'Show Develop menu in menu bar' on the Advanced tab of Preferences. " +
  51. "On the 'Develop' menu, check the 'Enable WebGL' menu item.");
  52. }
  53. //Resize
  54. window.addEventListener("resize", function () {
  55. engine.resize();
  56. });
  57. </script>
  58. </body>
  59. </html>