From 2960dfe40c014d84c80a353b813073d6e50c84e6 Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 11:18:35 +0100 Subject: [PATCH 1/6] DirectionalLightShadowFilter: format code + javadoc DirectionalLightShadowFilter: format code + javadoc Update License year Removed broken links to unreachable sites --- .../shadow/DirectionalLightShadowFilter.java | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java index e9152594c0..3c314e8880 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java @@ -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 @@ -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; * @@ -57,32 +55,28 @@ public class DirectionalLightShadowFilter extends AbstractShadowFilter { /** - * 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 http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html - * - * @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. + * + * @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) */ public DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int nbSplits) { super(assetManager, shadowMapSize, new DirectionalLightShadowRenderer(assetManager, shadowMapSize, nbSplits)); } /** - * return the light used to cast shadows + * Return the light used to cast shadows. * * @return the DirectionalLight */ @@ -91,7 +85,7 @@ public DirectionalLight getLight() { } /** - * Sets the light to use to cast shadows + * Sets the light to use to cast shadows. * * @param light a DirectionalLight */ @@ -100,7 +94,7 @@ public void setLight(DirectionalLight light) { } /** - * returns the lambda parameter + * Returns the lambda parameter. * * @see #setLambda(float lambda) * @return lambda @@ -110,24 +104,22 @@ 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 + * 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. * 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() { @@ -150,7 +142,6 @@ public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); oc.write(shadowRenderer, "shadowRenderer", null); - } @Override @@ -159,4 +150,5 @@ public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); shadowRenderer = (DirectionalLightShadowRenderer) ic.readSavable("shadowRenderer", null); } + } From ef862815bb2e287d5d2f69a0f671d96c0b3d9cb4 Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 15:54:07 +0100 Subject: [PATCH 2/6] Update DirectionalLightShadowFilter.java javadoc --- .../main/java/com/jme3/shadow/DirectionalLightShadowFilter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java index 3c314e8880..f430de1740 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java @@ -70,6 +70,8 @@ public DirectionalLightShadowFilter() { * @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)); From dd3d33ed4d936ec748cbe9fb78b6c001b69e11e2 Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 15:58:03 +0100 Subject: [PATCH 3/6] Update DirectionalLightShadowFilter.java javadoc --- .../jme3/shadow/DirectionalLightShadowFilter.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java index f430de1740..1f77442cc3 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java @@ -78,7 +78,7 @@ public DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize } /** - * Return the light used to cast shadows. + * Returns the light used to cast shadows. * * @return the DirectionalLight */ @@ -107,10 +107,13 @@ 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. + * 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. + *

