UNPKG

threepipe

Version:

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

32 lines (31 loc) 1.13 kB
import { _testFinish, LoadingScreenPlugin, Rhino3dmLoadPlugin, ThreeViewer } from 'threepipe'; async function init() { const viewer = new ThreeViewer({ canvas: document.getElementById('mcanvas'), msaa: true, dropzone: { allowedExtensions: ['3dm', 'hdr'], addOptions: { disposeSceneObjects: true, autoSetEnvironment: true, // when hdr is dropped autoSetBackground: true, }, }, plugins: [LoadingScreenPlugin], }); viewer.addPluginSync(Rhino3dmLoadPlugin); await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { setBackground: true, }); const result = await viewer.load('https://threejs.org/examples/models/3dm/Rhino_Logo.3dm', { autoCenter: true, autoScale: true, }); console.log(result); // Some objects are invisible in this file, set visible to true for all objects result?.traverse(object => { object.visible = true; }); result?.setDirty(); } init().finally(_testFinish);