org.xith3d.render.preprocessing
Class RenderAtom<T extends Node>

java.lang.Object
  extended by org.xith3d.render.states.StateSortable
      extended by org.xith3d.render.preprocessing.RenderAtom<T>
Direct Known Subclasses:
BoundsAtom, ShadowAtom

public abstract class RenderAtom<T extends Node>
extends StateSortable

A render atom is a discrete chunk of geometry and shader that will be drawn. Render atoms are submitted to a rendering peer which is API specific.


Field Summary
protected  boolean translucent
           
 
Constructor Summary
RenderAtom(int stateType, T node, boolean hasOrderedState)
           
 
Method Summary
 void clearStateUnits()
          Removes all shaders from the list
 org.openmali.spatial.bodies.Classifier.Classification getClassification()
           
 ClipperInfo getClipper()
           
 java.lang.Comparable getCustomComparable()
          Returns the custom comparable object.
 float getDistanceToView()
           
 T getNode()
           
 int getNumStateUnits()
           
 OrderedState getOrderedState()
           
abstract
<Tup extends org.openmali.vecmath2.Tuple3f>
Tup
getPosition(Tup p)
          Gets the position of the geometry (usually from transformed bounds
 ScissorRect getScissorRect()
           
 StateSortableMap getSortableStates()
           
 float getSquaredDistanceToView()
           
 long getStateId()
          
 StateUnit getStateUnit(int index)
           
 StateUnit[] getStateUnits()
           
 float getZValue()
           
 boolean isTranslucent()
           
 void setClassification(org.openmali.spatial.bodies.Classifier.Classification classify)
           
 void setCompareIndicators(float squaredDistanceToView, float zValue, java.lang.Comparable customComparable)
          Sets the values to compare by.
protected  void updateStateMap(StateUnit stateUnit)
           
 void updateStateUnit(StateUnit stateUnit)
          updates a shader to the atom's list of shaders.
 
Methods inherited from class org.xith3d.render.states.StateSortable
getCachedStateId, getStateType, updateCachedStateId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

translucent

protected boolean translucent
Constructor Detail

RenderAtom

public RenderAtom(int stateType,
                  T node,
                  boolean hasOrderedState)
Method Detail

setCompareIndicators

public final void setCompareIndicators(float squaredDistanceToView,
                                       float zValue,
                                       java.lang.Comparable customComparable)
Sets the values to compare by.

Parameters:
squaredDistanceToView - the absolute distance to the current View.
zValue - the z-value of the absolute translation
customComparable - the custom comparable object

getSquaredDistanceToView

public final float getSquaredDistanceToView()
Returns:
the absolute (squared) distance to the current View.

getDistanceToView

public final float getDistanceToView()
Returns:
the absolute distance to the current View.

getZValue

public final float getZValue()
Returns:
the z-value of the absolute translation

getCustomComparable

public final java.lang.Comparable getCustomComparable()
Returns the custom comparable object.

Returns:
the custom comparable object

setClassification

public void setClassification(org.openmali.spatial.bodies.Classifier.Classification classify)

getClassification

public org.openmali.spatial.bodies.Classifier.Classification getClassification()

getPosition

public abstract <Tup extends org.openmali.vecmath2.Tuple3f> Tup getPosition(Tup p)
Gets the position of the geometry (usually from transformed bounds

Parameters:
p -

getScissorRect

public final ScissorRect getScissorRect()
Returns:
the box, which is clipped using glScissor

getClipper

public final ClipperInfo getClipper()
Returns:
the the ClipperInfo

getNode

public final T getNode()

getNumStateUnits

public final int getNumStateUnits()

clearStateUnits

public void clearStateUnits()
Removes all shaders from the list


updateStateMap

protected final void updateStateMap(StateUnit stateUnit)

updateStateUnit

public void updateStateUnit(StateUnit stateUnit)
updates a shader to the atom's list of shaders. Does not work well if shader changes its translucent status.

Parameters:
stateUnit -

getSortableStates

public final StateSortableMap getSortableStates()

getStateUnits

public final StateUnit[] getStateUnits()

getStateUnit

public final StateUnit getStateUnit(int index)

isTranslucent

public final boolean isTranslucent()

getStateId

public final long getStateId()

Specified by:
getStateId in class StateSortable
Returns:
the state ID used to sort the item

getOrderedState

public final OrderedState getOrderedState()
Returns:
the ordered state for this render atom. If this is not in an ordered group then this returns null. The ordered state is