net.jinx.video.model
Interface Coloration

All Known Implementing Classes:
DualColoration, GradientColoration, Material, SegmentColoration, VertexColoration

public interface Coloration

Essentially, implementations of this interface serve as the paint on Models.

All methods of coloring a Model that implement this interfaceand MUST have a no argument constructor. See the load(net.jinx.db.Hierarchy) method for more information.

It is strongly suggested that all coloration implementations use Material objects for their underlying implementation, though this is not required. Material handles a great deal of drudge work for you; it uses quite a few of the attributes that are passed around via Context objects.
For an example of how to handle a mutable Material so you don't have to create a large number of Material objects, see the source code to GradientColoration in this package.

API Stability: Stable.


Method Summary
 void draw(Context options, int number, float[] vertex)
          Causes the Coloration to be drawn.
 void load(net.jinx.db.Hierarchy h)
          Configures this Coloration from the given Hierarchy.
 void store(net.jinx.db.Hierarchy h)
          Stores this Coloration to the given Hierarchy.
 

Method Detail

draw

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

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

void load(net.jinx.db.Hierarchy h)
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.

Parameters:
h - the Hierarchy to configure this Coloration from.

store

void store(net.jinx.db.Hierarchy h)
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.

Parameters:
h - the Hierarchy to store this Coloration to.