diff --git a/core/PConstants.java b/core/PConstants.java index 57298c38d..a36eee630 100644 --- a/core/PConstants.java +++ b/core/PConstants.java @@ -249,8 +249,9 @@ public interface PConstants { static final int DISABLE_TEXT_SMOOTH = 3; static final int DISABLE_SMOOTH_HACK = 4; static final int NO_DEPTH_TEST = 5; + static final int NO_FLYING_POO = 6; - static final int HINT_COUNT = 6; + static final int HINT_COUNT = 7; ////////////////////////////////////////////////////////////// diff --git a/core/PLine.java b/core/PLine.java index 033e7a621..bd252863d 100644 --- a/core/PLine.java +++ b/core/PLine.java @@ -254,6 +254,24 @@ public class PLine implements PConstants m_drawFlags &= ~R_SMOOTH; } + // line hack + if (parent.hints[NO_FLYING_POO]) { + float nwidth2 = -SCREEN_WIDTH; + float nheight2 = -SCREEN_HEIGHT; + float width2 = SCREEN_WIDTH * 2; + float height2 = SCREEN_HEIGHT * 2; + if ((x_array[1] < nwidth2) || + (x_array[1] > width2) || + (x_array[0] < nwidth2) || + (x_array[0] > width2) || + (y_array[1] < nheight2) || + (y_array[1] > height2) || + (y_array[0] < nheight2) || + (y_array[0] > height2)) { + return; // this is a bad line + } + } + /////////////////////////////////////// // line clipping visible = lineClipping(); diff --git a/core/PPolygon.java b/core/PPolygon.java index 543629ddb..2e8cb9047 100644 --- a/core/PPolygon.java +++ b/core/PPolygon.java @@ -201,6 +201,22 @@ public class PPolygon implements PConstants { r[i] = 0; dr[i] = 0; l[i] = 0; dl[i] = 0; } + // hack to not make polygons fly into the screen + if (parent.hints[NO_FLYING_POO]) { + float nwidth2 = -width * 2; + float nheight2 = -height * 2; + float width2 = width * 2; + float height2 = height * 2; + for (int i = 0; i < vertexCount; i++) { + if ((vertices[i][X] < nwidth2) || + (vertices[i][X] > width2) || + (vertices[i][Y] < nheight2) || + (vertices[i][Y] > height2)) { + return; // this is a bad poly + } + } + } + if (smoothing) { for (int i = 0; i < vertexCount; i++) { vertices[i][X] *= SUBXRES; diff --git a/core/todo.txt b/core/todo.txt index f2fd1183c..507651927 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -127,7 +127,10 @@ X fix array functions not returning a value 040726 X noiseSeed and randomSeed +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1090749784;start=0 +040727 +X incorporated NO_FLYING_POO line/poly hack developed for axel _ processing.net -> PClient, PServer