diff --git a/engine/src/core-effects/com/jme3/post/filters/BloomFilter.java b/engine/src/core-effects/com/jme3/post/filters/BloomFilter.java index 770e7f448..cddc7c0a7 100644 --- a/engine/src/core-effects/com/jme3/post/filters/BloomFilter.java +++ b/engine/src/core-effects/com/jme3/post/filters/BloomFilter.java @@ -41,6 +41,7 @@ import com.jme3.math.ColorRGBA; import com.jme3.post.Filter; import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; +import com.jme3.renderer.queue.RenderQueue; import com.jme3.texture.Image.Format; import java.io.IOException; import java.util.ArrayList; @@ -91,6 +92,8 @@ public class BloomFilter extends Filter { private Material hBlurMat; private int screenWidth; private int screenHeight; + private RenderManager renderManager; + private ViewPort viewPort; /** * Creates a Bloom filter @@ -110,6 +113,8 @@ public class BloomFilter extends Filter { @Override protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) { + this.renderManager = renderManager; + this.viewPort = vp; screenWidth = (int) Math.max(1, (w / downSamplingFactor)); screenHeight = (int) Math.max(1, (h / downSamplingFactor)); // System.out.println(screenWidth + " " + screenHeight); @@ -186,7 +191,7 @@ public class BloomFilter extends Filter { } @Override - protected void postQueue(RenderManager renderManager, ViewPort viewPort) { + protected void postQueue(RenderQueue queue) { if (glowMode != GlowMode.Scene) { renderManager.getRenderer().setBackgroundColor(ColorRGBA.BlackNoAlpha); renderManager.getRenderer().setFrameBuffer(preGlowPass.getRenderFrameBuffer()); diff --git a/engine/src/core-effects/com/jme3/post/filters/CartoonEdgeFilter.java b/engine/src/core-effects/com/jme3/post/filters/CartoonEdgeFilter.java index 3e9998ba7..a107f5bb2 100644 --- a/engine/src/core-effects/com/jme3/post/filters/CartoonEdgeFilter.java +++ b/engine/src/core-effects/com/jme3/post/filters/CartoonEdgeFilter.java @@ -39,6 +39,7 @@ import com.jme3.post.Filter.Pass; import com.jme3.renderer.RenderManager; import com.jme3.renderer.Renderer; import com.jme3.renderer.ViewPort; +import com.jme3.renderer.queue.RenderQueue; import com.jme3.texture.Image.Format; /** @@ -56,6 +57,8 @@ public class CartoonEdgeFilter extends Filter { private float normalSensitivity = 1.0f; private float depthSensitivity = 10.0f; private ColorRGBA edgeColor = new ColorRGBA(0, 0, 0, 1); + private RenderManager renderManager; + private ViewPort viewPort; /** * Creates a CartoonEdgeFilter @@ -70,7 +73,7 @@ public class CartoonEdgeFilter extends Filter { } @Override - protected void postQueue(RenderManager renderManager, ViewPort viewPort) { + protected void postQueue(RenderQueue queue) { Renderer r = renderManager.getRenderer(); r.setFrameBuffer(normalPass.getRenderFrameBuffer()); renderManager.getRenderer().clearBuffers(true, true, true); @@ -88,6 +91,8 @@ public class CartoonEdgeFilter extends Filter { @Override protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) { + this.renderManager = renderManager; + this.viewPort = vp; normalPass = new Pass(); normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth); material = new Material(manager, "Common/MatDefs/Post/CartoonEdge.j3md"); diff --git a/engine/src/core-effects/com/jme3/post/filters/LightScatteringFilter.java b/engine/src/core-effects/com/jme3/post/filters/LightScatteringFilter.java index 953f10a66..8ac9d8733 100644 --- a/engine/src/core-effects/com/jme3/post/filters/LightScatteringFilter.java +++ b/engine/src/core-effects/com/jme3/post/filters/LightScatteringFilter.java @@ -42,6 +42,7 @@ import com.jme3.post.Filter; import com.jme3.renderer.Camera; import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; +import com.jme3.renderer.queue.RenderQueue; import java.io.IOException; /** @@ -62,6 +63,7 @@ public class LightScatteringFilter extends Filter { Vector3f viewLightPos = new Vector3f(); private boolean display = true; private float innerLightDensity; + private ViewPort viewPort; /** * creates a lightScaterring filter @@ -96,7 +98,7 @@ public class LightScatteringFilter extends Filter { } @Override - protected void postQueue(RenderManager renderManager, ViewPort viewPort) { + protected void postQueue(RenderQueue queue) { getClipCoordinates(lightPosition, screenLightPos, viewPort.getCamera()); // screenLightPos.x = screenLightPos.x / viewPort.getCamera().getWidth(); // screenLightPos.y = screenLightPos.y / viewPort.getCamera().getHeight(); @@ -128,6 +130,7 @@ public class LightScatteringFilter extends Filter { @Override protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) { + this.viewPort = vp; material = new Material(manager, "Common/MatDefs/Post/LightScattering.j3md"); } diff --git a/engine/src/core-effects/com/jme3/post/ssao/SSAOFilter.java b/engine/src/core-effects/com/jme3/post/ssao/SSAOFilter.java index 06ff26ec7..260b733b6 100644 --- a/engine/src/core-effects/com/jme3/post/ssao/SSAOFilter.java +++ b/engine/src/core-effects/com/jme3/post/ssao/SSAOFilter.java @@ -44,6 +44,7 @@ import com.jme3.post.Filter.Pass; import com.jme3.renderer.RenderManager; import com.jme3.renderer.Renderer; import com.jme3.renderer.ViewPort; +import com.jme3.renderer.queue.RenderQueue; import com.jme3.shader.VarType; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; @@ -75,6 +76,8 @@ public class SSAOFilter extends Filter { // private Material downSampleMat; // private Pass downSamplePass; private float downSampleFactor = 1f; + private RenderManager renderManager; + private ViewPort viewPort; /** * Create a Screen Space Ambient Occlusion Filter @@ -104,7 +107,7 @@ public class SSAOFilter extends Filter { } @Override - protected void postQueue(RenderManager renderManager, ViewPort viewPort) { + protected void postQueue(RenderQueue queue) { Renderer r = renderManager.getRenderer(); r.setFrameBuffer(normalPass.getRenderFrameBuffer()); renderManager.getRenderer().clearBuffers(true, true, true); @@ -121,6 +124,8 @@ public class SSAOFilter extends Filter { @Override protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) { + this.renderManager = renderManager; + this.viewPort = vp; int screenWidth = w; int screenHeight = h; postRenderPasses = new ArrayList(); diff --git a/engine/src/core/com/jme3/post/Filter.java b/engine/src/core/com/jme3/post/Filter.java index ff2f655ec..919bfe715 100644 --- a/engine/src/core/com/jme3/post/Filter.java +++ b/engine/src/core/com/jme3/post/Filter.java @@ -38,6 +38,7 @@ import com.jme3.renderer.Caps; import com.jme3.renderer.RenderManager; import com.jme3.renderer.Renderer; import com.jme3.renderer.ViewPort; +import com.jme3.renderer.queue.RenderQueue; import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; @@ -97,7 +98,7 @@ public abstract class Filter implements Savable { public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat, int numSamples, boolean renderDepth) { Collection caps = renderer.getCaps(); if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample) && caps.contains(Caps.OpenGL31)) { - renderFrameBuffer = new FrameBuffer(width, height, numSamples); + renderFrameBuffer = new FrameBuffer(width, height, numSamples); renderedTexture = new Texture2D(width, height, numSamples, textureFormat); renderFrameBuffer.setDepthBuffer(depthBufferFormat); if (renderDepth) { @@ -291,7 +292,7 @@ public abstract class Filter implements Savable { * @param renderManager * @param viewPort */ - protected void postQueue(RenderManager renderManager, ViewPort viewPort) { + protected void postQueue(RenderQueue queue) { } /** diff --git a/engine/src/core/com/jme3/post/FilterPostProcessor.java b/engine/src/core/com/jme3/post/FilterPostProcessor.java index 23d896abf..d3ffddced 100644 --- a/engine/src/core/com/jme3/post/FilterPostProcessor.java +++ b/engine/src/core/com/jme3/post/FilterPostProcessor.java @@ -211,7 +211,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { for (Iterator it = filters.iterator(); it.hasNext();) { Filter filter = it.next(); if (filter.isEnabled()) { - filter.postQueue(renderManager, viewPort); + filter.postQueue(rq); } }