mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
wip
This commit is contained in:
parent
a66d4816b2
commit
5060b6eea8
@ -1,4 +1,5 @@
|
|||||||
import { Scene, Color } from 'three';
|
import { Scene, Color } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['three'],
|
inject: ['three'],
|
||||||
@ -9,6 +10,7 @@ export default {
|
|||||||
setup (props) {
|
setup (props) {
|
||||||
const scene = new Scene();
|
const scene = new Scene();
|
||||||
if (props.background) scene.background = new Color(props.background);
|
if (props.background) scene.background = new Color(props.background);
|
||||||
|
watch(() => props.background, (value) => { scene.background = new Color(value); });
|
||||||
return { scene };
|
return { scene };
|
||||||
},
|
},
|
||||||
provide() {
|
provide() {
|
||||||
|
@ -56,6 +56,10 @@ export default {
|
|||||||
this.geometry = geometry;
|
this.geometry = geometry;
|
||||||
if (this.mesh) this.mesh.geometry = geometry;
|
if (this.mesh) this.mesh.geometry = geometry;
|
||||||
},
|
},
|
||||||
|
setMaterial(material) {
|
||||||
|
this.material = material;
|
||||||
|
if (this.mesh) this.mesh.material = material;
|
||||||
|
},
|
||||||
refreshGeometry() {
|
refreshGeometry() {
|
||||||
const oldGeo = this.geometry;
|
const oldGeo = this.geometry;
|
||||||
this.createGeometry();
|
this.createGeometry();
|
||||||
|
Loading…
Reference in New Issue
Block a user