working on tweaks for recordRaw() and dxf/ai support

This commit is contained in:
benfry
2006-02-27 20:44:03 +00:00
parent 849c4f5401
commit 94065bf9ac
6 changed files with 53 additions and 35 deletions

View File

@@ -201,8 +201,9 @@ public class PGraphics extends PImage implements PConstants {
// vertices
static final int DEFAULT_VERTICES = 512;
public float vertices[][] = new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT];
int vertexCount; // total number of vertices
protected float vertices[][] =
new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT];
protected int vertexCount; // total number of vertices
// ........................................................
@@ -751,7 +752,7 @@ public class PGraphics extends PImage implements PConstants {
// not everyone needs this, but just easier to store rather
// than adding another moving part to the code...
vertices[vertexCount][MX] = x;
vertices[vertexCount][MY] = x;
vertices[vertexCount][MY] = y;
vertexCount++;
switch (shape) {

View File

@@ -1376,12 +1376,23 @@ public class PGraphics3 extends PGraphics {
triangle.render();
if (raw != null) {
raw.fill(ar, ag, ab, a[A]);
raw.vertex(a[X], a[Y]); // a[X] and not a[VX] ?
raw.fill(br, bg, bb, b[A]);
raw.vertex(b[X], b[Y]);
raw.fill(cr, cg, cb, c[A]);
raw.vertex(c[X], c[Y]);
if (raw instanceof PGraphics3) {
if ((a[VW] != 0) && (b[VW] != 0) && (c[VW] != 0)) {
raw.fill(ar, ag, ab, a[A]);
raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]);
raw.fill(br, bg, bb, b[A]);
raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]);
raw.fill(cr, cg, cb, c[A]);
raw.vertex(c[VX] / c[VW], c[VY] / c[VW], c[VZ] / c[VW]);
}
} else {
raw.fill(ar, ag, ab, a[A]);
raw.vertex(a[X], a[Y]);
raw.fill(br, bg, bb, b[A]);
raw.vertex(b[X], b[Y]);
raw.fill(cr, cg, cb, c[A]);
raw.vertex(c[X], c[Y]);
}
}
}
@@ -1419,6 +1430,12 @@ public class PGraphics3 extends PGraphics {
protected void render_lines() {
if (raw != null) {
raw.colorMode(RGB, 1);
raw.noFill();
raw.beginShape(LINES);
}
for (int i = 0; i < lineCount; i ++) {
float a[] = vertices[lines[i][VERTEX1]];
float b[] = vertices[lines[i][VERTEX2]];
@@ -1432,13 +1449,29 @@ public class PGraphics3 extends PGraphics {
line.setVertices(a[X], a[Y], a[Z],
b[X], b[Y], b[Z]);
//if (renderCallbackObject != null) {
//lineCallbackMethod.
//}
if (raw != null) {
if (raw instanceof PGraphics3) {
if ((a[VW] != 0) && (b[VW] != 0)) {
raw.stroke(a[SR], a[SG], a[SB], a[SA]);
raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]);
raw.stroke(b[SR], b[SG], b[SB], b[SA]);
raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]);
}
} else {
raw.stroke(a[SR], a[SG], a[SB], a[SA]);
raw.vertex(a[X], a[Y]);
raw.stroke(b[SR], b[SG], b[SB], b[SA]);
raw.vertex(b[X], b[Y]);
}
}
line.setIndex(index);
line.draw();
}
if (raw != null) {
raw.endShape();
}
}
@@ -3819,27 +3852,6 @@ public class PGraphics3 extends PGraphics {
//////////////////////////////////////////////////////////////
// RAW SHAPE RECORDING
/*
public void beginRaw(PGraphics raw) {
this.raw = raw;
raw.beginFrame();
}
public void endRaw() {
if (raw != null) {
raw.endFrame();
raw = null;
}
}
*/
//////////////////////////////////////////////////////////////
// MATH (internal use only)

View File

@@ -647,6 +647,8 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=127
PGraphicsGL
_ make a note about the anti-aliasing types in the faq
_ y may be flipped in modelX/Y/Z stuff on opengl
_ opengl doesn't work in applets
_ http://dev.processing.org/bugs/show_bug.cgi?id=166
_ example of getting it to work with an applet

View File

@@ -249,7 +249,7 @@ public class PGraphicsGL extends PGraphics3 {
* because OpenGL's pixel buffer is all handled internally.
*/
protected void allocate() {
// changing for 0100, need to resize rather than return-allocate
// changing for 0100, need to resize rather than re-allocate
canvas.setSize(width, height);
}

View File

@@ -12,7 +12,7 @@ import processing.core.*;
public class PGraphicsPDF extends PGraphics2 {
File temp;
int frameCount;
//int frameCount;
File file;
Document document;
PdfWriter writer;

View File

@@ -5,6 +5,9 @@ _ p5 not saving changes on quit, even if you say 'yes'
_ http://dev.processing.org/bugs/show_bug.cgi?id=276
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1139519266;start=;mstate=0
_ recordRaw() to a PGraphics3 should send 3D data.
_ but recordRaw() to a PGraphics(2) should send only 2D data.
X update osx for intel binary (if necessary)
_ http://developer.apple.com/qa/qa2005/qa1295.html
_ find/build universal version of jogl