threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
31 lines (30 loc) • 1.02 kB
JavaScript
import { _testFinish, LoadingScreenPlugin, ThreeViewer } from 'threepipe';
const viewer = new ThreeViewer({
canvas: document.getElementById('mcanvas'),
msaa: false,
rgbm: true,
zPrepass: false,
plugins: [LoadingScreenPlugin],
});
async function init() {
const [env, model, model2] = await Promise.all([
viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'),
viewer.load('https://threejs.org/examples/models/gltf/IridescenceLamp.glb', {
autoCenter: true,
autoScale: true,
}),
viewer.load('https://threejs.org/examples/models/gltf/IridescentDishWithOlives.glb', {
autoCenter: true,
autoScale: true,
}),
]);
console.log(env, model, model2);
if (!model || !model2) {
console.error('model not loaded');
return;
}
model.position.x = -1;
model2.position.x = 1;
model2.position.y = -1.2;
}
init().finally(_testFinish);