* The default value is 0.65 (the theoretical optimum). * * @param lambda the lambda value From 5f393cdaf57f050ff95b2704a0e8b95c07d5c608 Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 16:28:39 +0100 Subject: [PATCH 4/6] Update SpotLightShadowFilter: format code + javadoc --- .../jme3/shadow/SpotLightShadowFilter.java | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java index 3ed677a3d1..5bc1b4a0ba 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java @@ -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 @@ -40,45 +40,40 @@ import java.io.IOException; /** - * * This Filter does basically the same as a SpotLightShadowRenderer except it * renders the post shadow pass as a fullscreen quad pass instead of a 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 + * objects that render depth in the scene receive shadows. * - * API is basically the same as the PssmShadowRenderer; + * API is basically the same as the PssmShadowRenderer. * * @author Rémy Bouquet aka Nehon */ public class SpotLightShadowFilter extends AbstractShadowFilter { /** - * Used for serialization. - * Use SpotLightShadowFilter#SpotLightShadowFilter(AssetManager assetManager, - * int shadowMapSize) - * instead. + * For serialization only. Do not use. + * + * @see #SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize) */ protected SpotLightShadowFilter() { super(); } /** - * Creates a SpotLight Shadow Filter + * Creates a SpotLightShadowFilter. * - * @param assetManager the application asset manager - * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, - * etc...) The more quality, the fewer fps. + * @param assetManager the application's asset manager + * @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...) */ public SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new SpotLightShadowRenderer(assetManager, shadowMapSize)); } /** - * return the light used to cast shadows + * Returns the light used to cast shadows. * * @return the SpotLight */ @@ -87,20 +82,19 @@ public SpotLight getLight() { } /** - * Sets the light to use to cast shadows + * Sets the light to use to cast shadows. * - * @param light a SpotLight + * @param light the SpotLight */ public void setLight(SpotLight light) { shadowRenderer.setLight(light); } - + @Override public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); oc.write(shadowRenderer, "shadowRenderer", null); - } @Override @@ -109,4 +103,5 @@ public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); shadowRenderer = (SpotLightShadowRenderer) ic.readSavable("shadowRenderer", null); } + } From 048dde988cc66648e951c2828ed3864dad1bb6ee Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 16:29:30 +0100 Subject: [PATCH 5/6] Update PointLightShadowFilter: format code + javadoc --- .../jme3/shadow/PointLightShadowFilter.java | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowFilter.java index 184602d62d..ef5e3dc19c 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowFilter.java @@ -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 @@ -40,56 +40,51 @@ import java.io.IOException; /** - * * This Filter does basically the same as a PointLightShadowRenderer except it * renders the post shadow pass as a fullscreen quad pass instead of a geometry * pass. It's mostly faster than PointLightShadowRenderer 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; + * API is basically the same as the PssmShadowRenderer. * * @author Rémy Bouquet aka Nehon */ public class PointLightShadowFilter extends AbstractShadowFilter { /** - * Used for serialization. - * Use PointLightShadowFilter#PointLightShadowFilter(AssetManager - * assetManager, int shadowMapSize) - * instead. + * For serialization only. Do not use. + * + * @see #PointLightShadowFilter(AssetManager assetManager, int shadowMapSize) */ protected PointLightShadowFilter() { super(); } /** - * Creates a PointLightShadowFilter + * Creates a PointLightShadowFilter. * - * @param assetManager the application asset manager - * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, - * etc...) + * @param assetManager the application's asset manager + * @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...) */ public PointLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new PointLightShadowRenderer(assetManager, shadowMapSize)); } /** - * gets the point light used to cast shadows with this processor + * Returns the light used to cast shadows. * - * @return the point light + * @return the PointLight */ public PointLight getLight() { return shadowRenderer.getLight(); } /** - * sets the light to use for casting shadows with this processor + * Sets the light to use to cast shadows. * - * @param light the point light + * @param light the PointLight */ public void setLight(PointLight light) { shadowRenderer.setLight(light); @@ -100,7 +95,6 @@ public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); oc.write(shadowRenderer, "shadowRenderer", null); - } @Override @@ -109,4 +103,5 @@ public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); shadowRenderer = (PointLightShadowRenderer) ic.readSavable("shadowRenderer", null); } + } From 7e7f4ea95673228b4274105edb2b17c485feb311 Mon Sep 17 00:00:00 2001 From: Wyatt Gillette Date: Fri, 23 Feb 2024 16:30:35 +0100 Subject: [PATCH 6/6] Update DirectionalLightShadowFilter: javadoc --- .../java/com/jme3/shadow/DirectionalLightShadowFilter.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java index 1f77442cc3..4438e378c0 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java @@ -40,7 +40,6 @@ import java.io.IOException; /** - * * This Filter does basically the same as a DirectionalLightShadowRenderer * except it renders the post shadow pass as a fullscreen quad pass instead of a * geometry pass. It's mostly faster than PssmShadowRenderer as long as you have @@ -48,7 +47,7 @@ * that the shadow Receive mode set on spatial is ignored. So basically all and * only objects that render depth in the scene receive shadows. * - * API is basically the same as the PssmShadowRenderer; + * API is basically the same as the PssmShadowRenderer. * * @author Rémy Bouquet aka Nehon */ @@ -64,8 +63,7 @@ public DirectionalLightShadowFilter() { } /** - * Creates a new instance of {@code DirectionalLightShadowFilter} with the - * specified parameters. + * Creates a DirectionalLightShadowFilter. * * @param assetManager the application's asset manager * @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...)