major housecleaning and setting up NEW_GRAPHICS inside PGraphics

This commit is contained in:
benfry
2004-11-15 20:32:27 +00:00
parent 4dcbe6db7c
commit fecc90d4dc
8 changed files with 517 additions and 951 deletions
+9 -4
View File
@@ -4274,8 +4274,8 @@ public class PApplet extends Applet
}
public void textureMode(int textureMode) {
g.textureMode(textureMode);
public void textureMode(int mode) {
g.textureMode(mode);
}
@@ -4330,6 +4330,11 @@ public class PApplet extends Applet
}
public void render_lines() {
g.render_lines();
}
public void point(float x, float y) {
g.point(x, y);
}
@@ -4620,8 +4625,8 @@ public class PApplet extends Applet
}
public void cameraMode(int icameraMode) {
g.cameraMode(icameraMode);
public void cameraMode(int mode) {
g.cameraMode(mode);
}
+29 -30
View File
@@ -17,9 +17,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
@@ -55,12 +55,12 @@ public interface PConstants {
// angle modes
static final int RADIANS = 0;
static final int RADIANS = 0;
static final int DEGREES = 1;
// used by split, all the standard whitespace chars
// (uncludes unicode nbsp, that little bostage)
// (uncludes unicode nbsp, that little bostage)
static final String WHITESPACE = " \t\n\r\f\u00A0";
@@ -101,7 +101,7 @@ public interface PConstants {
public final static int DARKEST = 1 << 4;
// incomplete, slated for beta
public final static int DIFFERENCE = 1 << 5;
public final static int DIFFERENCE = 1 << 5;
public final static int MULTIPLY = 1 << 6;
public final static int SCREEN = 1 << 7;
public final static int OVERLAY = 1 << 8;
@@ -139,7 +139,7 @@ public interface PConstants {
// shapes
// the low four bits set the variety,
// the low four bits set the variety,
// higher bits set the specific shape type
static final int POINTS = (1 << 4) | 0;
@@ -191,13 +191,13 @@ public interface PConstants {
static final int SQUARE_ENDCAP = 1 << 0;
static final int ROUND_ENDCAP = 1 << 1;
static final int PROJECTED_ENDCAP = 1 << 2;
static final int STROKE_CAP_MASK =
static final int STROKE_CAP_MASK =
SQUARE_ENDCAP | ROUND_ENDCAP | PROJECTED_ENDCAP;
static final int MITERED_JOIN = 1 << 3;
static final int ROUND_JOIN = 1 << 4;
static final int BEVELED_JOIN = 1 << 5;
static final int STROKE_JOIN_MASK =
static final int STROKE_JOIN_MASK =
MITERED_JOIN | ROUND_JOIN | BEVELED_JOIN;
@@ -209,7 +209,7 @@ public interface PConstants {
static final int SPECULAR = 3;
// net
// net
static final int CLIENT = 0;
static final int SERVER = 1;
@@ -263,8 +263,9 @@ public interface PConstants {
static final int DISABLE_SMOOTH_HACK = 4;
static final int NO_DEPTH_TEST = 5;
static final int NO_FLYING_POO = 6;
static final int DEPTH_SORT = 7;
static final int HINT_COUNT = 7;
static final int HINT_COUNT = 8;
//////////////////////////////////////////////////////////////
@@ -297,44 +298,42 @@ public interface PConstants {
static final int MY = 10;
static final int MZ = 11;
static final int SR = 12; // stroke
static final int SR = 12; // stroke colors
static final int SG = 13;
static final int SB = 14;
static final int SA = 15;
static final int SW = 16; // stroke weight
// not used in rendering
// only used for calculating colors
static final int NX = 16; // normal
static final int NY = 17;
static final int NZ = 18;
static final int NX = 17; // normal
static final int NY = 18;
static final int NZ = 19;
static final int VX = 19; // view space coords
static final int VY = 20;
static final int VZ = 21;
static final int VW = 22;
static final int WT = 23; // stroke width
//static final int SPY = 22; // for subpixel rendering
static final int VX = 20; // view space coords
static final int VY = 21;
static final int VZ = 22;
static final int VW = 23;
static final int VERTEX_FIELD_COUNT = 24;
// line fields
static final int PA = 0; // point A
static final int PB = 1; // point B
static final int LI = 2; // shape index
static final int LI = 0; // shape index
static final int PA = 1; // point A
static final int PB = 2; // point B
static final int SM = 3; // stroke mode
static final int LINE_FIELD_COUNT = 4;
// triangle fields
static final int VA = 0; // point A
static final int VB = 1; // point B
static final int VC = 2; // point B
static final int TI = 3; // shape index
static final int TI = 0; // shape index
static final int VA = 1; // point A
static final int VB = 2; // point B
static final int VC = 3; // point C
static final int TEX = 4; // texture index
static final int TRIANGLE_FIELD_COUNT = 5;
+443 -900
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -348,7 +348,7 @@ public class PLine implements PConstants
}
z0 = z_array[o0];
z0 += -0.001f; // [rocha] ugly fix for z buffer precision
//z0 += -0.001f; // [rocha] ugly fix for z buffer precision
if (INTERPOLATE_Z) {
dz = (z_array[o1] - z_array[o0]) / length;
+4 -2
View File
@@ -60,7 +60,7 @@ public interface PMethods {
public void texture(PImage image);
public void textureMode(int textureMode);
public void textureMode(int mode);
public void normal(float nx, float ny, float nz);
@@ -83,6 +83,8 @@ public interface PMethods {
public void endShape();
public void render_lines();
public void point(float x, float y);
public void point(float x, float y, float z);
@@ -214,7 +216,7 @@ public interface PMethods {
public void beginCamera();
public void cameraMode(int icameraMode);
public void cameraMode(int mode);
public void endCamera();
+2
View File
@@ -136,6 +136,7 @@ public class PPolygon implements PConstants {
* Return true if this vertex is redundant. If so, will also
* decrement the vertex count.
*/
/*
public boolean redundantVertex(float x, float y, float z) {
// because vertexCount will be 2 when setting vertex[1]
if (vertexCount < 2) return false;
@@ -150,6 +151,7 @@ public class PPolygon implements PConstants {
}
return false;
}
*/
public void texture(PImage image) {
+5 -3
View File
@@ -320,7 +320,7 @@ public class PTriangle implements PConstants
m_drawFlags&=~R_GOURAUD;
}
// push values to arrays.. some extra scaling is added
// push values to arrays.. some extra scaling is added
// to prevent possible color "overflood" due to rounding errors
r_array[0] = (r0 * 253f + 1.0f) * 65536f;
r_array[1] = (r1 * 253f + 1.0f) * 65536f;
@@ -2165,7 +2165,8 @@ public class PTriangle implements PConstants
// get texture pixel color
try
{
if (iz < m_zbuffer[xstart]) {
//if (iz < m_zbuffer[xstart]) {
if (iz <= m_zbuffer[xstart]) { // [fry 041114]
//m_zbuffer[xstart] = iz;
// blend
@@ -2440,7 +2441,8 @@ public class PTriangle implements PConstants
// get texture pixel color
try
{
if (iz < m_zbuffer[xstart]) {
//if (iz < m_zbuffer[xstart]) {
if (iz <= m_zbuffer[xstart]) { // [fry 041114]
//m_zbuffer[xstart] = iz;
// blend
+24 -11
View File
@@ -4,11 +4,34 @@ X image() appears to require IMAGE_SPACE to function properly.
X added focusGained() and focusLost()
_ add to preprocessor
X lots of changes to internal naming of vars
X beginShape() defaults to beginShape(POLYGON)
_ needs to be noted for the reference
_ add TRIANGLE_FAN
_ beginFrame() around setup()
_ draw mode stuff happens inside setup..
_ or maybe need to get better at size() inside of draw() ?
_ depth testing of lines vs text is problematic
_ probably need to patch in an older version of the line code
_ use depth()/noDepth() to handle depth test
_ y2 position of rectangles not same as y2 position of lines
_ happens when the rectangle is flipped on the x or y axis
_ probably a hack that draws the "last" point differently
_ fishwick bug with text() and shapes
_ ellipses no longer completed when g.dimensions = 2 or 3,
_ or not even drawn.. what a mess.
_ only allocate stencil and zbuffer on first call to depth()
_ this will require changes to PTriangle and PLine inside their loops
_ pmouseX is broken again
_ add TRIANGLE_FAN
_ break apart functions into local (placement) and override (blitting)
_ just have a "thin_flat_line" option in opengl code
@@ -19,10 +42,6 @@ _ hacked for a fix in 72, but need to better coordinate with openStream()
_ uv coords > 1 shouldn't clamp, they should just repeat ala opengl
_ actually i think opengl has a setting for it
_ fishwick bug with text() and shapes
_ ellipses no longer completed when g.dimensions = 2 or 3,
_ or not even drawn.. what a mess.
_ renderers can plug in:
_ at direct api level
_ taking over all color() functions and vertex collection
@@ -41,12 +60,6 @@ _ when did this break? 1.4.1? 1.4.x vs 1.3?
_ go through and figure out what stuff to make public
_ depth testing of lines vs text is problematic
_ probably need to patch in an older version of the line code
_ use depth()/noDepth() to handle depth test
_ y2 position of rectangles not same as y2 position of lines
_ screenX/Y aren't properly working for 2D points against a 3D matrix
_ (ryan alexander rounding bug)
_ Just to clarify, it works completely correctly with rounding