From 5aef90da47d2a1242074243210fb30dabe0ff183 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Mon, 15 Jan 2018 17:18:21 +0100 Subject: [PATCH] Fix Shadow Filters not having a default constructor and hence not being deserializable. --- .../java/com/jme3/shadow/AbstractShadowFilter.java | 6 ++++++ .../com/jme3/shadow/DirectionalLightShadowFilter.java | 10 ++++++++++ .../java/com/jme3/shadow/PointLightShadowFilter.java | 10 ++++++++++ .../java/com/jme3/shadow/PointLightShadowRenderer.java | 5 +++-- .../main/java/com/jme3/shadow/PssmShadowFilter.java | 10 ++++++++++ .../java/com/jme3/shadow/SpotLightShadowFilter.java | 10 ++++++++++ 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java index aa80fa0c6..f9e0bb3a1 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java @@ -62,6 +62,12 @@ public abstract class AbstractShadowFilter ext protected T shadowRenderer; protected ViewPort viewPort; + /** + * used for serialization + */ + protected AbstractShadowFilter(){ + } + /** * Abstract class constructor * 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 844755cb7..7e822b9c4 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowFilter.java @@ -56,6 +56,16 @@ import java.io.IOException; */ public class DirectionalLightShadowFilter extends AbstractShadowFilter { + /** + * Used for serialzation. + * Use DirectionalLightShadowFilter#DirectionalLightShadowFilter + * (AssetManager assetManager, int shadowMapSize, int nbSplits) + * instead. + */ + public DirectionalLightShadowFilter() { + super(); + } + /** * Creates a DirectionalLightShadowFilter Shadow Filter More info on the * technique at { + /** + * Used for serialization. + * Use PointLightShadowFilter#PointLightShadowFilter(AssetManager + * assetManager, int shadowMapSize) + * instead. + */ + public PointLightShadowFilter() { + super(); + } + /** * Creates a PointLightShadowFilter * diff --git a/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowRenderer.java index 407f72367..a16c4353b 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/PointLightShadowRenderer.java @@ -63,9 +63,10 @@ public class PointLightShadowRenderer extends AbstractShadowRenderer { private Geometry[] frustums = null; /** - * Used for serialization use - * PointLightShadowRenderer"PointLightShadowRenderer(AssetManager + * Used for serialization. + * Use PointLightShadowRenderer#PointLightShadowRenderer(AssetManager * assetManager, int shadowMapSize) + * instead. */ public PointLightShadowRenderer() { super(); diff --git a/jme3-core/src/main/java/com/jme3/shadow/PssmShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/PssmShadowFilter.java index eecd9a28a..169425dc1 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/PssmShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/PssmShadowFilter.java @@ -69,6 +69,16 @@ public class PssmShadowFilter extends Filter { private PssmShadowRenderer pssmRenderer; private ViewPort viewPort; + /** + * Used for serialization. + * Use PssmShadowFilter#PssmShadowFilter(AssetManager + * assetManager, int size, int nbSplits) + * instead. + */ + public PssmShadowFilter() { + super(); + } + /** * Creates a PSSM Shadow Filter * More info on the technique at http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html 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 11126467d..58c410e10 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowFilter.java @@ -56,6 +56,16 @@ import java.io.IOException; */ public class SpotLightShadowFilter extends AbstractShadowFilter { + /** + * Used for serialization. + * Use SpotLightShadowFilter#SpotLightShadowFilter(AssetManager assetManager, + * int shadowMapSize) + * instead. + */ + public SpotLightShadowFilter() { + super(); + } + /** * Creates a SpotLight Shadow Filter *