Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/processing/core/PShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -2346,7 +2346,7 @@ protected void setPath(int vcount, float[][] verts, int ccount, int[] codes) {
* @see PShape#setVertex(int, float, float)
*/
public int getVertexCount() {
if (family == GROUP || family == PRIMITIVE) {
if (family == PRIMITIVE) {
PGraphics.showWarning(NO_VERTICES_ERROR);
}
return vertexCount;
Expand Down
22 changes: 15 additions & 7 deletions core/src/processing/opengl/PShapeOpenGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -1635,30 +1635,38 @@ protected void curveVertexImpl(float x, float y, float z) {

@Override
public int getVertexCount() {
if (family == GROUP) return 0; // Group shapes don't have vertices
else {
int count = 0;
// If the shape is a group, recursively count the vertices of its children
if (family == GROUP) {
// Iterate through all the child shapes and count their vertices
for (int i = 0; i < getChildCount(); i++) {
count += getChild(i).getVertexCount(); // Recursive call to get the vertex count of child shapes
}
} else {
if (root.tessUpdate) {
if (root.tessKind == TRIANGLES) {
return lastPolyVertex - firstPolyVertex + 1;
count += lastPolyVertex - firstPolyVertex + 1;
} else if (root.tessKind == LINES) {
return lastLineVertex - firstLineVertex + 1;
count += lastLineVertex - firstLineVertex + 1;
} else if (root.tessKind == POINTS) {
return lastPointVertex - firstPointVertex + 1;
count += lastPointVertex - firstPointVertex + 1;
} else {
return 0;
count += 0; // Handle other cases
}
} else {
if (family == PRIMITIVE || family == PATH) {
// the input geometry of primitive and path shapes is built during
// tessellation
updateTessellation();
}
return inGeo.vertexCount;
count += inGeo.vertexCount;
}
}
return count;
}



@Override
public PVector getVertex(int index, PVector vec) {
if (vec == null) vec = new PVector();
Expand Down