public class GLSLShader
extends java.lang.Object
Constructor and Description |
---|
GLSLShader(java.lang.String vertexShaderSource,
java.lang.String fragmentShaderSource)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
addReplacement(java.lang.String key,
java.lang.String shaderSrc)
With this, you can override the default shaders by making jPCT-AE use
your own shader code instead.
|
void |
dispose()
Disposes the shader.
|
void |
finalize() |
int |
getProgram()
Returns the id of the shader program.
|
static ShaderLocator |
getShaderLocator()
Returns the shader locator or a new instance of jar-locator if none other
has been set.
|
boolean |
isDepthShader()
Returns if this shader is a depth shader.
|
void |
setDepthShader(boolean depthShader)
Marks this shader as a depth shader.
|
void |
setFloatArrayUniform(java.lang.String name,
float[] val)
Sets a new float[] uniform.
|
static void |
setShaderLocator(ShaderLocator locator)
Sets a new shader locator.
|
void |
setStaticFloatArrayUniform(java.lang.String name,
float[] val)
Sets a new float[] uniform.
|
void |
setStaticUniform(java.lang.String name,
float val)
Sets a new float uniform.
|
void |
setStaticUniform(java.lang.String name,
float[] val)
Sets a new float|vecX uniform.
|
void |
setStaticUniform(java.lang.String name,
int val)
Sets a new integer uniform.
|
void |
setStaticUniform(java.lang.String name,
Matrix m)
Sets a new Matrix uniform.
|
void |
setStaticUniform(java.lang.String name,
Matrix[] ms)
Sets a new array of Matrix uniform.
|
void |
setStaticUniform(java.lang.String name,
SimpleVector val)
Sets a new SimpleVector uniform.
|
void |
setStaticUniform(java.lang.String name,
SimpleVector[] vals)
Sets a new array of SimpleVector uniform.
|
void |
setUniform(java.lang.String name,
float val)
Sets a new float uniform.
|
void |
setUniform(java.lang.String name,
float[] val)
Sets a new float|vecX uniform.
|
void |
setUniform(java.lang.String name,
int val)
Sets a new integer uniform.
|
void |
setUniform(java.lang.String name,
Matrix m)
Sets a new Matrix uniform.
|
void |
setUniform(java.lang.String name,
Matrix[] vals)
Sets a new array of Matrix uniform.
|
void |
setUniform(java.lang.String name,
SimpleVector val)
Sets a new SimpleVector uniform.
|
void |
setUniform(java.lang.String name,
SimpleVector[] vals)
Sets a new array of SimpleVectors uniform.
|
void |
setUniformCache(boolean cacheEnabled)
Sets if uniform values can be cached or not.
|
public GLSLShader(java.lang.String vertexShaderSource, java.lang.String fragmentShaderSource)
vertexShaderSource
- the source of the vertex shaderfragmentShaderSource
- the source of the fragment shaderpublic static void addReplacement(java.lang.String key, java.lang.String shaderSrc)
key
- shaderSrc
- public static void setShaderLocator(ShaderLocator locator)
locator
- the new locatorpublic static ShaderLocator getShaderLocator()
public void setUniformCache(boolean cacheEnabled)
cacheEnabled
- can we cache the uniforms?public int getProgram()
public void setStaticUniform(java.lang.String name, int val)
name
- the name of the uniformval
- the valuepublic void setStaticUniform(java.lang.String name, float val)
name
- the name of the uniformval
- the valuepublic void setStaticUniform(java.lang.String name, float[] val)
name
- the name of the uniformval
- the value. Supports array-lengths from 1 to 4.public void setStaticFloatArrayUniform(java.lang.String name, float[] val)
name
- the name of the uniformval
- the value.public void setStaticUniform(java.lang.String name, SimpleVector[] vals)
name
- the name of the uniformvals
- the valuespublic void setStaticUniform(java.lang.String name, SimpleVector val)
name
- the name of the uniformval
- the valuepublic void setStaticUniform(java.lang.String name, Matrix m)
name
- the name of the uniformm
- the matrix. It won't be transposed.public void setStaticUniform(java.lang.String name, Matrix[] ms)
name
- the name of the uniformvals
- the valuespublic void setUniform(java.lang.String name, Matrix[] vals)
name
- the name of the uniformvals
- the valuespublic void setUniform(java.lang.String name, int val)
name
- the name of the uniformval
- the valuepublic void setUniform(java.lang.String name, float val)
name
- the name of the uniformval
- the valuepublic void setUniform(java.lang.String name, SimpleVector val)
name
- the name of the uniformval
- the valuepublic void setUniform(java.lang.String name, SimpleVector[] vals)
name
- the name of the uniformvals
- the valuespublic void setUniform(java.lang.String name, float[] val)
name
- the name of the uniformval
- the value. Supports array-lengths from 1 to 4.public void setFloatArrayUniform(java.lang.String name, float[] val)
name
- the name of the uniformval
- the value.public void setUniform(java.lang.String name, Matrix m)
name
- the name of the uniformm
- the matrix. It won't be transposed.public boolean isDepthShader()
public void setDepthShader(boolean depthShader)
depthShader
- true, if it's a depth shader. False otherwise.public void dispose()
public void finalize()
finalize
in class java.lang.Object