threepipe
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

script.ts 1.0KB

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