threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829
  1. import {_testFinish, IObject3D, ThreeViewer, TweakpaneUiPlugin} from 'threepipe'
  2. async function init() {
  3. const viewer = new ThreeViewer({
  4. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  5. msaa: true,
  6. })
  7. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  8. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', {
  9. setBackground: true,
  10. })
  11. const result = await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
  12. autoCenter: true,
  13. autoScale: true,
  14. })
  15. const model = result?.getObjectByName('node_damagedHelmet_-6514')
  16. const materials = model?.materials || []
  17. for (const material of materials) {
  18. const config = material.uiConfig
  19. if (!config) continue
  20. ui.appendChild(config)
  21. }
  22. }
  23. init().then(_testFinish)