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.

123456789101112131415161718192021222324252627282930
  1. import {_testFinish, IObject3D, 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. msaa: true,
  7. })
  8. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  9. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', {
  10. setBackground: true,
  11. })
  12. const result = await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
  13. autoCenter: true,
  14. autoScale: true,
  15. })
  16. const model = result?.getObjectByName('node_damagedHelmet_-6514')
  17. const materials = model?.materials || []
  18. for (const material of materials) {
  19. const config = material.uiConfig
  20. if (!config) continue
  21. ui.appendChild(config)
  22. }
  23. }
  24. init().finally(_testFinish)