net.java.joglutils.msg.elements
Class Element

java.lang.Object
  extended by net.java.joglutils.msg.elements.Element
Direct Known Subclasses:
BlendElement, ColorElement, CoordinateElement, DepthTestElement, ModelMatrixElement, ProjectionMatrixElement, ShaderElement, TextureCoordinateElement, TextureElement, ViewingMatrixElement

public abstract class Element
extends Object

Represents an element in the global state, such as the current 3D coordinates or texture to be applied. The organization of the global state into elements is one of the key mechanisms for extendability of the library which was pioneered by Open Inventor.


Constructor Summary
protected Element()
           
 
Method Summary
 int getDepth()
          Returns the depth of this element in its stack, used to implement lazy state pushing.
 Element getNext()
          Returns the next element in the linked list of elements which were modified since the last state push.
 Element getNextInStack()
          Returns the next element in the stack.
abstract  StateIndex getStateIndex()
          All concrete element subclasses must register themselves with the State in order to reserve a slot, or index, in the state.
abstract  Element newInstance()
          Creates a new instance initialized to the default values for the state element.
 void pop(State state, Element previousTopElement)
          Pops the element, allowing for side effects to occur.
 void push(State state)
          Pushes the element, allowing for side effects to occur.
 void setDepth(int depth)
          Sets the depth of this element in its stack, used to implement lazy state pushing.
 void setNext(Element next)
          Sets the next element in the linked list of elements which were modified since the last state push.
 void setNextInStack(Element nextInStack)
          Sets the next element in the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Element

protected Element()
Method Detail

newInstance

public abstract Element newInstance()
Creates a new instance initialized to the default values for the state element. All concrete Element subclasses must implement this operation.


getNextInStack

public Element getNextInStack()
Returns the next element in the stack.


setNextInStack

public void setNextInStack(Element nextInStack)
Sets the next element in the stack.


getNext

public Element getNext()
Returns the next element in the linked list of elements which were modified since the last state push.


setNext

public void setNext(Element next)
Sets the next element in the linked list of elements which were modified since the last state push.


getDepth

public int getDepth()
Returns the depth of this element in its stack, used to implement lazy state pushing.


setDepth

public void setDepth(int depth)
Sets the depth of this element in its stack, used to implement lazy state pushing.


push

public void push(State state)
Pushes the element, allowing for side effects to occur. Default method does nothing.


pop

public void pop(State state,
                Element previousTopElement)
Pops the element, allowing for side effects to occur. Default method does nothing. NOTE that it is not legal to call State.getElement() in the implementation of this method, which is why the previous top element is provided as an argument.


getStateIndex

public abstract StateIndex getStateIndex()
All concrete element subclasses must register themselves with the State in order to reserve a slot, or index, in the state. This method must be overridden to return this slot.