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

improve liquid plane

This commit is contained in:
Kevin Levron 2021-03-15 19:13:55 +01:00
parent 51071f1210
commit 85d220f4f8

View File

@ -19,7 +19,7 @@ export default {
this.liquidEffect = new LiquidEffect(this.three.renderer); this.liquidEffect = new LiquidEffect(this.three.renderer);
this.rendererComponent.onMounted(() => { this.rendererComponent.onMounted(() => {
this.liquidEffect.renderer = this.rendererComponent.renderer; this.liquidEffect.renderer = this.rendererComponent.renderer;
this.three.onBeforeRender(this.liquidEffect.update); this.three.onBeforeRender(this.update);
}); });
this.material = new MeshStandardMaterial({ color: this.color, side: DoubleSide, metalness: this.metalness, roughness: this.roughness, this.material = new MeshStandardMaterial({ color: this.color, side: DoubleSide, metalness: this.metalness, roughness: this.roughness,
@ -44,6 +44,11 @@ export default {
this.initObject3D(this.mesh); this.initObject3D(this.mesh);
}, },
unmounted() { unmounted() {
this.three.offBeforeRender(this.liquidEffect.update); this.three.offBeforeRender(this.update);
},
methods: {
update() {
this.liquidEffect.update();
},
}, },
}; };