org.osm2world.core.target.jogl
public class DefaultShader extends AbstractPrimitiveShader
Modifier and Type | Field and Description |
---|---|
static boolean |
ANISOTROPIC_FILTERING
globally controls anisotropic filtering for all textures
|
static int |
MAX_TEXTURE_LAYERS
maximum number of texture layers any material can use
|
renderOnlySemiTransparent, renderSemiTransparent
fragmentShader, gl, shaderProgram, vertexShader
Constructor and Description |
---|
DefaultShader(GL3 gl) |
Modifier and Type | Method and Description |
---|---|
void |
bindShadowMap(int shadowMapHandle)
Binds the specified texture as shadow map and uses it for rendering shadows.
|
void |
enableSSAOwithDepthMap(int depthMapHandle)
Binds a texture as depth map and uses it for SSAO.
|
int |
getModelViewMatrixID() |
int |
getModelViewProjectionMatrixID() |
int |
getNormalMatrixID() |
int |
getProjectionMatrixID() |
int |
getShadowMatrixID() |
int |
getVertexBumpMapCoordID()
Returns the id to use by
JOGLRendererVBOShader to bind the vertex bumpmap coordinate attribute. |
int |
getVertexNormalID()
Returns the id to use by
JOGLRendererVBOShader to bind the vertex normal attribute. |
int |
getVertexPositionID()
Returns the id to use by
JOGLRendererVBOShader to bind the vertex position attribute. |
int |
getVertexTangentID()
Returns the id to use by
JOGLRendererVBOShader to bind the vertex tangent attribute. |
int |
getVertexTexCoordID(int i)
Returns the id to use by
JOGLRendererVBOShader to bind the vertex texture coordinate attribute. |
void |
loadDefaults()
Load default values for the shader.
|
void |
setGlobalLighting(GlobalLightingParameters lighting)
Prepares the shader to do lighting.
|
boolean |
setMaterial(Material material,
JOGLTextureManager textureManager)
Prepare the shader to use the given material when rendering the primitives later.
|
void |
setPMVMatrix(PMVMatrix pmvMatrix)
Send uniform matrices "ProjectionMatrix, ModelViewMatrix and ModelViewProjectionMatrix" to vertex shader
|
void |
setShadowed(boolean isShadowed)
Sets whether to Render everything as in shadow.
|
void |
setShadowMatrix(PMVMatrix pmvMatrix)
Sets the PMVMatrix that was used to render the shadow map set with
bindShadowMap(int) . |
void |
setSSAOkernelSize(int kernelSize)
Change the size of the SSAO kernel and recomputes it.
|
void |
setSSAOradius(float radius)
Change the radius used for SSAO.
|
glDisableVertexAttribArray, glEnableVertexAttribArray, glVertexAttribPointer, setRenderOnlySemiTransparent, setRenderSemiTransparent
disableShader, finalize, freeResources, getProgram, useShader, validateShader
public static final int MAX_TEXTURE_LAYERS
public static final boolean ANISOTROPIC_FILTERING
public void loadDefaults()
AbstractShader
AbstractShader.useShader()
and before any draw calls.loadDefaults
in class AbstractShader
public void setPMVMatrix(PMVMatrix pmvMatrix)
pmvMatrix
- public void setGlobalLighting(GlobalLightingParameters lighting)
lighting
- the global lighting to apply. Can be null
to disable lighting.public void setShadowed(boolean isShadowed)
public boolean setMaterial(Material material, JOGLTextureManager textureManager)
AbstractPrimitiveShader
setMaterial
in class AbstractPrimitiveShader
material
- the material to applytextureManager
- the texture manager to use if the material has texturestrue
if this shader wants to render primitives with the given material at all, false
otherwise.public void bindShadowMap(int shadowMapHandle)
public void enableSSAOwithDepthMap(int depthMapHandle)
public void setSSAOkernelSize(int kernelSize)
enableSSAOwithDepthMap(int)
to have any effect.public void setSSAOradius(float radius)
enableSSAOwithDepthMap(int)
to have any effect.public int getVertexPositionID()
AbstractPrimitiveShader
JOGLRendererVBOShader
to bind the vertex position attribute.
May be -1 if the attribute is unused.getVertexPositionID
in class AbstractPrimitiveShader
public int getVertexNormalID()
AbstractPrimitiveShader
JOGLRendererVBOShader
to bind the vertex normal attribute.
May be -1 if the attribute is unused.getVertexNormalID
in class AbstractPrimitiveShader
public int getVertexTexCoordID(int i)
AbstractPrimitiveShader
JOGLRendererVBOShader
to bind the vertex texture coordinate attribute.
May be -1 if the attribute is unused.getVertexTexCoordID
in class AbstractPrimitiveShader
public int getVertexBumpMapCoordID()
AbstractPrimitiveShader
JOGLRendererVBOShader
to bind the vertex bumpmap coordinate attribute.
May be -1 if the attribute is unused.getVertexBumpMapCoordID
in class AbstractPrimitiveShader
public int getProjectionMatrixID()
public int getModelViewMatrixID()
public int getModelViewProjectionMatrixID()
public int getNormalMatrixID()
public int getShadowMatrixID()
public int getVertexTangentID()
AbstractPrimitiveShader
JOGLRendererVBOShader
to bind the vertex tangent attribute.
May be -1 if the attribute is unused.getVertexTangentID
in class AbstractPrimitiveShader
public void setShadowMatrix(PMVMatrix pmvMatrix)
bindShadowMap(int)
.
This is needed to correctly compare the shadow map depth values with the fragment depth value.pmvMatrix
-