/** * Creates a PointLightShadowFilter * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) */ public PointLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new PointLightShadowRenderer(assetManager, shadowMapSize)); }
/** * sets the light to use for casting shadows with this processor * * @param light the point light */ public void setLight(PointLight light) { shadowRenderer.setLight(light); }
/** * gets the point light used to cast shadows with this processor * * @return the point light */ public PointLight getLight() { return shadowRenderer.getLight(); }
plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE); plsr.setLight((PointLight) scene.getLocalLightList().get(0)); plsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4); plsr.setShadowZExtend(15); plsr.setShadowZFadeLength(5); plsr.setShadowIntensity(0.9f); plsr.displayDebug(); viewPort.addProcessor(plsr);
viewPort.addProcessor(slsr); PointLightShadowRenderer plsr = new PointLightShadowRenderer(assetManager, 512); plsr.setLight(lamp_light); plsr.setShadowIntensity(0.6f); plsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest); viewPort.addProcessor(plsr);
plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE); plsr.setLight((PointLight) scene.getLocalLightList().get(0)); plsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
/** * Creates a PointLightShadowRenderer * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) */ public PointLightShadowRenderer(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, CAM_NUMBER); init(shadowMapSize); }
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { if (frustums == null) { frustums = new Geometry[CAM_NUMBER]; Vector3f[] points = new Vector3f[8]; for (int i = 0; i < 8; i++) { points[i] = new Vector3f(); } for (int i = 0; i < CAM_NUMBER; i++) { ShadowUtil.updateFrustumPoints2(shadowCams[i], points); frustums[i] = createFrustum(points, i); } } if (frustums[shadowMapIndex].getParent() == null) { ((Node) viewPort.getScenes().get(0)).attachChild(frustums[shadowMapIndex]); } }
@Override public void onAction(String name, boolean isPressed, float tpf) { if ((name.equals("ShadowUp") || name.equals("ShadowDown")) && isPressed) { al.setColor(ColorRGBA.White.mult((1 - plsr.getShadowIntensity()) * 0.2f)); } } }
@Override public void cloneFields(final Cloner cloner, final Object original) { light = cloner.clone(light); init((int) shadowMapSize); frustums = null; super.cloneFields(cloner, original); }
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { if (frustums == null) { frustums = new Geometry[CAM_NUMBER]; Vector3f[] points = new Vector3f[8]; for (int i = 0; i < 8; i++) { points[i] = new Vector3f(); } for (int i = 0; i < CAM_NUMBER; i++) { ShadowUtil.updateFrustumPoints2(shadowCams[i], points); frustums[i] = createFrustum(points, i); } } if (frustums[shadowMapIndex].getParent() == null) { ((Node) viewPort.getScenes().get(0)).attachChild(frustums[shadowMapIndex]); } }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); light = (PointLight) ic.readSavable("light", null); init((int) shadowMapSize); }
/** * sets the light to use for casting shadows with this processor * * @param light the point light */ public void setLight(PointLight light) { shadowRenderer.setLight(light); }
/** * Creates a PointLightShadowFilter * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) */ public PointLightShadowFilter(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, new PointLightShadowRenderer(assetManager, shadowMapSize)); }
/** * gets the point light used to cast shadows with this processor * * @return the point light */ public PointLight getLight() { return shadowRenderer.getLight(); }
/** * Creates a PointLightShadowRenderer * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) */ public PointLightShadowRenderer(AssetManager assetManager, int shadowMapSize) { super(assetManager, shadowMapSize, CAM_NUMBER); init(shadowMapSize); }
@Override public void cloneFields(final Cloner cloner, final Object original) { light = cloner.clone(light); init((int) shadowMapSize); frustums = null; super.cloneFields(cloner, original); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); light = (PointLight) ic.readSavable("light", null); init((int) shadowMapSize); }