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

add visible prop to object3d

This commit is contained in:
Kevin Levron 2021-04-30 18:37:05 +02:00
parent ddcca59d9c
commit 559e8f2cc7

View File

@ -50,8 +50,9 @@ export default defineComponent({
rotation: { type: Object as PropType<EulerPropInterface>, default: () => ({ x: 0, y: 0, z: 0 }) }, rotation: { type: Object as PropType<EulerPropInterface>, default: () => ({ x: 0, y: 0, z: 0 }) },
scale: { type: Object as PropType<Vector3PropInterface>, default: () => ({ x: 1, y: 1, z: 1, order: 'XYZ' }) }, scale: { type: Object as PropType<Vector3PropInterface>, default: () => ({ x: 1, y: 1, z: 1, order: 'XYZ' }) },
lookAt: { type: Object as PropType<Vector3PropInterface>, default: null }, lookAt: { type: Object as PropType<Vector3PropInterface>, default: null },
autoRemove: { type: Boolean, default: true },
userData: { type: Object, default: () => ({}) }, userData: { type: Object, default: () => ({}) },
visible: { type: Boolean, default: true },
autoRemove: { type: Boolean, default: true },
}, },
setup(): Object3DSetupInterface { setup(): Object3DSetupInterface {
// return object3DSetup() // return object3DSetup()
@ -78,6 +79,7 @@ export default defineComponent({
bindProp(this, 'rotation', o3d) bindProp(this, 'rotation', o3d)
bindProp(this, 'scale', o3d) bindProp(this, 'scale', o3d)
bindProp(this, 'userData', o3d.userData) bindProp(this, 'userData', o3d.userData)
bindProp(this, 'visible', o3d)
if (this.lookAt) o3d.lookAt(this.lookAt.x ?? 0, this.lookAt.y, this.lookAt.z) if (this.lookAt) o3d.lookAt(this.lookAt.x ?? 0, this.lookAt.y, this.lookAt.z)
watch(() => this.lookAt, (v) => { o3d.lookAt(v.x ?? 0, v.y, v.z) }, { deep: true }) watch(() => this.lookAt, (v) => { o3d.lookAt(v.x ?? 0, v.y, v.z) }, { deep: true })