threepipe
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

script.ts 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {_testFinish, _testStart, IObject3D, LoadingScreenPlugin, Rhino3dmLoadPlugin, 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: ['3dm', '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(Rhino3dmLoadPlugin)
  17. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', {
  18. setBackground: true,
  19. })
  20. const result = await viewer.load<IObject3D>('https://threejs.org/examples/models/3dm/Rhino_Logo.3dm', {
  21. autoCenter: true,
  22. autoScale: true,
  23. })
  24. console.log(result)
  25. // Some objects are invisible in this file, set visible to true for all objects
  26. result?.traverse(object => {
  27. object.visible = true
  28. })
  29. result?.setDirty()
  30. }
  31. _testStart()
  32. init().finally(_testFinish)