diff --git a/src/lights/Light.js b/src/lights/Light.js index d6639a4..cf31580 100644 --- a/src/lights/Light.js +++ b/src/lights/Light.js @@ -46,6 +46,9 @@ export default { this.scene.add(this.light); if (this.light.target) this.scene.add(this.light.target); }, + unmounted() { + this.scene.remove(this.light); + }, render() { return []; }, diff --git a/src/meshes/InstancedMesh.js b/src/meshes/InstancedMesh.js index 60fd382..8192079 100644 --- a/src/meshes/InstancedMesh.js +++ b/src/meshes/InstancedMesh.js @@ -38,6 +38,9 @@ export default { this.mesh.receiveShadow = this.receiveShadow; this.scene.add(this.mesh); }, + unmounted() { + this.scene.remove(this.mesh); + }, render() { return this.$slots.default(); }, diff --git a/src/meshes/Mesh.js b/src/meshes/Mesh.js index 540af03..45017d7 100644 --- a/src/meshes/Mesh.js +++ b/src/meshes/Mesh.js @@ -23,6 +23,7 @@ export default { }, unmounted() { if (this.geometry) this.geometry.dispose(); + if (this.mesh) this.scene.remove(this.mesh); }, methods: { initMesh() { diff --git a/src/meshes/Sprite.js b/src/meshes/Sprite.js index f0558a3..6b4f6d7 100644 --- a/src/meshes/Sprite.js +++ b/src/meshes/Sprite.js @@ -23,6 +23,7 @@ export default { unmounted() { this.texture.dispose(); this.material.dispose(); + this.scene.remove(this.sprite); }, methods: { onLoaded() {