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.

1234567891011121314151617181920212223242526272829
  1. import {_testFinish, GLTFAnimationPlugin, 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. })
  14. const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin)
  15. gltfAnimation.autoplayOnLoad = true
  16. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  17. const result = await viewer.load('https://threejs.org/examples/models/gltf/Horse.glb', {
  18. autoCenter: true,
  19. autoScale: true,
  20. })
  21. console.log(result)
  22. }
  23. init().finally(_testFinish)