de.grogra.imp3d.glsl.material
Class GLSLMaterial

java.lang.Object
  extended by de.grogra.imp3d.glsl.utility.GLSLShader
      extended by de.grogra.imp3d.glsl.utility.GLSLManagedShader
          extended by de.grogra.imp3d.glsl.material.GLSLMaterial
All Implemented Interfaces:
GLSLOpenGLObject
Direct Known Subclasses:
GLSLPhong, GLSLRGBAShader, GLSLSideSwitchShader, GLSLSunSky

public abstract class GLSLMaterial
extends GLSLManagedShader

Represents a class of Shaders that need to be recompiled for every property change. (e.g GLSLPhong)

Author:
Konni Hartmann

Field Summary
 
Fields inherited from class de.grogra.imp3d.glsl.utility.GLSLManagedShader
config
 
Constructor Summary
GLSLMaterial()
           
 
Method Summary
protected abstract  Result[] getAllChannels(java.lang.Object sha)
           
protected  java.lang.String[] getFragmentShader(java.lang.Object sha)
          Generate the FragmentShaderCode by using the configuration of the Shader.
 boolean isOpaque(java.lang.Object s)
           
 boolean mayDiscard(java.lang.Object s)
           
protected  void setupDynamicUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, java.lang.Object data, int shaderNo)
          Function that loads uniforms of the represented Shader.
protected  void setupShader(javax.media.opengl.GL gl, GLSLDisplay disp, java.lang.Object s)
           
protected  void setupUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, java.lang.Object s, int shaderProgramNumber)
          Function that loads uniforms of the represented Shader.
 
Methods inherited from class de.grogra.imp3d.glsl.utility.GLSLManagedShader
deleteShader, getConfig, getMaterial_stamp, setConfig, setMaterial_stamp
 
Methods inherited from class de.grogra.imp3d.glsl.utility.GLSLShader
activateShader, cleanup, getInstance, getShaderProgramNumber, getVertexShader, instanceFor, needsRecompilation, printProgramInfoLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLSLMaterial

public GLSLMaterial()
Method Detail

getAllChannels

protected abstract Result[] getAllChannels(java.lang.Object sha)

getFragmentShader

protected java.lang.String[] getFragmentShader(java.lang.Object sha)
Generate the FragmentShaderCode by using the configuration of the Shader.

Specified by:
getFragmentShader in class GLSLShader
Returns:

isOpaque

public boolean isOpaque(java.lang.Object s)

mayDiscard

public boolean mayDiscard(java.lang.Object s)
Parameters:
s - GroImp Shader that acts as a base for this shader
Returns:
True, if fragments may be discarded by this shader

setupDynamicUniforms

protected void setupDynamicUniforms(javax.media.opengl.GL gl,
                                    GLSLDisplay disp,
                                    java.lang.Object data,
                                    int shaderNo)
Description copied from class: GLSLShader
Function that loads uniforms of the represented Shader.

Overrides:
setupDynamicUniforms in class GLSLShader
disp - GLSLDisplay that tries using this shader
data - The GroIMP-Shader-Object represented by this shader.

setupShader

protected void setupShader(javax.media.opengl.GL gl,
                           GLSLDisplay disp,
                           java.lang.Object s)
Overrides:
setupShader in class GLSLShader

setupUniforms

protected void setupUniforms(javax.media.opengl.GL gl,
                             GLSLDisplay disp,
                             java.lang.Object s,
                             int shaderProgramNumber)
Function that loads uniforms of the represented Shader. Called by setupShader(GL, GLSLDisplay, Object). Use this to add special uniforms instead of overloading setupShader(GL, GLSLDisplay, Object). Used by SideSwitchShader to initialize both shaders.

Parameters:
gl -
disp - GLSLDisplay that tries using this shader
s - The GroIMP-Shader-Object represented by this shader.