forked from GreggJuanEduardoPH/vue-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vgl-mesh-basic-material.js
36 lines (34 loc) · 1.04 KB
/
vgl-mesh-basic-material.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { MeshBasicMaterial } from 'three';
import { VglMaterialWithMap } from '../mixins';
import { name, color } from '../types';
import { validateName } from '../validators';
/**
* A material for drawing geometries in a simple shaded (flat or wireframe) way,
* corresponding [THREE.MeshBasicMaterial](https://threejs.org/docs/index.html#api/materials/MeshBasicMaterial).
* This material is not affected by lights.
*
* Properties of [VglMaterial](vgl-material) are also available as mixin.
*/
export default {
mixins: [VglMaterialWithMap],
props: {
/** CSS style color of the material. */
color: { type: color, default: '#fff' },
/** The color map of the material. */
map: { type: name, validator: validateName },
},
computed: {
/** The THREE.MeshBasicMaterial instance. */
inst: () => new MeshBasicMaterial(),
},
watch: {
inst: {
handler(inst) { inst.color.setStyle(this.color); },
immediate: true,
},
color(newColor) {
this.inst.color.setStyle(newColor);
this.update();
},
},
};