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) { public void setReflectionMapSize(int reflectionMapSize) {
this.reflectionMapSize = reflectionMapSize; this.reflectionMapSize = reflectionMapSize;
reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth); //if reflection pass is already initialized we must update it
reflectionCam.resize(reflectionMapSize, reflectionMapSize, true); if(reflectionPass != null){
reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer()); reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth);
material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture()); reflectionCam.resize(reflectionMapSize, reflectionMapSize, true);
reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer());
material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture());
}
} }

Loading…
Cancel
Save