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.

пре 2 година
пре 2 година
123456789101112131415161718192021222324252627282930313233
  1. import {_testFinish, _testStart, IObject3D, LoadingScreenPlugin, ThreeViewer, USDZLoadPlugin} from 'threepipe'
  2. async function init() {
  3. const viewer = new ThreeViewer({
  4. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  5. msaa: true,
  6. dropzone: {
  7. allowedExtensions: ['usdz', 'usda', 'hdr', 'exr'],
  8. addOptions: {
  9. disposeSceneObjects: true,
  10. autoSetEnvironment: true, // when hdr is dropped
  11. autoSetBackground: true,
  12. },
  13. },
  14. plugins: [LoadingScreenPlugin],
  15. })
  16. viewer.addPluginSync(USDZLoadPlugin)
  17. const options = {
  18. autoCenter: true,
  19. autoScale: true,
  20. }
  21. await Promise.all([
  22. viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'),
  23. viewer.load<IObject3D>('https://threejs.org/examples/models/usdz/saeukkang.usdz', options),
  24. ])
  25. }
  26. _testStart()
  27. init().finally(_testFinish)