threepipe
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

script.ts 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import {
  2. _testFinish, _testStart,
  3. GLTFKHRMaterialVariantsPlugin,
  4. IObject3D,
  5. LoadingScreenPlugin,
  6. SSAAPlugin,
  7. ThreeViewer,
  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. msaa: true,
  14. plugins: [SSAAPlugin, GLTFKHRMaterialVariantsPlugin, LoadingScreenPlugin],
  15. })
  16. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  17. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  18. const result = await viewer.load<IObject3D>(
  19. 'https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Sample-Assets/Models/MaterialsVariantsShoe/glTF/MaterialsVariantsShoe.gltf',
  20. {
  21. autoCenter: true,
  22. autoScale: true,
  23. })
  24. ui.setupPluginUi(GLTFKHRMaterialVariantsPlugin, {expanded: true})
  25. ui.appendChild(result?.getObjectByName('Shoe')?.uiConfig)
  26. }
  27. _testStart()
  28. init().finally(_testFinish)