UNPKG

threepipe

Version:

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

21 lines (20 loc) 909 B
import { _testFinish, LoadingScreenPlugin, ThreeViewer, TonemapPlugin } from 'threepipe'; import { BlueprintJsUiPlugin } from '@threepipe/plugin-blueprintjs'; async function init() { const viewer = new ThreeViewer({ canvas: document.getElementById('mcanvas'), msaa: true, plugins: [LoadingScreenPlugin], }); const ui = viewer.addPluginSync(new BlueprintJsUiPlugin()); ui.appendChild(viewer.uiConfig); ui.setupPluginUi(TonemapPlugin); await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); const result = await viewer.load('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', { autoCenter: true, autoScale: true, }); const mesh = result?.getObjectByName('node_damagedHelmet_-6514'); ui.appendChild(mesh?.uiConfig); } init().finally(_testFinish);