mirror of
https://github.com/processing/processing4.git
synced 2026-05-09 12:22:43 +02:00
taking care of empty groups in PShapeOpenGL, some additional methods
This commit is contained in:
@@ -544,6 +544,8 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* based on the IMAGE or NORMALIZED.
|
||||
*/
|
||||
public int textureMode;
|
||||
|
||||
public int textureWrap;
|
||||
|
||||
/**
|
||||
* Current horizontal coordinate for texture, will always
|
||||
@@ -1063,7 +1065,20 @@ public class PGraphics extends PImage implements PConstants {
|
||||
this.textureMode = mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: use this setting in GL renderer.
|
||||
public void textureWrap(int wrap) {
|
||||
this.textureWrap = wrap;
|
||||
}
|
||||
|
||||
|
||||
// TODO: do we need something like this to choose between
|
||||
// point, linear and trilinear texture sampling?
|
||||
//public void textureQualityt(int quality) {
|
||||
// this.textureQuality = quality;
|
||||
//}
|
||||
|
||||
|
||||
/**
|
||||
* ( begin auto-generated from texture.xml )
|
||||
*
|
||||
|
||||
@@ -396,6 +396,28 @@ public class PShape implements PConstants {
|
||||
return depth;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: need to discuss about these two (four).
|
||||
public PVector getTop() {
|
||||
return getTop(null);
|
||||
}
|
||||
|
||||
|
||||
public PVector getTop(PVector top) {
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
public PVector getBottom() {
|
||||
return getBottom(null);
|
||||
}
|
||||
|
||||
|
||||
public PVector getBottom(PVector bottom) {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if this shape is 2D. Defaults to true.
|
||||
|
||||
@@ -534,6 +534,26 @@ public class PShapeOpenGL extends PShape {
|
||||
}
|
||||
|
||||
|
||||
public PVector getTop(PVector top) {
|
||||
if (top == null) {
|
||||
top = new PVector();
|
||||
}
|
||||
top.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY);
|
||||
getVertexMin(top);
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
public PVector getBottom(PVector bottom) {
|
||||
if (bottom == null) {
|
||||
bottom = new PVector();
|
||||
}
|
||||
bottom.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
|
||||
getVertexMax(bottom);
|
||||
return bottom;
|
||||
}
|
||||
|
||||
|
||||
protected void getVertexMin(PVector min) {
|
||||
updateTessellation();
|
||||
|
||||
@@ -3266,7 +3286,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
firstPolyIndexCache = lastPolyIndexCache = -1;
|
||||
int gindex = -1;
|
||||
|
||||
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
PShapeOpenGL child = (PShapeOpenGL) children[i];
|
||||
|
||||
@@ -3291,8 +3311,13 @@ public class PShapeOpenGL extends PShape {
|
||||
}
|
||||
|
||||
// Updating the first and last poly vertices for this group shape.
|
||||
if (i == 0) firstPolyVertex = child.firstPolyVertex;
|
||||
if (i == childCount - 1) lastPolyVertex = child.lastPolyVertex;
|
||||
if (-1 < child.firstPolyVertex) {
|
||||
if (firstPolyVertex == -1) firstPolyVertex = Integer.MAX_VALUE;
|
||||
firstPolyVertex = PApplet.min(firstPolyVertex, child.firstPolyVertex);
|
||||
}
|
||||
if (-1 < child.lastPolyVertex) {
|
||||
lastPolyVertex = PApplet.max(lastPolyVertex, child.lastPolyVertex);
|
||||
}
|
||||
}
|
||||
lastPolyIndexCache = gindex;
|
||||
} else {
|
||||
@@ -3387,8 +3412,13 @@ public class PShapeOpenGL extends PShape {
|
||||
}
|
||||
|
||||
// Updating the first and last line vertices for this group shape.
|
||||
if (i == 0) firstLineVertex = child.firstLineVertex;
|
||||
if (i == childCount - 1) lastLineVertex = child.lastLineVertex;
|
||||
if (-1 < child.firstLineVertex) {
|
||||
if (firstLineVertex == -1) firstLineVertex = Integer.MAX_VALUE;
|
||||
firstLineVertex = PApplet.min(firstLineVertex, child.firstLineVertex);
|
||||
}
|
||||
if (-1 < child.lastLineVertex) {
|
||||
lastLineVertex = PApplet.max(lastLineVertex, child.lastLineVertex);
|
||||
}
|
||||
}
|
||||
lastLineIndexCache = gindex;
|
||||
} else {
|
||||
@@ -3444,9 +3474,14 @@ public class PShapeOpenGL extends PShape {
|
||||
}
|
||||
}
|
||||
|
||||
// Updating the first and last point vertices for this group shape.
|
||||
if (i == 0) firstPointVertex = child.firstPointVertex;
|
||||
if (i == childCount - 1) lastPointVertex = child.lastPointVertex;
|
||||
// Updating the first and last point vertices for this group shape.
|
||||
if (-1 < child.firstPointVertex) {
|
||||
if (firstPointVertex == -1) firstPointVertex = Integer.MAX_VALUE;
|
||||
firstPointVertex = PApplet.min(firstPointVertex, child.firstPointVertex);
|
||||
}
|
||||
if (-1 < child.lastPointVertex) {
|
||||
lastPointVertex = PApplet.max(lastPointVertex, child.lastPointVertex);
|
||||
}
|
||||
}
|
||||
lastPointIndexCache = gindex;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user