net.jinx.video.model
Class VertexColoration

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

public class VertexColoration
extends java.lang.Object
implements Coloration

Coloration implementation that keeps track of individual Material objects for each vertex of a Model.

API Stability: Stable.


Constructor Summary
VertexColoration()
          Constructs a VertexColoration with no Materials.
VertexColoration(Material[] materials)
          Constructs a VertexColoration using the given Material array.
 
Method Summary
 void draw(Context opt, int number, float[] vertex)
          Causes the Coloration to be drawn.
 Material[] getMaterials()
          Provides the Material array.
 void load(net.jinx.db.Hierarchy h)
          Configures this Coloration from the given Hierarchy.
 void setMaterials(Material[] materials)
          Sets the Material array for this coloration.
 void store(net.jinx.db.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

VertexColoration

public VertexColoration()
Constructs a VertexColoration with no Materials. It will have no effect on the Model.


VertexColoration

public VertexColoration(Material[] materials)
Constructs a VertexColoration using the given Material array.

Parameters:
materials - the Material array.
Method Detail

setMaterials

public void setMaterials(Material[] materials)
Sets the Material array for this coloration.

Parameters:
materials - the Material array.

getMaterials

public Material[] getMaterials()
Provides the Material array.

Returns:
the Material array.

draw

public void draw(Context opt,
                 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:
opt - 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(net.jinx.db.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(net.jinx.db.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.