Skip to content

Commit 5ca191d

Browse files
authored
Update AbstractShadowFilter.java
1 parent 8751505 commit 5ca191d

File tree

1 file changed

+12
-34
lines changed

1 file changed

+12
-34
lines changed

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

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
package com.jme3.shadow;
3333

3434
import com.jme3.asset.AssetManager;
35-
import com.jme3.export.InputCapsule;
36-
import com.jme3.export.JmeExporter;
37-
import com.jme3.export.JmeImporter;
38-
import com.jme3.export.OutputCapsule;
3935
import com.jme3.material.Material;
4036
import com.jme3.material.RenderState;
4137
import com.jme3.math.Matrix4f;
@@ -48,35 +44,34 @@
4844
import com.jme3.util.clone.Cloner;
4945
import com.jme3.util.clone.JmeCloneable;
5046

51-
import java.io.IOException;
52-
5347
/**
5448
* Generic abstract filter that holds common implementations for the different
5549
* shadow filters
5650
*
57-
* @author Rémy Bouquet aka Nehon
51+
* @author Nehon
5852
*/
59-
public abstract class AbstractShadowFilter<T extends AbstractShadowRenderer> extends Filter implements Cloneable, JmeCloneable {
53+
public abstract class AbstractShadowFilter<T extends AbstractShadowRenderer> extends Filter implements JmeCloneable {
6054

6155
protected T shadowRenderer;
6256
protected ViewPort viewPort;
6357

58+
private final Vector4f tempVec4 = new Vector4f();
59+
private final Matrix4f tempMat4 = new Matrix4f();
60+
6461
/**
6562
* For serialization only. Do not use.
6663
*/
6764
protected AbstractShadowFilter() {
6865
}
6966

7067
/**
71-
* Abstract class constructor
68+
* Creates an AbstractShadowFilter. Subclasses invoke this constructor.
7269
*
73-
* @param manager the application asset manager
74-
* @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048,
75-
* etc...)
76-
* @param shadowRenderer the shadowRenderer to use for this Filter
70+
* @param assetManager The application's asset manager.
71+
* @param shadowMapSize The size of the rendered shadow maps (e.g., 512, 1024, 2048).
72+
* @param shadowRenderer The shadowRenderer to use for this Filter
7773
*/
78-
@SuppressWarnings("all")
79-
protected AbstractShadowFilter(AssetManager manager, int shadowMapSize, T shadowRenderer) {
74+
protected AbstractShadowFilter(AssetManager assetManager, int shadowMapSize, T shadowRenderer) {
8075
super("Post Shadow");
8176
this.shadowRenderer = shadowRenderer;
8277
// this is legacy setting for shadows with backface shadows
@@ -93,18 +88,12 @@ protected boolean isRequiresDepthTexture() {
9388
return true;
9489
}
9590

96-
public Material getShadowMaterial() {
97-
return material;
98-
}
99-
100-
Vector4f tmpv = new Vector4f();
101-
10291
@Override
10392
protected void preFrame(float tpf) {
10493
shadowRenderer.preFrame(tpf);
105-
material.setMatrix4("ViewProjectionMatrixInverse", viewPort.getCamera().getViewProjectionMatrix().invert());
10694
Matrix4f m = viewPort.getCamera().getViewProjectionMatrix();
107-
material.setVector4("ViewProjectionMatrixRow2", tmpv.set(m.m20, m.m21, m.m22, m.m23));
95+
material.setMatrix4("ViewProjectionMatrixInverse", tempMat4.set(m).invertLocal());
96+
material.setVector4("ViewProjectionMatrixRow2", tempVec4.set(m.m20, m.m21, m.m22, m.m23));
10897
}
10998

11099
@Override
@@ -337,15 +326,4 @@ public void cloneFields(final Cloner cloner, final Object original) {
337326
shadowRenderer.setPostShadowMaterial(material);
338327
}
339328

340-
@Override
341-
public void write(JmeExporter ex) throws IOException {
342-
super.write(ex);
343-
OutputCapsule oc = ex.getCapsule(this);
344-
}
345-
346-
@Override
347-
public void read(JmeImporter im) throws IOException {
348-
super.read(im);
349-
InputCapsule ic = im.getCapsule(this);
350-
}
351329
}

0 commit comments

Comments
 (0)