mesh_parent_inline.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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="./TOB-out/mesh_parent.js"></script>
  8. <script src="./lib/mesh_parent_common.js"></script>
  9. <style>
  10. html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
  11. #renderCanvas{ width: 100%; height: 100%; }
  12. #button {
  13. color: white; background-color: Dimgray;
  14. font-size: 14pt; font-weight: bold;
  15. padding-left:4pt; padding-right:4pt;
  16. border: black outset 2pt; line-height: 2em;
  17. cursor: pointer;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div id="buttonbar" style="background-color: Darkorange;">
  23. <span id="button" onclick="pausePlay()"> Pause - Play </span>
  24. <span id="button" onclick="orphanConceive()"> Orhpan - Conceive </span>
  25. </div>
  26. <canvas id="renderCanvas"></canvas>
  27. <script>
  28. if (BABYLON.Engine.isSupported()) {
  29. var canvas = document.getElementById("renderCanvas");
  30. var engine = new BABYLON.Engine(canvas, true);
  31. console.log("Babylon version: " + BABYLON.Engine.Version);
  32. var scene = new BABYLON.Scene(engine);
  33. materialsRootDir = "./TOB-out"; // edit when texture files in a different dir than html
  34. mesh_parent.initScene(scene, materialsRootDir);
  35. scene.activeCamera.attachControl(canvas);
  36. engine.runRenderLoop(function () {
  37. animate(scene);
  38. scene.render();
  39. });
  40. }else{
  41. alert("WebGL not supported in this browser.\n\n" +
  42. "If in Safari browser, check 'Show Develop menu in menu bar' on the Advanced tab of Preferences. " +
  43. "On the 'Develop' menu, check the 'Enable WebGL' menu item.");
  44. }
  45. //Resize
  46. window.addEventListener("resize", function () {
  47. engine.resize();
  48. });
  49. </script>
  50. </body>
  51. </html>