org.osm2world.core.target.jogl
public class ShadowMapShader extends DepthBufferShader
Modifier and Type | Field and Description |
---|---|
int |
colorBufferHandle |
int |
depthBufferHandle |
protected int |
shadowMapHeight |
protected int |
shadowMapWidth |
USE_TRANSPARENCY
renderOnlySemiTransparent, renderSemiTransparent
fragmentShader, gl, shaderProgram, vertexShader
Constructor and Description |
---|
ShadowMapShader(GL3 gl) |
Modifier and Type | Method and Description |
---|---|
void |
disableShader()
Completes the rendering of the shadow map.
|
PMVMatrix |
getPMVMatrix()
Returns the PMVMatrix that was used to render the shadow map.
|
int |
getShadowMapHandle()
Returns the handle of the texture containing the rendered shadow map.
|
void |
preparePMVMatrix(GlobalLightingParameters lighting,
PMVMatrix cameraPMV,
AxisAlignedBoundingBoxXYZ primitivesBoundingBox)
Prepare and use PMVMatrix for rendering shadows from global lighting perspective
|
void |
preparePMVMatrixPSM(GlobalLightingParameters lighting,
PMVMatrix cameraPMV,
AxisAlignedBoundingBoxXYZ primitivesBoundingBox)
prepare and use PMVMatrix for rendering shadows from global lighting perspective using "Perspective Shadow Maps"
(see http://www-sop.inria.fr/reves/Marc.Stamminger/psm/)
|
void |
saveColorBuffer(File file) |
void |
setCameraFrustumPadding(int padding) |
boolean |
setMaterial(Material material,
JOGLTextureManager textureManager)
Prepare the shader to use the given material when rendering the primitives later.
|
void |
setRenderOpaque(boolean renderOpaque)
Sets whether to render opaque objects or not.
|
void |
setShadowMapSize(int width,
int height)
Change the size of the shadow map texture.
|
void |
useShader()
Prepares rendering of the shadow map.
|
getModelViewProjectionMatrixID, getVertexBumpMapCoordID, getVertexNormalID, getVertexPositionID, getVertexTangentID, getVertexTexCoordID, setPMVMatrix
glDisableVertexAttribArray, glEnableVertexAttribArray, glVertexAttribPointer, setRenderOnlySemiTransparent, setRenderSemiTransparent
finalize, freeResources, getProgram, loadDefaults, validateShader
protected int shadowMapWidth
protected int shadowMapHeight
public int depthBufferHandle
public int colorBufferHandle
public void setCameraFrustumPadding(int padding)
cameraFrustumPadding
public void setShadowMapSize(int width, int height)
useShader()
,
as otherwise the viewport may be wrong.width
- the new texture widthheight
- the new texture heightpublic void saveColorBuffer(File file)
public void preparePMVMatrixPSM(GlobalLightingParameters lighting, PMVMatrix cameraPMV, AxisAlignedBoundingBoxXYZ primitivesBoundingBox)
lighting
- public void preparePMVMatrix(GlobalLightingParameters lighting, PMVMatrix cameraPMV, AxisAlignedBoundingBoxXYZ primitivesBoundingBox)
lighting
- contains the lights directioncameraPMV
- the current camera PMVMatrix used to tighten the lights view frustum on the visible part of the worldprimitivesBoundingBox
- bounding box around all relevant primitives in world coordinates. Also used to tighten the lights view frustumpublic boolean setMaterial(Material material, JOGLTextureManager textureManager)
setRenderOpaque(boolean)
setMaterial
in class DepthBufferShader
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 setRenderOpaque(boolean renderOpaque)
public PMVMatrix getPMVMatrix()
useShader()
public int getShadowMapHandle()
public void useShader()
disableShader()
should be called after the rendering is complete to bind the default framebuffer again
and restore the original viewport.useShader
in class AbstractShader
public void disableShader()
disableShader
in class AbstractShader