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.

1234567891011121314151617181920212223242526272829303132333435
  1. import {_testFinish, _testStart, IObject3D, LoadingScreenPlugin, STLLoadPlugin, ThreeViewer} 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: ['stl', 'hdr'],
  8. addOptions: {
  9. disposeSceneObjects: true,
  10. autoSetEnvironment: true, // when hdr is dropped
  11. autoSetBackground: true,
  12. },
  13. },
  14. plugins: [LoadingScreenPlugin],
  15. })
  16. viewer.addPluginSync(STLLoadPlugin)
  17. const options = {
  18. autoCenter: true,
  19. autoScale: true,
  20. }
  21. const res = 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/stl/ascii/slotted_disk.stl', options),
  24. viewer.load<IObject3D>('https://threejs.org/examples/models/stl/binary/pr2_head_pan.stl', options),
  25. ])
  26. console.log(res)
  27. }
  28. _testStart()
  29. init().finally(_testFinish)