processing.core
Class PTriangle

java.lang.Object
  extended by processing.core.PTriangle
All Implemented Interfaces:
PConstants

public class PTriangle
extends java.lang.Object
implements PConstants

Handles rendering of single (tesselated) triangles in 3D.

Originally written by sami (www.sumea.com)


Field Summary
 boolean INTERPOLATE_ALPHA
           
 boolean INTERPOLATE_RGB
           
 boolean INTERPOLATE_UV
           
 int m_drawFlags
           
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
PTriangle(PGraphics3D g)
           
 
Method Summary
 void render()
          Renders the polygon
 void reset()
          Resets polygon attributes
 void setCamVertices(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2)
          Pass camera-space coordinates for the triangle.
 void setCulling(boolean tf)
          Sets backface culling on/off
 void setIntensities(float r0, float g0, float b0, float a0, float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2)
          Sets vertex intensities in 0xRRGGBBAA format
static void setInterpPower(int pwr)
          Set the power of two used for linear interpolation of texture coordinates.
 void setTexture(PImage image)
          Sets texture image used for the polygon
 void setUV(float[] u, float[] v)
           
 void setUV(float u0, float v0, float u1, float v1, float u2, float v2)
          Sets the UV coordinates of the texture
 void setVertices(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2)
          Sets vertex coordinates for the triangle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERPOLATE_UV

public boolean INTERPOLATE_UV

INTERPOLATE_RGB

public boolean INTERPOLATE_RGB

INTERPOLATE_ALPHA

public boolean INTERPOLATE_ALPHA

m_drawFlags

public int m_drawFlags
Constructor Detail

PTriangle

public PTriangle(PGraphics3D g)
Method Detail

reset

public void reset()
Resets polygon attributes


setCulling

public void setCulling(boolean tf)
Sets backface culling on/off


setVertices

public void setVertices(float x0,
                        float y0,
                        float z0,
                        float x1,
                        float y1,
                        float z1,
                        float x2,
                        float y2,
                        float z2)
Sets vertex coordinates for the triangle


setCamVertices

public void setCamVertices(float x0,
                           float y0,
                           float z0,
                           float x1,
                           float y1,
                           float z1,
                           float x2,
                           float y2,
                           float z2)
Pass camera-space coordinates for the triangle. Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. Generally this will not need to be called manually, currently called from PGraphics3D.render_triangles()


setUV

public void setUV(float u0,
                  float v0,
                  float u1,
                  float v1,
                  float u2,
                  float v2)
Sets the UV coordinates of the texture


setIntensities

public void setIntensities(float r0,
                           float g0,
                           float b0,
                           float a0,
                           float r1,
                           float g1,
                           float b1,
                           float a1,
                           float r2,
                           float g2,
                           float b2,
                           float a2)
Sets vertex intensities in 0xRRGGBBAA format


setTexture

public void setTexture(PImage image)
Sets texture image used for the polygon


setUV

public void setUV(float[] u,
                  float[] v)

render

public void render()
Renders the polygon


setInterpPower

public static void setInterpPower(int pwr)
Set the power of two used for linear interpolation of texture coordinates. A true texture coordinate is computed every 2^pwr pixels along a scanline.