threepipe
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.html 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Threepipe HTML/JS 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. <canvas id="three-canvas" style="width: 800px; height: 600px;"></canvas>
  18. <!--<script src="https://unpkg.com/threepipe"></script>-->
  19. <script src="./../../dist/index.js"></script>
  20. <script id="example-script" type="module" data-scripts="./index.html">
  21. const {ThreeViewer, LoadingScreenPlugin} = threepipe
  22. // or
  23. // import {ThreeViewer, LoadingScreenPlugin} from 'threepipe' // if using import maps
  24. // import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs'
  25. // import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs'
  26. const viewer = new ThreeViewer({canvas: document.getElementById('three-canvas')})
  27. viewer.addPluginSync(LoadingScreenPlugin)
  28. // Load an environment map
  29. const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  30. const modelPromise = viewer.load('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
  31. autoCenter: true,
  32. autoScale: true,
  33. })
  34. Promise.all([envPromise, modelPromise]).then(([env, model])=>{
  35. console.log('Loaded', model, env, viewer)
  36. })
  37. </script>
  38. </body>
  39. </html>