fix for bug #737, duplicate geometry from P3D

This commit is contained in:
benfry
2008-08-16 01:37:37 +00:00
parent 168c8d44d0
commit 2b1bb723d4
2 changed files with 8 additions and 6 deletions

View File

@@ -940,6 +940,7 @@ public class PGraphics3D extends PGraphics {
case QUADS:
{
stop = vertexCount-3;
for (int i = vertex_start; i < stop; i += 4) {
// first triangle
add_triangle(i, i+1, i+2);
@@ -952,6 +953,7 @@ public class PGraphics3D extends PGraphics {
case QUAD_STRIP:
{
stop = vertexCount-3;
for (int i = vertex_start; i < stop; i += 2) {
// first triangle
add_triangle(i+0, i+2, i+1);
@@ -1270,7 +1272,6 @@ public class PGraphics3D extends PGraphics {
protected final void add_triangle_no_clip(int a, int b, int c) {
//System.out.println("adding triangle " + triangleCount);
if (triangleCount == triangles.length) {
int temp[][] = new int[triangleCount<<1][TRIANGLE_FIELD_COUNT];
System.arraycopy(triangles, 0, temp, 0, triangleCount);
@@ -1341,7 +1342,7 @@ public class PGraphics3D extends PGraphics {
Float.isNaN(vertices[triangles[b][VERTEX1]][Z]) ||
Float.isNaN(vertices[triangles[b][VERTEX2]][Z]) ||
Float.isNaN(vertices[triangles[b][VERTEX3]][Z])) {
throw new RuntimeException("nan triangle");
System.err.println("NaN values in triangle");
}
return
(vertices[triangles[b][VERTEX1]][Z] +
@@ -1446,7 +1447,7 @@ public class PGraphics3D extends PGraphics {
raw.fill(cr, cg, cb, c[A]);
raw.vertex(c[VX] / c[VW], c[VY] / c[VW], c[VZ] / c[VW]);
}
} else { // otherwise it's a PGraphics2D
} else { // raw instanceof PGraphics2D
raw.fill(ar, ag, ab, a[A]);
raw.vertex(a[X], a[Y]);
raw.fill(br, bg, bb, b[A]);
@@ -1471,6 +1472,7 @@ public class PGraphics3D extends PGraphics {
c[VY] -= shift*c[VW];
}
}
triangleCount = 0;
if (raw != null) {
raw.endShape();

View File

@@ -8,6 +8,9 @@ o start an integration section?
X get() in java2d not honoring imageMode or rectMode
X add imageMode(CENTER) implementation
X add a bunch of changes to the reference to support this
X Duplicate 3d faces in beginRaw() export
X this was actually doubling geometry, potentially a bit of a disaster
X http://dev.processing.org/bugs/show_bug.cgi?id=737
cleanup
X switch to requestImage() (done in 0145)
@@ -51,9 +54,6 @@ _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=displ
_ bezierVertex YZ Plane fill problem
_ http://dev.processing.org/bugs/show_bug.cgi?id=752
_ Duplicate 3d faces in beginRaw() export
_ http://dev.processing.org/bugs/show_bug.cgi?id=737
_ for begin/endRecord, use a piggyback mechanism
_ that way won't have to pass a PApplet around
_ this has a big impact on the SVG library