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.

script.ts 1000B

1234567891011121314151617181920212223242526272829
  1. import {_testFinish, GLTFKHRMaterialVariantsPlugin, IObject3D, SSAAPlugin, 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: [SSAAPlugin, GLTFKHRMaterialVariantsPlugin],
  8. })
  9. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  10. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  11. const result = await viewer.load<IObject3D>(
  12. 'https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Sample-Assets/Models/MaterialsVariantsShoe/glTF/MaterialsVariantsShoe.gltf',
  13. {
  14. autoCenter: true,
  15. autoScale: true,
  16. })
  17. ui.setupPluginUi(GLTFKHRMaterialVariantsPlugin, {expanded: true})
  18. ui.appendChild(result?.getObjectByName('Shoe')?.uiConfig)
  19. }
  20. init().finally(_testFinish)