threepipe
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

script.ts 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. import {_testFinish, FullScreenPlugin, IObject3D, ThreeViewer} from 'threepipe'
  2. import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js'
  3. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  4. async function init() {
  5. const viewer = new ThreeViewer({
  6. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  7. })
  8. const fullScreenPlugin = viewer.addPluginSync(new FullScreenPlugin())
  9. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  10. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf')
  11. createSimpleButtons({
  12. ['Enter/Exit fullscreen']: () => {
  13. if (fullScreenPlugin.isFullScreen()) fullScreenPlugin.exit()
  14. else fullScreenPlugin.enter(document.body) // parameter is optional, if not specified, the viewer canvas will be used
  15. // or just use
  16. // fullScreenPlugin.toggle(document.body)
  17. },
  18. })
  19. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  20. ui.setupPluginUi(FullScreenPlugin)
  21. }
  22. init().then(_testFinish)