|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.renderer.pass.Pass
com.jme.renderer.pass.DirectionalShadowMapPass
public class DirectionalShadowMapPass
A pass providing a shadow mapping layer across the top of an existing scene. Based on code by Robert Larsson and Joshua Slack
Field Summary | |
---|---|
protected Vector3f |
direction
The direction shadows are being cast from - directional light? |
protected float |
dis
The distance we're modelling the direction light source as being away from the focal point, again the higher the number the more of the scene is covered but at lower resolution |
protected boolean |
initialised
True once the pass has been initialised |
protected float |
shadowMapScale
The scaling applied to the shadow map when rendered to - lower number means higher res but less ara covered by the shadow map |
Fields inherited from class com.jme.renderer.pass.Pass |
---|
context, enabled, passStates, savedStates, spatials, zFactor, zOffset |
Constructor Summary | |
---|---|
DirectionalShadowMapPass(Vector3f direction)
Create a shadow map pass casting shadows from a light with the direction given. |
|
DirectionalShadowMapPass(Vector3f direction,
int shadowMapSize)
Create a shadow map pass casting shadows from a light with the direction given. |
Method Summary | |
---|---|
void |
addOccluder(Spatial occluder)
Add a spatial that will occlude light and hence cast a shadow |
void |
cleanUp()
|
void |
clear()
Remove the contents of the pass |
void |
doRender(Renderer r)
|
GLSLShaderObjectsState |
getShader()
|
void |
init(Renderer r)
Initialise the pass render states |
protected void |
renderShadowedScene(Renderer r)
Render the scene with shadows |
protected void |
replaceEnforcedStates()
replaces any states enforced by the user at the end of the pass. |
protected void |
saveEnforcedStates()
saves any states enforced by the user for replacement at the end of the pass. |
void |
setCullOccluders(boolean cullOccluders)
Indicate whether occluders should be culled against shadow map frustrum |
void |
setShadowAlpha(float alpha)
Set the colour of the shadows to be cast |
void |
setShadowMapScale(float scale)
Set the scale factor thats used to stretch the shadow map texture across the scene. |
void |
setViewDistance(float dis)
Set the distance of the camera representing the directional light. |
void |
setViewTarget(Vector3f target)
Set the target of the view. |
protected void |
updateShadowCamera()
Update the direction from which the shadows are cast |
protected void |
updateShadowMap(Renderer r)
Update the shadow map |
Methods inherited from class com.jme.renderer.pass.Pass |
---|
add, applyPassStates, clearPassState, clearPassState, clearPassStates, contains, doUpdate, get, getRenderState, getRenderState, getZFactor, getZOffset, isEnabled, remove, removeAll, renderPass, resetOldStates, setEnabled, setPassState, setZFactor, setZOffset, size, updatePass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean initialised
protected Vector3f direction
protected float shadowMapScale
protected float dis
Constructor Detail |
---|
public DirectionalShadowMapPass(Vector3f direction)
direction
- The direction of the light casting the shadowspublic DirectionalShadowMapPass(Vector3f direction, int shadowMapSize)
shadowMapSize
- The size of the shadow map texturedirection
- The direction of the light casting the shadowsMethod Detail |
---|
public void setShadowAlpha(float alpha)
col
- The colour of the shadows to be castpublic void setViewDistance(float dis)
dis
- The distance to be used for the shadow map camera (default =
500)public void setCullOccluders(boolean cullOccluders)
cullOccluders
- True if occluders should be culled against shadow map frustrumpublic void setShadowMapScale(float scale)
scale
- The scale used to stretch the shadow map across the scene.public void setViewTarget(Vector3f target)
target
- The target of the viewprotected void saveEnforcedStates()
protected void replaceEnforcedStates()
public void addOccluder(Spatial occluder)
occluder
- The spatial to add as an occluderpublic void init(Renderer r)
public GLSLShaderObjectsState getShader()
public void doRender(Renderer r)
doRender
in class Pass
Pass.doRender(com.jme.renderer.Renderer)
protected void renderShadowedScene(Renderer r)
r
- The renderer to useprotected void updateShadowMap(Renderer r)
r
- The renderer to being use to display this mapprotected void updateShadowCamera()
public void cleanUp()
cleanUp
in class Pass
Pass.cleanUp()
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |