Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xxxLightShadowFilter: format code + javadoc #2204

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -46,9 +46,7 @@
* geometry pass. It's mostly faster than PssmShadowRenderer as long as you have
* more than about ten shadow receiving objects. The expense is the drawback
* that the shadow Receive mode set on spatial is ignored. So basically all and
* only objects that render depth in the scene receive shadows. See this post
* for more details
* http://jmonkeyengine.org/groups/general-2/forum/topic/silly-question-about-shadow-rendering/#post-191599
* only objects that render depth in the scene receive shadows.
*
* API is basically the same as the PssmShadowRenderer;
*
Expand All @@ -57,32 +55,30 @@
public class DirectionalLightShadowFilter extends AbstractShadowFilter<DirectionalLightShadowRenderer> {

/**
* Used for serialization.
* Use DirectionalLightShadowFilter#DirectionalLightShadowFilter
* (AssetManager assetManager, int shadowMapSize, int nbSplits)
* instead.
* For serialization only. Do not use.
*
* @see #DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int nbSplits)
*/
public DirectionalLightShadowFilter() {
super();
}

/**
* Creates a DirectionalLight shadow filter. More info on the
* technique at <a
* href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a>
*
* @param assetManager the application's asset manager
* @param shadowMapSize the size of the rendered shadowmaps (512, 1024, 2048,
* etcetera)
* @param nbSplits the number of shadow maps rendered (More shadow maps mean
* better quality, fewer frames per second.)
* Creates a new instance of {@code DirectionalLightShadowFilter} with the
* specified parameters.
capdevon marked this conversation as resolved.
Show resolved Hide resolved
*
* @param assetManager the application's asset manager
* @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...)
* @param nbSplits the number of shadow maps rendered (more shadow maps = better quality, but slower)
*
* @throws IllegalArgumentException if the provided 'nbSplits' is not within the valid range of 1 to 4.
*/
public DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int nbSplits) {
super(assetManager, shadowMapSize, new DirectionalLightShadowRenderer(assetManager, shadowMapSize, nbSplits));
}

/**
* return the light used to cast shadows
* Returns the light used to cast shadows.
*
* @return the DirectionalLight
*/
Expand All @@ -91,7 +87,7 @@ public DirectionalLight getLight() {
}

/**
* Sets the light to use to cast shadows
* Sets the light to use to cast shadows.
*
* @param light a DirectionalLight
*/
Expand All @@ -100,7 +96,7 @@ public void setLight(DirectionalLight light) {
}

/**
* returns the lambda parameter
* Returns the lambda parameter.
*
* @see #setLambda(float lambda)
* @return lambda
Expand All @@ -110,24 +106,25 @@ public float getLambda() {
}

/**
* Adjusts the partition of the shadow extend into shadow maps.
* Lambda is usually between 0 and 1.
* A low value gives a more linear partition,
* resulting in consistent shadow quality over the extend,
* but near shadows could look very jagged.
* A high value gives a more logarithmic partition,
* resulting in high quality for near shadows,
* but quality decreases rapidly with distance.
* Adjusts the partition of the shadow extend into shadow maps. Lambda is
capdevon marked this conversation as resolved.
Show resolved Hide resolved
* usually between 0 and 1.
* <p>
* A low value gives a more linear partition, resulting in consistent shadow
* quality over the extend, but near shadows could look very jagged. A high
* value gives a more logarithmic partition, resulting in high quality for near
* shadows, but quality decreases rapidly with distance.
* <p>
* The default value is 0.65 (the theoretical optimum).
*
* @param lambda the lambda value.
* @param lambda the lambda value
*/
public void setLambda(float lambda) {
shadowRenderer.setLambda(lambda);
}

/**
* returns true if stabilization is enabled
* Returns true if stabilization is enabled.
*
* @return true if stabilization is enabled
*/
public boolean isEnabledStabilization() {
Expand All @@ -150,7 +147,6 @@ public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(shadowRenderer, "shadowRenderer", null);

}

@Override
Expand All @@ -159,4 +155,5 @@ public void read(JmeImporter im) throws IOException {
InputCapsule ic = im.getCapsule(this);
shadowRenderer = (DirectionalLightShadowRenderer) ic.readSavable("shadowRenderer", null);
}

}
Loading