MCPcopy Index your code
hub / github.com/benfry/processing4 / copyGeometry

Method copyGeometry

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

Source from the content-addressed store, hash-verified

1542
1543 // TODO unapproved
1544 static protected void copyGeometry(PShape src, PShape dest) {
1545 dest.beginShape(src.getKind());
1546
1547 copyMatrix(src, dest);
1548 copyStyles(src, dest);
1549 copyImage(src, dest);
1550
1551 if (src.style) {
1552 for (int i = 0; i < src.vertexCount; i++) {
1553 float[] vert = src.vertices[i];
1554
1555 dest.fill((int)(vert[PGraphics.A] * 255) << 24 |
1556 (int)(vert[PGraphics.R] * 255) << 16 |
1557 (int)(vert[PGraphics.G] * 255) << 8 |
1558 (int)(vert[PGraphics.B] * 255));
1559
1560 // Do we need to copy these as well?
1561// dest.ambient(vert[PGraphics.AR] * 255, vert[PGraphics.AG] * 255, vert[PGraphics.AB] * 255);
1562// dest.specular(vert[PGraphics.SPR] * 255, vert[PGraphics.SPG] * 255, vert[PGraphics.SPB] * 255);
1563// dest.emissive(vert[PGraphics.ER] * 255, vert[PGraphics.EG] * 255, vert[PGraphics.EB] * 255);
1564// dest.shininess(vert[PGraphics.SHINE]);
1565
1566 if (0 < PApplet.dist(vert[PGraphics.NX],
1567 vert[PGraphics.NY],
1568 vert[PGraphics.NZ], 0, 0, 0)) {
1569 dest.normal(vert[PGraphics.NX],
1570 vert[PGraphics.NY],
1571 vert[PGraphics.NZ]);
1572 }
1573 dest.vertex(vert[X], vert[Y], vert[Z],
1574 vert[PGraphics.U],
1575 vert[PGraphics.V]);
1576 }
1577 } else {
1578 for (int i = 0; i < src.vertexCount; i++) {
1579 float[] vert = src.vertices[i];
1580 if (vert[Z] == 0) {
1581 dest.vertex(vert[X], vert[Y]);
1582 } else {
1583 dest.vertex(vert[X], vert[Y], vert[Z]);
1584 }
1585 }
1586 }
1587
1588 dest.endShape();
1589 }
1590
1591
1592 // 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