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

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