From 672c4f6ad21915be93d105d8582d292fd1e95127 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Wed, 21 Apr 2021 01:10:48 +0200 Subject: [PATCH] wip: improve object3d --- src/core/Object3D.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/Object3D.ts b/src/core/Object3D.ts index e901c72..87d309c 100644 --- a/src/core/Object3D.ts +++ b/src/core/Object3D.ts @@ -1,8 +1,13 @@ -import { Object3D } from 'three' -import { ComponentPublicInstance, defineComponent, watch } from 'vue' +import { Object3D, Scene } from 'three' +import { ComponentPublicInstance, defineComponent, inject, watch } from 'vue' import { bindProp } from '../tools' +import { RendererInterface } from './Renderer' +import { ThreeInterface } from './useThree' interface Object3DSetupInterface { + three: ThreeInterface + scene: Scene + renderer: RendererInterface o3d?: Object3D parent?: ComponentPublicInstance } @@ -27,7 +32,10 @@ export default defineComponent({ userData: { type: Object, default: () => ({}) }, }, 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() { if (this.autoRemove) this.removeFromParent()