threepipe
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

script.ts 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {
  2. _testFinish,
  3. GLTFMeshOptDecodePlugin,
  4. IObject3D,
  5. KTX2LoadPlugin,
  6. LoadingScreenPlugin,
  7. ThreeViewer,
  8. } from 'threepipe'
  9. async function init() {
  10. const viewer = new ThreeViewer({
  11. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  12. msaa: true,
  13. dropzone: {
  14. addOptions: {
  15. disposeSceneObjects: true,
  16. },
  17. },
  18. plugins: [LoadingScreenPlugin, GLTFMeshOptDecodePlugin, KTX2LoadPlugin],
  19. })
  20. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  21. const options = {
  22. autoCenter: true,
  23. autoScale: true,
  24. };
  25. (await Promise.all([
  26. viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/coffeemat.glb', options),
  27. viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/facecap.glb', options),
  28. ])).forEach((result, i) => {
  29. if (!result) return
  30. result.position.x = i * 2 - 1
  31. })
  32. }
  33. init().finally(_testFinish)