public abstract class AbstractShadowRendererVR extends java.lang.Object implements SceneProcessor, Savable
Modifier and Type | Field and Description |
---|---|
protected AssetManager |
assetManager |
protected boolean |
debug |
protected Picture[] |
dispPic |
protected Texture2D |
dummyTex |
protected EdgeFilteringMode |
edgeFilteringMode |
protected float |
edgesThickness |
protected Vector2f |
fadeInfo |
protected float |
fadeLength |
protected RenderState |
forcedRenderState |
protected Camera |
frustumCam |
protected GeometryList |
lightReceivers |
protected Matrix4f[] |
lightViewProjectionsMatrices |
protected java.util.List<Material> |
matCache
list of materials for post shadow queue geometries
|
protected int |
nbShadowMaps |
protected boolean |
needsfallBackMaterial
true if the fallback material should be used, otherwise false
|
protected Material |
postshadowMat |
protected java.lang.String |
postTechniqueName
name of the post material technique
|
protected Material |
preshadowMat |
protected AppProfiler |
profiler |
protected boolean |
renderBackFacesShadows |
protected RenderManager |
renderManager |
protected CompareMode |
shadowCompareMode |
protected FrameBuffer[] |
shadowFB |
protected float |
shadowIntensity |
protected GeometryList |
shadowMapOccluders |
protected Texture2D[] |
shadowMaps |
protected float |
shadowMapSize |
protected boolean |
skipPostPass
true to skip the post pass when there are no shadow casters
|
protected ViewPort |
viewPort |
protected float |
zFarOverride
fade shadows at distance
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractShadowRendererVR()
used for serialization
|
protected |
AbstractShadowRendererVR(AssetManager assetManager,
int shadowMapSize,
int nbShadowMaps)
Create an abstract shadow renderer.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
checkCulling(Camera viewCam)
returns true if the light source bounding box is in the view frustum
|
void |
cleanup()
Called when the SP is removed from the RM.
|
protected abstract void |
clearMaterialParameters(Material material)
This method is called once per frame and is responsible for clearing any
material parameters that subclasses may need to clear on the post material.
|
protected Geometry |
createFrustum(Vector3f[] pts,
int i)
debug function to create a visible frustum
|
void |
displayDebug()
For debugging purposes, "snapshot" the current frustum to the scene.
|
void |
displayFrustum()
Force the frustum to be displayed.
|
protected void |
displayShadowMap(Renderer r)
For debugging purposes, display depth shadow maps.
|
protected void |
doDisplayFrustumDebug(int shadowMapIndex)
responsible for displaying the frustum of the shadow cam for debug
purpose
|
EdgeFilteringMode |
getEdgeFilteringMode()
Get the edge filtering mode.
|
int |
getEdgesThickness()
returns the edges thickness
|
protected abstract GeometryList |
getOccludersToRender(int shadowMapIndex,
GeometryList shadowMapOccluders)
Returns a subclass-specific geometryList containing the occluders to be
rendered in the shadow map
|
RenderState |
getPreShadowForcedRenderState()
Returns the pre shadows pass render state.
|
protected abstract void |
getReceivers(GeometryList lightReceivers) |
protected abstract Camera |
getShadowCam(int shadowMapIndex)
return the shadow camera to use for rendering the shadow map according
the given index
|
CompareMode |
getShadowCompareMode()
returns the shadow compare mode
|
float |
getShadowIntensity()
Returns the shadow intensity.
|
float |
getShadowZExtend()
How far the shadows are rendered in the view
|
float |
getShadowZFadeLength()
get the length over which the shadow will fade out when using a
shadowZextend
|
protected void |
initForcedRenderState() |
protected abstract void |
initFrustumCam()
delegates the initialization of the frustum cam to child renderers
|
void |
initialize(RenderManager rm,
ViewPort vp)
Initialize this shadow renderer prior to its first update.
|
boolean |
isFlushQueues()
Deprecated.
This method does nothing now and is kept only for backward compatibility.
|
boolean |
isInitialized()
Test whether this shadow renderer has been initialized.
|
boolean |
isRenderBackFacesShadows()
if this processor renders back faces shadows
|
void |
postFrame(FrameBuffer out)
Called after a frame has been rendered and the queue flushed.
|
void |
postQueue(RenderQueue rq)
Called after the scene graph has been queued, but before it is flushed.
|
void |
preFrame(float tpf)
Called before a frame
|
void |
read(JmeImporter im)
De-serialize this instance, for example when loading from a J3O file.
|
protected void |
renderShadowMap(int shadowMapIndex) |
void |
reshape(ViewPort vp,
int w,
int h)
Called when the resolution of the viewport has been changed.
|
void |
setEdgeFilteringMode(EdgeFilteringMode filterMode)
Sets the filtering mode for shadow edges.
|
void |
setEdgesThickness(int edgesThickness)
Sets the shadow edges thickness.
|
void |
setFlushQueues(boolean flushQueues)
Deprecated.
This method does nothing now and is kept only for backward compatibility.
|
protected abstract void |
setMaterialParameters(Material material)
This method is called once per frame and is responsible for setting any
material parameters that subclasses may need to set on the post material.
|
protected void |
setPostShadowMaterial(Material postShadowMat)
set the post shadow material for this renderer
|
protected void |
setPostShadowParams()
for internal use only
|
void |
setProfiler(AppProfiler profiler)
Sets a profiler Instance for this processor.
|
void |
setRenderBackFacesShadows(java.lang.Boolean renderBackFacesShadows)
Set to true if you want back faces shadows on geometries.
|
void |
setShadowCompareMode(CompareMode compareMode)
Sets the shadow compare mode.
|
void |
setShadowIntensity(float shadowIntensity)
Set the shadowIntensity.
|
void |
setShadowZExtend(float zFar)
Set the distance from the eye where the shadows will be rendered default
value is dynamically computed to the shadow casters/receivers union bound
zFar, capped to view frustum far value.
|
void |
setShadowZFadeLength(float length)
Define the length over which the shadow will fade out when using a
shadowZextend This is useful to make dynamic shadows fade into baked
shadows in the distance.
|
protected abstract void |
updateShadowCams(Camera viewCam)
Invoked once per frame to update the shadow cams according to the light
view.
|
void |
write(JmeExporter ex)
Serialize this instance, for example when saving to a J3O file.
|
protected int nbShadowMaps
protected float shadowMapSize
protected float shadowIntensity
protected RenderManager renderManager
protected ViewPort viewPort
protected FrameBuffer[] shadowFB
protected Texture2D[] shadowMaps
protected Texture2D dummyTex
protected Material preshadowMat
protected Material postshadowMat
protected Matrix4f[] lightViewProjectionsMatrices
protected AssetManager assetManager
protected boolean debug
protected float edgesThickness
protected EdgeFilteringMode edgeFilteringMode
protected CompareMode shadowCompareMode
protected Picture[] dispPic
protected RenderState forcedRenderState
protected boolean renderBackFacesShadows
protected AppProfiler profiler
protected boolean needsfallBackMaterial
protected java.lang.String postTechniqueName
protected java.util.List<Material> matCache
protected GeometryList lightReceivers
protected GeometryList shadowMapOccluders
protected float zFarOverride
protected Vector2f fadeInfo
protected float fadeLength
protected Camera frustumCam
protected boolean skipPostPass
protected AbstractShadowRendererVR()
protected AbstractShadowRendererVR(AssetManager assetManager, int shadowMapSize, int nbShadowMaps)
assetManager
- the application asset managershadowMapSize
- the size of the rendered shadow maps (512,1024,2048,
etc...)nbShadowMaps
- the number of shadow maps rendered (the more shadow
maps the more quality, the fewer fps).protected void initForcedRenderState()
protected final void setPostShadowMaterial(Material postShadowMat)
postShadowMat
- public final void setEdgeFilteringMode(EdgeFilteringMode filterMode)
EdgeFilteringMode
for more info.filterMode
- the desired filter mode (not null)public EdgeFilteringMode getEdgeFilteringMode()
public final void setShadowCompareMode(CompareMode compareMode)
CompareMode
for more info.compareMode
- the desired compare mode (not null)public CompareMode getShadowCompareMode()
CompareMode
protected Geometry createFrustum(Vector3f[] pts, int i)
public void initialize(RenderManager rm, ViewPort vp)
initialize
in interface SceneProcessor
rm
- the render managervp
- the viewportprotected abstract void initFrustumCam()
public boolean isInitialized()
isInitialized
in interface SceneProcessor
protected abstract void updateShadowCams(Camera viewCam)
viewCam
- the scene camprotected abstract GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders)
shadowMapIndex
- the index of the shadow map being renderedshadowMapOccluders
- the list of occludersprotected abstract Camera getShadowCam(int shadowMapIndex)
shadowMapIndex
- the index of the shadow map being renderedpublic void setProfiler(AppProfiler profiler)
SceneProcessor
setProfiler
in interface SceneProcessor
profiler
- the profiler instance.protected void doDisplayFrustumDebug(int shadowMapIndex)
shadowMapIndex
- public void postQueue(RenderQueue rq)
SceneProcessor
postQueue
in interface SceneProcessor
rq
- The render queueprotected void renderShadowMap(int shadowMapIndex)
public void displayFrustum()
protected void displayShadowMap(Renderer r)
public void displayDebug()
protected abstract void getReceivers(GeometryList lightReceivers)
public void postFrame(FrameBuffer out)
SceneProcessor
postFrame
in interface SceneProcessor
out
- The FB to which the scene was rendered.protected abstract void clearMaterialParameters(Material material)
material
- the material that was used for the post shadow passprotected abstract void setMaterialParameters(Material material)
material
- the material to use for the post shadow passprotected void setPostShadowParams()
public float getShadowZExtend()
setShadowZExtend(float zFar)
public void setShadowZExtend(float zFar)
zFar
- the zFar values that override the computed onepublic void setShadowZFadeLength(float length)
length
- the fade length in world unitspublic float getShadowZFadeLength()
protected abstract boolean checkCulling(Camera viewCam)
public void preFrame(float tpf)
SceneProcessor
preFrame
in interface SceneProcessor
tpf
- Time per framepublic void cleanup()
SceneProcessor
cleanup
in interface SceneProcessor
public void reshape(ViewPort vp, int w, int h)
SceneProcessor
reshape
in interface SceneProcessor
public float getShadowIntensity()
setShadowIntensity(float shadowIntensity)
public final void setShadowIntensity(float shadowIntensity)
shadowIntensity
- the darkness of the shadowpublic int getEdgesThickness()
setEdgesThickness(int edgesThickness)
public void setEdgesThickness(int edgesThickness)
edgesThickness
- the shadow edges thickness.@Deprecated public boolean isFlushQueues()
false
@Deprecated public void setFlushQueues(boolean flushQueues)
flushQueues
- any boolean.public RenderState getPreShadowForcedRenderState()
public void setRenderBackFacesShadows(java.lang.Boolean renderBackFacesShadows)
Material.setBoolean(String, boolean)
This also will automatically adjust the faceCullMode and the PolyOffset of the pre shadow pass.
You can modify them by using getPreShadowForcedRenderState()
renderBackFacesShadows
- true or false.public boolean isRenderBackFacesShadows()
public void read(JmeImporter im) throws java.io.IOException
public void write(JmeExporter ex) throws java.io.IOException