threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>CMPT (Composite 3D Model, OGC Tiles) Load</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <!-- Import maps polyfill -->
  8. <!-- Remove this when import maps will be widely supported -->
  9. <script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>
  10. <script type="importmap">
  11. {
  12. "imports": {
  13. "threepipe": "./../../dist/index.mjs",
  14. "@threepipe/plugin-3d-tiles-renderer": "./../../plugins/3d-tiles-renderer/dist/index.mjs"
  15. }
  16. }
  17. </script>
  18. <style id="example-style">
  19. html, body, #canvas-container, #mcanvas {
  20. width: 100%;
  21. height: 100%;
  22. margin: 0;
  23. overflow: hidden;
  24. }
  25. </style>
  26. <script type="module" src="../examples-utils/simple-code-preview.mjs"></script>
  27. <script id="example-script" type="module">
  28. import {_testFinish, LoadingScreenPlugin, ThreeViewer, Vector3, Box3B} from 'threepipe'
  29. import {CMPTLoadPlugin} from '@threepipe/plugin-3d-tiles-renderer'
  30. const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')})
  31. viewer.addPluginsSync([CMPTLoadPlugin, LoadingScreenPlugin])
  32. async function init() {
  33. viewer.scene.backgroundColor.set(0)
  34. //
  35. // viewer.scene.mainCamera.position.set(2,2,3)
  36. // viewer.scene.mainCamera.setDirty()
  37. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  38. // https://github.com/CesiumGS/3d-tiles-tools
  39. // https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/example/data/root.b3dm
  40. const result2 = await viewer.load('https://raw.githubusercontent.com/CesiumGS/3d-tiles-tools/main/specs/data/contentTypes/content.cmpt', {
  41. autoCenter: true,
  42. autoScale: true,
  43. // autoScaleRadius: 1.5,
  44. })
  45. console.log(result2)
  46. result2.setDirty()
  47. console.log(new Box3B(result2).getCenter(new Vector3())) // todo why is this is NaN?
  48. }
  49. init().finally(_testFinish)
  50. </script>
  51. </head>
  52. <body>
  53. <div id="canvas-container">
  54. <canvas id="mcanvas"></canvas>
  55. </div>
  56. </body>