Skip to content

Commit b1f8232

Browse files
committed
Added GetTessGroups demo
1 parent e29994d commit b1f8232

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// GetTessGroups, by Andres Colubri
2+
// The getTessellation() function in Processing 4 returns a group shape
3+
// where the first shape contains only the fill geometry, the second,
4+
// the stroke lines, and third, only the points (if any).
5+
6+
PShape box;
7+
PShape tess;
8+
9+
boolean onlyStrokeLines = false;
10+
11+
void setup() {
12+
size(600, 600, P3D);
13+
14+
strokeWeight(5);
15+
box = createShape(BOX, 200);
16+
17+
tess = box.getTessellation();
18+
}
19+
20+
void draw() {
21+
background(180);
22+
lights();
23+
24+
translate(width/2, height/2);
25+
rotateX(frameCount * 0.01);
26+
rotateY(frameCount * 0.01);
27+
for (int i = 0; i < tess.getChildCount(); i++) {
28+
if (!onlyStrokeLines || i == 1) {
29+
shape(tess.getChild(i));
30+
}
31+
}
32+
}
33+
34+
void keyPressed() {
35+
onlyStrokeLines = !onlyStrokeLines;
36+
}

0 commit comments

Comments
 (0)