| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import {_testFinish, _testStart, AssetExporterPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe'
- import {GLTFDracoExportPlugin, GLTFSpecGlossinessConverterPlugin} from '@threepipe/plugin-gltf-transform'
-
- const viewer = new ThreeViewer({
- canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
- dropzone: {
- addOptions: {
- disposeSceneObjects: true,
- },
- },
- msaa: true,
- })
-
- async function init() {
-
- viewer.addPluginSync(LoadingScreenPlugin)
- viewer.addPluginSync(AssetExporterPlugin)
- viewer.addPluginSync(GLTFDracoExportPlugin)
- viewer.addPluginSync(GLTFSpecGlossinessConverterPlugin)
-
- // Note: see asset-exporter-plugin example as well
-
- // load obj + mtl
- await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
- const model = await viewer.load<IObject3D>('https://asset-samples.threepipe.org/tests/SpecGlossVsMetalRough.glb', {
- autoCenter: true,
- autoScale: true,
- confirmSpecGlossConversion: false, // prevents the confirmation dialog
- })
- if (!model) {
- console.error('Unable to load model')
- return
- }
-
- }
-
- _testStart()
- init().finally(_testFinish)
|