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.

script.ts 1.1KB

123456789101112131415161718192021222324252627
  1. import {_testFinish, IObject3D, LoadingScreenPlugin, 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. })
  7. const loadingScreen = viewer.addPluginSync(new LoadingScreenPlugin())
  8. loadingScreen.loadingTextHeader = 'Loading Helmet 3D Model'
  9. loadingScreen.errorTextHeader = 'Error Loading Helmet 3D Model'
  10. loadingScreen.showFileNames = true
  11. loadingScreen.showProcessStates = true
  12. loadingScreen.showProgress = true
  13. loadingScreen.backgroundOpacity = 0.4 // 0-1
  14. loadingScreen.backgroundBlur = 28 // px
  15. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  16. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf')
  17. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  18. ui.setupPluginUi(LoadingScreenPlugin, {expanded: true})
  19. }
  20. init().finally(_testFinish)