1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

add ThreemfModel component for importing 3MF files

This commit is contained in:
Chaphasilor 2022-10-26 17:27:15 +00:00
parent 8c5dd149b9
commit f54b94d6de
5 changed files with 2542 additions and 0 deletions

View File

@ -15,6 +15,7 @@ const external = [
'three/examples/jsm/loaders/FontLoader.js',
'three/examples/jsm/loaders/FBXLoader.js',
'three/examples/jsm/loaders/GLTFLoader.js',
'three/examples/jsm/loaders/3MFLoader.js',
'three/examples/jsm/postprocessing/BokehPass.js',
'three/examples/jsm/postprocessing/EffectComposer.js',
'three/examples/jsm/postprocessing/FilmPass.js',

15
src/models/3MF.ts Normal file
View File

@ -0,0 +1,15 @@
import { defineComponent } from 'vue'
import { ThreeMFLoader } from 'three/examples/jsm/loaders/3MFLoader.js'
import Model from './Model'
export default defineComponent({
extends: Model,
created() {
const loader = new ThreeMFLoader()
this.$emit('before-load', loader)
loader.load(this.src, (threeMF) => {
this.onLoad(threeMF)
this.initObject3D(threeMF)
}, this.onProgress, this.onError)
},
})

View File

@ -1,2 +1,3 @@
export { default as GltfModel } from './GLTF'
export { default as FbxModel } from './FBX'
export { default as ThreemfModel } from './3MF'

View File

@ -64,6 +64,7 @@ export const TroisJSVuePlugin = {
'FbxModel',
'GltfModel',
'ThreemfModel',
'BokehPass',
'EffectComposer',

2524
yarn.lock Normal file

File diff suppressed because it is too large Load Diff