/** * Creates a SpotLight Shadow Filter * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) the more quality, the less fps). */ public SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new SpotLightShadowRenderer(assetManager, shadowMapSize)); }
/** * Sets the light to use to cast shadows * * @param light a SpotLight */ public void setLight(SpotLight light) { shadowRenderer.setLight(light); }
/** * return the light used to cast shadows * * @return the SpotLight */ public SpotLight getLight() { return shadowRenderer.getLight(); }
final SpotLightShadowRenderer slsr = new SpotLightShadowRenderer(assetManager, 512); slsr.setLight(spot); slsr.setShadowIntensity(0.5f); slsr.setShadowZExtend(100); slsr.setShadowZFadeLength(5); slsr.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON); viewPort.addProcessor(slsr);
rootNode.addLight(pl); SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024); shadows.setLight(sl); shadows.setShadowIntensity(0.3f); shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8); viewPort.addProcessor(shadows);
rootNode.addLight(spotLight); slsr = new SpotLightShadowRenderer(assetManager, SHADOWMAP_SIZE); slsr.setLight(spotLight); slsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
/** * Create a SpotLightShadowRenderer This use standard shadow mapping * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) the more quality, the less fps). */ public SpotLightShadowRenderer(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, 1); init(shadowMapSize); }
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { Vector3f[] points2 = points.clone(); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points, shadowMapIndex)); ShadowUtil.updateFrustumPoints2(shadowCam, points2); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points2, shadowMapIndex)); }
rootNode.addLight(lamp_light); SpotLightShadowRenderer slsr = new SpotLightShadowRenderer(assetManager, 512); slsr.setLight(spot); slsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest); slsr.setShadowIntensity(0.6f); viewPort.addProcessor(slsr);
@Override public void cloneFields(final Cloner cloner, final Object original) { light = cloner.clone(light); init((int) shadowMapSize); super.cloneFields(cloner, original); }
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { Vector3f[] points2 = points.clone(); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points, shadowMapIndex)); ShadowUtil.updateFrustumPoints2(shadowCam, points2); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points2, shadowMapIndex)); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); zFarOverride = ic.readInt("zFarOverride", 0); light = (SpotLight) ic.readSavable("light", null); fadeInfo = (Vector2f) ic.readSavable("fadeInfo", null); fadeLength = ic.readFloat("fadeLength", 0f); init((int) shadowMapSize); }
/** * Creates a SpotLight Shadow Filter * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) the more quality, the less fps). */ public SpotLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new SpotLightShadowRenderer(assetManager, shadowMapSize)); }
/** * Sets the light to use to cast shadows * * @param light a SpotLight */ public void setLight(SpotLight light) { shadowRenderer.setLight(light); }
/** * return the light used to cast shadows * * @return the SpotLight */ public SpotLight getLight() { return shadowRenderer.getLight(); }
/** * Create a SpotLightShadowRenderer This use standard shadow mapping * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) the more quality, the less fps). */ public SpotLightShadowRenderer(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, 1); init(shadowMapSize); }
@Override public void cloneFields(final Cloner cloner, final Object original) { light = cloner.clone(light); init((int) shadowMapSize); super.cloneFields(cloner, original); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); zFarOverride = ic.readInt("zFarOverride", 0); light = (SpotLight) ic.readSavable("light", null); fadeInfo = (Vector2f) ic.readSavable("fadeInfo", null); fadeLength = ic.readFloat("fadeLength", 0f); init((int) shadowMapSize); }