org.xith3d.scenegraph.utils
Class GeomDrawUtil

java.lang.Object
  extended by org.xith3d.scenegraph.utils.GeomDrawUtil

public class GeomDrawUtil
extends java.lang.Object

The GeomDrawUtil is a utility class, that allows for drawing a geometry, i.e. creating a geometry through step-by-step drawig instructions.


Field Summary
static int CHANGE_COLORS
           
static int CHANGE_COORDINATES
          The following are used for building a mask of what you are planning on changing during the drawing cycle.
static int CHANGE_NORMALS
           
static int CHANGE_TEXCOORDS
           
 
Constructor Summary
GeomDrawUtil(Geometry geom)
           
 
Method Summary
 void drawEnd()
          Ends the drawing cycle and commits the geometry changes to the 3d card.
 void drawStart()
          Resets the vertices back to zero and sets the types of changes that will be made during the drawing cycle.
 void drawStart(int mask)
          Resets the vertices back to zero and sets the types of changes that will be made during the drawing cycle.
 int newVertex()
          Starts a new vertex to be updated.
 void setColor(byte r, byte g, byte b)
           
 void setColor(byte r, byte g, byte b, byte a)
           
 void setColor(org.openmali.vecmath2.Colorf color)
           
 void setColor(float r, float g, float b)
           
 void setColor(float r, float g, float b, float a)
           
 void setCoordinate(float x, float y, float z)
           
 void setCoordinate(org.openmali.vecmath2.Tuple3f p)
          Sets the current coordinate's value.
 void setGeom(Geometry geom)
           
 void setNormal(float x, float y, float z)
           
 void setNormal(org.openmali.vecmath2.Vector3f normal)
           
 void setTexCoord(int unit, float s)
           
 void setTexCoord(int unit, float s, float t)
           
 void setTexCoord(int unit, float s, float t, float p)
           
 void setTexCoord(int unit, float s, float t, float p, float q)
           
 void setTexCoord(int unit, org.openmali.vecmath2.TexCoord1f t)
           
 void setTexCoord(int unit, org.openmali.vecmath2.TexCoord2f t)
           
 void setTexCoord(int unit, org.openmali.vecmath2.TexCoord3f t)
           
 void setTexCoord(int unit, org.openmali.vecmath2.TexCoord4f t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHANGE_COORDINATES

public static final int CHANGE_COORDINATES
The following are used for building a mask of what you are planning on changing during the drawing cycle.

See Also:
Constant Field Values

CHANGE_NORMALS

public static final int CHANGE_NORMALS
See Also:
Constant Field Values

CHANGE_COLORS

public static final int CHANGE_COLORS
See Also:
Constant Field Values

CHANGE_TEXCOORDS

public static final int CHANGE_TEXCOORDS
See Also:
Constant Field Values
Constructor Detail

GeomDrawUtil

public GeomDrawUtil(Geometry geom)
Method Detail

setGeom

public void setGeom(Geometry geom)

drawStart

public void drawStart(int mask)
Resets the vertices back to zero and sets the types of changes that will be made during the drawing cycle. In some implementations the data will be destroyed in any buffer referenced in the mask.

Parameters:
mask - The bitmask of things which can change.

drawStart

public void drawStart()
Resets the vertices back to zero and sets the types of changes that will be made during the drawing cycle. This assumes all the data is going to change. Use the drawStart(mask) version if you will only be changing some of the data.


newVertex

public int newVertex()
Starts a new vertex to be updated. This must be called before setting the vertex information.

Returns:
The index of the new vertex.

setCoordinate

public void setCoordinate(org.openmali.vecmath2.Tuple3f p)
Sets the current coordinate's value. Only call this once per vertex since some implementations will auto increment the pointers.

Parameters:
p -

setCoordinate

public void setCoordinate(float x,
                          float y,
                          float z)

setNormal

public void setNormal(float x,
                      float y,
                      float z)

setNormal

public void setNormal(org.openmali.vecmath2.Vector3f normal)

setColor

public void setColor(org.openmali.vecmath2.Colorf color)

setColor

public void setColor(float r,
                     float g,
                     float b)

setColor

public void setColor(float r,
                     float g,
                     float b,
                     float a)

setColor

public void setColor(byte r,
                     byte g,
                     byte b)

setColor

public void setColor(byte r,
                     byte g,
                     byte b,
                     byte a)

setTexCoord

public void setTexCoord(int unit,
                        org.openmali.vecmath2.TexCoord1f t)

setTexCoord

public void setTexCoord(int unit,
                        org.openmali.vecmath2.TexCoord2f t)

setTexCoord

public void setTexCoord(int unit,
                        org.openmali.vecmath2.TexCoord3f t)

setTexCoord

public void setTexCoord(int unit,
                        org.openmali.vecmath2.TexCoord4f t)

setTexCoord

public void setTexCoord(int unit,
                        float s)

setTexCoord

public void setTexCoord(int unit,
                        float s,
                        float t)

setTexCoord

public void setTexCoord(int unit,
                        float s,
                        float t,
                        float p)

setTexCoord

public void setTexCoord(int unit,
                        float s,
                        float t,
                        float p,
                        float q)

drawEnd

public void drawEnd()
Ends the drawing cycle and commits the geometry changes to the 3d card. The number of vertices will be set.