threepipe
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

script.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {_testFinish, _testStart, AssetExporterPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe'
  2. import {GLTFDracoExportPlugin, GLTFSpecGlossinessConverterPlugin} from '@threepipe/plugin-gltf-transform'
  3. const viewer = new ThreeViewer({
  4. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  5. dropzone: {
  6. addOptions: {
  7. disposeSceneObjects: true,
  8. },
  9. },
  10. msaa: true,
  11. })
  12. async function init() {
  13. viewer.addPluginSync(LoadingScreenPlugin)
  14. viewer.addPluginSync(AssetExporterPlugin)
  15. viewer.addPluginSync(GLTFDracoExportPlugin)
  16. viewer.addPluginSync(GLTFSpecGlossinessConverterPlugin)
  17. // Note: see asset-exporter-plugin example as well
  18. // load obj + mtl
  19. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  20. const model = await viewer.load<IObject3D>('https://asset-samples.threepipe.org/tests/SpecGlossVsMetalRough.glb', {
  21. autoCenter: true,
  22. autoScale: true,
  23. confirmSpecGlossConversion: false, // prevents the confirmation dialog
  24. })
  25. if (!model) {
  26. console.error('Unable to load model')
  27. return
  28. }
  29. }
  30. _testStart()
  31. init().finally(_testFinish)