Fixed NPE in water filter when setting the reflection mapsize before the filter has been initialized

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10560 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent 9b33c7c851
commit 198adb0753
  1. 11
      engine/src/core-effects/com/jme3/water/WaterFilter.java

@ -853,10 +853,13 @@ public class WaterFilter extends Filter {
*/
public void setReflectionMapSize(int reflectionMapSize) {
this.reflectionMapSize = reflectionMapSize;
reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth);
reflectionCam.resize(reflectionMapSize, reflectionMapSize, true);
reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer());
material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture());
//if reflection pass is already initialized we must update it
if(reflectionPass != null){
reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth);
reflectionCam.resize(reflectionMapSize, reflectionMapSize, true);
reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer());
material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture());
}
}

Loading…
Cancel
Save