Skip to content

Commit 14bb821

Browse files
authored
xxxLightShadowFilter: format code + javadoc (#2204)
DirectionalLightShadowFilter, DirectionalLightShadowFilter, SpotLightShadowFilter, PointLightShadowFilter : format code + javadoc
1 parent 52dc934 commit 14bb821

File tree

3 files changed

+56
-71
lines changed

3 files changed

+56
-71
lines changed

jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java

+28-33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -40,49 +40,43 @@
4040
import java.io.IOException;
4141

4242
/**
43-
*
4443
* This Filter does basically the same as a DirectionalLightShadowRenderer
4544
* except it renders the post shadow pass as a fullscreen quad pass instead of a
4645
* geometry pass. It's mostly faster than PssmShadowRenderer as long as you have
4746
* more than about ten shadow receiving objects. The expense is the drawback
4847
* that the shadow Receive mode set on spatial is ignored. So basically all and
49-
* only objects that render depth in the scene receive shadows. See this post
50-
* for more details
51-
* http://jmonkeyengine.org/groups/general-2/forum/topic/silly-question-about-shadow-rendering/#post-191599
48+
* only objects that render depth in the scene receive shadows.
5249
*
53-
* API is basically the same as the PssmShadowRenderer;
50+
* API is basically the same as the PssmShadowRenderer.
5451
*
5552
* @author Rémy Bouquet aka Nehon
5653
*/
5754
public class DirectionalLightShadowFilter extends AbstractShadowFilter<DirectionalLightShadowRenderer> {
5855

5956
/**
60-
* Used for serialization.
61-
* Use DirectionalLightShadowFilter#DirectionalLightShadowFilter
62-
* (AssetManager assetManager, int shadowMapSize, int nbSplits)
63-
* instead.
57+
* For serialization only. Do not use.
58+
*
59+
* @see #DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int nbSplits)
6460
*/
6561
public DirectionalLightShadowFilter() {
6662
super();
6763
}
6864

6965
/**
70-
* Creates a DirectionalLight shadow filter. More info on the
71-
* technique at <a
72-
* href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a>
73-
*
74-
* @param assetManager the application's asset manager
75-
* @param shadowMapSize the size of the rendered shadowmaps (512, 1024, 2048,
76-
* etcetera)
77-
* @param nbSplits the number of shadow maps rendered (More shadow maps mean
78-
* better quality, fewer frames per second.)
66+
* Creates a DirectionalLightShadowFilter.
67+
*
68+
* @param assetManager the application's asset manager
69+
* @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...)
70+
* @param nbSplits the number of shadow maps rendered (more shadow maps = better quality, but slower)
71+
*
72+
* @throws IllegalArgumentException if the provided 'nbSplits' is not within the valid range of 1 to 4.
7973
*/
8074
public DirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int nbSplits) {
8175
super(assetManager, shadowMapSize, new DirectionalLightShadowRenderer(assetManager, shadowMapSize, nbSplits));
8276
}
8377

8478
/**
85-
* return the light used to cast shadows
79+
* Returns the light used to cast shadows.
8680
*
8781
* @return the DirectionalLight
8882
*/
@@ -91,7 +85,7 @@ public DirectionalLight getLight() {
9185
}
9286

9387
/**
94-
* Sets the light to use to cast shadows
88+
* Sets the light to use to cast shadows.
9589
*
9690
* @param light a DirectionalLight
9791
*/
@@ -100,7 +94,7 @@ public void setLight(DirectionalLight light) {
10094
}
10195

10296
/**
103-
* returns the lambda parameter
97+
* Returns the lambda parameter.
10498
*
10599
* @see #setLambda(float lambda)
106100
* @return lambda
@@ -110,24 +104,25 @@ public float getLambda() {
110104
}
111105

112106
/**
113-
* Adjusts the partition of the shadow extend into shadow maps.
114-
* Lambda is usually between 0 and 1.
115-
* A low value gives a more linear partition,
116-
* resulting in consistent shadow quality over the extend,
117-
* but near shadows could look very jagged.
118-
* A high value gives a more logarithmic partition,
119-
* resulting in high quality for near shadows,
120-
* but quality decreases rapidly with distance.
107+
* Adjusts the partition of the shadow extend into shadow maps. Lambda is
108+
* usually between 0 and 1.
109+
* <p>
110+
* A low value gives a more linear partition, resulting in consistent shadow
111+
* quality over the extend, but near shadows could look very jagged. A high
112+
* value gives a more logarithmic partition, resulting in high quality for near
113+
* shadows, but quality decreases rapidly with distance.
114+
* <p>
121115
* The default value is 0.65 (the theoretical optimum).
122116
*
123-
* @param lambda the lambda value.
117+
* @param lambda the lambda value
124118
*/
125119
public void setLambda(float lambda) {
126120
shadowRenderer.setLambda(lambda);
127121
}
128122

129123
/**
130-
* returns true if stabilization is enabled
124+
* Returns true if stabilization is enabled.
125+
*
131126
* @return true if stabilization is enabled
132127
*/
133128
public boolean isEnabledStabilization() {
@@ -150,7 +145,6 @@ public void write(JmeExporter ex) throws IOException {
150145
super.write(ex);
151146
OutputCapsule oc = ex.getCapsule(this);
152147
oc.write(shadowRenderer, "shadowRenderer", null);
153-
154148
}
155149

156150
@Override
@@ -159,4 +153,5 @@ public void read(JmeImporter im) throws IOException {
159153
InputCapsule ic = im.getCapsule(this);
160154
shadowRenderer = (DirectionalLightShadowRenderer) ic.readSavable("shadowRenderer", null);
161155
}
156+
162157
}

jme3-core/src/main/java/com/jme3/shadow/PointLightShadowFilter.java

+14-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -40,56 +40,51 @@
4040
import java.io.IOException;
4141

4242
/**
43-
*
4443
* This Filter does basically the same as a PointLightShadowRenderer except it
4544
* renders the post shadow pass as a fullscreen quad pass instead of a geometry
4645
* pass. It's mostly faster than PointLightShadowRenderer as long as you have
4746
* more than about ten shadow receiving objects. The expense is the drawback
4847
* that the shadow Receive mode set on spatial is ignored. So basically all and
49-
* only objects that render depth in the scene receive shadows. See this post
50-
* for more details
51-
* http://jmonkeyengine.org/groups/general-2/forum/topic/silly-question-about-shadow-rendering/#post-191599
48+
* only objects that render depth in the scene receive shadows.
5249
*
53-
* API is basically the same as the PssmShadowRenderer;
50+
* API is basically the same as the PssmShadowRenderer.
5451
*
5552
* @author Rémy Bouquet aka Nehon
5653
*/
5754
public class PointLightShadowFilter extends AbstractShadowFilter<PointLightShadowRenderer> {
5855

5956
/**
60-
* Used for serialization.
61-
* Use PointLightShadowFilter#PointLightShadowFilter(AssetManager
62-
* assetManager, int shadowMapSize)
63-
* instead.
57+
* For serialization only. Do not use.
58+
*
59+
* @see #PointLightShadowFilter(AssetManager assetManager, int shadowMapSize)
6460
*/
6561
protected PointLightShadowFilter() {
6662
super();
6763
}
6864

6965
/**
70-
* Creates a PointLightShadowFilter
66+
* Creates a PointLightShadowFilter.
7167
*
72-
* @param assetManager the application asset manager
73-
* @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048,
74-
* etc...)
68+
* @param assetManager the application's asset manager
69+
* @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...)
7570
*/
7671
public PointLightShadowFilter(AssetManager assetManager, int shadowMapSize) {
7772
super(assetManager, shadowMapSize, new PointLightShadowRenderer(assetManager, shadowMapSize));
7873
}
7974

8075
/**
81-
* gets the point light used to cast shadows with this processor
76+
* Returns the light used to cast shadows.
8277
*
83-
* @return the point light
78+
* @return the PointLight
8479
*/
8580
public PointLight getLight() {
8681
return shadowRenderer.getLight();
8782
}
8883

8984
/**
90-
* sets the light to use for casting shadows with this processor
85+
* Sets the light to use to cast shadows.
9186
*
92-
* @param light the point light
87+
* @param light the PointLight
9388
*/
9489
public void setLight(PointLight light) {
9590
shadowRenderer.setLight(light);
@@ -100,7 +95,6 @@ public void write(JmeExporter ex) throws IOException {
10095
super.write(ex);
10196
OutputCapsule oc = ex.getCapsule(this);
10297
oc.write(shadowRenderer, "shadowRenderer", null);
103-
10498
}
10599

106100
@Override
@@ -109,4 +103,5 @@ public void read(JmeImporter im) throws IOException {
109103
InputCapsule ic = im.getCapsule(this);
110104
shadowRenderer = (PointLightShadowRenderer) ic.readSavable("shadowRenderer", null);
111105
}
106+
112107
}

jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java

+14-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -40,45 +40,40 @@
4040
import java.io.IOException;
4141

4242
/**
43-
*
4443
* This Filter does basically the same as a SpotLightShadowRenderer except it
4544
* renders the post shadow pass as a fullscreen quad pass instead of a geometry
4645
* pass. It's mostly faster than PssmShadowRenderer as long as you have more
4746
* than about ten shadow receiving objects. The expense is the drawback that
4847
* the shadow Receive mode set on spatial is ignored. So basically all and only
49-
* objects that render depth in the scene receive shadows. See this post for
50-
* more details
51-
* http://jmonkeyengine.org/groups/general-2/forum/topic/silly-question-about-shadow-rendering/#post-191599
48+
* objects that render depth in the scene receive shadows.
5249
*
53-
* API is basically the same as the PssmShadowRenderer;
50+
* API is basically the same as the PssmShadowRenderer.
5451
*
5552
* @author Rémy Bouquet aka Nehon
5653
*/
5754
public class SpotLightShadowFilter extends AbstractShadowFilter<SpotLightShadowRenderer> {
5855

5956
/**
60-
* Used for serialization.
61-
* Use SpotLightShadowFilter#SpotLightShadowFilter(AssetManager assetManager,
62-
* int shadowMapSize)
63-
* instead.
57+
* For serialization only. Do not use.
58+
*
59+
* @see #SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize)
6460
*/
6561
protected SpotLightShadowFilter() {
6662
super();
6763
}
6864

6965
/**
70-
* Creates a SpotLight Shadow Filter
66+
* Creates a SpotLightShadowFilter.
7167
*
72-
* @param assetManager the application asset manager
73-
* @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048,
74-
* etc...) The more quality, the fewer fps.
68+
* @param assetManager the application's asset manager
69+
* @param shadowMapSize the size of the rendered shadow maps (512, 1024, 2048, etc...)
7570
*/
7671
public SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize) {
7772
super(assetManager, shadowMapSize, new SpotLightShadowRenderer(assetManager, shadowMapSize));
7873
}
7974

8075
/**
81-
* return the light used to cast shadows
76+
* Returns the light used to cast shadows.
8277
*
8378
* @return the SpotLight
8479
*/
@@ -87,20 +82,19 @@ public SpotLight getLight() {
8782
}
8883

8984
/**
90-
* Sets the light to use to cast shadows
85+
* Sets the light to use to cast shadows.
9186
*
92-
* @param light a SpotLight
87+
* @param light the SpotLight
9388
*/
9489
public void setLight(SpotLight light) {
9590
shadowRenderer.setLight(light);
9691
}
97-
92+
9893
@Override
9994
public void write(JmeExporter ex) throws IOException {
10095
super.write(ex);
10196
OutputCapsule oc = ex.getCapsule(this);
10297
oc.write(shadowRenderer, "shadowRenderer", null);
103-
10498
}
10599

106100
@Override
@@ -109,4 +103,5 @@ public void read(JmeImporter im) throws IOException {
109103
InputCapsule ic = im.getCapsule(this);
110104
shadowRenderer = (SpotLightShadowRenderer) ic.readSavable("shadowRenderer", null);
111105
}
106+
112107
}

0 commit comments

Comments
 (0)