mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
Models: add before-load event
This commit is contained in:
parent
f109069d9f
commit
07064c32a3
@ -6,6 +6,7 @@ export default defineComponent({
|
|||||||
extends: Model,
|
extends: Model,
|
||||||
created() {
|
created() {
|
||||||
const loader = new FBXLoader()
|
const loader = new FBXLoader()
|
||||||
|
this.$emit('before-load', loader)
|
||||||
loader.load(this.src, (fbx) => {
|
loader.load(this.src, (fbx) => {
|
||||||
this.onLoad(fbx)
|
this.onLoad(fbx)
|
||||||
}, this.onProgress, this.onError)
|
}, this.onProgress, this.onError)
|
||||||
|
@ -6,6 +6,7 @@ export default defineComponent({
|
|||||||
extends: Model,
|
extends: Model,
|
||||||
created() {
|
created() {
|
||||||
const loader = new GLTFLoader()
|
const loader = new GLTFLoader()
|
||||||
|
this.$emit('before-load', loader)
|
||||||
loader.load(this.src, (gltf) => {
|
loader.load(this.src, (gltf) => {
|
||||||
this.onLoad(gltf.scene)
|
this.onLoad(gltf.scene)
|
||||||
}, this.onProgress, this.onError)
|
}, this.onProgress, this.onError)
|
||||||
|
@ -4,7 +4,7 @@ import Object3D from '../core/Object3D'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
extends: Object3D,
|
extends: Object3D,
|
||||||
emits: ['load', 'progress', 'error'],
|
emits: ['load', 'progress', 'error', 'before-load'],
|
||||||
props: {
|
props: {
|
||||||
src: { type: String, required: true },
|
src: { type: String, required: true },
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user