Package com.jme3.shadow
Class SdsmDirectionalLightShadowRenderer
java.lang.Object
com.jme3.shadow.AbstractShadowRenderer
com.jme3.shadow.SdsmDirectionalLightShadowRenderer
- All Implemented Interfaces:
Savable,SceneProcessor,JmeCloneable,Cloneable
-
Field Summary
Fields inherited from class com.jme3.shadow.AbstractShadowRenderer
assetManager, debug, debugfrustums, dispPic, dummyTex, edgeFilteringMode, edgesThickness, fadeInfo, fadeLength, forcedRenderState, frustumCam, lightReceivers, lightViewProjectionsMatrices, logger, matCache, nbShadowMaps, needsfallBackMaterial, postshadowMat, postTechniqueName, preshadowMat, prof, renderBackFacesShadows, renderManager, shadowCompareMode, shadowFB, shadowIntensity, shadowMapOccluders, shadowMaps, shadowMapSize, shadowMapStringCache, skipPostPass, viewPort, zFarOverride -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUsed for serialization.SdsmDirectionalLightShadowRenderer(AssetManager assetManager, int shadowMapSize, int nbShadowMaps) Creates an SDSM directional light shadow renderer. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckCulling(Camera viewCam) Abstract method to check if the light source's bounding box is within the view frustum of the given camera.voidcleanup()Cleans up GPU resources used by the SDSM fitter.protected voidclearMaterialParameters(Material material) This method is called once per frame and is responsible for clearing any material parameters that subclasses may have set on the post-shadow material.voidcloneFields(Cloner cloner, Object original) Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner.voidprotected voiddoDisplayFrustumDebug(int shadowMapIndex) Responsible for displaying the frustum of the shadow camera for debugging purposes.floatGets the fit expansion factor.floatGets the frame delay tolerance for reusing old fit results.getLight()Returns the light used to cast shadows.protected GeometryListgetOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders) Returns a subclass-specificGeometryListcontaining the occluders that should be rendered into the shadow map.protected voidgetReceivers(GeometryList lightReceivers) Populates the providedGeometryListwith geometries that are considered shadow receivers.protected CameragetShadowCam(int shadowMapIndex) Returns the shadow camera to use for rendering the shadow map according to the given index.protected voidDelegates the initialization of the frustum camera to child renderers.voidread(JmeImporter im) De-serialize this instance, for example when loading from a J3O file.voidsetDepthTexture(Texture depthTexture) voidsetFitExpansionFactor(float fitExpansionFactor) Sets the expansion factor for fitted shadow frustums.voidsetFitFrameDelayTolerance(float fitFrameDelayTolerance) Sets the tolerance for reusing old fit results.voidsetLight(DirectionalLight light) Sets the light to use for casting shadows.protected voidsetMaterialParameters(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 voidFor internal use only.protected voidupdateShadowCams(Camera viewCam) Invoked once per frame to update the shadow cameras according to the light view.voidwrite(JmeExporter ex) Serialize this instance, for example when saving to a J3O file.Methods inherited from class com.jme3.shadow.AbstractShadowRenderer
createFrustum, displayDebug, displayFrustum, displayShadowMap, getEdgeFilteringMode, getEdgesThickness, getNumShadowMaps, getPreShadowForcedRenderState, getSceneForDebug, getShadowCompareMode, getShadowIntensity, getShadowMapSize, getShadowZExtend, getShadowZFadeLength, initForcedRenderState, initialize, isFlushQueues, isInitialized, isRenderBackFacesShadows, jmeClone, postFrame, postQueue, preFrame, renderShadowMap, reshape, setEdgeFilteringMode, setEdgesThickness, setPostShadowMaterial, setProfiler, setRenderBackFacesShadows, setShadowCompareMode, setShadowIntensity, setShadowZExtend, setShadowZFadeLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jme3.post.SceneProcessor
rescale
-
Constructor Details
-
SdsmDirectionalLightShadowRenderer
protected SdsmDirectionalLightShadowRenderer()Used for serialization. Do not use.- See Also:
-
SdsmDirectionalLightShadowRenderer
public SdsmDirectionalLightShadowRenderer(AssetManager assetManager, int shadowMapSize, int nbShadowMaps) Creates an SDSM directional light shadow renderer. You likely should not use this directly, as it requires an SdsmDirectionalLightShadowFilter.
-
-
Method Details
-
getLight
Returns the light used to cast shadows. -
setLight
Sets the light to use for casting shadows. -
setDepthTexture
-
getFitExpansionFactor
public float getFitExpansionFactor()Gets the fit expansion factor.- Returns:
- the expansion factor
-
setFitExpansionFactor
public void setFitExpansionFactor(float fitExpansionFactor) Sets the expansion factor for fitted shadow frustums.A value of 1.0 uses the exact computed bounds. Larger values (e.g., 1.05) add some margin to reduce artifacts from frame delay or precision issues.
- Parameters:
fitExpansionFactor- the expansion factor (default 1.0)
-
getFitFrameDelayTolerance
public float getFitFrameDelayTolerance()Gets the frame delay tolerance for reusing old fit results.- Returns:
- the tolerance value
-
setFitFrameDelayTolerance
public void setFitFrameDelayTolerance(float fitFrameDelayTolerance) Sets the tolerance for reusing old fit results.When the camera hasn't moved significantly (within this tolerance), old fit results can be reused to avoid GPU stalls.
- Parameters:
fitFrameDelayTolerance- the tolerance (default 0.05)
-
initFrustumCam
protected void initFrustumCam()Description copied from class:AbstractShadowRendererDelegates the initialization of the frustum camera to child renderers. This camera defines the view for calculating shadow frustums.- Specified by:
initFrustumCamin classAbstractShadowRenderer
-
updateShadowCams
Description copied from class:AbstractShadowRendererInvoked once per frame to update the shadow cameras according to the light view. Subclasses must implement this method to define how shadow cameras are positioned and oriented.- Specified by:
updateShadowCamsin classAbstractShadowRenderer- Parameters:
viewCam- The main scene camera.
-
getOccludersToRender
Description copied from class:AbstractShadowRendererReturns a subclass-specificGeometryListcontaining the occluders that should be rendered into the shadow map.- Specified by:
getOccludersToRenderin classAbstractShadowRenderer- Parameters:
shadowMapIndex- The index of the shadow map being rendered.shadowMapOccluders- An existingGeometryListthat can be reused or populated.- Returns:
- A
GeometryListcontaining the geometries that cast shadows for the given map.
-
getReceivers
Description copied from class:AbstractShadowRendererPopulates the providedGeometryListwith geometries that are considered shadow receivers. Subclasses must implement this method.- Specified by:
getReceiversin classAbstractShadowRenderer- Parameters:
lightReceivers- TheGeometryListto populate with shadow-receiving geometries.
-
getShadowCam
Description copied from class:AbstractShadowRendererReturns the shadow camera to use for rendering the shadow map according to the given index. Subclasses must implement this to provide the correct camera for each shadow map.- Specified by:
getShadowCamin classAbstractShadowRenderer- Parameters:
shadowMapIndex- The index of the shadow map being rendered.- Returns:
- The
Camerainstance representing the shadow's viewpoint.
-
doDisplayFrustumDebug
protected void doDisplayFrustumDebug(int shadowMapIndex) Description copied from class:AbstractShadowRendererResponsible for displaying the frustum of the shadow camera for debugging purposes. Subclasses can override this method to provide specific debug visualizations.- Overrides:
doDisplayFrustumDebugin classAbstractShadowRenderer- Parameters:
shadowMapIndex- The index of the shadow map for which to display the frustum.
-
displayAllDebugFrustums
public void displayAllDebugFrustums() -
setMaterialParameters
Description copied from class:AbstractShadowRendererThis method is called once per frame and is responsible for setting any material parameters that subclasses may need to set on the post material.- Specified by:
setMaterialParametersin classAbstractShadowRenderer- Parameters:
material- the material to use for the post shadow pass
-
clearMaterialParameters
Description copied from class:AbstractShadowRendererThis method is called once per frame and is responsible for clearing any material parameters that subclasses may have set on the post-shadow material. This ensures that parameters from previous frames or other renderers do not interfere.- Specified by:
clearMaterialParametersin classAbstractShadowRenderer- Parameters:
material- The material that was used for the post-shadow pass.
-
setPostShadowParams
protected void setPostShadowParams()Description copied from class:AbstractShadowRendererFor internal use only. Sets the common shadow parameters on the internal post-shadow material. This is used when a fallback material is needed.- Overrides:
setPostShadowParamsin classAbstractShadowRenderer
-
checkCulling
Description copied from class:AbstractShadowRendererAbstract method to check if the light source's bounding box is within the view frustum of the given camera. This is used for culling to avoid unnecessary shadow computations.- Specified by:
checkCullingin classAbstractShadowRenderer- Parameters:
viewCam- ACamerato define the view frustum against which to check.- Returns:
- True if the light source's bounding box is in the view frustum, otherwise false.
-
cleanup
public void cleanup()Cleans up GPU resources used by the SDSM fitter.- Specified by:
cleanupin interfaceSceneProcessor- Overrides:
cleanupin classAbstractShadowRenderer
-
cloneFields
Description copied from interface:JmeCloneableImplemented to perform deep cloning for this object, resolving local cloned references using the specified cloner. The object can call cloner.clone(fieldValue) to deep clone any of its fields.Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
- Specified by:
cloneFieldsin interfaceJmeCloneable- Overrides:
cloneFieldsin classAbstractShadowRenderer- Parameters:
cloner- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.original- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
-
read
Description copied from class:AbstractShadowRendererDe-serialize this instance, for example when loading from a J3O file.- Specified by:
readin interfaceSavable- Overrides:
readin classAbstractShadowRenderer- Parameters:
im- importer (not null)- Throws:
IOException- from the importer
-
write
Description copied from class:AbstractShadowRendererSerialize this instance, for example when saving to a J3O file.- Specified by:
writein interfaceSavable- Overrides:
writein classAbstractShadowRenderer- Parameters:
ex- exporter (not null)- Throws:
IOException- from the exporter
-