threepipe
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

script.ts 1.1KB

12345678910111213141516171819202122232425262728
  1. import {_testFinish, _testStart, 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. _testStart()
  21. init().finally(_testFinish)