j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class VertexShader

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.GL14ShaderProgram
              extended byorg.j3d.aviatrix3d.VertexShader
All Implemented Interfaces:
java.lang.Comparable, Renderable, RenderableObject

public class VertexShader
extends GL14ShaderProgram
implements RenderableObject, java.lang.Comparable

Node that handles Vertex shader implementation.

The implementation is relatively simple using just a bind program call followed by the parameter setting. If the application needs greater control than this, such as multi-pass rendering, then derive this class and change the render-loop code to do what is required.

Parameters follow the OpenGL model. There are 96 evironment parameters and 96 local parameters. Both can be set through this class, though this may change in a future design revision, to make environment parameters into a global setting.

Though OpenGL can take the attributes as doubles, this is not supported by this API currently.

Version:
$Revision: 1.16 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.GL14ShaderProgram
programChanged, programId, programString
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount, parentList
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
VertexShader()
          Constructs a Vertex shader with default values.
VertexShader(int attrListSize, int paramListSize)
          Create a vertext shader instance with a guaranteed maximum parameter list size.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(VertexShader sh)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 boolean equals(VertexShader sh)
          Compares this object with the specified object to check for equivalence.
 void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
           
 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Set up the rendering state now.
 void setEnvironmentParam(int idx, float[] value)
          Set the environment parameter as a float array.
 void setLocalParam(int idx, float[] value)
          Set the local parameter as a float array.
 
Methods inherited from class org.j3d.aviatrix3d.GL14ShaderProgram
getProgramString, setProgramString
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VertexShader

public VertexShader()
Constructs a Vertex shader with default values. The internal arrays for vertex attributes will be 16 and environment and local parameters to 96.


VertexShader

public VertexShader(int attrListSize,
                    int paramListSize)
             throws InvalidWriteTimingException
Create a vertext shader instance with a guaranteed maximum parameter list size. If an attempt is made to read/set past this, an exception will generated. This ID is the maximum parameter index that will be used and the maxium number actually used.

Parameters:
paramListSize - The maximum number of environment and local parameters that will be used.
attrListSize - The maximum number of vertex attributes that will be used
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method
Method Detail

render

public void render(net.java.games.jogl.GL gl,
                   net.java.games.jogl.GLU glu)
Set up the rendering state now.

Specified by:
render in interface RenderableObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

postRender

public void postRender(net.java.games.jogl.GL gl,
                       net.java.games.jogl.GLU glu)
Specified by:
postRender in interface RenderableObject

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Derived classes should extend this one to add the extra comparisons needed.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The objec to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Parameters:
o - The object to be compared
Returns:
True if these represent the same values

setEnvironmentParam

public void setEnvironmentParam(int idx,
                                float[] value)
                         throws InvalidWriteTimingException
Set the environment parameter as a float array.

Parameters:
idx - The index of the parameter to set
value - A float array 4 in length of the values to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setLocalParam

public void setLocalParam(int idx,
                          float[] value)
                   throws InvalidWriteTimingException
Set the local parameter as a float array.

Parameters:
idx - The index of the parameter to set
value - A float array 4 in length of the values to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

compareTo

public int compareTo(VertexShader sh)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Derived classes should extend this one to add the extra comparisons needed.

Parameters:
sh - The shader instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(VertexShader sh)
Compares this object with the specified object to check for equivalence.

Parameters:
sh - The shader instance to be compared
Returns:
true if the objects represent identical values

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org