threepipe
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

script.ts 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  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. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  18. const model = await viewer.load<IObject3D>('https://asset-samples.threepipe.org/tests/SpecGlossVsMetalRough.glb', {
  19. autoCenter: true,
  20. autoScale: true,
  21. confirmSpecGlossConversion: false, // prevents the confirmation dialog
  22. })
  23. if (!model) {
  24. console.error('Unable to load model')
  25. return
  26. }
  27. }
  28. _testStart()
  29. init().finally(_testFinish)