MCPcopy Index your code
hub / github.com/processing/processing / copyGeometry

Method copyGeometry

core/src/processing/core/PShape.java:1487–1532  ·  view source on GitHub ↗
(PShape src, PShape dest)

Source from the content-addressed store, hash-verified

1485
1486 // TODO unapproved
1487 static protected void copyGeometry(PShape src, PShape dest) {
1488 dest.beginShape(src.getKind());
1489
1490 copyMatrix(src, dest);
1491 copyStyles(src, dest);
1492 copyImage(src, dest);
1493
1494 if (src.style) {
1495 for (int i = 0; i < src.vertexCount; i++) {
1496 float[] vert = src.vertices[i];
1497
1498 dest.fill((int)(vert[PGraphics.A] * 255) << 24 |
1499 (int)(vert[PGraphics.R] * 255) << 16 |
1500 (int)(vert[PGraphics.G] * 255) << 8 |
1501 (int)(vert[PGraphics.B] * 255));
1502
1503 // Do we need to copy these as well?
1504// dest.ambient(vert[PGraphics.AR] * 255, vert[PGraphics.AG] * 255, vert[PGraphics.AB] * 255);
1505// dest.specular(vert[PGraphics.SPR] * 255, vert[PGraphics.SPG] * 255, vert[PGraphics.SPB] * 255);
1506// dest.emissive(vert[PGraphics.ER] * 255, vert[PGraphics.EG] * 255, vert[PGraphics.EB] * 255);
1507// dest.shininess(vert[PGraphics.SHINE]);
1508
1509 if (0 < PApplet.dist(vert[PGraphics.NX],
1510 vert[PGraphics.NY],
1511 vert[PGraphics.NZ], 0, 0, 0)) {
1512 dest.normal(vert[PGraphics.NX],
1513 vert[PGraphics.NY],
1514 vert[PGraphics.NZ]);
1515 }
1516 dest.vertex(vert[X], vert[Y], vert[Z],
1517 vert[PGraphics.U],
1518 vert[PGraphics.V]);
1519 }
1520 } else {
1521 for (int i = 0; i < src.vertexCount; i++) {
1522 float[] vert = src.vertices[i];
1523 if (vert[Z] == 0) {
1524 dest.vertex(vert[X], vert[Y]);
1525 } else {
1526 dest.vertex(vert[X], vert[Y], vert[Z]);
1527 }
1528 }
1529 }
1530
1531 dest.endShape();
1532 }
1533
1534
1535 // TODO unapproved

Callers 2

createShapeMethod · 0.95
createShapeMethod · 0.95

Calls 10

copyMatrixMethod · 0.95
copyStylesMethod · 0.95
copyImageMethod · 0.95
distMethod · 0.95
getKindMethod · 0.80
vertexMethod · 0.65
beginShapeMethod · 0.45
fillMethod · 0.45
normalMethod · 0.45
endShapeMethod · 0.45

Tested by

no test coverage detected