FilterPostProcessor now correctly clears the color of the previous render when rendering a new filter, except when in multiviewports.

This fixes the color bleeding when enabling AlphaToCoverage. (see post http://jmonkeyengine.org/groups/graphics/forum/topic/multi-sampling-issues/#post-183919)



git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9586 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent ce124e7729
commit ef6644b58f
  1. 17
      engine/src/core/com/jme3/post/FilterPostProcessor.java

@ -77,6 +77,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
private int originalHeight;
private int lastFilterIndex = -1;
private boolean cameraInit = false;
private boolean clearColor= true;
/**
* Create a FilterProcessor
@ -99,7 +100,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
*/
public void addFilter(Filter filter) {
if (filter == null) {
throw new IllegalArgumentException( "Filter cannot be null." );
throw new IllegalArgumentException("Filter cannot be null.");
}
filters.add(filter);
@ -117,7 +118,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
*/
public void removeFilter(Filter filter) {
if (filter == null) {
throw new IllegalArgumentException( "Filter cannot be null." );
throw new IllegalArgumentException("Filter cannot be null.");
}
filters.remove(filter);
filter.cleanup(renderer);
@ -196,7 +197,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
renderManager.setCamera(filterCam, true);
r.setFrameBuffer(buff);
r.clearBuffers(false, true, true);
r.clearBuffers(clearColor, true, true);
renderManager.renderGeometry(fsQuad);
}
@ -392,6 +393,16 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
height = (int) (h * (Math.abs(bottom - top)));
width = Math.max(1, width);
height = Math.max(1, height);
//Testing original versus actual viewport dimension.
//If they are different we are in a multiview situation and color from other view port must not be cleared.
//However, not clearing the color can cause issues when AlphaToCoverage is active on the renderer.
if(originalWidth!=width || originalHeight!=height){
clearColor = false;
}else{
clearColor = true;
}
cam.resize(width, height, false);
cameraInit = true;
computeDepth = false;

Loading…
Cancel
Save