com.jme.scene.state
Class VertexProgramState

java.lang.Object
  extended by com.jme.scene.state.RenderState
      extended by com.jme.scene.state.VertexProgramState
All Implemented Interfaces:
Savable
Direct Known Subclasses:
JOGLVertexProgramState, LWJGLVertexProgramState

public abstract class VertexProgramState
extends RenderState

Implementation of the GL_ARB_vertex_program extension.

Version:
$Id: VertexProgramState.java 4336 2009-05-03 20:57:01Z christoph.luder $
Author:
Eric Woroshow

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.state.RenderState
RenderState.StateType
 
Field Summary
protected static float[][] envparameters
          Environmental parameters applied to all vertex programs
protected  float[][] parameters
          Parameters local to this vertex program
protected  java.nio.ByteBuffer program
           
protected  boolean usingParameters
          If any local parameters for this VP state are set
 
Fields inherited from class com.jme.scene.state.RenderState
QUICK_COMPARE, RS_BLEND, RS_CLIP, RS_COLORMASK_STATE, RS_CULL, RS_FOG, RS_FRAGMENT_PROGRAM, RS_GLSL_SHADER_OBJECTS, RS_LIGHT, RS_MATERIAL, RS_MAX_STATE, RS_SHADE, RS_STENCIL, RS_TEXTURE, RS_VERTEX_PROGRAM, RS_WIREFRAME, RS_ZBUFFER
 
Constructor Summary
VertexProgramState()
          Creates a new VertexProgramState.
 
Method Summary
 java.lang.Class<?> getClassTag()
           
abstract  java.lang.String getProgram()
           
 RenderState.StateType getStateType()
          getStateType returns the type RenderState.StateType.VertexProgram
 int getType()
          Deprecated. As of 2.0, use RenderState.getStateType() instead.
abstract  boolean isSupported()
          isSupported determines if the ARB_vertex_program extension is supported by current graphics configuration.
abstract  void load(java.lang.String programContents)
           
abstract  void load(java.net.URL file)
          load loads the vertex program from the specified file.
 void read(JMEImporter e)
           
static void setEnvParameter(float[] param, int paramID)
          setEnvParameter sets an environmental vertex program parameter that is accessable by all vertex programs in memory.
 void setParameter(float[] param, int paramID)
          setParameter sets a parameter for this vertex program.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.state.RenderState
apply, createStateRecord, extract, isEnabled, needsRefresh, setEnabled, setNeedsRefresh, setQuickCompares
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

envparameters

protected static float[][] envparameters
Environmental parameters applied to all vertex programs


usingParameters

protected boolean usingParameters
If any local parameters for this VP state are set


parameters

protected float[][] parameters
Parameters local to this vertex program


program

protected java.nio.ByteBuffer program
Constructor Detail

VertexProgramState

public VertexProgramState()
Creates a new VertexProgramState. load(URL) must be called before the state can be used.

Method Detail

setEnvParameter

public static void setEnvParameter(float[] param,
                                   int paramID)
setEnvParameter sets an environmental vertex program parameter that is accessable by all vertex programs in memory.

Parameters:
param - four-element array of floating point numbers
paramID - identity number of the parameter, ranging from 0 to 95

isSupported

public abstract boolean isSupported()
isSupported determines if the ARB_vertex_program extension is supported by current graphics configuration.

Returns:
if ARB vertex programs are supported

setParameter

public void setParameter(float[] param,
                         int paramID)
setParameter sets a parameter for this vertex program.

Parameters:
paramID - identity number of the parameter, ranging from 0 to 95
param - four-element array of floating point numbers

getType

public int getType()
Deprecated. As of 2.0, use RenderState.getStateType() instead.

Description copied from class: RenderState
Defined by the subclass, this returns an int identifying the renderstate. For example, RS_CULL or RS_TEXTURE.

Specified by:
getType in class RenderState
Returns:
RS_VERTEX_PROGRAM
See Also:
RenderState.getType()

getStateType

public RenderState.StateType getStateType()
getStateType returns the type RenderState.StateType.VertexProgram

Specified by:
getStateType in class RenderState
Returns:
RenderState.StateType.VertexProgram
See Also:
RenderState.getStateType()

load

public abstract void load(java.net.URL file)
load loads the vertex program from the specified file. The program must be in ASCII format. We delegate the loading to each implementation because we do not know in what format the underlying API wants the data.

Parameters:
file - text file containing the vertex program

load

public abstract void load(java.lang.String programContents)

getProgram

public abstract java.lang.String getProgram()

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class RenderState
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class RenderState
Throws:
java.io.IOException

getClassTag

public java.lang.Class<?> getClassTag()
Specified by:
getClassTag in interface Savable
Overrides:
getClassTag in class RenderState