mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
Removed polyTypes
This commit is contained in:
@@ -72,11 +72,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
/** Current flush mode. */
|
||||
protected int flushMode = FLUSH_WHEN_FULL;
|
||||
|
||||
/** Types of polygon vertices. */
|
||||
static protected final byte FILL_VERTEX = 0;
|
||||
static protected final byte LINE_VERTEX = 1;
|
||||
static protected final byte POINT_VERTEX = 2;
|
||||
|
||||
// ........................................................
|
||||
|
||||
@@ -7929,8 +7924,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int[] polySpecular;
|
||||
int[] polyEmissive;
|
||||
float[] polyShininess;
|
||||
|
||||
byte[] polyTypes;
|
||||
|
||||
int polyIndexCount;
|
||||
int firstPolyIndex;
|
||||
@@ -7984,7 +7977,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polySpecular = new int[PGL.DEFAULT_TESS_VERTICES];
|
||||
polyEmissive = new int[PGL.DEFAULT_TESS_VERTICES];
|
||||
polyShininess = new float[PGL.DEFAULT_TESS_VERTICES];
|
||||
polyTypes = new byte[PGL.DEFAULT_TESS_VERTICES];
|
||||
polyIndices = new short[PGL.DEFAULT_TESS_VERTICES];
|
||||
|
||||
lineVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
|
||||
@@ -8024,7 +8016,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polySpecular = null;
|
||||
polyEmissive = null;
|
||||
polyShininess = null;
|
||||
polyTypes = null;
|
||||
polyIndices = null;
|
||||
|
||||
lineVertices = null;
|
||||
@@ -8050,7 +8041,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
expandPolySpecular(newSize);
|
||||
expandPolyEmissive(newSize);
|
||||
expandPolyShininess(newSize);
|
||||
expandPolyTypes(newSize);
|
||||
}
|
||||
|
||||
firstPolyVertex = polyVertexCount;
|
||||
@@ -8071,7 +8061,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
expandPolySpecular(newSize);
|
||||
expandPolyEmissive(newSize);
|
||||
expandPolyShininess(newSize);
|
||||
expandPolyTypes(newSize);
|
||||
}
|
||||
|
||||
firstPolyVertex = polyVertexCount;
|
||||
@@ -8305,12 +8294,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polyShininess = temp;
|
||||
}
|
||||
|
||||
void expandPolyTypes(int n) {
|
||||
byte temp[] = new byte[n];
|
||||
PApplet.arrayCopy(polyTypes, 0, temp, 0, polyVertexCount);
|
||||
polyTypes = temp;
|
||||
}
|
||||
|
||||
void expandPolyIndices(int n) {
|
||||
short temp[] = new short[n];
|
||||
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
|
||||
@@ -8379,7 +8362,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
trimPolySpecular();
|
||||
trimPolyEmissive();
|
||||
trimPolyShininess();
|
||||
trimPolyTypes();
|
||||
}
|
||||
|
||||
if (0 < polyIndexCount && polyIndexCount < polyIndices.length) {
|
||||
@@ -8455,12 +8437,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polyShininess = temp;
|
||||
}
|
||||
|
||||
void trimPolyTypes() {
|
||||
byte temp[] = new byte[polyVertexCount];
|
||||
PApplet.arrayCopy(polyTypes, 0, temp, 0, polyVertexCount);
|
||||
polyTypes = temp;
|
||||
}
|
||||
|
||||
void trimPolyIndices() {
|
||||
short temp[] = new short[polyIndexCount];
|
||||
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
|
||||
@@ -8685,14 +8661,13 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// Add poly geometry
|
||||
|
||||
void setPolyVertex(int tessIdx, float x, float y, float z,
|
||||
int rgba, byte type,
|
||||
int rgba,
|
||||
InGeometry in, int[] vertices) {
|
||||
setPolyVertex(tessIdx, x, y, z,
|
||||
rgba,
|
||||
0, 0, 1,
|
||||
0, 0,
|
||||
0, 0, 0, 0,
|
||||
type,
|
||||
in, vertices);
|
||||
}
|
||||
|
||||
@@ -8701,7 +8676,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float nx, float ny, float nz,
|
||||
float u, float v,
|
||||
int am, int sp, int em, float shine,
|
||||
byte type,
|
||||
InGeometry in, int[] vertices) {
|
||||
int index;
|
||||
|
||||
@@ -8732,8 +8706,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polyNormals[index ] = nz;
|
||||
}
|
||||
|
||||
polyTypes[tessIdx] = type;
|
||||
|
||||
polyColors[tessIdx] = rgba;
|
||||
|
||||
index = 2 * tessIdx;
|
||||
@@ -8763,7 +8735,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float nx, float ny, float nz,
|
||||
float u, float v,
|
||||
int am, int sp, int em, float shine,
|
||||
byte type,
|
||||
InGeometry in, int[] vertices, float[] weights) {
|
||||
polyVertexCheck();
|
||||
int index;
|
||||
@@ -8796,8 +8767,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
polyNormals[index ] = nz;
|
||||
}
|
||||
|
||||
polyTypes[count] = type;
|
||||
|
||||
polyColors[count] = rgba;
|
||||
|
||||
index = 2 * count;
|
||||
@@ -8822,15 +8791,15 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
}
|
||||
|
||||
void addPolyVertices(InGeometry in, byte type) {
|
||||
addPolyVertices(in, in.firstVertex, in.lastVertex, type);
|
||||
void addPolyVertices(InGeometry in) {
|
||||
addPolyVertices(in, in.firstVertex, in.lastVertex);
|
||||
}
|
||||
|
||||
void addPolyVertex(InGeometry in, int i, byte type) {
|
||||
addPolyVertices(in, i, i, type);
|
||||
void addPolyVertex(InGeometry in, int i) {
|
||||
addPolyVertices(in, i, i);
|
||||
}
|
||||
|
||||
void addPolyVertices(InGeometry in, int i0, int i1, byte type) {
|
||||
void addPolyVertices(InGeometry in, int i0, int i1) {
|
||||
int index;
|
||||
int nvert = i1 - i0 + 1;
|
||||
|
||||
@@ -8913,8 +8882,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
index = 2 * inIdx;
|
||||
float u = in.texcoords[index++];
|
||||
float v = in.texcoords[index ];
|
||||
|
||||
polyTypes[tessIdx] = type;
|
||||
|
||||
polyColors[tessIdx] = in.colors[inIdx];
|
||||
|
||||
@@ -8929,7 +8896,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
} else {
|
||||
PApplet.arrayCopy(in.colors, i0, polyColors, firstPolyVertex, nvert);
|
||||
Arrays.fill(polyTypes, i0, i0 + nvert, type);
|
||||
PApplet.arrayCopy(in.texcoords, 2 * i0, polyTexcoords, 2 * firstPolyVertex, 2 * nvert);
|
||||
PApplet.arrayCopy(in.ambient, i0, polyAmbient, firstPolyVertex, nvert);
|
||||
PApplet.arrayCopy(in.specular, i0, polySpecular, firstPolyVertex, nvert);
|
||||
@@ -9328,11 +9294,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
float val = 0;
|
||||
float inc = (float) SINCOS_LENGTH / perim;
|
||||
tess.setPolyVertex(vertIdx, x0, y0, 0, rgba, POINT_VERTEX, in, null);
|
||||
tess.setPolyVertex(vertIdx, x0, y0, 0, rgba, in, null);
|
||||
vertIdx++;
|
||||
for (int k = 0; k < perim; k++) {
|
||||
tess.setPolyVertex(vertIdx, x0 + 0.5f * cosLUT[(int) val] * strokeWeight,
|
||||
y0 + 0.5f * sinLUT[(int) val] * strokeWeight, 0, rgba, POINT_VERTEX, in, null);
|
||||
y0 + 0.5f * sinLUT[(int) val] * strokeWeight, 0, rgba, in, null);
|
||||
vertIdx++;
|
||||
val = (val + inc) % SINCOS_LENGTH;
|
||||
}
|
||||
@@ -9461,11 +9427,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// in.tessMap.addFillIndex(i, -1);
|
||||
}
|
||||
|
||||
tess.setPolyVertex(vertIdx, x0, y0, 0, rgba, POINT_VERTEX, in, null);
|
||||
tess.setPolyVertex(vertIdx, x0, y0, 0, rgba, in, null);
|
||||
vertIdx++;
|
||||
for (int k = 0; k < nvert - 1; k++) {
|
||||
tess.setPolyVertex(vertIdx, x0 + 0.5f * QUAD_POINT_SIGNS[k][0] * strokeWeight,
|
||||
y0 + 0.5f * QUAD_POINT_SIGNS[k][1] * strokeWeight, 0, rgba, POINT_VERTEX, in, null);
|
||||
y0 + 0.5f * QUAD_POINT_SIGNS[k][1] * strokeWeight, 0, rgba, in, null);
|
||||
vertIdx++;
|
||||
}
|
||||
|
||||
@@ -9867,18 +9833,18 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float normx = -diry / llen;
|
||||
float normy = +dirx / llen;
|
||||
|
||||
tess.setPolyVertex(vidx, x0 + normx * weight/2, y0 + normy * weight/2, 0, color, LINE_VERTEX, in, verts);
|
||||
tess.setPolyVertex(vidx, x0 + normx * weight/2, y0 + normy * weight/2, 0, color, in, verts);
|
||||
tess.polyIndices[iidx++] = (short) (count + 0);
|
||||
|
||||
vidx++;
|
||||
tess.setPolyVertex(vidx, x0 - normx * weight/2, y0 - normy * weight/2, 0, color, LINE_VERTEX, in, verts);
|
||||
tess.setPolyVertex(vidx, x0 - normx * weight/2, y0 - normy * weight/2, 0, color, in, verts);
|
||||
tess.polyIndices[iidx++] = (short) (count + 1);
|
||||
|
||||
color = constStroke ? strokeColor : in.strokeColors[i1];
|
||||
weight = constStroke ? strokeWeight : in.strokeWeights[i1];
|
||||
|
||||
vidx++;
|
||||
tess.setPolyVertex(vidx, x1 - normx * weight/2, y1 - normy * weight/2, 0, color, LINE_VERTEX, in, verts);
|
||||
tess.setPolyVertex(vidx, x1 - normx * weight/2, y1 - normy * weight/2, 0, color, in, verts);
|
||||
tess.polyIndices[iidx++] = (short) (count + 2);
|
||||
|
||||
// Starting a new triangle re-using prev vertices.
|
||||
@@ -9886,7 +9852,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
tess.polyIndices[iidx++] = (short) (count + 0);
|
||||
|
||||
vidx++;
|
||||
tess.setPolyVertex(vidx, x1 + normx * weight/2, y1 + normy * weight/2, 0, color, LINE_VERTEX, in, verts);
|
||||
tess.setPolyVertex(vidx, x1 + normx * weight/2, y1 + normy * weight/2, 0, color, in, verts);
|
||||
tess.polyIndices[iidx++] = (short) (count + 3);
|
||||
|
||||
// NEW TESSMAP API
|
||||
@@ -10104,7 +10070,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// so we need to wrap-up things anyways.
|
||||
|
||||
// So, copy vertices in current region first
|
||||
tess.addPolyVertices(in, inMaxVert0, inMaxVert1, FILL_VERTEX);
|
||||
tess.addPolyVertices(in, inMaxVert0, inMaxVert1);
|
||||
|
||||
if (0 < dup) {
|
||||
// Adjusting the negative indices so they correspond to vertices added
|
||||
@@ -10121,7 +10087,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// Copy duplicated vertices from previous regions last
|
||||
for (int i = 0; i < inDupList.size(); i++) {
|
||||
int ri = inDupList.get(i);
|
||||
tess.addPolyVertex(in, ri + inMaxVert0, FILL_VERTEX);
|
||||
tess.addPolyVertex(in, ri + inMaxVert0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10197,7 +10163,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
if (fill && 3 <= nInVert) {
|
||||
firstPolyIndexCache = -1;
|
||||
|
||||
callback.init(in.renderMode == RETAINED, FILL_VERTEX, false, calcNormals);
|
||||
callback.init(in.renderMode == RETAINED, false, calcNormals);
|
||||
|
||||
gluTess.beginPolygon();
|
||||
|
||||
@@ -10263,7 +10229,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// Based on the opengl stroke hack described here:
|
||||
// http://wiki.processing.org/w/Stroke_attributes_in_OpenGL
|
||||
public void tessellateLinePath(LinePath path) {
|
||||
callback.init(in.renderMode == RETAINED, LINE_VERTEX, true, false);
|
||||
callback.init(in.renderMode == RETAINED, true, false);
|
||||
|
||||
int cap = strokeCap == ROUND ? LinePath.CAP_ROUND :
|
||||
strokeCap == PROJECT ? LinePath.CAP_SQUARE :
|
||||
@@ -10344,15 +10310,13 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
protected class TessellatorCallback implements PGL.TessellatorCallback {
|
||||
boolean calcNormals;
|
||||
boolean strokeTess;
|
||||
byte vertexType;
|
||||
IndexCache cache;
|
||||
int cacheIndex;
|
||||
int vertFirst;
|
||||
int vertCount;
|
||||
int primitive;
|
||||
|
||||
public void init(boolean addCache, byte vertType, boolean strokeTess, boolean calcNorm) {
|
||||
this.vertexType = vertType;
|
||||
public void init(boolean addCache, boolean strokeTess, boolean calcNorm) {
|
||||
this.strokeTess = strokeTess;
|
||||
this.calcNormals = calcNorm;
|
||||
|
||||
@@ -10492,7 +10456,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
(float) d[10], (float) d[11],
|
||||
acolor, scolor, ecolor,
|
||||
(float) d[24],
|
||||
vertexType,
|
||||
in, vertices, weights);
|
||||
|
||||
vertCount++;
|
||||
|
||||
Reference in New Issue
Block a user