//Remy - 09/14/2010 setted the timer in the renderManager\r
renderManager.setTimer(timer);\r
viewPort = renderManager.createMainView("Default", cam);\r
- viewPort.setClearEnabled(true);\r
+ viewPort.setClearFlags(true, true, true);\r
\r
// Create a new cam for the gui\r
Camera guiCam = new Camera(settings.getWidth(), settings.getHeight());\r
guiViewPort = renderManager.createPostView("Gui Default", guiCam);\r
- guiViewPort.setClearEnabled(false);\r
+ guiViewPort.setClearFlags(false, false, false);\r
}\r
\r
/**\r
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();
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) {
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() {
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;
// 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);
// 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);
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));
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,
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);
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);
// 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
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
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
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
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);
}
}