Skip to content

Commit f0f9558

Browse files
committed
don't need 2D/3D versions of createShape()
1 parent 74fee4f commit f0f9558

3 files changed

Lines changed: 18 additions & 16 deletions

File tree

core/src/processing/opengl/PGraphics2D.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static protected PShape loadShapeImpl(PGraphics pg,
243243
String filename, String extension) {
244244
if (extension.equals("svg") || extension.equals("svgz")) {
245245
PShapeSVG svg = new PShapeSVG(pg.parent.loadXML(filename));
246-
return PShapeOpenGL.createShape2D((PGraphicsOpenGL) pg, svg);
246+
return PShapeOpenGL.createShape((PGraphicsOpenGL) pg, svg);
247247
}
248248
return null;
249249
}

core/src/processing/opengl/PGraphics3D.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static protected PShape loadShapeImpl(PGraphics pg, String filename,
126126
obj = new PShapeOBJ(pg.parent, filename);
127127
int prevTextureMode = pg.textureMode;
128128
pg.textureMode = NORMAL;
129-
PShapeOpenGL p3d = PShapeOpenGL.createShape3D((PGraphicsOpenGL)pg, obj);
129+
PShapeOpenGL p3d = PShapeOpenGL.createShape((PGraphicsOpenGL)pg, obj);
130130
pg.textureMode = prevTextureMode;
131131
return p3d;
132132
}

core/src/processing/opengl/PShapeOpenGL.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -600,22 +600,22 @@ protected void finalizePointBuffers() {
600600
// Shape creation (temporary hack)
601601

602602

603-
public static PShapeOpenGL createShape3D(PGraphicsOpenGL pg, PShape src) {
603+
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) {
604604
PShapeOpenGL dest = null;
605605
if (src.getFamily() == GROUP) {
606606
//dest = PGraphics3D.createShapeImpl(pg, GROUP);
607-
dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(GROUP);
608-
copyGroup3D(pg, src, dest);
607+
dest = (PShapeOpenGL) pg.createShapeFamily(GROUP);
608+
copyGroup(pg, src, dest);
609609
} else if (src.getFamily() == PRIMITIVE) {
610610
//dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams());
611-
dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapePrimitive(src.getKind(), src.getParams());
611+
dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams());
612612
PShape.copyPrimitive(src, dest);
613613
} else if (src.getFamily() == GEOMETRY) {
614614
//dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY);
615-
dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(PShape.GEOMETRY);
615+
dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY);
616616
PShape.copyGeometry(src, dest);
617617
} else if (src.getFamily() == PATH) {
618-
dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(PShape.PATH);
618+
dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH);
619619
//dest = PGraphics3D.createShapeImpl(pg, PATH);
620620
PShape.copyPath(src, dest);
621621
}
@@ -627,44 +627,46 @@ public static PShapeOpenGL createShape3D(PGraphicsOpenGL pg, PShape src) {
627627
}
628628

629629

630+
/*
630631
static public PShapeOpenGL createShape2D(PGraphicsOpenGL pg, PShape src) {
631632
PShapeOpenGL dest = null;
632633
if (src.getFamily() == GROUP) {
633634
//dest = PGraphics2D.createShapeImpl(pg, GROUP);
634-
dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(GROUP);
635+
dest = (PShapeOpenGL) pg.createShapeFamily(GROUP);
635636
copyGroup2D(pg, src, dest);
636637
} else if (src.getFamily() == PRIMITIVE) {
637638
//dest = PGraphics2D.createShapeImpl(pg, src.getKind(), src.getParams());
638-
dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapePrimitive(src.getKind(), src.getParams());
639+
dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams());
639640
PShape.copyPrimitive(src, dest);
640641
} else if (src.getFamily() == GEOMETRY) {
641642
//dest = PGraphics2D.createShapeImpl(pg, PShape.GEOMETRY);
642-
dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(PShape.GEOMETRY);
643+
dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY);
643644
PShape.copyGeometry(src, dest);
644645
} else if (src.getFamily() == PATH) {
645646
//dest = PGraphics2D.createShapeImpl(pg, PATH);
646-
dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(PShape.PATH);
647+
dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH);
647648
PShape.copyPath(src, dest);
648649
}
649650
dest.setName(src.getName());
650651
dest.width = src.width;
651652
dest.height = src.height;
652653
return dest;
653654
}
655+
*/
654656

655-
656-
static public void copyGroup3D(PGraphicsOpenGL pg, PShape src, PShape dest) {
657+
static public void copyGroup(PGraphicsOpenGL pg, PShape src, PShape dest) {
657658
copyMatrix(src, dest);
658659
copyStyles(src, dest);
659660
copyImage(src, dest);
660661

661662
for (int i = 0; i < src.getChildCount(); i++) {
662-
PShape c = createShape3D(pg, src.getChild(i));
663+
PShape c = createShape(pg, src.getChild(i));
663664
dest.addChild(c);
664665
}
665666
}
666667

667668

669+
/*
668670
static public void copyGroup2D(PGraphicsOpenGL pg, PShape src, PShape dest) {
669671
copyMatrix(src, dest);
670672
copyStyles(src, dest);
@@ -675,7 +677,7 @@ static public void copyGroup2D(PGraphicsOpenGL pg, PShape src, PShape dest) {
675677
dest.addChild(c);
676678
}
677679
}
678-
680+
*/
679681

680682
///////////////////////////////////////////////////////////
681683

0 commit comments

Comments
 (0)