* Fixed crash in TestDepthOfField

* Moved Remy's render state hack to filter processor where it belongs

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7603 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 068b6a9943
commit a8533e5378
  1. 9
      engine/src/core/com/jme3/post/FilterPostProcessor.java
  2. 2
      engine/src/core/com/jme3/renderer/RenderContext.java
  3. 2
      engine/src/core/com/jme3/renderer/RenderManager.java
  4. 1
      engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java
  5. 2
      engine/src/test/jme3test/post/TestDepthOfField.java
  6. 2
      engine/src/test/jme3test/post/TestRenderToMemory.java

@ -40,7 +40,7 @@ import com.jme3.export.InputCapsule;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import com.jme3.material.Material;
import com.jme3.post.filters.TranslucentBucketFilter;
import com.jme3.material.RenderState;
import com.jme3.renderer.Camera;
import com.jme3.renderer.Caps;
import com.jme3.renderer.RenderManager;
@ -164,9 +164,12 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
filterCam.resize(buff.getWidth(), buff.getHeight(), true);
fsQuad.setPosition(0, 0);
}
if (mat.getAdditionalRenderState().isDepthWrite()) {
mat.getAdditionalRenderState().setDepthTest(false);
mat.getAdditionalRenderState().setDepthWrite(false);
}
fsQuad.setMaterial(mat);
fsQuad.updateGeometricState();
@ -174,6 +177,10 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
r.setFrameBuffer(buff);
r.clearBuffers(false, true, true);
renderManager.renderGeometry(fsQuad);
//re applying default render state at the end of the render
// to avoid depth write issues, MUST BE A BETTER WAY
r.applyRenderState(RenderState.DEFAULT);
}
public boolean isInitialized() {

@ -54,7 +54,7 @@ public class RenderContext {
public boolean alphaTestEnabled = false;
public boolean depthWriteEnabled = false;
public boolean depthWriteEnabled = true;
public boolean colorWriteEnabled = true;

@ -423,8 +423,6 @@ public class RenderManager {
} else {
g.getMaterial().render(g, this);
}
//re applying default render state at the end of the render to avoid depth write issues, MUST BE A BETTER WAY
renderer.applyRenderState(RenderState.DEFAULT);
}
public void renderGeometryList(GeometryList gl) {

@ -548,6 +548,7 @@ public class LwjglRenderer implements Renderer {
context.polyOffsetUnits = 0;
}
}
if (state.getFaceCullMode() != context.cullMode) {
if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) {
glDisable(GL_CULL_FACE);

@ -161,7 +161,7 @@ public class TestDepthOfField extends SimpleApplication {
rock.setWrap(WrapMode.Repeat);
matRock.setTexture("DiffuseMap_2", rock);
matRock.setFloat("DiffuseMap_2_scale", 128);
Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.png");
Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
normalMap0.setWrap(WrapMode.Repeat);
Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
normalMap1.setWrap(WrapMode.Repeat);

@ -59,8 +59,6 @@ import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.awt.image.WritableRaster;
import java.nio.ByteBuffer;
import javax.swing.JFrame;
import javax.swing.JPanel;

Loading…
Cancel
Save