From bfa243a619d0a8a4c758a3099c00d747946b6b7f Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Mon, 30 Jan 2012 23:04:09 +0000 Subject: [PATCH] PssmShadowRenderer now have a contructor that takes a material as a parameter to override the post shadow material git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9123 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/shadow/PssmShadowRenderer.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/shadow/PssmShadowRenderer.java b/engine/src/core/com/jme3/shadow/PssmShadowRenderer.java index fb9924033..9fa95cb4b 100644 --- a/engine/src/core/com/jme3/shadow/PssmShadowRenderer.java +++ b/engine/src/core/com/jme3/shadow/PssmShadowRenderer.java @@ -147,8 +147,23 @@ public class PssmShadowRenderer implements SceneProcessor { * @param manager the application asset manager * @param size the size of the rendered shadowmaps (512,1024,2048, etc...) * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). + * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). */ public PssmShadowRenderer(AssetManager manager, int size, int nbSplits) { + this(manager, size, nbSplits, new Material(manager, "Common/MatDefs/Shadow/PostShadowPSSM.j3md")); + + } + + /** + * Create a PSSM Shadow Renderer + * More info on the technique at http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html + * @param manager the application asset manager + * @param size the size of the rendered shadowmaps (512,1024,2048, etc...) + * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). + * @param postShadowMat the material used for post shadows if you need to override it * + */ + //TODO remove the postShadowMat when we have shader injection....or remove this todo if we are in 2020. + public PssmShadowRenderer(AssetManager manager, int size, int nbSplits, Material postShadowMat) { assetManager = manager; nbSplits = Math.max(Math.min(nbSplits, 4), 1); this.nbSplits = nbSplits; @@ -164,7 +179,7 @@ public class PssmShadowRenderer implements SceneProcessor { dummyTex = new Texture2D(size, size, Format.RGBA8); preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md"); - postshadowMat = new Material(manager, "Common/MatDefs/Shadow/PostShadowPSSM.j3md"); + this.postshadowMat = postShadowMat; for (int i = 0; i < nbSplits; i++) { lightViewProjectionsMatrices[i] = new Matrix4f();