net.jinx.video.model
Class DualColoration

java.lang.Object
  extended by net.jinx.video.model.DualColoration
All Implemented Interfaces:
Coloration

public class DualColoration
extends java.lang.Object
implements Coloration

Coloration implementation that uses two different Colorations based on a divider line. Which coloration is used is based on the current vertex. If the vertex is above the divider's value, the first Coloration is used. If it isn't, then the second divider is used.
The divider is simply a float value that identifies where along it's axis the divider is. It can be based on the X, Y, or Z axis.

API Stability: Stable.


Constructor Summary
DualColoration()
          Constructs a DualColoration.
 
Method Summary
 void draw(Context options, int number, float[] vertex)
          Causes the Coloration to be drawn.
 void load(Hierarchy h)
          Configures this Coloration from the given Hierarchy.
 void setDivider(float divider)
          Sets the divider.
 void setOne(Coloration colorOne)
          Sets the Coloration that will be used as the first color.
 void setTwo(Coloration colorTwo)
          Sets the Coloration that will be used as the second color.
 void setXDivider()
          Sets the divider to be based on the X axis.
 void setYDivider()
          Sets the divider to be based on the Y axis.
 void setZDivider()
          Sets the divider to be based on the Z axis.
 void store(Hierarchy h)
          Stores this Coloration to the given Hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DualColoration

public DualColoration()
Constructs a DualColoration.

Method Detail

setXDivider

public void setXDivider()
Sets the divider to be based on the X axis.


setYDivider

public void setYDivider()
Sets the divider to be based on the Y axis.


setZDivider

public void setZDivider()
Sets the divider to be based on the Z axis.


setOne

public void setOne(Coloration colorOne)
Sets the Coloration that will be used as the first color.

Parameters:
colorOne - the Coloration.

setDivider

public void setDivider(float divider)
Sets the divider.

Parameters:
divider - the point on the axis to divide on.

setTwo

public void setTwo(Coloration colorTwo)
Sets the Coloration that will be used as the second color.

Parameters:
colorTwo - the Coloration.

draw

public void draw(Context options,
                 int number,
                 float[] vertex)
Description copied from interface: Coloration
Causes the Coloration to be drawn. This should simply setup the OpenGL state according to the color that should be used.

Specified by:
draw in interface Coloration
Parameters:
options - the rendering options that are being used. Implementatons of this interface should pay attention to the color related flags.
number - the current vertex number.
vertex - the current vertex position (x, y, and z coordinates).

load

public void load(Hierarchy h)
Description copied from interface: Coloration
Configures this Coloration from the given Hierarchy. This is not meant to be called directly, unless you intend to configure a specific Coloration object.
This method is actually designed to be called by the loadColoration(net.jinx.db.Hierarchy) method of ModelUtil, which will construct and return an instance of any Coloration class. This is the reason that all Coloration classes must have a no argument constructor. ModelUtil.loadColoration(net.jinx.db.Hierarchy) needs that to do it's job. By the time this method is called, the type of the coloration has already been determined and constructed and is now ready to be configured.

Specified by:
load in interface Coloration
Parameters:
h - the Hierarchy to configure this Coloration from.

store

public void store(Hierarchy h)
Description copied from interface: Coloration
Stores this Coloration to the given Hierarchy. This is not meant to be called directly, unless you know you're going to be using a specific Coloration implementation.
This method is actually designed to be called by the store(net.jinx.db.Hierarchy, Coloration) method of ModelUtil, which stores the name of the class to use, so that when the loadColoration(net.jinx.db.Hierarchy) method of ModelUtil is used, the class can be instantiated and used.

Specified by:
store in interface Coloration
Parameters:
h - the Hierarchy to store this Coloration to.