UNPKG

threepipe

Version:

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

27 lines (26 loc) 942 B
import { _testFinish, LoadingScreenPlugin, ThreeViewer, USDZLoadPlugin } from 'threepipe'; async function init() { const viewer = new ThreeViewer({ canvas: document.getElementById('mcanvas'), msaa: true, dropzone: { allowedExtensions: ['usdz', 'usda', 'hdr', 'exr'], addOptions: { disposeSceneObjects: true, autoSetEnvironment: true, // when hdr is dropped autoSetBackground: true, }, }, plugins: [LoadingScreenPlugin], }); viewer.addPluginSync(USDZLoadPlugin); const options = { autoCenter: true, autoScale: true, }; await Promise.all([ viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'), viewer.load('https://threejs.org/examples/models/usdz/saeukkang.usdz', options), ]); } init().finally(_testFinish);