mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
wip: improve object3d
This commit is contained in:
parent
9583a24136
commit
672c4f6ad2
@ -1,8 +1,13 @@
|
|||||||
import { Object3D } from 'three'
|
import { Object3D, Scene } from 'three'
|
||||||
import { ComponentPublicInstance, defineComponent, watch } from 'vue'
|
import { ComponentPublicInstance, defineComponent, inject, watch } from 'vue'
|
||||||
import { bindProp } from '../tools'
|
import { bindProp } from '../tools'
|
||||||
|
import { RendererInterface } from './Renderer'
|
||||||
|
import { ThreeInterface } from './useThree'
|
||||||
|
|
||||||
interface Object3DSetupInterface {
|
interface Object3DSetupInterface {
|
||||||
|
three: ThreeInterface
|
||||||
|
scene: Scene
|
||||||
|
renderer: RendererInterface
|
||||||
o3d?: Object3D
|
o3d?: Object3D
|
||||||
parent?: ComponentPublicInstance
|
parent?: ComponentPublicInstance
|
||||||
}
|
}
|
||||||
@ -27,7 +32,10 @@ export default defineComponent({
|
|||||||
userData: { type: Object, default: () => ({}) },
|
userData: { type: Object, default: () => ({}) },
|
||||||
},
|
},
|
||||||
setup(): Object3DSetupInterface {
|
setup(): Object3DSetupInterface {
|
||||||
return {}
|
const three = inject('three') as ThreeInterface
|
||||||
|
const scene = inject('scene') as Scene
|
||||||
|
const renderer = inject('renderer') as RendererInterface
|
||||||
|
return { three, scene, renderer }
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
if (this.autoRemove) this.removeFromParent()
|
if (this.autoRemove) this.removeFromParent()
|
||||||
|
Loading…
Reference in New Issue
Block a user