threepipe
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import {
  2. _testFinish, _testStart,
  3. IObject3D,
  4. LoadingScreenPlugin,
  5. PickingPlugin,
  6. ThreeViewer,
  7. TransformControlsPlugin,
  8. } from 'threepipe'
  9. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  10. async function init() {
  11. const viewer = new ThreeViewer({
  12. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  13. renderScale: 'auto',
  14. plugins: [LoadingScreenPlugin],
  15. })
  16. viewer.scene.setBackgroundColor(0x151822)
  17. const picking = viewer.addPluginSync(PickingPlugin)
  18. const transformControlsPlugin = viewer.addPluginSync(TransformControlsPlugin)
  19. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  20. const model = 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(TransformControlsPlugin, {expanded: true})
  23. ui.setupPluginUi(PickingPlugin)
  24. // Get the underlying transform controls (instance of TransformControls2)
  25. const transformControls = transformControlsPlugin.transformControls
  26. console.log(transformControls)
  27. // Transform controls plugin automatically tracks the selected object in the PickingPlugin and shows the transform controls
  28. picking.setSelectedObject(model)
  29. }
  30. _testStart()
  31. init().finally(_testFinish)