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 1005B

123456789101112131415161718192021222324252627282930
  1. import {_testFinish, GLTFAnimationPlugin, LoadingScreenPlugin, 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: ['gltf', 'glb', 'hdr', 'bin', 'png', 'jpeg', 'webp', 'jpg', 'exr'],
  8. addOptions: {
  9. disposeSceneObjects: true,
  10. autoSetEnvironment: true, // when hdr is dropped
  11. },
  12. },
  13. plugins: [LoadingScreenPlugin],
  14. })
  15. const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin)
  16. gltfAnimation.autoplayOnLoad = true
  17. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  18. const result = await viewer.load('https://threejs.org/examples/models/gltf/Horse.glb', {
  19. autoCenter: true,
  20. autoScale: true,
  21. })
  22. console.log(result)
  23. }
  24. init().finally(_testFinish)