* Deprecated ViewPort.setClearEnabled, since we have separate clear flags for each channel in the framebuffer

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7455 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 9c3b269061
commit 6b537307fd
  1. 4
      engine/src/core/com/jme3/app/Application.java
  2. 10
      engine/src/core/com/jme3/renderer/RenderManager.java
  3. 26
      engine/src/core/com/jme3/renderer/ViewPort.java
  4. 4
      engine/src/desktop-fx/com/jme3/water/SimpleWaterProcessor.java
  5. 2
      engine/src/desktop-fx/com/jme3/water/WaterFilter.java
  6. 4
      engine/src/test/jme3test/niftygui/TestNiftyToMesh.java
  7. 2
      engine/src/test/jme3test/post/TestMultiRenderTarget.java
  8. 2
      engine/src/test/jme3test/post/TestRenderToMemory.java
  9. 2
      engine/src/test/jme3test/post/TestRenderToTexture.java
  10. 6
      engine/src/test/jme3test/renderer/TestMultiViews.java

@ -201,12 +201,12 @@ public class Application implements SystemListener {
//Remy - 09/14/2010 setted the timer in the renderManager
renderManager.setTimer(timer);
viewPort = renderManager.createMainView("Default", cam);
viewPort.setClearEnabled(true);
viewPort.setClearFlags(true, true, true);
// Create a new cam for the gui
Camera guiCam = new Camera(settings.getWidth(), settings.getHeight());
guiViewPort = renderManager.createPostView("Gui Default", guiCam);
guiViewPort.setClearEnabled(false);
guiViewPort.setClearFlags(false, false, false);
}
/**

@ -691,11 +691,13 @@ public class RenderManager {
renderer.setFrameBuffer(vp.getOutputFrameBuffer());
setCamera(vp.getCamera(), false);
if (vp.isClearEnabled()) {
renderer.setBackgroundColor(vp.getBackgroundColor());
if (vp.isClearDepth() || vp.isClearColor() || vp.isClearStencil()) {
if (vp.isClearColor()){
renderer.setBackgroundColor(vp.getBackgroundColor());
}
renderer.clearBuffers(vp.isClearColor(),
vp.isClearDepth(),
vp.isClearStencil());
vp.isClearDepth(),
vp.isClearStencil());
}
List<Spatial> scenes = vp.getScenes();

@ -50,8 +50,7 @@ public class ViewPort {
protected FrameBuffer out = null;
protected final ColorRGBA backColor = new ColorRGBA(0,0,0,0);
protected boolean clearEnabled = false;
protected boolean clearDepth = true, clearColor = true, clearStencil = true;
protected boolean clearDepth = false, clearColor = false, clearStencil = false;
private boolean enabled = true;
public ViewPort(String name, Camera cam) {
@ -76,8 +75,24 @@ public class ViewPort {
processor.cleanup();
}
/**
* Does nothing.
* @deprecated Use {@link ViewPort#setClearColor(boolean) } and similar
* methods.
*/
@Deprecated
public boolean isClearEnabled() {
return clearEnabled;
return clearDepth && clearColor && clearStencil;
}
/**
* Does nothing.
* @deprecated Use {@link ViewPort#setClearColor(boolean) } and similar
* methods.
*/
@Deprecated
public void setClearEnabled(boolean clearEnabled) {
clearDepth = clearColor = clearStencil = clearEnabled;
}
public boolean isClearDepth() {
@ -104,12 +119,7 @@ public class ViewPort {
this.clearStencil = clearStencil;
}
public void setClearEnabled(boolean clearEnabled) {
this.clearEnabled = clearEnabled;
}
public void setClearFlags(boolean color, boolean depth, boolean stencil){
this.clearEnabled = true;
this.clearColor = color;
this.clearDepth = depth;
this.clearStencil = stencil;

@ -259,7 +259,7 @@ public class SimpleWaterProcessor implements SceneProcessor {
// create a pre-view. a view that is rendered before the main view
reflectionView = new ViewPort("Reflection View", reflectionCam);
reflectionView.setClearEnabled(true);
reflectionView.setClearFlags(true, true, true);
reflectionView.setBackgroundColor(ColorRGBA.Black);
// create offscreen framebuffer
reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
@ -275,7 +275,7 @@ public class SimpleWaterProcessor implements SceneProcessor {
// create a pre-view. a view that is rendered before the main view
refractionView = new ViewPort("Refraction View", refractionCam);
refractionView.setClearEnabled(true);
refractionView.setClearFlags(true, true, true);
refractionView.setBackgroundColor(ColorRGBA.Black);
// create offscreen framebuffer
refractionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);

@ -188,7 +188,7 @@ public class WaterFilter extends Filter {
reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth);
reflectionCam = new Camera(reflectionMapSize, reflectionMapSize);
reflectionView = new ViewPort("reflectionView", reflectionCam);
reflectionView.setClearEnabled(true);
reflectionView.setClearFlags(true, true, true);
reflectionView.attachScene(reflectionScene);
reflectionView.setOutputFrameBuffer(reflectionPass.getRenderFrameBuffer());
plane = new Plane(Vector3f.UNIT_Y, new Vector3f(0, waterHeight, 0).dot(Vector3f.UNIT_Y));

@ -58,7 +58,7 @@ public class TestNiftyToMesh extends SimpleApplication{
public void simpleInitApp() {
ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
niftyView.setClearEnabled(true);
niftyView.setClearFlags(true, true, true);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
@ -76,7 +76,7 @@ public class TestNiftyToMesh extends SimpleApplication{
tex.setMagFilter(MagFilter.Bilinear);
fb.setColorTexture(tex);
niftyView.setClearEnabled(true);
niftyView.setClearFlags(true, true, true);
niftyView.setOutputFrameBuffer(fb);
Box b = new Box(Vector3f.ZERO, 1, 1, 1);

@ -116,7 +116,7 @@ public class TestMultiRenderTarget extends SimpleApplication implements ScenePro
public void initialize(RenderManager rm, ViewPort vp) {
reshape(vp, vp.getCamera().getWidth(), vp.getCamera().getHeight());
viewPort.setOutputFrameBuffer(fb);
guiViewPort.setClearEnabled(true);
guiViewPort.setClearFlags(true, true, true);
guiNode.attachChild(display);
// guiNode.attachChild(display1);
// guiNode.attachChild(display2);

@ -176,7 +176,7 @@ public class TestRenderToMemory extends SimpleApplication implements SceneProces
// create a pre-view. a view that is rendered before the main view
offView = renderManager.createPreView("Offscreen View", offCamera);
offView.setBackgroundColor(ColorRGBA.DarkGray);
offView.setClearEnabled(true);
offView.setClearFlags(true, true, true);
// this will let us know when the scene has been rendered to the
// frame buffer

@ -69,7 +69,7 @@ public class TestRenderToTexture extends SimpleApplication implements ActionList
Camera offCamera = new Camera(512, 512);
offView = renderManager.createPreView("Offscreen View", offCamera);
offView.setClearEnabled(true);
offView.setClearFlags(true, true, true);
offView.setBackgroundColor(ColorRGBA.DarkGray);
// create offscreen framebuffer

@ -73,7 +73,7 @@ public class TestMultiViews extends SimpleApplication {
cam2.setRotation(new Quaternion(0.0010108891f, 0.99857414f, -0.04928594f, 0.020481428f));
ViewPort view2 = renderManager.createMainView("Bottom Left", cam2);
view2.setClearEnabled(true);
view2.setClearFlags(true, true, true);
view2.attachScene(rootNode);
// Setup third view
@ -83,7 +83,7 @@ public class TestMultiViews extends SimpleApplication {
cam3.setRotation(new Quaternion(0.004381671f, 0.72363687f, -0.69015175f, 0.0045953835f));
ViewPort view3 = renderManager.createMainView("Top Left", cam3);
view3.setClearEnabled(true);
view3.setClearFlags(true, true, true);
view3.attachScene(rootNode);
// Setup fourth view
@ -93,7 +93,7 @@ public class TestMultiViews extends SimpleApplication {
cam4.setRotation(new Quaternion(0.02356979f, -0.74957186f, 0.026729556f, 0.66096294f));
ViewPort view4 = renderManager.createMainView("Top Right", cam4);
view4.setClearEnabled(true);
view4.setClearFlags(true, true, true);
view4.attachScene(rootNode);
}
}

Loading…
Cancel
Save