Filter Pass can now render its own depth buffer

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8088 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
rem..om 2011-08-25 16:41:28 +00:00
parent 367c9c3799
commit 27c5b3cfb0

View File

@ -99,14 +99,22 @@ public abstract class Filter implements Savable {
* @param depthBufferFormat
* @param numSamples
*/
public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat, int numSamples) {
public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat, int numSamples, boolean renderDepth) {
Collection<Caps> caps = renderer.getCaps();
if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample) && caps.contains(Caps.OpenGL31)) {
renderFrameBuffer = new FrameBuffer(width, height, numSamples);
renderedTexture = new Texture2D(width, height, numSamples, textureFormat);
if(renderDepth){
depthTexture = new Texture2D(width, height, numSamples, depthBufferFormat);
renderFrameBuffer.setDepthTexture(depthTexture);
}
} else {
renderFrameBuffer = new FrameBuffer(width, height, 1);
renderedTexture = new Texture2D(width, height, textureFormat);
if(renderDepth){
depthTexture = new Texture2D(width, height, depthBufferFormat);
renderFrameBuffer.setDepthTexture(depthTexture);
}
}
renderFrameBuffer.setColorTexture(renderedTexture);
@ -125,6 +133,10 @@ public abstract class Filter implements Savable {
public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat) {
init(renderer, width, height, textureFormat, depthBufferFormat, 1);
}
public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat, int numSamples) {
init(renderer, width, height, textureFormat, depthBufferFormat, numSamples, false);
}
/**
* init the pass called internally