@@ -1739,15 +1739,6 @@ protected void transform(int type, float... args) {
17391739
17401740 protected void transformImpl (int type , int ncoords , float ... args ) {
17411741 if (shapeEnded ) {
1742- if (family == GROUP ) {
1743- updateTessellation ();
1744- // The tessellation is not updated for geometry/primitive shapes
1745- // because a common situation is shapes not still tessellated
1746- // but being transformed before adding them to the parent group
1747- // shape. If each shape is tessellated individually, then the process
1748- // is significantly slower than tessellating all the geometry in a single
1749- // batch when calling tessellate() on the root shape.
1750- }
17511742 checkMatrix (ncoords );
17521743 calcTransform (type , ncoords , args );
17531744 if (tessellated ) {
@@ -2723,7 +2714,7 @@ protected void tessellateImpl() {
27232714 child .tessellateImpl ();
27242715 }
27252716 } else {
2726- if (shapeEnded ) {
2717+ if (shapeEnded ) {
27272718 // If the geometry was tessellated previously, then
27282719 // the edges information will still be stored in the
27292720 // input object, so it needs to be removed to avoid
@@ -3227,14 +3218,14 @@ protected void aggregateImpl() {
32273218 // Recursively aggregating the child shapes.
32283219 hasPolys = false ;
32293220 hasLines = false ;
3230- hasPoints = false ;
3221+ hasPoints = false ;
32313222 for (int i = 0 ; i < childCount ; i ++) {
32323223 PShapeOpenGL child = (PShapeOpenGL ) children [i ];
32333224 child .aggregateImpl ();
32343225 hasPolys |= child .hasPolys ;
32353226 hasLines |= child .hasLines ;
32363227 hasPoints |= child .hasPoints ;
3237- }
3228+ }
32383229 } else { // LEAF SHAPE (family either GEOMETRY, PATH or PRIMITIVE)
32393230 hasPolys = -1 < firstPolyIndexCache && -1 < lastPolyIndexCache ;
32403231 hasLines = -1 < firstLineIndexCache && -1 < lastLineIndexCache ;
@@ -3301,13 +3292,12 @@ protected void updatePolyIndexCache() {
33013292 }
33023293 }
33033294 }
3295+
3296+ // Updating the first and last poly vertices for this group shape.
3297+ if (i == 0 ) firstPolyVertex = child .firstPolyVertex ;
3298+ if (i == childCount - 1 ) lastPolyVertex = child .lastPolyVertex ;
33043299 }
33053300 lastPolyIndexCache = gindex ;
3306-
3307- if (-1 < firstPolyIndexCache && -1 < lastPolyIndexCache ) {
3308- firstPolyVertex = cache .vertexOffset [firstPolyIndexCache ];
3309- lastPolyVertex = cache .vertexOffset [lastPolyIndexCache ] + cache .vertexCount [lastPolyIndexCache ] - 1 ;
3310- }
33113301 } else {
33123302 // The index cache is updated in order to reflect the fact that all
33133303 // the vertices will be stored in a single VBO in the root shape.
@@ -3350,11 +3340,12 @@ protected void updatePolyIndexCache() {
33503340
33513341 protected boolean startStrokeCache (int n ) {
33523342 return texture != null && (n == firstLineIndexCache || n == firstPointIndexCache );
3353- // return n == firstLineIndexCache || n == firstPointIndexCache;
33543343 }
33553344
33563345
33573346 protected void firstStrokeVertex (int n ) {
3347+ // TODO: this is probably not correct, but needs to be fixed together with the
3348+ // updateStrokeWeight(), etc.
33583349 if (n == firstLineIndexCache ) {
33593350 firstLineVertex = lastLineVertex = root .polyVertexOffset ;
33603351 }
@@ -3397,13 +3388,12 @@ protected void updateLineIndexCache() {
33973388 }
33983389 }
33993390 }
3391+
3392+ // Updating the first and last line vertices for this group shape.
3393+ if (i == 0 ) firstLineVertex = child .firstLineVertex ;
3394+ if (i == childCount - 1 ) lastLineVertex = child .lastLineVertex ;
34003395 }
34013396 lastLineIndexCache = gindex ;
3402-
3403- if (-1 < firstLineIndexCache && -1 < lastLineIndexCache ) {
3404- firstLineVertex = cache .vertexOffset [firstLineIndexCache ];
3405- lastLineVertex = cache .vertexOffset [lastLineIndexCache ] + cache .vertexCount [lastLineIndexCache ] - 1 ;
3406- }
34073397 } else {
34083398 firstLineVertex = lastLineVertex = cache .vertexOffset [firstLineIndexCache ];
34093399 for (int n = firstLineIndexCache ; n <= lastLineIndexCache ; n ++) {
@@ -3456,13 +3446,12 @@ protected void updatePointIndexCache() {
34563446 }
34573447 }
34583448 }
3449+
3450+ // Updating the first and last point vertices for this group shape.
3451+ if (i == 0 ) firstPointVertex = child .firstPointVertex ;
3452+ if (i == childCount - 1 ) lastPointVertex = child .lastPointVertex ;
34593453 }
3460- lastPointIndexCache = gindex ;
3461-
3462- if (-1 < firstPointIndexCache && -1 < lastPointIndexCache ) {
3463- firstPointVertex = cache .vertexOffset [firstPointIndexCache ];
3464- lastPointVertex = cache .vertexOffset [lastPointIndexCache ] + cache .vertexCount [lastPointIndexCache ] - 1 ;
3465- }
3454+ lastPointIndexCache = gindex ;
34663455 } else {
34673456 firstPointVertex = lastPointVertex = cache .vertexOffset [firstPointIndexCache ];
34683457 for (int n = firstPointIndexCache ; n <= lastPointIndexCache ; n ++) {
@@ -4291,7 +4280,7 @@ protected void renderPolys(PGraphicsOpenGL g, PImage textureImage) {
42914280 PolyShader shader = null ;
42924281 IndexCache cache = tessGeo .polyIndexCache ;
42934282 for (int n = firstPolyIndexCache ; n <= lastPolyIndexCache ; n ++) {
4294- if (tex != null && ( is3D () || (firstLineIndexCache == -1 || n < firstLineIndexCache ) &&
4283+ if (is3D () || ( tex != null && (firstLineIndexCache == -1 || n < firstLineIndexCache ) &&
42954284 (firstPointIndexCache == -1 || n < firstPointIndexCache ))) {
42964285 // Rendering fill triangles, which can be lit and textured.
42974286 if (!renderingFill ) {
0 commit comments