threepipe
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Threepipe Vue/HTML Sample</title>
  6. <style>
  7. html, body{
  8. width: 100%;
  9. height: 100%;
  10. margin: 0;
  11. overflow: hidden;
  12. }
  13. </style>
  14. <script type="module" src="../examples-utils/simple-code-preview.mjs"></script>
  15. </head>
  16. <body>
  17. <div id="app">
  18. <canvas id="three-canvas" style="width: 800px; height: 600px" ref="canvasRef"></canvas>
  19. </div>
  20. <script id="example-script" type="module" data-scripts="./index.html">
  21. // import { ThreeViewer, LoadingScreenPlugin } from 'https://unpkg.com/threepipe@latest/dist/index.mjs'
  22. import { ThreeViewer, LoadingScreenPlugin } from './../../dist/index.mjs'
  23. import { createApp, ref, onMounted, onBeforeUnmount } from "https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js";
  24. const ThreeViewerComponent = {
  25. setup() {
  26. const canvasRef = ref(null);
  27. onMounted(() => {
  28. const viewer = new ThreeViewer({
  29. canvas: canvasRef.value,
  30. plugins: [LoadingScreenPlugin],
  31. });
  32. // Load an environment map
  33. const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr');
  34. const modelPromise = viewer.load('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
  35. autoCenter: true,
  36. autoScale: true,
  37. });
  38. Promise.all([envPromise, modelPromise]).then(([env, model]) => {
  39. console.log('Loaded', model, env, viewer);
  40. });
  41. onBeforeUnmount(() => {
  42. viewer.dispose();
  43. });
  44. });
  45. return { canvasRef };
  46. },
  47. };
  48. const app = createApp(ThreeViewerComponent);
  49. app.mount('#app');
  50. </script>
  51. </body>
  52. </html>