com.hardcorepawn
Class SuperTri

java.lang.Object
  extended by com.hardcorepawn.SuperTri

public class SuperTri
extends java.lang.Object

This class allows you to create a large number of triangles in OPENGL mode in processing.

Author:
JohnG

Constructor Summary
SuperTri(processing.core.PApplet p)
          Create a new SuperTri object like:
 
Method Summary
 int addPoint(float x, float y, float z, float nx, float ny, float nz, float r, float g, float b, float a)
          Add a new point to the list.
 int addPointPlain(float x, float y, float z)
          Synonym for addPoint(x,y,z,0,0,1,1,1,1,1);
 int addPointWithColour(float x, float y, float z, float r, float g, float b, float a)
          Synonym for addPoint(x,y,z,0,0,1,r,g,b,a);
 int addPointWithNormal(float x, float y, float z, float nx, float ny, float nz)
          Synonym for addPoint(x,y,z,nx,ny,nz,1,1,1,1);
 void addTri(int point1, int point2, int point3)
          Create a triangle out of the 3 supplied point IDs.
 void draw()
          Draws the triangles.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuperTri

public SuperTri(processing.core.PApplet p)
Create a new SuperTri object like:
SuperTri p;
 void setup()
 {
   //size etc...
   p=new SuperTri(this);
 }

Parameters:
p -
Method Detail

addPointPlain

public int addPointPlain(float x,
                         float y,
                         float z)
Synonym for addPoint(x,y,z,0,0,1,1,1,1,1);


addPointWithColour

public int addPointWithColour(float x,
                              float y,
                              float z,
                              float r,
                              float g,
                              float b,
                              float a)
Synonym for addPoint(x,y,z,0,0,1,r,g,b,a);


addPointWithNormal

public int addPointWithNormal(float x,
                              float y,
                              float z,
                              float nx,
                              float ny,
                              float nz)
Synonym for addPoint(x,y,z,nx,ny,nz,1,1,1,1);


addPoint

public int addPoint(float x,
                    float y,
                    float z,
                    float nx,
                    float ny,
                    float nz,
                    float r,
                    float g,
                    float b,
                    float a)
Add a new point to the list. Normal values should be normalised but might work without. The red/green/blue/alpha values should be between 0 and 1, not 0 and 255.

Parameters:
x,y,z - the position in space
nx,ny,nz - the normals of the point
r,g,b,a - the 0..1 colour values
Returns:
the point ID of the added point for use in addTri(int,int,int)

addTri

public void addTri(int point1,
                   int point2,
                   int point3)
Create a triangle out of the 3 supplied point IDs. Ensure all IDs are valid or things could crash nastily.

Parameters:
point1 -
point2 -
point3 -

draw

public void draw()
Draws the triangles. Do not call beginGL() before calling this.