From 8a8ace9bedc32e159bbf42dbf8123cdb3e58a225 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 12 Jun 2015 15:48:12 -0400 Subject: [PATCH] don't need 2D/3D versions of createShape() --- core/src/processing/opengl/PGraphics2D.java | 2 +- core/src/processing/opengl/PGraphics3D.java | 2 +- core/src/processing/opengl/PShapeOpenGL.java | 30 +++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/core/src/processing/opengl/PGraphics2D.java b/core/src/processing/opengl/PGraphics2D.java index cb61d131c..daa5b8611 100644 --- a/core/src/processing/opengl/PGraphics2D.java +++ b/core/src/processing/opengl/PGraphics2D.java @@ -243,7 +243,7 @@ public class PGraphics2D extends PGraphicsOpenGL { String filename, String extension) { if (extension.equals("svg") || extension.equals("svgz")) { PShapeSVG svg = new PShapeSVG(pg.parent.loadXML(filename)); - return PShapeOpenGL.createShape2D((PGraphicsOpenGL) pg, svg); + return PShapeOpenGL.createShape((PGraphicsOpenGL) pg, svg); } return null; } diff --git a/core/src/processing/opengl/PGraphics3D.java b/core/src/processing/opengl/PGraphics3D.java index 469c21ffb..4766b5a2b 100644 --- a/core/src/processing/opengl/PGraphics3D.java +++ b/core/src/processing/opengl/PGraphics3D.java @@ -126,7 +126,7 @@ public class PGraphics3D extends PGraphicsOpenGL { obj = new PShapeOBJ(pg.parent, filename); int prevTextureMode = pg.textureMode; pg.textureMode = NORMAL; - PShapeOpenGL p3d = PShapeOpenGL.createShape3D((PGraphicsOpenGL)pg, obj); + PShapeOpenGL p3d = PShapeOpenGL.createShape((PGraphicsOpenGL)pg, obj); pg.textureMode = prevTextureMode; return p3d; } diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java index 0ee47eb01..0fb45ac2a 100644 --- a/core/src/processing/opengl/PShapeOpenGL.java +++ b/core/src/processing/opengl/PShapeOpenGL.java @@ -600,22 +600,22 @@ public class PShapeOpenGL extends PShape { // Shape creation (temporary hack) - public static PShapeOpenGL createShape3D(PGraphicsOpenGL pg, PShape src) { + public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics3D.createShapeImpl(pg, GROUP); - dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(GROUP); - copyGroup3D(pg, src, dest); + dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); + copyGroup(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams()); - dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapePrimitive(src.getKind(), src.getParams()); + dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY); - dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(PShape.GEOMETRY); + dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { - dest = (PShapeOpenGL) ((PGraphics3D) pg).createShapeFamily(PShape.PATH); + dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); //dest = PGraphics3D.createShapeImpl(pg, PATH); PShape.copyPath(src, dest); } @@ -627,23 +627,24 @@ public class PShapeOpenGL extends PShape { } + /* static public PShapeOpenGL createShape2D(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics2D.createShapeImpl(pg, GROUP); - dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(GROUP); + dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); copyGroup2D(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics2D.createShapeImpl(pg, src.getKind(), src.getParams()); - dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapePrimitive(src.getKind(), src.getParams()); + dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics2D.createShapeImpl(pg, PShape.GEOMETRY); - dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(PShape.GEOMETRY); + dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { //dest = PGraphics2D.createShapeImpl(pg, PATH); - dest = (PShapeOpenGL) ((PGraphics2D) pg).createShapeFamily(PShape.PATH); + dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); PShape.copyPath(src, dest); } dest.setName(src.getName()); @@ -651,20 +652,21 @@ public class PShapeOpenGL extends PShape { dest.height = src.height; return dest; } +*/ - - static public void copyGroup3D(PGraphicsOpenGL pg, PShape src, PShape dest) { + static public void copyGroup(PGraphicsOpenGL pg, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); copyImage(src, dest); for (int i = 0; i < src.getChildCount(); i++) { - PShape c = createShape3D(pg, src.getChild(i)); + PShape c = createShape(pg, src.getChild(i)); dest.addChild(c); } } + /* static public void copyGroup2D(PGraphicsOpenGL pg, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); @@ -675,7 +677,7 @@ public class PShapeOpenGL extends PShape { dest.addChild(c); } } - +*/ ///////////////////////////////////////////////////////////