UNPKG

threepipe

Version:

A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.

25 lines (24 loc) 988 B
import { _testFinish, GLTFAnimationPlugin, LoadingScreenPlugin, ThreeViewer } from 'threepipe'; async function init() { const viewer = new ThreeViewer({ canvas: document.getElementById('mcanvas'), msaa: true, dropzone: { allowedExtensions: ['gltf', 'glb', 'hdr', 'bin', 'png', 'jpeg', 'webp', 'jpg', 'exr'], addOptions: { disposeSceneObjects: true, autoSetEnvironment: true, // when hdr is dropped }, }, plugins: [LoadingScreenPlugin], }); const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin); gltfAnimation.autoplayOnLoad = true; await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); const result = await viewer.load('https://threejs.org/examples/models/gltf/Horse.glb', { autoCenter: true, autoScale: true, }); console.log(result); } init().finally(_testFinish);