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.0KB

123456789101112131415161718192021222324252627282930313233
  1. import {_testFinish, IObject3D, 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. })
  15. viewer.addPluginSync(STLLoadPlugin)
  16. const options = {
  17. autoCenter: true,
  18. autoScale: true,
  19. }
  20. const res = await Promise.all([
  21. viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'),
  22. viewer.load<IObject3D>('https://threejs.org/examples/models/stl/ascii/slotted_disk.stl', options),
  23. viewer.load<IObject3D>('https://threejs.org/examples/models/stl/binary/pr2_head_pan.stl', options),
  24. ])
  25. console.log(res)
  26. }
  27. init().then(_testFinish)