de.grogra.imp3d.glsl.utility
Class ShaderConfiguration

java.lang.Object
  extended by de.grogra.imp3d.glsl.utility.ShaderConfiguration
Direct Known Subclasses:
LightShaderConfiguration, MaterialConfiguration

public abstract class ShaderConfiguration
extends java.lang.Object


Field Summary
protected  java.util.Vector<java.lang.String> constVar
           
protected  java.util.Vector<java.lang.String> customSampler
           
protected  java.util.LinkedHashMap<java.lang.String,java.lang.String> funcMap
           
protected  java.lang.Object referenceKey
           
protected  java.util.Vector<java.lang.String> sampler
           
static int T_BOOL
           
static int T_FLOAT
           
static int T_MAT3
           
static int T_SAMPLER2D
           
static int T_SAMPLER2DRECT
           
static int T_SAMPLER2DSHADOW
           
static int T_SAMPLERCUBE
           
static int T_VEC2
           
static int T_VEC3
           
static int T_VEC4
           
protected  java.util.Vector<java.lang.String> uniform
           
static byte USE_DERIVATES
           
static byte USE_GLOBAL_POS
           
static byte USE_LOCAL_POS
           
static byte USE_UV
           
protected  java.util.Vector<java.lang.String> var
           
protected  int version
           
 
Constructor Summary
ShaderConfiguration()
           
 
Method Summary
 void bindTextures(javax.media.opengl.GL gl, GLSLDisplay disp, int shaderNo, int offset)
           
 void cleanUp(javax.media.opengl.GL gl, boolean javaonly)
           
 void clearTmpVariables()
           
abstract  ShaderConfiguration clone()
           
 boolean equals(java.lang.Object obj)
           
 boolean getBit(byte mask)
           
protected  java.lang.Object getReferenceKeyValue()
           
abstract  GLSLManagedShader getShaderByDefaultCollection(GLSLDisplay disp, java.lang.Object reference)
           
 int hashCode()
           
protected  boolean perInstance()
           
 java.lang.String registerCustomTexture(GLSLQueuedTexture data)
           
 void registerFunc(java.lang.String signature, java.lang.String source)
          Register a function to be used within this shaders code.
 java.lang.String registerGlobalConst(int type, java.lang.String value)
           
 java.lang.String registerNewTmpVar(int type, java.lang.String value)
           
 java.lang.String registerNewUniform(int type)
           
 java.lang.String registerTexture(java.awt.Image img)
           
 void set(java.lang.Object obj)
           
 void set(OpenGLState glState, GLSLDisplay disp, java.lang.Object obj)
           
 void setBit(byte mask)
           
protected  void setThisToOther(ShaderConfiguration other)
          Sets all permanent attributes of this instance to the values from other.
 void setupDynamicUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, int shaderNo)
           
 void setupShader(javax.media.opengl.GL gl, GLSLDisplay disp, int shaderNo)
           
 void setupTextures(javax.media.opengl.GL gl, GLSLDisplay disp, int shaderNo, int offset)
           
 void setVersion(int i)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constVar

protected transient java.util.Vector<java.lang.String> constVar

customSampler

protected final transient java.util.Vector<java.lang.String> customSampler

funcMap

protected transient java.util.LinkedHashMap<java.lang.String,java.lang.String> funcMap

referenceKey

protected java.lang.Object referenceKey

sampler

protected final transient java.util.Vector<java.lang.String> sampler

T_BOOL

public static final int T_BOOL
See Also:
Constant Field Values

T_FLOAT

public static final int T_FLOAT
See Also:
Constant Field Values

T_MAT3

public static final int T_MAT3
See Also:
Constant Field Values

T_SAMPLER2D

public static final int T_SAMPLER2D
See Also:
Constant Field Values

T_SAMPLER2DRECT

public static final int T_SAMPLER2DRECT
See Also:
Constant Field Values

T_SAMPLER2DSHADOW

public static final int T_SAMPLER2DSHADOW
See Also:
Constant Field Values

T_SAMPLERCUBE

public static final int T_SAMPLERCUBE
See Also:
Constant Field Values

T_VEC2

public static final int T_VEC2
See Also:
Constant Field Values

T_VEC3

public static final int T_VEC3
See Also:
Constant Field Values

T_VEC4

public static final int T_VEC4
See Also:
Constant Field Values

uniform

protected transient java.util.Vector<java.lang.String> uniform

USE_DERIVATES

public static final byte USE_DERIVATES
See Also:
Constant Field Values

USE_GLOBAL_POS

public static final byte USE_GLOBAL_POS
See Also:
Constant Field Values

USE_LOCAL_POS

public static final byte USE_LOCAL_POS
See Also:
Constant Field Values

USE_UV

public static final byte USE_UV
See Also:
Constant Field Values

var

protected transient java.util.Vector<java.lang.String> var

version

protected int version
Constructor Detail

ShaderConfiguration

public ShaderConfiguration()
Method Detail

bindTextures

public void bindTextures(javax.media.opengl.GL gl,
                         GLSLDisplay disp,
                         int shaderNo,
                         int offset)

cleanUp

public void cleanUp(javax.media.opengl.GL gl,
                    boolean javaonly)

clearTmpVariables

public void clearTmpVariables()

clone

public abstract ShaderConfiguration clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getBit

public boolean getBit(byte mask)

getReferenceKeyValue

protected java.lang.Object getReferenceKeyValue()

getShaderByDefaultCollection

public abstract GLSLManagedShader getShaderByDefaultCollection(GLSLDisplay disp,
                                                               java.lang.Object reference)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

perInstance

protected boolean perInstance()

registerCustomTexture

public java.lang.String registerCustomTexture(GLSLQueuedTexture data)

registerFunc

public void registerFunc(java.lang.String signature,
                         java.lang.String source)
Register a function to be used within this shaders code. Functions are guarantied to be added only once per signature using the last added. Appearance will be in order of registration

Parameters:
signature - Signature of the function for example "float calc(vec3 pos)"
source - Source of the function without surrounding "{...}"

registerGlobalConst

public java.lang.String registerGlobalConst(int type,
                                            java.lang.String value)

registerNewTmpVar

public java.lang.String registerNewTmpVar(int type,
                                          java.lang.String value)

registerNewUniform

public java.lang.String registerNewUniform(int type)

registerTexture

public java.lang.String registerTexture(java.awt.Image img)

set

public void set(java.lang.Object obj)

set

public void set(OpenGLState glState,
                GLSLDisplay disp,
                java.lang.Object obj)

setBit

public void setBit(byte mask)

setThisToOther

protected void setThisToOther(ShaderConfiguration other)
Sets all permanent attributes of this instance to the values from other. This method is used by clone() to generate a shallow copy of a ShaderConfiguration

Parameters:
other - Reference from which attributes are copied

setupDynamicUniforms

public void setupDynamicUniforms(javax.media.opengl.GL gl,
                                 GLSLDisplay disp,
                                 int shaderNo)

setupShader

public void setupShader(javax.media.opengl.GL gl,
                        GLSLDisplay disp,
                        int shaderNo)

setupTextures

public void setupTextures(javax.media.opengl.GL gl,
                          GLSLDisplay disp,
                          int shaderNo,
                          int offset)

setVersion

public void setVersion(int i)