threepipe
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {
  2. _testFinish,
  3. _testStart,
  4. DeviceOrientationControlsPlugin,
  5. IObject3D,
  6. LoadingScreenPlugin,
  7. ThreeViewer,
  8. } from 'threepipe'
  9. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  10. async function init() {
  11. const viewer = new ThreeViewer({
  12. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  13. msaa: true,
  14. plugins: [DeviceOrientationControlsPlugin, LoadingScreenPlugin],
  15. })
  16. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  17. ui.appendChild(viewer.scene.mainCamera.uiConfig)
  18. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  19. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
  20. autoCenter: true,
  21. autoScale: true,
  22. })
  23. const overlayEl = document.getElementById('deviceOrientationOverlay') as HTMLDivElement
  24. overlayEl.addEventListener('click', () => {
  25. viewer.scene.mainCamera.controlsMode = 'deviceOrientation'
  26. overlayEl.style.display = 'none'
  27. })
  28. }
  29. _testStart()
  30. init().finally(_testFinish)