threepipe
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {
  2. _testFinish,
  3. _testStart,
  4. EditorViewWidgetPlugin,
  5. IObject3D,
  6. LoadingScreenPlugin,
  7. ThreeViewer,
  8. timeout,
  9. } from 'threepipe'
  10. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  11. async function init() {
  12. const viewer = new ThreeViewer({
  13. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  14. msaa: true,
  15. plugins: [LoadingScreenPlugin],
  16. })
  17. viewer.scene.setBackgroundColor(0x151822)
  18. const plugin = viewer.addPluginSync(new EditorViewWidgetPlugin('bottom-left', 256))
  19. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  20. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf')
  21. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  22. ui.setupPluginUi(EditorViewWidgetPlugin)
  23. // look at the model from left
  24. plugin.setOrientation('-z')
  25. await timeout(1000) // wait for 1 sec
  26. // look at the model from back
  27. plugin.setOrientation('-x')
  28. await timeout(1000) // wait for 1 sec
  29. // look at the model from front
  30. plugin.setOrientation('+z')
  31. }
  32. _testStart()
  33. init().finally(_testFinish)