-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVertex.pde
53 lines (44 loc) · 1.05 KB
/
Vertex.pde
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
class Vertex {
Coord coord;
Coord texCoord;
Normal normal;
Vertex() {
}
Vertex(Coord v, Coord vt, Normal vn) {
referTo(v, vt, vn);
}
String toString() {
return new StringBuilder()
.append(coord).append(",\n")
.append(texCoord).append(",\n")
.append(normal)
.toString();
}
Vertex copyFrom(Vertex vert) {
return copyFrom(vert.coord, vert.texCoord, vert.normal);
}
Vertex copyFrom(Coord coord, Coord texCoord, Normal normal) {
if (this.coord == null) {
this.coord = new Coord();
}
this.coord.set(coord);
if (this.texCoord == null) {
this.texCoord = new Coord();
}
this.texCoord.set(texCoord);
if (this.normal == null) {
this.normal = new Normal();
}
this.normal.set(normal);
return this;
}
Vertex referTo(Vertex vert) {
return referTo(vert.coord, vert.texCoord, vert.normal);
}
Vertex referTo(Coord coord, Coord texCoord, Normal normal) {
this.coord = coord;
this.texCoord = texCoord;
this.normal = normal;
return this;
}
}