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
This commit is contained in:
parent
ce124e7729
commit
ef6644b58f
@ -77,6 +77,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
private int originalHeight;
|
private int originalHeight;
|
||||||
private int lastFilterIndex = -1;
|
private int lastFilterIndex = -1;
|
||||||
private boolean cameraInit = false;
|
private boolean cameraInit = false;
|
||||||
|
private boolean clearColor= true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a FilterProcessor
|
* Create a FilterProcessor
|
||||||
@ -99,7 +100,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
*/
|
*/
|
||||||
public void addFilter(Filter filter) {
|
public void addFilter(Filter filter) {
|
||||||
if (filter == null) {
|
if (filter == null) {
|
||||||
throw new IllegalArgumentException( "Filter cannot be null." );
|
throw new IllegalArgumentException("Filter cannot be null.");
|
||||||
}
|
}
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
*/
|
*/
|
||||||
public void removeFilter(Filter filter) {
|
public void removeFilter(Filter filter) {
|
||||||
if (filter == null) {
|
if (filter == null) {
|
||||||
throw new IllegalArgumentException( "Filter cannot be null." );
|
throw new IllegalArgumentException("Filter cannot be null.");
|
||||||
}
|
}
|
||||||
filters.remove(filter);
|
filters.remove(filter);
|
||||||
filter.cleanup(renderer);
|
filter.cleanup(renderer);
|
||||||
@ -196,7 +197,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
|
|
||||||
renderManager.setCamera(filterCam, true);
|
renderManager.setCamera(filterCam, true);
|
||||||
r.setFrameBuffer(buff);
|
r.setFrameBuffer(buff);
|
||||||
r.clearBuffers(false, true, true);
|
r.clearBuffers(clearColor, true, true);
|
||||||
renderManager.renderGeometry(fsQuad);
|
renderManager.renderGeometry(fsQuad);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -392,6 +393,16 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
height = (int) (h * (Math.abs(bottom - top)));
|
height = (int) (h * (Math.abs(bottom - top)));
|
||||||
width = Math.max(1, width);
|
width = Math.max(1, width);
|
||||||
height = Math.max(1, height);
|
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);
|
cam.resize(width, height, false);
|
||||||
cameraInit = true;
|
cameraInit = true;
|
||||||
computeDepth = false;
|
computeDepth = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user