-
Notifications
You must be signed in to change notification settings - Fork 284
/
MeshColorMaterial.ts
executable file
·54 lines (44 loc) · 1.05 KB
/
MeshColorMaterial.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import Material = require("./Material");
class MeshColorMaterial extends Material {
type: string = "";
ready: boolean = false;
singleColor: number[];
triangleColors: number[][];
verticeColors: number[][];
constructor() {
super();
this.reset();
}
isReady(){
return this.ready;
}
getType(){
return "MeshColorMaterial";
}
reset() {
this.type = '';
this.singleColor = null;
this.triangleColors = [];
this.verticeColors = [];
this.ready = false;
}
setSingleColor(color: number[]) {
this.type = 'single';
this.singleColor = color;
this.ready = true;
}
setTriangleColor(colors: number[][]) {
this.type = 'triangle';
this.triangleColors = colors;
this.ready = true;
};
setVerticeColor(colors: number[][]) {
this.type = 'vertice';
this.verticeColors = colors;
this.ready = true;
}
destroy() {
this.reset();
}
}
export = MeshColorMaterial;