threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
28 lines (27 loc) • 999 B
JavaScript
import { _testFinish, GLTFMeshOptDecodePlugin, KTX2LoadPlugin, LoadingScreenPlugin, ThreeViewer, } from 'threepipe';
async function init() {
const viewer = new ThreeViewer({
canvas: document.getElementById('mcanvas'),
msaa: true,
dropzone: {
addOptions: {
disposeSceneObjects: true,
},
},
plugins: [LoadingScreenPlugin, GLTFMeshOptDecodePlugin, KTX2LoadPlugin],
});
await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr');
const options = {
autoCenter: true,
autoScale: true,
};
(await Promise.all([
viewer.load('https://threejs.org/examples/models/gltf/coffeemat.glb', options),
viewer.load('https://threejs.org/examples/models/gltf/facecap.glb', options),
])).forEach((result, i) => {
if (!result)
return;
result.position.x = i * 2 - 1;
});
}
init().finally(_testFinish);