org.xith3d.scenegraph
Class ShaderProgram<S extends Shader>

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.NodeComponent
          extended by org.xith3d.scenegraph.ShaderProgram<S>
All Implemented Interfaces:
java.lang.Comparable<ShaderProgram<S>>, org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, StateTrackable<ShaderProgram<S>>
Direct Known Subclasses:
AssemblyShaderProgram, GLSLShaderProgram

public abstract class ShaderProgram<S extends Shader>
extends NodeComponent
implements org.jagatoo.datatypes.Enableable, StateTrackable<ShaderProgram<S>>


Field Summary
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
ShaderProgram()
           
ShaderProgram(boolean enabled)
           
 
Method Summary
 void addShader(S shader)
           
abstract  int compareTo(ShaderProgram<S> o)
          
protected  void duplicateNodeComponent(NodeComponent original, boolean forceDuplicate)
           
abstract  boolean equals(java.lang.Object obj)
          
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all this NodeComponent and all child-components.
 S getFragmentShader(int index)
           
 int getNumFragmentShaders()
           
 int getNumShaders()
           
 int getNumVertexShaders()
           
 long getStateId()
           
 StateNode getStateNode()
           
 S getVertexShader(int index)
           
 boolean isEnabled()
           
 void removeAllShaders()
           
 void removeShader(S shader)
           
protected  void setDirty(boolean dirty)
           
 void setEnabled(boolean enabled)
           
 void setStateNode(StateNode node)
          Used by the render engine to set the state id for the node.
 
Methods inherited from class org.xith3d.scenegraph.NodeComponent
cloneNodeComponent, freeOpenGLResources, getDuplicateOnCloneTree, getModListener, isChanged, isChanged2, setChanged, setDuplicateOnCloneTree, setModListener
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xith3d.render.states.StateTrackable
getCopy
 

Constructor Detail

ShaderProgram

public ShaderProgram(boolean enabled)

ShaderProgram

public ShaderProgram()
Method Detail

setEnabled

public final void setEnabled(boolean enabled)
Specified by:
setEnabled in interface org.jagatoo.datatypes.Enableable

isEnabled

public final boolean isEnabled()
Specified by:
isEnabled in interface org.jagatoo.datatypes.Enableable

setDirty

protected final void setDirty(boolean dirty)

addShader

public final void addShader(S shader)

removeShader

public final void removeShader(S shader)

removeAllShaders

public final void removeAllShaders()

getNumVertexShaders

public final int getNumVertexShaders()

getNumFragmentShaders

public final int getNumFragmentShaders()

getNumShaders

public final int getNumShaders()

getVertexShader

public final S getVertexShader(int index)

getFragmentShader

public final S getFragmentShader(int index)

freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all this NodeComponent and all child-components.

Specified by:
freeOpenGLResources in class NodeComponent

setStateNode

public final void setStateNode(StateNode node)
Description copied from interface: StateTrackable
Used by the render engine to set the state id for the node.

Specified by:
setStateNode in interface StateTrackable<ShaderProgram<S extends Shader>>

getStateNode

public final StateNode getStateNode()
Specified by:
getStateNode in interface StateTrackable<ShaderProgram<S extends Shader>>
Returns:
the id of the object. This should return -1 if there is no assigned id.

getStateId

public final long getStateId()

compareTo

public abstract int compareTo(ShaderProgram<S> o)

Specified by:
compareTo in interface java.lang.Comparable<ShaderProgram<S extends Shader>>

equals

public abstract boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

duplicateNodeComponent

protected void duplicateNodeComponent(NodeComponent original,
                                      boolean forceDuplicate)
Overrides:
duplicateNodeComponent in class NodeComponent