mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge branch 'master' of github.com:processing/processing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user