From 5060b6eea80408009bf1a22c4b20eec8d41e6292 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Sat, 3 Oct 2020 12:35:29 +0200 Subject: [PATCH] wip --- src/core/Scene.js | 2 ++ src/meshes/Mesh.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/core/Scene.js b/src/core/Scene.js index c239cbb..c53b685 100644 --- a/src/core/Scene.js +++ b/src/core/Scene.js @@ -1,4 +1,5 @@ import { Scene, Color } from 'three'; +import { watch } from 'vue'; export default { inject: ['three'], @@ -9,6 +10,7 @@ export default { setup (props) { const scene = new Scene(); if (props.background) scene.background = new Color(props.background); + watch(() => props.background, (value) => { scene.background = new Color(value); }); return { scene }; }, provide() { diff --git a/src/meshes/Mesh.js b/src/meshes/Mesh.js index 922b639..88c6efe 100644 --- a/src/meshes/Mesh.js +++ b/src/meshes/Mesh.js @@ -56,6 +56,10 @@ export default { this.geometry = geometry; if (this.mesh) this.mesh.geometry = geometry; }, + setMaterial(material) { + this.material = material; + if (this.mesh) this.mesh.material = material; + }, refreshGeometry() { const oldGeo = this.geometry; this.createGeometry();