Cleaning up PConstants

This commit is contained in:
codeanticode
2012-04-09 22:23:18 +00:00
parent c5838c950f
commit 3727ed2b52
6 changed files with 2515 additions and 2511 deletions
@@ -35,24 +35,7 @@ import android.view.KeyEvent;
* as possible. For instance, the constant is TIFF instead of
* FILE_TYPE_TIFF. We'll do this as long as we can get away with it.
*/
public interface PConstants {
// render & flush modes (in P3D)
static public final int IMMEDIATE = 0;
static public final int RETAINED = 1;
static public final int FLUSH_CONTINUOUSLY = 0;
static public final int FLUSH_WHEN_FULL = 1;
// shaders
static public final int FILL_SHADER_SIMPLE = 0;
static public final int FILL_SHADER_LIT = 1;
static public final int FILL_SHADER_TEX = 2;
static public final int FILL_SHADER_FULL = 3;
static public final int LINE_SHADER = 4;
static public final int POINT_SHADER = 5;
public interface PConstants {
// vertex fields
static public final int X = 0; // model coords xyz (formerly MX/MY/MZ)
@@ -398,7 +381,8 @@ public interface PConstants {
// PTexture
/** This constant identifies the texture target GL_TEXTURE_2D, that is, textures with normalized coordinates */
/** This constant identifies the texture target GL_TEXTURE_2D, that is,
* textures with normalized coordinates */
public static final int TEXTURE2D = 0;
/** This constant identifies the nearest texture filter (point sampling) */
@@ -406,21 +390,14 @@ public interface PConstants {
/** This constant identifies the linear texture filter, usually called bilinear sampling */
public static final int BILINEAR = 3;
/** This constant identifies the linear/linear function to build mipmaps */
public static final int TRILINEAR = 4;
// Point sprites distance attenuation functions
public static final int LINEAR = 0;
public static final int QUADRATIC = 1;
public static final int TRILINEAR = 4;
/** This constant identifies the clamp-to-edge wrapping mode */
public static final int CLAMP = 0;
/** This constant identifies the repeat wrapping mode */
public static final int REPEAT = 1;
/** This constant identifies the modulate texture environment mode */
public static final int MODULATE = 1;
// PShape3D
// vbos
/** Static usage mode for PShape3D (vertices won't be updated after creation). */
public static final int STATIC = 0;
@@ -429,6 +406,17 @@ public interface PConstants {
/** Dynamic usage mode for PShape3D (vertices will be updated at every frame). */
public static final int STREAM = 2;
// shaders
static public final int FILL_SHADER_SIMPLE = 0;
static public final int FILL_SHADER_LIT = 1;
static public final int FILL_SHADER_TEX = 2;
static public final int FILL_SHADER_FULL = 3;
static public final int LINE_SHADER = 4;
static public final int POINT_SHADER = 5;
// stroke modes
static final int SQUARE = 1 << 0; // called 'butt' in the svg spec
File diff suppressed because it is too large Load Diff
@@ -267,9 +267,9 @@ public class PShape3D extends PShape {
this.tessellated = false;
if (family == GEOMETRY || family == PRIMITIVE || family == PATH) {
in = pg.newInGeometry(RETAINED);
in = pg.newInGeometry(PGraphicsOpenGL.RETAINED);
}
tess = pg.newTessGeometry(RETAINED);
tess = pg.newTessGeometry(PGraphicsOpenGL.RETAINED);
fillIndexData = new ArrayList<IndexData>();
lineIndexData = new ArrayList<IndexData>();
pointIndexData = new ArrayList<IndexData>();
+14 -27
View File
@@ -38,23 +38,6 @@ import java.awt.event.KeyEvent;
* @usage Web &amp; Application
*/
public interface PConstants {
// render & flush modes (in P3D)
static public final int IMMEDIATE = 0;
static public final int RETAINED = 1;
static public final int FLUSH_CONTINUOUSLY = 0;
static public final int FLUSH_WHEN_FULL = 1;
// shaders
static public final int FILL_SHADER_SIMPLE = 0;
static public final int FILL_SHADER_LIT = 1;
static public final int FILL_SHADER_TEX = 2;
static public final int FILL_SHADER_FULL = 3;
static public final int LINE_SHADER = 4;
static public final int POINT_SHADER = 5;
// vertex fields
static public final int X = 0; // model coords xyz (formerly MX/MY/MZ)
@@ -142,8 +125,6 @@ public interface PConstants {
static final String PDF = "processing.pdf.PGraphicsPDF";
static final String DXF = "processing.dxf.RawDXF";
static final String LWJGL = "processing.lwjgl.PGraphicsLWJGL";
// platform IDs for PApplet.platform
static final int OTHER = 0;
@@ -451,9 +432,10 @@ public interface PConstants {
// text alignment modes
// are inherited from LEFT, CENTER, RIGHT
// PTexture
// textures
/** This constant identifies the texture target GL_TEXTURE_2D, that is, textures with normalized coordinates */
/** This constant identifies the texture target GL_TEXTURE_2D, that is,
* textures with normalized coordinates */
public static final int TEXTURE2D = 0;
/** This constant identifies the nearest texture filter (point sampling) */
@@ -462,18 +444,13 @@ public interface PConstants {
public static final int BILINEAR = 3;
/** This constant identifies the linear/linear function to build mipmaps */
public static final int TRILINEAR = 4;
/** This constant identifies the clamp-to-edge wrapping mode */
public static final int CLAMP = 0;
/** This constant identifies the repeat wrapping mode */
public static final int REPEAT = 1;
/** Point sprite distance attenuation functions */
public static final int LINEAR = 0;
public static final int QUADRATIC = 1;
// PShape3D
// vbos
/** Static usage mode for PShape3D (vertices won't be updated after creation). */
public static final int STATIC = 0;
@@ -482,7 +459,17 @@ public interface PConstants {
/** Dynamic usage mode for PShape3D (vertices will be updated at every frame). */
public static final int STREAM = 2;
// shaders
static public final int FILL_SHADER_SIMPLE = 0;
static public final int FILL_SHADER_LIT = 1;
static public final int FILL_SHADER_TEX = 2;
static public final int FILL_SHADER_FULL = 3;
static public final int LINE_SHADER = 4;
static public final int POINT_SHADER = 5;
// stroke modes
static final int SQUARE = 1 << 0; // called 'butt' in the svg spec
@@ -44,7 +44,7 @@ import java.util.Stack;
* OpenGL renderer.
*
*/
public class PGraphicsOpenGL extends PGraphics {
public class PGraphicsOpenGL extends PGraphics {
/** Interface between Processing and OpenGL */
public PGL pgl;
@@ -55,7 +55,22 @@ public class PGraphicsOpenGL extends PGraphics {
// Basic rendering parameters:
/** Flush modes: continuously (geometry is flushed after each call to
* endShape) when-full (geometry is accumulated until a maximum size is
* reached. */
static protected final int FLUSH_CONTINUOUSLY = 0;
static protected final int FLUSH_WHEN_FULL = 1;
/** Type of geometry: immediate is that generated with beginShape/vertex/
* endShape, retained is the result of creating a PShape3D object with
* createShape. */
static protected final int IMMEDIATE = 0;
static protected final int RETAINED = 1;
/** Current flush mode. */
protected int flushMode = FLUSH_WHEN_FULL;
/** VBO storage mode. */
protected int vboMode = PGL.GL_STATIC_DRAW;
// ........................................................
@@ -507,12 +522,11 @@ public class PGraphicsOpenGL extends PGraphics {
deleteFinalizedGLResources();
}
// Only for debugging purposes.
public void setFlushMode(int mode) {
flushMode = mode;
protected void setFlushMode(int mode) {
flushMode = mode;
}
//////////////////////////////////////////////////////////////
@@ -6369,9 +6383,9 @@ public class PGraphicsOpenGL extends PGraphics {
float ny = v10z * v12x - v12z * v10x;
float nz = v10x * v12y - v12x * v10y;
float d = PApplet.sqrt(nx * nx + ny * ny + nz * nz);
nx /= d;
ny /= d;
nz /= d;
nx /= -d;
ny /= -d;
nz /= -d;
index = 3 * i0;
normals[index++] = nx;
@@ -278,9 +278,9 @@ public class PShape3D extends PShape {
this.tessellated = false;
if (family == GEOMETRY || family == PRIMITIVE || family == PATH) {
in = pg.newInGeometry(RETAINED);
in = pg.newInGeometry(PGraphicsOpenGL.RETAINED);
}
tess = pg.newTessGeometry(RETAINED);
tess = pg.newTessGeometry(PGraphicsOpenGL.RETAINED);
fillIndexData = new ArrayList<IndexData>();
lineIndexData = new ArrayList<IndexData>();
pointIndexData = new ArrayList<IndexData>();