mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Removed line normals
This commit is contained in:
@@ -67,7 +67,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
|
||||
public int glLineVertexBufferID;
|
||||
public int glLineColorBufferID;
|
||||
public int glLineNormalBufferID;
|
||||
public int glLineDirWidthBufferID;
|
||||
public int glLineIndexBufferID;
|
||||
protected boolean lineVBOsCreated = false;
|
||||
@@ -424,7 +423,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
|
||||
glLineVertexBufferID = 0;
|
||||
glLineColorBufferID = 0;
|
||||
glLineNormalBufferID = 0;
|
||||
glLineDirWidthBufferID = 0;
|
||||
glLineIndexBufferID = 0;
|
||||
|
||||
@@ -1221,10 +1219,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColorBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, null, vboMode);
|
||||
|
||||
glLineNormalBufferID = createVertexBufferObject();
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineNormalBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, vboMode);
|
||||
|
||||
glLineDirWidthBufferID = createVertexBufferObject();
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineDirWidthBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, null, vboMode);
|
||||
@@ -1259,9 +1253,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
deleteVertexBufferObject(glLineColorBufferID);
|
||||
glLineColorBufferID = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineNormalBufferID);
|
||||
glLineNormalBufferID = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineDirWidthBufferID);
|
||||
glLineDirWidthBufferID = 0;
|
||||
|
||||
@@ -6905,7 +6896,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
public int lastLineVertex;
|
||||
public float[] lineVertices;
|
||||
public float[] lineColors;
|
||||
public float[] lineNormals;
|
||||
public float[] lineDirWidths;
|
||||
|
||||
public int lineIndexCount;
|
||||
@@ -6960,7 +6950,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
|
||||
lineVertices = new float[3 * PGL.DEFAULT_TESS_VERTICES];
|
||||
lineColors = new float[4 * PGL.DEFAULT_TESS_VERTICES];
|
||||
lineNormals = new float[3 * PGL.DEFAULT_TESS_VERTICES];
|
||||
lineDirWidths = new float[4 * PGL.DEFAULT_TESS_VERTICES];
|
||||
lineIndices = new short[PGL.DEFAULT_TESS_VERTICES];
|
||||
|
||||
@@ -6992,7 +6981,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
if (lineVertexCount < lineVertices.length / 3) {
|
||||
trimLineVertices();
|
||||
trimLineColors();
|
||||
trimLineNormals();
|
||||
trimLineAttributes();
|
||||
}
|
||||
|
||||
@@ -7078,12 +7066,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineColors = temp;
|
||||
}
|
||||
|
||||
protected void trimLineNormals() {
|
||||
float temp[] = new float[3 * lineVertexCount];
|
||||
PApplet.arrayCopy(lineNormals, 0, temp, 0, 3 * lineVertexCount);
|
||||
lineNormals = temp;
|
||||
}
|
||||
|
||||
protected void trimLineAttributes() {
|
||||
float temp[] = new float[4 * lineVertexCount];
|
||||
PApplet.arrayCopy(lineDirWidths, 0, temp, 0, 4 * lineVertexCount);
|
||||
@@ -7139,7 +7121,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
|
||||
lineVertices = null;
|
||||
lineColors = null;
|
||||
lineNormals = null;
|
||||
lineDirWidths = null;
|
||||
lineIndices = null;
|
||||
|
||||
@@ -7467,7 +7448,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
|
||||
expandLineVertices(newSize);
|
||||
expandLineColors(newSize);
|
||||
expandLineNormals(newSize);
|
||||
expandLineAttributes(newSize);
|
||||
}
|
||||
|
||||
@@ -7488,12 +7468,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineColors = temp;
|
||||
}
|
||||
|
||||
protected void expandLineNormals(int n) {
|
||||
float temp[] = new float[3 * n];
|
||||
PApplet.arrayCopy(lineNormals, 0, temp, 0, 3 * lineVertexCount);
|
||||
lineNormals = temp;
|
||||
}
|
||||
|
||||
protected void expandLineAttributes(int n) {
|
||||
float temp[] = new float[4 * n];
|
||||
PApplet.arrayCopy(lineDirWidths, 0, temp, 0, 4 * lineVertexCount);
|
||||
@@ -7746,11 +7720,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
float y0 = in.vertices[index++];
|
||||
float z0 = in.vertices[index ];
|
||||
|
||||
index = 3 * inIdx0;
|
||||
float nx = in.normals[index++];
|
||||
float ny = in.normals[index++];
|
||||
float nz = in.normals[index ];
|
||||
|
||||
index = 3 * inIdx1;
|
||||
float x1 = in.vertices[index++];
|
||||
float y1 = in.vertices[index++];
|
||||
@@ -7764,11 +7733,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineVertices[index++] = x0 * tr.m10 + y0 * tr.m11 + z0 * tr.m12 + tr.m13;
|
||||
lineVertices[index ] = x0 * tr.m20 + y0 * tr.m21 + z0 * tr.m22 + tr.m23;
|
||||
|
||||
index = 3 * tessIdx;
|
||||
lineNormals[index++] = nx * tr.m00 + ny * tr.m01 + nz * tr.m02;
|
||||
lineNormals[index++] = nx * tr.m10 + ny * tr.m11 + nz * tr.m12;
|
||||
lineNormals[index ] = nx * tr.m20 + ny * tr.m21 + nz * tr.m22;
|
||||
|
||||
index = 4 * tessIdx;
|
||||
lineDirWidths[index++] = x1 * tr.m00 + y1 * tr.m01 + z1 * tr.m02 + tr.m03;
|
||||
lineDirWidths[index++] = x1 * tr.m10 + y1 * tr.m11 + z1 * tr.m12 + tr.m13;
|
||||
@@ -7779,11 +7743,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineVertices[index++] = y0;
|
||||
lineVertices[index ] = z0;
|
||||
|
||||
index = 3 * tessIdx;
|
||||
lineNormals[index++] = nx;
|
||||
lineNormals[index++] = ny;
|
||||
lineNormals[index ] = nz;
|
||||
|
||||
index = 4 * tessIdx;
|
||||
lineDirWidths[index++] = x1;
|
||||
lineDirWidths[index++] = y1;
|
||||
@@ -8055,10 +8014,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
float x = lineVertices[index++];
|
||||
float y = lineVertices[index ];
|
||||
|
||||
index = 3 * i;
|
||||
float nx = lineNormals[index++];
|
||||
float ny = lineNormals[index ];
|
||||
|
||||
index = 4 * i;
|
||||
float xa = lineDirWidths[index++];
|
||||
float ya = lineDirWidths[index ];
|
||||
@@ -8067,10 +8022,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineVertices[index++] = x * tr.m00 + y * tr.m01 + tr.m02;
|
||||
lineVertices[index ] = x * tr.m10 + y * tr.m11 + tr.m12;
|
||||
|
||||
index = 3 * i;
|
||||
lineNormals[index++] = nx * tr.m00 + ny * tr.m01;
|
||||
lineNormals[index ] = nx * tr.m10 + ny * tr.m11;
|
||||
|
||||
index = 4 * i;
|
||||
lineDirWidths[index++] = xa * tr.m00 + ya * tr.m01 + tr.m02;
|
||||
lineDirWidths[index ] = xa * tr.m10 + ya * tr.m11 + tr.m12;
|
||||
@@ -8136,11 +8087,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
float y = lineVertices[index++];
|
||||
float z = lineVertices[index ];
|
||||
|
||||
index = 3 * i;
|
||||
float nx = lineNormals[index++];
|
||||
float ny = lineNormals[index++];
|
||||
float nz = lineNormals[index ];
|
||||
|
||||
index = 4 * i;
|
||||
float xa = lineDirWidths[index++];
|
||||
float ya = lineDirWidths[index++];
|
||||
@@ -8151,11 +8097,6 @@ public class PGraphicsAndroid3D extends PGraphics {
|
||||
lineVertices[index++] = x * tr.m10 + y * tr.m11 + z * tr.m12 + tr.m13;
|
||||
lineVertices[index ] = x * tr.m20 + y * tr.m21 + z * tr.m22 + tr.m23;
|
||||
|
||||
index = 3 * i;
|
||||
lineNormals[index++] = nx * tr.m00 + ny * tr.m01 + nz * tr.m02;
|
||||
lineNormals[index++] = nx * tr.m10 + ny * tr.m11 + nz * tr.m12;
|
||||
lineNormals[index ] = nx * tr.m20 + ny * tr.m21 + nz * tr.m22;
|
||||
|
||||
index = 4 * i;
|
||||
lineDirWidths[index++] = xa * tr.m00 + ya * tr.m01 + za * tr.m02 + tr.m03;
|
||||
lineDirWidths[index++] = xa * tr.m10 + ya * tr.m11 + za * tr.m12 + tr.m13;
|
||||
|
||||
@@ -89,7 +89,6 @@ public class PShape3D extends PShape {
|
||||
|
||||
public int glLineVertexBufferID;
|
||||
public int glLineColorBufferID;
|
||||
public int glLineNormalBufferID;
|
||||
public int glLineDirWidthBufferID;
|
||||
public int glLineIndexBufferID;
|
||||
|
||||
@@ -142,7 +141,6 @@ public class PShape3D extends PShape {
|
||||
|
||||
boolean modifiedLineVertices;
|
||||
boolean modifiedLineColors;
|
||||
boolean modifiedLineNormals;
|
||||
boolean modifiedLineAttributes;
|
||||
|
||||
boolean modifiedPointVertices;
|
||||
@@ -161,7 +159,6 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected VertexCache lineVerticesCache;
|
||||
protected VertexCache lineColorsCache;
|
||||
protected VertexCache lineNormalsCache;
|
||||
protected VertexCache lineAttributesCache;
|
||||
|
||||
protected VertexCache pointVerticesCache;
|
||||
@@ -268,7 +265,6 @@ public class PShape3D extends PShape {
|
||||
|
||||
glLineVertexBufferID = 0;
|
||||
glLineColorBufferID = 0;
|
||||
glLineNormalBufferID = 0;
|
||||
glLineDirWidthBufferID = 0;
|
||||
glLineIndexBufferID = 0;
|
||||
|
||||
@@ -449,10 +445,6 @@ public class PShape3D extends PShape {
|
||||
pg.finalizeVertexBufferObject(glLineColorBufferID);
|
||||
}
|
||||
|
||||
if (glLineNormalBufferID != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineNormalBufferID);
|
||||
}
|
||||
|
||||
if (glLineDirWidthBufferID != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineDirWidthBufferID);
|
||||
}
|
||||
@@ -1538,7 +1530,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1574,7 +1565,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1611,7 +1601,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1648,7 +1637,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1684,7 +1672,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1721,7 +1708,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1758,7 +1744,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1808,7 +1793,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -1862,7 +1846,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
if (0 < tess.lineVertexCount) {
|
||||
modifiedLineVertices = true;
|
||||
modifiedLineNormals = true;
|
||||
modifiedLineAttributes = true;
|
||||
}
|
||||
if (0 < tess.pointVertexCount) {
|
||||
@@ -2256,11 +2239,6 @@ public class PShape3D extends PShape {
|
||||
return tess.lineColors;
|
||||
}
|
||||
|
||||
public float[] lineNormals() {
|
||||
updateTesselation();
|
||||
return tess.lineNormals;
|
||||
}
|
||||
|
||||
public float[] lineAttributes() {
|
||||
updateTesselation();
|
||||
return tess.lineDirWidths;
|
||||
@@ -2414,10 +2392,6 @@ public class PShape3D extends PShape {
|
||||
unmapVertexImpl();
|
||||
}
|
||||
|
||||
public FloatBuffer mapLineNormals() {
|
||||
return mapVertexImpl(root.glLineNormalBufferID, 3 * tess.firstLineVertex, 3 * tess.lineVertexCount).asFloatBuffer();
|
||||
}
|
||||
|
||||
public void unmapLineNormals() {
|
||||
unmapVertexImpl();
|
||||
}
|
||||
@@ -2837,11 +2811,6 @@ public class PShape3D extends PShape {
|
||||
root.lineColorsCache.reset();
|
||||
}
|
||||
|
||||
if (root.lineNormalsCache != null && root.lineNormalsCache.hasData()) {
|
||||
root.copyLineNormals(root.lineNormalsCache.offset, root.lineNormalsCache.size, root.lineNormalsCache.floatData);
|
||||
root.lineNormalsCache.reset();
|
||||
}
|
||||
|
||||
if (root.lineAttributesCache != null && root.lineAttributesCache.hasData()) {
|
||||
root.copyLineAttributes(root.lineAttributesCache.offset, root.lineAttributesCache.size, root.lineAttributesCache.floatData);
|
||||
root.lineAttributesCache.reset();
|
||||
@@ -3288,17 +3257,6 @@ public class PShape3D extends PShape {
|
||||
root.lineColorsCache.reset();
|
||||
}
|
||||
|
||||
if (modifiedLineNormals) {
|
||||
if (root.lineNormalsCache == null) {
|
||||
root.lineNormalsCache = new VertexCache(3, true);
|
||||
}
|
||||
root.lineNormalsCache.add(root.lineVertCopyOffset, tess.lineVertexCount, tess.lineNormals);
|
||||
modifiedLineNormals = false;
|
||||
} else if (root.lineNormalsCache != null && root.lineNormalsCache.hasData()) {
|
||||
root.copyLineNormals(root.lineNormalsCache.offset, root.lineNormalsCache.size, root.lineNormalsCache.floatData);
|
||||
root.lineNormalsCache.reset();
|
||||
}
|
||||
|
||||
if (modifiedLineAttributes) {
|
||||
if (root.lineAttributesCache == null) {
|
||||
root.lineAttributesCache = new VertexCache(4, true);
|
||||
@@ -3478,10 +3436,6 @@ public class PShape3D extends PShape {
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColorBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, null, glMode);
|
||||
|
||||
glLineNormalBufferID = pg.createVertexBufferObject();
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineNormalBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, glMode);
|
||||
|
||||
glLineDirWidthBufferID = pg.createVertexBufferObject();
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineDirWidthBufferID);
|
||||
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, null, glMode);
|
||||
@@ -3505,7 +3459,7 @@ public class PShape3D extends PShape {
|
||||
} else {
|
||||
if (hasLines) {
|
||||
root.copyLineGeometry(root.lineVertCopyOffset, tess.lineVertexCount,
|
||||
tess.lineVertices, tess.lineColors, tess.lineNormals, tess.lineDirWidths);
|
||||
tess.lineVertices, tess.lineColors, tess.lineDirWidths);
|
||||
root.lineVertCopyOffset += tess.lineVertexCount;
|
||||
|
||||
root.copyLineIndices(root.lineIndCopyOffset, tess.lineIndexCount, tess.lineIndices);
|
||||
@@ -3516,7 +3470,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
|
||||
protected void copyLineGeometry(int offset, int size,
|
||||
float[] vertices, float[] colors, float[] normals, float[] attribs) {
|
||||
float[] vertices, float[] colors, float[] attribs) {
|
||||
int offsetf = offset * PGL.SIZEOF_FLOAT;
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
|
||||
@@ -3526,9 +3480,6 @@ public class PShape3D extends PShape {
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColorBufferID);
|
||||
pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offsetf, 4 * sizef, FloatBuffer.wrap(colors, 0, 4 * size));
|
||||
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineNormalBufferID);
|
||||
pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 3 * offsetf, 3 * sizef, FloatBuffer.wrap(normals, 0, 3 * size));
|
||||
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineDirWidthBufferID);
|
||||
pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offsetf, 4 * sizef, FloatBuffer.wrap(attribs, 0, 4 * size));
|
||||
|
||||
@@ -3550,13 +3501,6 @@ public class PShape3D extends PShape {
|
||||
}
|
||||
|
||||
|
||||
protected void copyLineNormals(int offset, int size, float[] normals) {
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineNormalBufferID);
|
||||
pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 3 * offset * PGL.SIZEOF_FLOAT, 3 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(normals, 0, 4 * size));
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
protected void copyLineAttributes(int offset, int size, float[] attribs) {
|
||||
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineDirWidthBufferID);
|
||||
pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(attribs, 0, 4 * size));
|
||||
@@ -3749,11 +3693,6 @@ public class PShape3D extends PShape {
|
||||
glLineColorBufferID = 0;
|
||||
}
|
||||
|
||||
if (glLineNormalBufferID != 0) {
|
||||
pg.deleteVertexBufferObject(glLineNormalBufferID);
|
||||
glLineNormalBufferID = 0;
|
||||
}
|
||||
|
||||
if (glLineDirWidthBufferID != 0) {
|
||||
pg.deleteVertexBufferObject(glLineDirWidthBufferID);
|
||||
glLineDirWidthBufferID = 0;
|
||||
|
||||
Reference in New Issue
Block a user