threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031
  1. import {_testFinish, CameraViewPlugin, Object3DGeneratorPlugin, PickingPlugin, ThreeViewer} from 'threepipe'
  2. import {GeometryGeneratorPlugin} from '@threepipe/plugin-geometry-generator'
  3. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  4. async function init() {
  5. const viewer = new ThreeViewer({
  6. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  7. msaa: true,
  8. plugins: [PickingPlugin, CameraViewPlugin, Object3DGeneratorPlugin],
  9. })
  10. const generator = viewer.addPluginSync(GeometryGeneratorPlugin)
  11. viewer.scene.setBackgroundColor('#444466')
  12. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  13. console.log(generator.generators)
  14. const sphere = generator.generateObject('sphere', {radius: 0.5, widthSegments: 32, heightSegments: 32})
  15. viewer.scene.addObject(sphere)
  16. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  17. ui.setupPluginUi(GeometryGeneratorPlugin)
  18. ui.setupPluginUi(PickingPlugin)
  19. ui.setupPluginUi(Object3DGeneratorPlugin)
  20. }
  21. init().finally(_testFinish)