threepipe
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

index.html 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>DZI (Deep Zoom Image) 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/global-loading.mjs"></script>
  27. <script type="module" src="../examples-utils/simple-code-preview.mjs"></script>
  28. <script id="example-script" type="module" lang="ts">
  29. import {_testFinish, _testStart, LoadingScreenPlugin, ThreeViewer, SSAAPlugin} from 'threepipe'
  30. import {DeepZoomImageLoadPlugin, EnvironmentControlsPlugin} from '@threepipe/plugin-3d-tiles-renderer'
  31. const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas'),
  32. msaa: true, renderScale: window.devicePixelRatio,
  33. tonemap: false})
  34. viewer.addPluginsSync([EnvironmentControlsPlugin, DeepZoomImageLoadPlugin, LoadingScreenPlugin, SSAAPlugin])
  35. async function init() {
  36. viewer.scene.mainCamera.position.set(0,0, 20)
  37. viewer.scene.mainCamera.lookAt(0,0, 0)
  38. viewer.scene.mainCamera.minNearPlane = 0.1
  39. viewer.scene.mainCamera.setDirty()
  40. viewer.scene.mainCamera.controlsMode = 'environment'
  41. viewer.scene.mainCamera.controls.minDistance = 0.3
  42. viewer.scene.mainCamera.controls.maxDistance = 50
  43. viewer.scene.mainCamera.controls.enableDamping = true
  44. viewer.scene.mainCamera.controls.cameraRadius = 0.25
  45. viewer.scene.mainCamera.controls.fallbackPlane.normal.set( 0,0 , 1 );
  46. viewer.scene.mainCamera.controls.up.set( 0, 0, 1 );
  47. // https://github.com/CesiumGS/3d-tiles-samples
  48. // from https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/example/data/root.b3dm
  49. const result = await viewer.load('https://openseadragon.github.io/example-images/duomo/duomo.dzi', {
  50. autoCenter: true,
  51. autoScale: true,
  52. autoScaleRadius: 30,
  53. tiles: {
  54. DeepZoomImagePlugin: {
  55. center: true
  56. },
  57. errorTarget: 1,
  58. }
  59. })
  60. viewer.setDirty()
  61. console.log(result)
  62. }
  63. _testStart()
  64. init().finally(_testFinish)
  65. </script>
  66. </head>
  67. <body>
  68. <div id="canvas-container">
  69. <canvas id="mcanvas"></canvas>
  70. </div>
  71. </body>