1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

hmr unmounted : remove object from scene

This commit is contained in:
Kevin Levron 2020-09-19 19:05:17 +02:00
parent fd4807a6bb
commit 816a38d1fd
4 changed files with 8 additions and 0 deletions

View File

@ -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 [];
},

View File

@ -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();
},

View File

@ -23,6 +23,7 @@ export default {
},
unmounted() {
if (this.geometry) this.geometry.dispose();
if (this.mesh) this.scene.remove(this.mesh);
},
methods: {
initMesh() {

View File

@ -23,6 +23,7 @@ export default {
unmounted() {
this.texture.dispose();
this.material.dispose();
this.scene.remove(this.sprite);
},
methods: {
onLoaded() {