From 07a7d9ee2e95dcf8f73c9b0af7b554ae76246252 Mon Sep 17 00:00:00 2001 From: nadro Date: Thu, 15 Oct 2015 18:20:06 +0000 Subject: [PATCH] - Added clear buffer flags. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5151 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + examples/01.HelloWorld/main.cpp | 2 +- examples/02.Quake3Map/main.cpp | 2 +- examples/03.CustomSceneNode/main.cpp | 2 +- examples/04.Movement/main.cpp | 2 +- examples/05.UserInterface/main.cpp | 2 +- examples/06.2DGraphics/main.cpp | 2 +- examples/07.Collision/main.cpp | 2 +- examples/08.SpecialFX/main.cpp | 2 +- examples/09.Meshviewer/main.cpp | 2 +- examples/10.Shaders/main.cpp | 2 +- examples/11.PerPixelLighting/main.cpp | 2 +- examples/12.TerrainRendering/main.cpp | 2 +- examples/13.RenderToTexture/main.cpp | 6 +- examples/14.Win32Window/main.cpp | 4 +- examples/15.LoadIrrFile/main.cpp | 2 +- examples/16.Quake3MapShader/main.cpp | 2 +- examples/18.SplitScreen/main.cpp | 2 +- examples/19.MouseAndJoystick/main.cpp | 2 +- examples/20.ManagedLights/main.cpp | 2 +- examples/21.Quake3Explorer/main.cpp | 8 +- examples/22.MaterialViewer/main.cpp | 2 +- examples/23.SMeshHandling/main.cpp | 2 +- examples/24.CursorControl/main.cpp | 2 +- examples/25.XmlHandling/main.cpp | 2 +- examples/26.OcclusionQuery/main.cpp | 2 +- examples/30.Profiling/main.cpp | 2 +- examples/Demo/CDemo.cpp | 7 +- examples/Demo/CMainMenu.cpp | 2 +- include/IVideoDriver.h | 116 ++++++++++++------ include/SIrrCreationParameters.h | 4 +- include/irrlicht.h | 2 +- source/Irrlicht/CD3D9Driver.cpp | 50 +++----- source/Irrlicht/CD3D9Driver.h | 19 +-- source/Irrlicht/CNullDriver.cpp | 29 +---- source/Irrlicht/CNullDriver.h | 23 ++-- source/Irrlicht/COpenGLDriver.cpp | 103 +++++++--------- source/Irrlicht/COpenGLDriver.h | 19 +-- source/Irrlicht/CSoftwareDriver.cpp | 34 ++--- source/Irrlicht/CSoftwareDriver.h | 19 +-- source/Irrlicht/CSoftwareDriver2.cpp | 37 ++---- source/Irrlicht/CSoftwareDriver2.h | 19 +-- tests/2dmaterial.cpp | 6 +- tests/anti-aliasing.cpp | 2 +- tests/b3dAnimation.cpp | 4 +- tests/billboards.cpp | 4 +- tests/burningsVideo.cpp | 2 +- tests/createImage.cpp | 4 +- tests/draw2DImage.cpp | 16 +-- tests/drawPixel.cpp | 6 +- tests/drawRectOutline.cpp | 2 +- tests/drawVertexPrimitive.cpp | 2 +- tests/flyCircleAnimator.cpp | 2 +- tests/guiDisabledMenu.cpp | 2 +- tests/ioScene.cpp | 2 +- tests/lightMaps.cpp | 2 +- tests/lights.cpp | 2 +- tests/makeColorKeyTexture.cpp | 2 +- tests/material.cpp | 4 +- tests/md2Animation.cpp | 4 +- tests/meshTransform.cpp | 4 +- tests/mrt.cpp | 12 +- tests/orthoCam.cpp | 4 +- tests/planeMatrix.cpp | 2 +- tests/projectionMatrix.cpp | 2 +- tests/renderTargetTexture.cpp | 26 ++-- tests/sceneCollisionManager.cpp | 6 +- tests/screenshot.cpp | 2 +- tests/softwareDevice.cpp | 2 +- tests/stencilshadow.cpp | 4 +- tests/terrainSceneNode.cpp | 6 +- tests/testGeometryCreator.cpp | 4 +- tests/testUtils.cpp | 2 +- tests/textureFeatures.cpp | 6 +- tests/textureRenderStates.cpp | 22 ++-- tests/transparentMaterials.cpp | 12 +- tests/triangleSelector.cpp | 10 +- tests/userClipPlane.cpp | 2 +- tests/viewPort.cpp | 2 +- tests/writeImageToFile.cpp | 2 +- tools/GUIEditor/main.cpp | 2 +- .../IrrFontTool/newFontTool/CVectorFontTool.h | 8 +- tools/IrrFontTool/newFontTool/main.cpp | 2 +- 83 files changed, 340 insertions(+), 420 deletions(-) diff --git a/changes.txt b/changes.txt index 2027c59b..05efca17 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ -------------------------- Changes in 1.9 (not yet released) +- Add clear buffer flags and marked some methods used for clear buffers as deprecated. - Fix: CGUIImage no longer scales wrong when working with textures which don't have the original image size. - Fix CSoftwareTexture2 calculation for OriginalSize of ITexture. It was returning the changed texture size instead of the original one before. - Fix skinned meshes not playing their last frame. Also clarified animation documentation to describe current behavior more exactly. diff --git a/examples/01.HelloWorld/main.cpp b/examples/01.HelloWorld/main.cpp index 1750f2ae..d8b92f9f 100644 --- a/examples/01.HelloWorld/main.cpp +++ b/examples/01.HelloWorld/main.cpp @@ -215,7 +215,7 @@ int main() the GUI Environment draw their content. With the endScene() call everything is presented on the screen. */ - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(ECBF_COLOR | ECBF_DEPTH, SColor(255,100,101,140)); smgr->drawAll(); guienv->drawAll(); diff --git a/examples/02.Quake3Map/main.cpp b/examples/02.Quake3Map/main.cpp index 89bdadea..cd3f32fe 100644 --- a/examples/02.Quake3Map/main.cpp +++ b/examples/02.Quake3Map/main.cpp @@ -153,7 +153,7 @@ int main() { if (device->isWindowActive()) { - driver->beginScene(true, true, video::SColor(255,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,200,200,200)); smgr->drawAll(); driver->endScene(); diff --git a/examples/03.CustomSceneNode/main.cpp b/examples/03.CustomSceneNode/main.cpp index 25e850bb..1fcd4461 100644 --- a/examples/03.CustomSceneNode/main.cpp +++ b/examples/03.CustomSceneNode/main.cpp @@ -243,7 +243,7 @@ int main() u32 frames=0; while(device->run()) { - driver->beginScene(true, true, video::SColor(0,100,100,100)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,100,100,100)); smgr->drawAll(); diff --git a/examples/04.Movement/main.cpp b/examples/04.Movement/main.cpp index 21c03589..af890924 100644 --- a/examples/04.Movement/main.cpp +++ b/examples/04.Movement/main.cpp @@ -227,7 +227,7 @@ int main() node->setPosition(nodePosition); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); // draw the 3d scene device->getGUIEnvironment()->drawAll(); // draw the gui environment (the logo) diff --git a/examples/05.UserInterface/main.cpp b/examples/05.UserInterface/main.cpp index ae9b0440..933197ac 100644 --- a/examples/05.UserInterface/main.cpp +++ b/examples/05.UserInterface/main.cpp @@ -289,7 +289,7 @@ int main() while(device->run() && driver) if (device->isWindowActive()) { - driver->beginScene(true, true, SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,200,200,200)); env->drawAll(); diff --git a/examples/06.2DGraphics/main.cpp b/examples/06.2DGraphics/main.cpp index 3b08c786..4338a9bf 100644 --- a/examples/06.2DGraphics/main.cpp +++ b/examples/06.2DGraphics/main.cpp @@ -93,7 +93,7 @@ int main() { u32 time = device->getTimer()->getTime(); - driver->beginScene(true, true, video::SColor(255,120,102,136)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,120,102,136)); /* First, we draw 3 sprites, using the alpha channel we diff --git a/examples/07.Collision/main.cpp b/examples/07.Collision/main.cpp index 47b13c3f..6d785268 100644 --- a/examples/07.Collision/main.cpp +++ b/examples/07.Collision/main.cpp @@ -245,7 +245,7 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); // Unlight any currently highlighted scene node diff --git a/examples/08.SpecialFX/main.cpp b/examples/08.SpecialFX/main.cpp index 7c8b544d..c2abaa61 100644 --- a/examples/08.SpecialFX/main.cpp +++ b/examples/08.SpecialFX/main.cpp @@ -285,7 +285,7 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); diff --git a/examples/09.Meshviewer/main.cpp b/examples/09.Meshviewer/main.cpp index b57c66ce..559646e7 100644 --- a/examples/09.Meshviewer/main.cpp +++ b/examples/09.Meshviewer/main.cpp @@ -997,7 +997,7 @@ int main(int argc, char* argv[]) if (Device->isWindowActive()) { - driver->beginScene(true, true, video::SColor(150,50,50,50)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(150,50,50,50)); smgr->drawAll(); env->drawAll(); diff --git a/examples/10.Shaders/main.cpp b/examples/10.Shaders/main.cpp index 3e6d0cf1..565b9e5b 100644 --- a/examples/10.Shaders/main.cpp +++ b/examples/10.Shaders/main.cpp @@ -422,7 +422,7 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, video::SColor(255,0,0,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,0)); smgr->drawAll(); driver->endScene(); diff --git a/examples/11.PerPixelLighting/main.cpp b/examples/11.PerPixelLighting/main.cpp index 03511e92..337d4b3e 100644 --- a/examples/11.PerPixelLighting/main.cpp +++ b/examples/11.PerPixelLighting/main.cpp @@ -457,7 +457,7 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); env->drawAll(); diff --git a/examples/12.TerrainRendering/main.cpp b/examples/12.TerrainRendering/main.cpp index e846e02f..5686bf32 100644 --- a/examples/12.TerrainRendering/main.cpp +++ b/examples/12.TerrainRendering/main.cpp @@ -252,7 +252,7 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, 0 ); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); env->drawAll(); diff --git a/examples/13.RenderToTexture/main.cpp b/examples/13.RenderToTexture/main.cpp index 2462e8e5..b4b01447 100644 --- a/examples/13.RenderToTexture/main.cpp +++ b/examples/13.RenderToTexture/main.cpp @@ -168,14 +168,14 @@ int main() while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); if (renderTarget) { // draw scene into render target // set render target texture - driver->setRenderTarget(renderTarget, 0, true, true, false, video::SColor(0, 0, 0, 255)); + driver->setRenderTarget(renderTarget, 0, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,255)); // make cube invisible and set fixed camera as active camera test->setVisible(false); @@ -186,7 +186,7 @@ int main() // set back old render target // The buffer might have been distorted, so clear it - driver->setRenderTarget(0, 0, false, false, false, 0); + driver->setRenderTarget((video::IRenderTarget*)0, 0, 0, video::SColor(0)); // make the cube visible and set the user controlled camera as active one test->setVisible(true); diff --git a/examples/14.Win32Window/main.cpp b/examples/14.Win32Window/main.cpp index 8a3d8ef8..183381b9 100644 --- a/examples/14.Win32Window/main.cpp +++ b/examples/14.Win32Window/main.cpp @@ -214,12 +214,12 @@ int main() while (device->run()) { - driver->beginScene(true, true, 0, videodata); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0), 1.f, 0, videodata); smgr->drawAll(); driver->endScene(); if (key=='b') { - driver->beginScene(true, true, 0xbbbbbbbb); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0xbbbbbbbb)); device->getGUIEnvironment()->drawAll(); driver->endScene(); } diff --git a/examples/15.LoadIrrFile/main.cpp b/examples/15.LoadIrrFile/main.cpp index 90a2596e..d28e6f67 100644 --- a/examples/15.LoadIrrFile/main.cpp +++ b/examples/15.LoadIrrFile/main.cpp @@ -153,7 +153,7 @@ int main(int argc, char** argv) while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, video::SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,200,200,200)); smgr->drawAll(); driver->endScene(); diff --git a/examples/16.Quake3MapShader/main.cpp b/examples/16.Quake3MapShader/main.cpp index ae962ca1..4a91b4e3 100644 --- a/examples/16.Quake3MapShader/main.cpp +++ b/examples/16.Quake3MapShader/main.cpp @@ -349,7 +349,7 @@ int IRRCALLCONV main(int argc, char* argv[]) while(device->run()) if (device->isWindowActive()) { - driver->beginScene(true, true, video::SColor(255,20,20,40)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,20,20,40)); smgr->drawAll(); gui->drawAll(); driver->endScene(); diff --git a/examples/18.SplitScreen/main.cpp b/examples/18.SplitScreen/main.cpp index a154e9f3..600b7bf8 100644 --- a/examples/18.SplitScreen/main.cpp +++ b/examples/18.SplitScreen/main.cpp @@ -172,7 +172,7 @@ Sounds a little complicated, but you'll see it isn't: { //Set the viewpoint to the whole screen and begin scene driver->setViewPort(rect(0,0,ResX,ResY)); - driver->beginScene(true,true,SColor(255,100,100,100)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,100,100)); //If SplitScreen is used if (SplitScreen) { diff --git a/examples/19.MouseAndJoystick/main.cpp b/examples/19.MouseAndJoystick/main.cpp index 4563278a..faa63057 100644 --- a/examples/19.MouseAndJoystick/main.cpp +++ b/examples/19.MouseAndJoystick/main.cpp @@ -268,7 +268,7 @@ int main() // Turn lighting on and off depending on whether the left mouse button is down. node->setMaterialFlag(video::EMF_LIGHTING, receiver.GetMouseState().LeftButtonDown); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); // draw the 3d scene driver->endScene(); } diff --git a/examples/20.ManagedLights/main.cpp b/examples/20.ManagedLights/main.cpp index 0a3d6896..f1fdb50d 100644 --- a/examples/20.ManagedLights/main.cpp +++ b/examples/20.ManagedLights/main.cpp @@ -362,7 +362,7 @@ Add several "zones". You could use this technique to light individual rooms, fo while(device->run()) { - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); guienv->drawAll(); driver->endScene(); diff --git a/examples/21.Quake3Explorer/main.cpp b/examples/21.Quake3Explorer/main.cpp index 1a0c32b9..41d50802 100644 --- a/examples/21.Quake3Explorer/main.cpp +++ b/examples/21.Quake3Explorer/main.cpp @@ -1928,7 +1928,7 @@ void CQuake3EventHandler::Render() if (anaglyph) { scene::ICameraSceneNode* cameraOld = Game->Device->getSceneManager()->getActiveCamera(); - driver->beginScene(true, true, SColor(0,0,0,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,0,0,0)); driver->getOverrideMaterial().Material.ColorMask = ECP_NONE; driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK; driver->getOverrideMaterial().EnablePasses = ESNRP_SKY_BOX + @@ -1937,7 +1937,7 @@ void CQuake3EventHandler::Render() ESNRP_TRANSPARENT_EFFECT + ESNRP_SHADOW; Game->Device->getSceneManager()->drawAll(); - driver->clearZBuffer(); + driver->clearBuffers(video::ECBF_DEPTH, video::SColor(255,0,0,0)); const vector3df oldPosition = cameraOld->getPosition(); const vector3df oldTarget = cameraOld->getTarget(); @@ -1965,7 +1965,7 @@ void CQuake3EventHandler::Render() camera->setTarget(focusPoint); Game->Device->getSceneManager()->drawAll(); - driver->clearZBuffer(); + driver->clearBuffers(video::ECBF_DEPTH, video::SColor(255, 0, 0, 0)); //Right eye... move.setTranslation( vector3df(1.5f,0.0f,0.0f) ); @@ -1999,7 +1999,7 @@ void CQuake3EventHandler::Render() } else { - driver->beginScene(true, true, SColor(0,0,0,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,0,0,0)); Game->Device->getSceneManager()->drawAll(); } Game->Device->getGUIEnvironment()->drawAll(); diff --git a/examples/22.MaterialViewer/main.cpp b/examples/22.MaterialViewer/main.cpp index 439943a6..08b7a21a 100755 --- a/examples/22.MaterialViewer/main.cpp +++ b/examples/22.MaterialViewer/main.cpp @@ -831,7 +831,7 @@ bool CApp::update() // draw everything video::SColor bkColor( skin->getColor(gui::EGDC_APP_WORKSPACE) ); - videoDriver->beginScene(true, true, bkColor); + videoDriver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, bkColor); smgr->drawAll(); guiEnv->drawAll(); diff --git a/examples/23.SMeshHandling/main.cpp b/examples/23.SMeshHandling/main.cpp index c3c2ccf8..2baa1d95 100644 --- a/examples/23.SMeshHandling/main.cpp +++ b/examples/23.SMeshHandling/main.cpp @@ -411,7 +411,7 @@ int main(int argc, char* argv[]) mesh.init(hm, 50.f, yellow, driver); } - driver->beginScene(true, true, SColor(0xff000000)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0xff000000)); smgr->drawAll(); driver->endScene(); } diff --git a/examples/24.CursorControl/main.cpp b/examples/24.CursorControl/main.cpp index 4c9f18dd..22c22cb7 100644 --- a/examples/24.CursorControl/main.cpp +++ b/examples/24.CursorControl/main.cpp @@ -529,7 +529,7 @@ int main() context.update(); - driver->beginScene(true, true, SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,200,200,200)); env->drawAll(); diff --git a/examples/25.XmlHandling/main.cpp b/examples/25.XmlHandling/main.cpp index 35b05ae9..657ad8dc 100644 --- a/examples/25.XmlHandling/main.cpp +++ b/examples/25.XmlHandling/main.cpp @@ -490,7 +490,7 @@ int main() { if (app.Device->isWindowActive()) { - app.Driver->beginScene(true, true, SColor(0,200,200,200)); + app.Driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,200,200,200)); app.Gui->drawAll(); app.Driver->endScene(); } diff --git a/examples/26.OcclusionQuery/main.cpp b/examples/26.OcclusionQuery/main.cpp index a7b48d55..d6de904c 100644 --- a/examples/26.OcclusionQuery/main.cpp +++ b/examples/26.OcclusionQuery/main.cpp @@ -157,7 +157,7 @@ int main() { plane->setVisible(!receiver.IsKeyDown(irr::KEY_SPACE)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); /* First, we draw the scene, possibly without the occluded element. This is necessary because we need the occluder to be drawn first. You can also use several scene diff --git a/examples/30.Profiling/main.cpp b/examples/30.Profiling/main.cpp index eacd132a..0ad479af 100644 --- a/examples/30.Profiling/main.cpp +++ b/examples/30.Profiling/main.cpp @@ -458,7 +458,7 @@ int main() */ recursive(5); - driver->beginScene(true, true, SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,200,200,200)); /* If you want to profile only some lines and not a complete scope diff --git a/examples/Demo/CDemo.cpp b/examples/Demo/CDemo.cpp index 5f3de45c..e9babcdf 100644 --- a/examples/Demo/CDemo.cpp +++ b/examples/Demo/CDemo.cpp @@ -105,7 +105,12 @@ void CDemo::run() createParticleImpacts(); - driver->beginScene(timeForThisScene != -1, true, backColor); + u16 clearFlag = video::ECBF_DEPTH; + + if (timeForThisScene != -1) + clearFlag |= video::ECBF_COLOR; + + driver->beginScene(clearFlag, backColor); smgr->drawAll(); guienv->drawAll(); diff --git a/examples/Demo/CMainMenu.cpp b/examples/Demo/CMainMenu.cpp index 060937fa..0d838ecb 100644 --- a/examples/Demo/CMainMenu.cpp +++ b/examples/Demo/CMainMenu.cpp @@ -231,7 +231,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, { if (MenuDevice->isWindowActive()) { - driver->beginScene(false, true, video::SColor(0,0,0,0)); + driver->beginScene(video::ECBF_DEPTH, video::SColor(0,0,0,0)); if (irrlichtBack) driver->draw2DImage(irrlichtBack, diff --git a/include/IVideoDriver.h b/include/IVideoDriver.h index 27c2b389..c29c873a 100644 --- a/include/IVideoDriver.h +++ b/include/IVideoDriver.h @@ -130,6 +130,15 @@ namespace video ERT_AUX_BUFFER4 }; + //! Enum for the flags of clear buffer + enum E_CLEAR_BUFFER_FLAG + { + ECBF_NONE = 0, + ECBF_COLOR = 1, + ECBF_DEPTH = 2, + ECBF_STENCIL = 4 + }; + //! Enum for the types of fog distributions to choose from enum E_FOG_TYPE { @@ -224,14 +233,10 @@ namespace video //! Applications must call this method before performing any rendering. /** This method can clear the back- and the z-buffer. - \param backBuffer Specifies if the back buffer should be - cleared, which means that the screen is filled with the color - specified. If this parameter is false, the back buffer will - not be cleared and the color parameter is ignored. - \param zBuffer Specifies if the depth buffer (z buffer) should - be cleared. It is not nesesarry to do so if only 2d drawing is - used. - \param color The color used for back buffer clearing + \param clearFlag The clear flags. + \param clearColor The clear color for the color buffer. + \param clearDepth The clear value for the depth buffer. + \param clearStencil The clear value for the stencil buffer. \param videoData Handle of another window, if you want the bitmap to be displayed on another window. If this is an empty element, everything will be displayed in the default window. @@ -240,16 +245,28 @@ namespace video rectangle of the area to be presented. Set to null to present everything. Note: not implemented in all devices. \return False if failed. */ - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) =0; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData=SExposedVideoData(), core::rect* sourceRect = 0) = 0; + + _IRR_DEPRECATED_ bool beginScene(bool backBuffer = true, bool zBuffer = true, SColor color = SColor(255,0,0,0), + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) + { + u16 flag = 0; + + if (backBuffer) + flag |= ECBF_COLOR; + + if (zBuffer) + flag |= ECBF_DEPTH; + + return beginScene(flag, color, 1.f, 0, videoData, sourceRect); + } //! Presents the rendered image to the screen. /** Applications must call this method after performing any rendering. \return False if failed and true if succeeded. */ - virtual bool endScene() =0; + virtual bool endScene() = 0; //! Queries the features of the driver. /** Returns true if a feature is available @@ -537,23 +554,22 @@ namespace video \param activeTextureID Array of texture indices which should be active during RTT process. If more than one ID will be apply, this render target will work as a Multiple Render Target. - \param clearBackBuffer Clears the back buffer of the render - target with the clearColor parameter. - \param clearDepthBuffer Clears the depth buffer of the rendertarget. - \param clearStencilBuffer Clears the stencil buffer of the rendertarget. - \param clearColor The clear color for the render target. + \param clearFlag The clear flags. + \param clearColor The clear color for the color buffer. + \param clearDepth The clear value for the depth buffer. + \param clearStencil The clear value for the stencil buffer. \return True if sucessful and false if not. */ - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor = video::SColor(255,0,0,0)) = 0; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) = 0; //! Set a render target. - bool setRenderTarget(IRenderTarget* target, u32 activeTextureID, bool clearBackBuffer, bool clearDepthBuffer, - bool clearStencilBuffer, SColor clearColor = video::SColor(255,0,0,0)) + bool setRenderTarget(IRenderTarget* target, u32 activeTextureID, u16 clearFlag, SColor clearColor = SColor(255,0,0,0), + f32 clearDepth = 1.f, u8 clearStencil = 0) { core::array idArray(1); idArray.push_back(activeTextureID); - return setRenderTarget(target, idArray, clearBackBuffer, clearDepthBuffer, clearStencilBuffer, clearColor); + return setRenderTarget(target, idArray, clearFlag, clearColor); } //! Sets a new render target. @@ -580,17 +596,27 @@ namespace video IVideoDriver::addRenderTargetTexture(). If set to 0, it sets the previous render target which was set before the last setRenderTarget() call. - \param clearBackBuffer Clears the backbuffer of the render - target with the color parameter - \param clearZBuffer Clears the zBuffer of the rendertarget. - Note that because the frame buffer may share the zbuffer with - the rendertarget, its zbuffer might be partially cleared too - by this. - \param color The background color for the render target. + \param clearFlag The clear flags. + \param clearColor The clear color for the color buffer. + \param clearDepth The clear value for the depth buffer. + \param clearStencil The clear value for the stencil buffer. \return True if sucessful and false if not. */ - virtual bool setRenderTarget(video::ITexture* texture, - bool clearBackBuffer = true, bool clearZBuffer = true, - SColor color = video::SColor(0, 0, 0, 0)) = 0; + virtual bool setRenderTarget(ITexture* texture, u16 clearFlag, SColor clearColor = SColor(255,0,0,0), + f32 clearDepth = 1.f, u8 clearStencil = 0) = 0; + + _IRR_DEPRECATED_ bool setRenderTarget(ITexture* texture, bool clearBackBuffer = true, + bool clearZBuffer = true, SColor color = SColor(255,0,0,0)) + { + u16 flag = 0; + + if (clearBackBuffer) + flag |= ECBF_COLOR; + + if (clearZBuffer) + flag |= ECBF_DEPTH; + + return setRenderTarget(texture, flag, color); + } //! Sets a new viewport. /** Every rendering operation is done into this new area. @@ -1345,7 +1371,24 @@ namespace video virtual scene::IMeshManipulator* getMeshManipulator() =0; //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) = 0; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) = 0; + + //! Clear the color, depth and/or stencil buffers. + _IRR_DEPRECATED_ void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) + { + u16 flag = 0; + + if (backBuffer) + flag |= ECBF_COLOR; + + if (depthBuffer) + flag |= ECBF_DEPTH; + + if (stencilBuffer) + flag |= ECBF_STENCIL; + + clearBuffers(flag, color); + } //! Clears the ZBuffer. /** Note that you usually need not to call this method, as it @@ -1354,7 +1397,10 @@ namespace video you have to render some special things, you can clear the zbuffer during the rendering process with this method any time. */ - _IRR_DEPRECATED_ virtual void clearZBuffer() = 0; + _IRR_DEPRECATED_ void clearZBuffer() + { + clearBuffers(ECBF_DEPTH, SColor(255,0,0,0), 1.f, 0); + } //! Make a screenshot of the last rendered frame. /** \return An image created from the last rendered frame. */ diff --git a/include/SIrrCreationParameters.h b/include/SIrrCreationParameters.h index c960f955..8612d9ca 100644 --- a/include/SIrrCreationParameters.h +++ b/include/SIrrCreationParameters.h @@ -222,7 +222,7 @@ namespace irr \code while (device->run()) { - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, 0); smgr->drawAll(); driver->endScene(); } @@ -254,7 +254,7 @@ namespace irr device->getTimer()->tick(); // draw engine picture - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, 0); smgr->drawAll(); driver->endScene(); } diff --git a/include/irrlicht.h b/include/irrlicht.h index 42df085e..2f81e366 100644 --- a/include/irrlicht.h +++ b/include/irrlicht.h @@ -256,7 +256,7 @@ * // draw everything * while(device->run() && driver) * { - * driver->beginScene(true, true, video::SColor(255,0,0,255)); + * driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,255)); * scenemgr->drawAll(); * driver->endScene(); * } diff --git a/source/Irrlicht/CD3D9Driver.cpp b/source/Irrlicht/CD3D9Driver.cpp index 0dbc322d..f41cbccf 100644 --- a/source/Irrlicht/CD3D9Driver.cpp +++ b/source/Irrlicht/CD3D9Driver.cpp @@ -493,12 +493,9 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware) return true; } - -//! applications must call this method before performing any rendering. returns false if failed. -bool CD3D9Driver::beginScene(bool backBuffer, bool zBuffer, SColor color, - const SExposedVideoData& videoData, core::rect* sourceRect) +bool CD3D9Driver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect* sourceRect) { - CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect); + CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect); WindowId = (HWND)videoData.D3D9.HWnd; SceneSourceRect = sourceRect; @@ -523,7 +520,7 @@ bool CD3D9Driver::beginScene(bool backBuffer, bool zBuffer, SColor color, } } - clearBuffers(backBuffer, zBuffer, false, color); + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); hr = pID3DDevice->BeginScene(); if (FAILED(hr)) @@ -535,8 +532,6 @@ bool CD3D9Driver::beginScene(bool backBuffer, bool zBuffer, SColor color, return true; } - -//! applications must call this method after performing any rendering. returns false if failed. bool CD3D9Driver::endScene() { CNullDriver::endScene(); @@ -763,10 +758,7 @@ void CD3D9Driver::setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, CNullDriver::setTextureCreationFlag(flag, enabled); } - -//! set a render target -bool CD3D9Driver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) +bool CD3D9Driver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { if (target && target->getDriverType() != EDT_DIRECT3D9) { @@ -882,7 +874,7 @@ bool CD3D9Driver::setRenderTarget(IRenderTarget* target, const core::array& CurrentRenderTarget = target; - clearBuffers(clearBackBuffer, clearDepthBuffer, clearStencilBuffer, clearColor); + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); return true; } @@ -3156,24 +3148,22 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d& size return tex; } - -//! Clear the color, depth and/or stencil buffers. -void CD3D9Driver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) +void CD3D9Driver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil) { - DWORD flags = 0; + DWORD internalFlag = 0; - if (backBuffer) - flags |= D3DCLEAR_TARGET; + if (flag & ECBF_COLOR) + internalFlag |= D3DCLEAR_TARGET; - if (depthBuffer) - flags |= D3DCLEAR_ZBUFFER; + if (flag & ECBF_DEPTH) + internalFlag |= D3DCLEAR_ZBUFFER; - if (stencilBuffer) - flags |= D3DCLEAR_STENCIL; + if (flag & ECBF_STENCIL) + internalFlag |= D3DCLEAR_STENCIL; - if (flags) + if (internalFlag) { - HRESULT hr = pID3DDevice->Clear(0, NULL, flags, color.color, 1.0, 0); + HRESULT hr = pID3DDevice->Clear(0, NULL, internalFlag, color.color, depth, stencil); if (FAILED(hr)) os::Printer::log("DIRECT3D9 clear failed.", ELL_WARNING); @@ -3181,16 +3171,6 @@ void CD3D9Driver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBu } -//! Clears the ZBuffer. -void CD3D9Driver::clearZBuffer() -{ - HRESULT hr = pID3DDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0, 0); - - if (FAILED(hr)) - os::Printer::log("CD3D9Driver clearZBuffer() failed.", ELL_WARNING); -} - - //! Returns an image created from the last rendered frame. IImage* CD3D9Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target) { diff --git a/source/Irrlicht/CD3D9Driver.h b/source/Irrlicht/CD3D9Driver.h index 0a69e2e7..b8da9c03 100644 --- a/source/Irrlicht/CD3D9Driver.h +++ b/source/Irrlicht/CD3D9Driver.h @@ -44,13 +44,9 @@ namespace video //! destructor virtual ~CD3D9Driver(); - //! applications must call this method before performing any rendering. returns false if failed. - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) _IRR_OVERRIDE_; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) _IRR_OVERRIDE_; - //! applications must call this method after performing any rendering. returns false if failed. virtual bool endScene() _IRR_OVERRIDE_; //! queries the features of the driver, returns true if feature is available @@ -62,9 +58,8 @@ namespace video //! sets a material virtual void setMaterial(const SMaterial& material) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) _IRR_OVERRIDE_; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; //! sets a viewport virtual void setViewPort(const core::rect& area) _IRR_OVERRIDE_; @@ -271,11 +266,7 @@ namespace video virtual ITexture* addRenderTargetTexture(const core::dimension2d& size, const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_; - //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) _IRR_OVERRIDE_; - - //! Clears the ZBuffer. - virtual void clearZBuffer() _IRR_OVERRIDE_; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_; //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index 8b97a671..5aa13e70 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -308,19 +308,13 @@ void CNullDriver::deleteAllTextures() SharedDepthTextures.clear(); } - - -//! applications must call this method before performing any rendering. returns false if failed. -bool CNullDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, - const SExposedVideoData& videoData, core::rect* sourceRect) +bool CNullDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect* sourceRect) { core::clearFPUException(); PrimitivesDrawn = 0; return true; } - -//! applications must call this method after performing any rendering. returns false if failed. bool CNullDriver::endScene() { FPSCounter.registerFrame(os::Timer::getRealTime(), PrimitivesDrawn); @@ -625,15 +619,12 @@ ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const io::p return new SDummyTexture(name); } - -//! set a render target -bool CNullDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) +bool CNullDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { return false; } -bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, bool clearZBuffer, SColor color) +bool CNullDriver::setRenderTarget(ITexture* texture, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { if (texture) { @@ -663,11 +654,11 @@ bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer SharedRenderTarget->setTexture(texture, depthTexture); - return IVideoDriver::setRenderTarget(SharedRenderTarget, 0, clearBackBuffer, clearZBuffer, clearZBuffer, color); + return IVideoDriver::setRenderTarget(SharedRenderTarget, 0, clearFlag, clearColor, clearDepth, clearStencil); } else { - return IVideoDriver::setRenderTarget(NULL, 0, clearBackBuffer, clearZBuffer, false, color); + return IVideoDriver::setRenderTarget(NULL, 0, clearFlag, clearColor, clearDepth, clearStencil); } } @@ -2410,15 +2401,7 @@ ITexture* CNullDriver::addRenderTargetTexture(const core::dimension2d& size return 0; } - -//! Clear the color, depth and/or stencil buffers. -void CNullDriver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) -{ -} - - -//! Clears the ZBuffer. -void CNullDriver::clearZBuffer() +void CNullDriver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil) { } diff --git a/source/Irrlicht/CNullDriver.h b/source/Irrlicht/CNullDriver.h index 37fb81aa..6c7de193 100644 --- a/source/Irrlicht/CNullDriver.h +++ b/source/Irrlicht/CNullDriver.h @@ -48,10 +48,8 @@ namespace video //! destructor virtual ~CNullDriver(); - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) _IRR_OVERRIDE_; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) _IRR_OVERRIDE_; virtual bool endScene() _IRR_OVERRIDE_; @@ -100,14 +98,11 @@ namespace video //! creates a Texture virtual ITexture* addTexture(const core::dimension2d& size, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) _IRR_OVERRIDE_; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(video::ITexture* texture, - bool clearBackBuffer = true, bool clearZBuffer = true, - SColor color = video::SColor(0, 0, 0, 0)) _IRR_OVERRIDE_; + virtual bool setRenderTarget(ITexture* texture, u16 clearFlag, SColor clearColor = SColor(255,0,0,0), + f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; //! sets a viewport virtual void setViewPort(const core::rect& area) _IRR_OVERRIDE_; @@ -593,11 +588,7 @@ namespace video //! Returns a pointer to the mesh manipulator. virtual scene::IMeshManipulator* getMeshManipulator() _IRR_OVERRIDE_; - //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) _IRR_OVERRIDE_; - - //! Clears the ZBuffer. - virtual void clearZBuffer() _IRR_OVERRIDE_; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_; //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 7c50e832..a0fa25bb 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -804,8 +804,40 @@ void COpenGLDriver::createMaterialRenderers() addAndDropMaterialRenderer(new COpenGLMaterialRenderer_ONETEXTURE_BLEND(this)); } +bool COpenGLDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect* sourceRect) +{ + CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect); + + switch (DeviceType) + { +#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_ + case EIDT_WIN32: + changeRenderContext(videoData, Win32Device); + break; +#endif +#ifdef _IRR_COMPILE_WITH_X11_DEVICE_ + case EIDT_X11: + changeRenderContext(videoData, X11Device); + break; +#endif + default: + changeRenderContext(videoData, (void*)0); + break; + } + +#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) + if (DeviceType == EIDT_SDL) + { + // todo: SDL sets glFrontFace(GL_CCW) after driver creation, + // it would be better if this was fixed elsewhere. + glFrontFace(GL_CW); + } +#endif + + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); + return true; +} -//! presents the rendered scene on the screen, returns false if failed bool COpenGLDriver::endScene() { CNullDriver::endScene(); @@ -847,43 +879,6 @@ bool COpenGLDriver::endScene() } -//! init call for rendering start -bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, - const SExposedVideoData& videoData, core::rect* sourceRect) -{ - CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect); - - switch (DeviceType) - { -#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_ - case EIDT_WIN32: - changeRenderContext(videoData, Win32Device); - break; -#endif -#ifdef _IRR_COMPILE_WITH_X11_DEVICE_ - case EIDT_X11: - changeRenderContext(videoData, X11Device); - break; -#endif - default: - changeRenderContext(videoData, (void*)0); - break; - } - -#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) - if (DeviceType == EIDT_SDL) - { - // todo: SDL sets glFrontFace(GL_CCW) after driver creation, - // it would be better if this was fixed elsewhere. - glFrontFace(GL_CW); - } -#endif - - clearBuffers(backBuffer, zBuffer, false, color); - return true; -} - - //! Returns the transformation set by setTransform const core::matrix4& COpenGLDriver::getTransform(E_TRANSFORMATION_STATE state) const { @@ -4220,10 +4215,7 @@ u32 COpenGLDriver::getMaximalPrimitiveCount() const return 0x7fffffff; } - -//! set a render target -bool COpenGLDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) +bool COpenGLDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { if (target && target->getDriverType() != EDT_OPENGL) { @@ -4288,11 +4280,11 @@ bool COpenGLDriver::setRenderTarget(IRenderTarget* target, const core::array& COpenGLDriver::getCurrentRenderTargetSize() const return CurrentRenderTargetSize; } - -//! Clear the color, depth and/or stencil buffers. -void COpenGLDriver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) +void COpenGLDriver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil) { GLbitfield mask = 0; - if (backBuffer) + if (flag & ECBF_COLOR) { BridgeCalls->setColorMask(true, true, true, true); @@ -4324,27 +4314,24 @@ void COpenGLDriver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencil mask |= GL_COLOR_BUFFER_BIT; } - if (depthBuffer) + if (flag & ECBF_DEPTH) { BridgeCalls->setDepthMask(true); + glClearDepth(depth); mask |= GL_DEPTH_BUFFER_BIT; } - if (stencilBuffer) + if (flag & ECBF_STENCIL) + { + glClearStencil(stencil); mask |= GL_STENCIL_BUFFER_BIT; + } if (mask) glClear(mask); } -//! Clears the ZBuffer. -void COpenGLDriver::clearZBuffer() -{ - clearBuffers(false, true, false, 0x0); -} - - //! Returns an image created from the last rendered frame. IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target) { diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index 5f1a1ea3..73d633e6 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -74,13 +74,9 @@ namespace video //! destructor virtual ~COpenGLDriver(); - //! clears the zbuffer - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) _IRR_OVERRIDE_; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) _IRR_OVERRIDE_; - //! presents the rendered scene on the screen, returns false if failed virtual bool endScene() _IRR_OVERRIDE_; //! sets transformation @@ -359,15 +355,10 @@ namespace video virtual ITexture* addRenderTargetTexture(const core::dimension2d& size, const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) _IRR_OVERRIDE_; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; - //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) _IRR_OVERRIDE_; - - //! Clears the ZBuffer. - virtual void clearZBuffer() _IRR_OVERRIDE_; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_; //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CSoftwareDriver.cpp b/source/Irrlicht/CSoftwareDriver.cpp index 45624cbb..01bba3c2 100644 --- a/source/Irrlicht/CSoftwareDriver.cpp +++ b/source/Irrlicht/CSoftwareDriver.cpp @@ -227,22 +227,17 @@ void CSoftwareDriver::setMaterial(const SMaterial& material) } } - -//! clears the zbuffer -bool CSoftwareDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, - const SExposedVideoData& videoData, core::rect* sourceRect) +bool CSoftwareDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect* sourceRect) { - CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect); + CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect); WindowId=videoData.D3D9.HWnd; SceneSourceRect = sourceRect; - clearBuffers(backBuffer, zBuffer, false, color); + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); return true; } - -//! presents the rendered scene on the screen, returns false if failed bool CSoftwareDriver::endScene() { CNullDriver::endScene(); @@ -258,10 +253,7 @@ ITexture* CSoftwareDriver::createDeviceDependentTexture(IImage* surface, const i return new CSoftwareTexture(surface, name, false, mipmapData); } - -//! set a render target -bool CSoftwareDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) +bool CSoftwareDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { if (target && target->getDriverType() != EDT_SOFTWARE) { @@ -285,7 +277,7 @@ bool CSoftwareDriver::setRenderTarget(IRenderTarget* target, const core::array& return tex; } - -//! Clear the color, depth and/or stencil buffers. -void CSoftwareDriver::clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) +void CSoftwareDriver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil) { - if (backBuffer && RenderTargetSurface) + if ((flag & ECBF_COLOR) && RenderTargetSurface) RenderTargetSurface->fill(color); - if (depthBuffer && ZBuffer) - ZBuffer->clear(); -} - - -//! Clears the ZBuffer. -void CSoftwareDriver::clearZBuffer() -{ - if (ZBuffer) + if ((flag & ECBF_DEPTH) && ZBuffer) ZBuffer->clear(); } diff --git a/source/Irrlicht/CSoftwareDriver.h b/source/Irrlicht/CSoftwareDriver.h index 7f4051d3..10e7efc6 100644 --- a/source/Irrlicht/CSoftwareDriver.h +++ b/source/Irrlicht/CSoftwareDriver.h @@ -36,20 +36,15 @@ namespace video //! sets a material virtual void setMaterial(const SMaterial& material) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) _IRR_OVERRIDE_; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; //! sets a viewport virtual void setViewPort(const core::rect& area) _IRR_OVERRIDE_; - //! clears the zbuffer - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) _IRR_OVERRIDE_; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) _IRR_OVERRIDE_; - //! presents the rendered scene on the screen, returns false if failed virtual bool endScene() _IRR_OVERRIDE_; //! Only used by the internal engine. Used to notify the driver that @@ -111,11 +106,7 @@ namespace video virtual ITexture* addRenderTargetTexture(const core::dimension2d& size, const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_; - //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) _IRR_OVERRIDE_; - - //! Clears the ZBuffer. - virtual void clearZBuffer() _IRR_OVERRIDE_; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_; //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CSoftwareDriver2.cpp b/source/Irrlicht/CSoftwareDriver2.cpp index 3875c02a..8ffaad6c 100644 --- a/source/Irrlicht/CSoftwareDriver2.cpp +++ b/source/Irrlicht/CSoftwareDriver2.cpp @@ -390,24 +390,18 @@ void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core: } } - -//! clears the zbuffer -bool CBurningVideoDriver::beginScene(bool backBuffer, bool zBuffer, - SColor color, const SExposedVideoData& videoData, - core::rect* sourceRect) +bool CBurningVideoDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect* sourceRect) { - CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect); + CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect); WindowId = videoData.D3D9.HWnd; SceneSourceRect = sourceRect; - clearBuffers(backBuffer, zBuffer, false, color); + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); memset ( TransformationFlag, 0, sizeof ( TransformationFlag ) ); return true; } - -//! presents the rendered scene on the screen, returns false if failed bool CBurningVideoDriver::endScene() { CNullDriver::endScene(); @@ -415,10 +409,7 @@ bool CBurningVideoDriver::endScene() return Presenter->present(BackBuffer, WindowId, SceneSourceRect); } - -//! set a render target -bool CBurningVideoDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) +bool CBurningVideoDriver::setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil) { if (target && target->getDriverType() != EDT_BURNINGSVIDEO) { @@ -442,7 +433,7 @@ bool CBurningVideoDriver::setRenderTarget(IRenderTarget* target, const core::arr setRenderTarget(BackBuffer); } - clearBuffers(clearBackBuffer, clearDepthBuffer, clearStencilBuffer, clearColor); + clearBuffers(clearFlag, clearColor, clearDepth, clearStencil); return true; } @@ -2236,29 +2227,19 @@ ITexture* CBurningVideoDriver::addRenderTargetTexture(const core::dimension2dfill(color); - if (depthBuffer && DepthBuffer) + if ((flag & ECBF_DEPTH) && DepthBuffer) DepthBuffer->clear(); - if (stencilBuffer && StencilBuffer) + if ((flag & ECBF_STENCIL) && StencilBuffer) StencilBuffer->clear(); } -//! Clears the DepthBuffer. -void CBurningVideoDriver::clearZBuffer() -{ - if (DepthBuffer) - DepthBuffer->clear(); -} - - //! Returns an image created from the last rendered frame. IImage* CBurningVideoDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target) { diff --git a/source/Irrlicht/CSoftwareDriver2.h b/source/Irrlicht/CSoftwareDriver2.h index 1df789d2..cc74d57f 100644 --- a/source/Irrlicht/CSoftwareDriver2.h +++ b/source/Irrlicht/CSoftwareDriver2.h @@ -39,20 +39,15 @@ namespace video //! sets a material virtual void setMaterial(const SMaterial& material) _IRR_OVERRIDE_; - //! set a render target - virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, bool clearBackBuffer, - bool clearDepthBuffer, bool clearStencilBuffer, SColor clearColor) _IRR_OVERRIDE_; + virtual bool setRenderTarget(IRenderTarget* target, const core::array& activeTextureID, u16 clearFlag, + SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_; //! sets a viewport virtual void setViewPort(const core::rect& area) _IRR_OVERRIDE_; - //! clears the zbuffer - virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, - SColor color=SColor(255,0,0,0), - const SExposedVideoData& videoData=SExposedVideoData(), - core::rect* sourceRect=0) _IRR_OVERRIDE_; + virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0, + const SExposedVideoData& videoData = SExposedVideoData(), core::rect* sourceRect = 0) _IRR_OVERRIDE_; - //! presents the rendered scene on the screen, returns false if failed virtual bool endScene() _IRR_OVERRIDE_; //! Only used by the internal engine. Used to notify the driver that @@ -136,11 +131,7 @@ namespace video virtual ITexture* addRenderTargetTexture(const core::dimension2d& size, const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_; - //! Clear the color, depth and/or stencil buffers. - virtual void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color) _IRR_OVERRIDE_; - - //! Clears the DepthBuffer. - virtual void clearZBuffer() _IRR_OVERRIDE_; + virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_; //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) _IRR_OVERRIDE_; diff --git a/tests/2dmaterial.cpp b/tests/2dmaterial.cpp index 4f62b779..96eec8e6 100644 --- a/tests/2dmaterial.cpp +++ b/tests/2dmaterial.cpp @@ -691,7 +691,7 @@ static bool draw2DImage4c(video::E_DRIVER_TYPE type) driver->getMaterial2D().TextureLayer[0].BilinearFilter = true; { - driver->beginScene(true, true, video::SColor(255,120,102,136)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,120,102,136)); driver->enableMaterial2D(); @@ -822,7 +822,7 @@ static bool addBlend2d(video::E_DRIVER_TYPE type) } material2D.AntiAliasing=video::EAAM_FULL_BASIC; - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->enableMaterial2D(); env->drawAll(); @@ -871,7 +871,7 @@ static bool moreFilterTests(video::E_DRIVER_TYPE type) driver->getMaterial2D().TextureLayer[0].TrilinearFilter=true; { - driver->beginScene(true, true, irr::video::SColor(255,255,255,255)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, irr::video::SColor(255,255,255,255)); // all three logos should be with filtering driver->enableMaterial2D(); diff --git a/tests/anti-aliasing.cpp b/tests/anti-aliasing.cpp index 09205be4..62446c5f 100644 --- a/tests/anti-aliasing.cpp +++ b/tests/anti-aliasing.cpp @@ -52,7 +52,7 @@ static bool testLineRendering(video::E_DRIVER_TYPE type) smgr->addCameraSceneNode(0, core::vector3df(0,30,-40), core::vector3df(0,5,0)); device->getTimer()->setTime(0); // scene has animations and current scene seems to be saved at that time - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->draw3DBox(node->getBoundingBox(), video::SColor(0,255,0,0)); driver->draw2DLine(core::position2di(10,10), core::position2di(100,100), video::SColor(255,0,0,0)); diff --git a/tests/b3dAnimation.cpp b/tests/b3dAnimation.cpp index 50ec9df2..c0dbf3b5 100644 --- a/tests/b3dAnimation.cpp +++ b/tests/b3dAnimation.cpp @@ -52,7 +52,7 @@ bool b3dAnimation(void) // Just jump to the last frame since that's all we're interested in. device->run(); - driver->beginScene(true, true, video::SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); @@ -73,7 +73,7 @@ bool b3dAnimation(void) // Simple render call device->run(); - driver->beginScene(true, true, video::SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); diff --git a/tests/billboards.cpp b/tests/billboards.cpp index 20e0f861..2b1499b1 100644 --- a/tests/billboards.cpp +++ b/tests/billboards.cpp @@ -96,7 +96,7 @@ bool billboardSize(void) bool result = false; device->run(); - driver->beginScene(true, true, video::SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); @@ -132,7 +132,7 @@ bool billboardOrientation(void) bool result = false; device->run(); - driver->beginScene(true, true, video::SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); diff --git a/tests/burningsVideo.cpp b/tests/burningsVideo.cpp index 6271a640..665a4865 100644 --- a/tests/burningsVideo.cpp +++ b/tests/burningsVideo.cpp @@ -25,7 +25,7 @@ bool burningsVideo(void) bool result = false; device->run(); - if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80))) + if (driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0, 80, 80, 80))) { smgr->drawAll(); driver->endScene(); diff --git a/tests/createImage.cpp b/tests/createImage.cpp index 55cb57e0..91a20e56 100644 --- a/tests/createImage.cpp +++ b/tests/createImage.cpp @@ -42,7 +42,7 @@ bool testImageCreation() } } - driver->beginScene(true, true, video::SColor(255,255,0,255));//Backbuffer background is pink + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255));//Backbuffer background is pink driver->draw2DImage(tex, core::position2d(0,0), core::recti(0,0,32,32)); driver->draw2DImage(tex1, core::position2d(32,0)); @@ -69,7 +69,7 @@ bool testImageFormats() video::IVideoDriver* driver = device->getVideoDriver(); video::ITexture* tex=driver->getTexture("../media/water.jpg"); video::ITexture* tex1=driver->getTexture("media/grey.tga"); - driver->beginScene(true, true); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,0)); driver->draw2DImage(tex, core::position2d(0,0), core::recti(0,0,64,64)); driver->draw2DImage(tex1, core::position2d(0,64), core::recti(0,0,64,64)); diff --git a/tests/draw2DImage.cpp b/tests/draw2DImage.cpp index 73acd83b..6371bba8 100644 --- a/tests/draw2DImage.cpp +++ b/tests/draw2DImage.cpp @@ -36,14 +36,14 @@ bool testWithRenderTarget(video::E_DRIVER_TYPE driverType) video::ITexture* tex=driver->getTexture("../media/water.jpg"); - driver->beginScene(true, true, video::SColor(255,255,0,255));//Backbuffer background is pink + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255));//Backbuffer background is pink //draw the 256x256 water image on the rendertarget: - driver->setRenderTarget(renderTarget,0,true,true,false,video::SColor(255,0,0,255));//Rendertarget background is blue + driver->setRenderTarget(renderTarget,0,video::ECBF_COLOR|video::ECBF_DEPTH,video::SColor(255,0,0,255));//Rendertarget background is blue driver->draw2DImage(tex, core::position2d(0,0), core::recti(0,0,32,32)); - driver->setRenderTarget(0, 0, false, false, false); + driver->setRenderTarget((video::IRenderTarget*)0, 0, 0); //draw the rendertarget on screen: //this should normally draw a 64x64 image containing a 32x32 image in the top left corner @@ -76,7 +76,7 @@ bool testRectangles(video::E_DRIVER_TYPE driverType) video::ITexture *tex=driver->getTexture("../media/fireball.bmp"); - driver->beginScene(true, true, video::SColor(255,255,0,255));//Backbuffer background is pink + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255));//Backbuffer background is pink // draw normal, will be overdrwan in error case driver->draw2DImage(tex, core::recti(68,32,132,96), core::recti(0,0,64,64)); @@ -119,7 +119,7 @@ bool testWithPNG(video::E_DRIVER_TYPE driverType) video::ITexture *tex=driver->getTexture("media/RedbrushAlpha-0.25.png"); - driver->beginScene(true, true, video::SColor(255,40,40,255));//Backbuffer background is blue + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,40,40,255));//Backbuffer background is blue driver->draw2DImage(tex, core::recti(0,0,160,120), core::recti(0,0,256,256), 0, 0, true); driver->endScene(); @@ -164,10 +164,10 @@ bool testExactPlacement(video::E_DRIVER_TYPE driverType) video::ITexture* tex=driver->getTexture("../media/fireball.bmp"); - driver->beginScene(true, true, video::SColor(255,40,40,255));//Backbuffer background is blue - driver->setRenderTarget(renderTarget, 0, true, true, true); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,40,40,255));//Backbuffer background is blue + driver->setRenderTarget(renderTarget, 0, video::ECBF_COLOR | video::ECBF_DEPTH); driver->draw2DImage(tex, core::recti(0,0,32,32), core::recti(0,0,64,64)); - driver->setRenderTarget(0, 0, false, false, false); + driver->setRenderTarget((video::IRenderTarget*)0, 0, 0); driver->endScene(); video::IImage* img = driver->createImage(renderTargetTex, core::vector2di(), renderTargetTex->getSize()); diff --git a/tests/drawPixel.cpp b/tests/drawPixel.cpp index 6ae19b87..38a6baf6 100644 --- a/tests/drawPixel.cpp +++ b/tests/drawPixel.cpp @@ -34,7 +34,7 @@ static bool lineRender(E_DRIVER_TYPE driverType) cube->setMaterialFlag(video::EMF_LIGHTING, false); (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); smgr->drawAll(); // Test for benign handling of offscreen pixel values as well as onscreen ones. @@ -74,7 +74,7 @@ static bool pixelAccuracy(E_DRIVER_TYPE driverType) device->getSceneManager()->addCameraSceneNode(); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); u32 start=0; for (u32 count=1; count<10; ++count) { @@ -136,7 +136,7 @@ static bool drawLine(E_DRIVER_TYPE driverType) device->getSceneManager()->addCameraSceneNode(); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); // horizontal lines for (u32 i=0; i<20; ++i) { diff --git a/tests/drawRectOutline.cpp b/tests/drawRectOutline.cpp index 096fb7e1..6995e155 100644 --- a/tests/drawRectOutline.cpp +++ b/tests/drawRectOutline.cpp @@ -18,7 +18,7 @@ bool testWithDriver(video::E_DRIVER_TYPE driverType) logTestString("Testing driver %ls\n", driver->getName()); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); core::recti r; r.UpperLeftCorner = core::position2di(1,1); diff --git a/tests/drawVertexPrimitive.cpp b/tests/drawVertexPrimitive.cpp index 6e35b13d..e121f584 100644 --- a/tests/drawVertexPrimitive.cpp +++ b/tests/drawVertexPrimitive.cpp @@ -52,7 +52,7 @@ bool testWithDriver(video::E_DRIVER_TYPE driverType) bool result = true; for (u32 Type=scene::EPT_POINTS; Type <= scene::EPT_POINT_SPRITES; ++Type) { - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); u32 primCount = 0; switch (Type) diff --git a/tests/flyCircleAnimator.cpp b/tests/flyCircleAnimator.cpp index 89f25377..272dd895 100644 --- a/tests/flyCircleAnimator.cpp +++ b/tests/flyCircleAnimator.cpp @@ -44,7 +44,7 @@ bool flyCircleAnimator(void) bool result = false; // Don't do device->run() since I need the time to remain at 0. - if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80))) + if (driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0, 80, 80, 80))) { smgr->drawAll(); driver->endScene(); diff --git a/tests/guiDisabledMenu.cpp b/tests/guiDisabledMenu.cpp index 5c1ee125..9ca2466f 100644 --- a/tests/guiDisabledMenu.cpp +++ b/tests/guiDisabledMenu.cpp @@ -44,7 +44,7 @@ bool guiDisabledMenu(void) (void)menu->OnEvent(event); device->run(); - driver->beginScene(true, true, video::SColor(150,50,50,50)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(150,50,50,50)); env->drawAll(); driver->endScene(); diff --git a/tests/ioScene.cpp b/tests/ioScene.cpp index f7a3fa60..f36f33b1 100644 --- a/tests/ioScene.cpp +++ b/tests/ioScene.cpp @@ -91,7 +91,7 @@ static bool loadScene(void) bool result = false; device->run(); device->getTimer()->setTime(666); // scene has animations and current scene seems to be saved at that time ... really - best result with just that number :-) - if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80))) + if (driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0, 80, 80, 80))) { smgr->drawAll(); driver->endScene(); diff --git a/tests/lightMaps.cpp b/tests/lightMaps.cpp index 05e6c350..2e9273f2 100644 --- a/tests/lightMaps.cpp +++ b/tests/lightMaps.cpp @@ -48,7 +48,7 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, core::vector3df(0,0,0), core::vector3df(40,100,30)); - driver->beginScene(true, true, video::SColor(255,255,255,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0)); smgr->drawAll(); driver->endScene(); diff --git a/tests/lights.cpp b/tests/lights.cpp index 7913d4e9..5c0dce0d 100644 --- a/tests/lights.cpp +++ b/tests/lights.cpp @@ -48,7 +48,7 @@ static bool testLightTypes(video::E_DRIVER_TYPE driverType) light3->setLightType(video::ELT_DIRECTIONAL); light1->getLightData().DiffuseColor.set(0,1,0); - driver->beginScene (true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); driver->endScene(); diff --git a/tests/makeColorKeyTexture.cpp b/tests/makeColorKeyTexture.cpp index c9cbe05b..288a4268 100644 --- a/tests/makeColorKeyTexture.cpp +++ b/tests/makeColorKeyTexture.cpp @@ -37,7 +37,7 @@ static bool doTestWith(E_DRIVER_TYPE driverType, zeroTexels); (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); smgr->drawAll(); driver->draw2DImage(Texture, diff --git a/tests/material.cpp b/tests/material.cpp index 947c6152..cf44a612 100644 --- a/tests/material.cpp +++ b/tests/material.cpp @@ -46,7 +46,7 @@ static bool polygonOffset(video::E_DRIVER_TYPE type) plane->getMaterial(0).PolygonOffsetDirection=video::EPO_BACK; plane->getMaterial(0).PolygonOffsetFactor=7; - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); bool result = takeScreenshotAndCompareAgainstReference(driver, "-polygonBack.png"); @@ -56,7 +56,7 @@ static bool polygonOffset(video::E_DRIVER_TYPE type) // test front plane to front plane2->getMaterial(0).PolygonOffsetDirection=video::EPO_FRONT; plane2->getMaterial(0).PolygonOffsetFactor=7; - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); result &= takeScreenshotAndCompareAgainstReference(driver, "-polygonFront.png"); diff --git a/tests/md2Animation.cpp b/tests/md2Animation.cpp index 9feebd90..29013743 100644 --- a/tests/md2Animation.cpp +++ b/tests/md2Animation.cpp @@ -41,7 +41,7 @@ bool testLastFrame() node->setCurrentFrame((f32)(node->getEndFrame())); node->setAnimationSpeed(0); device->run(); - driver->beginScene(true, true, video::SColor(255, 255, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 255, 255, 0)); smgr->drawAll(); driver->endScene(); if (mesh->getBoundingBox() != mesh->getMesh(node->getEndFrame())->getBoundingBox()) @@ -103,7 +103,7 @@ bool testNormals() node->setMD2Animation(scene::EMAT_STAND); node->setAnimationSpeed(0); device->run(); - driver->beginScene(true, true, video::SColor(255, 255, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 255, 255, 0)); smgr->drawAll(); driver->endScene(); } diff --git a/tests/meshTransform.cpp b/tests/meshTransform.cpp index aa15794c..e57bcb0b 100644 --- a/tests/meshTransform.cpp +++ b/tests/meshTransform.cpp @@ -58,7 +58,7 @@ bool meshTransform(void) // Just jump to the last frame since that's all we're interested in. device->run(); - driver->beginScene(true, true, SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); @@ -74,7 +74,7 @@ bool meshTransform(void) // Just jump to the last frame since that's all we're interested in. device->run(); - driver->beginScene(true, true, SColor(255, 60, 60, 60)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255, 60, 60, 60)); smgr->drawAll(); driver->endScene(); diff --git a/tests/mrt.cpp b/tests/mrt.cpp index 69c67a2c..748b8613 100644 --- a/tests/mrt.cpp +++ b/tests/mrt.cpp @@ -68,11 +68,11 @@ static bool testWithDriver(video::E_DRIVER_TYPE driverType) node->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType); device->getSceneManager()->addCameraSceneNode(0, core::vector3df(0,0,-10)); - driver->beginScene(true, false, video::SColor(255, 0, 0, 0)); + driver->beginScene(video::ECBF_COLOR, video::SColor(255, 0, 0, 0)); // render - driver->setRenderTarget(renderTarget, renderTargetID, true, true, false, video::SColor(255, 0, 0, 0)); + driver->setRenderTarget(renderTarget, renderTargetID, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,0)); device->getSceneManager()->drawAll(); - driver->setRenderTarget(0, renderTargetID, false, false, false, video::SColor(255, 0, 0, 0)); + driver->setRenderTarget(0, renderTargetID, 0, video::SColor(255, 0, 0, 0)); // draw debug rt driver->draw2DImage(renderTargetTex[0], core::position2d(0,0)); @@ -83,12 +83,12 @@ static bool testWithDriver(video::E_DRIVER_TYPE driverType) result = takeScreenshotAndCompareAgainstReference(driver, "-mrt.png"); - driver->beginScene(true, false, video::SColor(255, 0, 0, 0)); + driver->beginScene(video::ECBF_COLOR, video::SColor(255, 0, 0, 0)); // render device->getSceneManager()->getActiveCamera()->setPosition(core::vector3df(0,0,-15)); - driver->setRenderTarget(renderTarget, renderTargetID, true, true, false, video::SColor(255, 0, 0, 0)); + driver->setRenderTarget(renderTarget, renderTargetID, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,0)); device->getSceneManager()->drawAll(); - driver->setRenderTarget(0, renderTargetID, false, false, false, video::SColor(255, 0, 0, 0)); + driver->setRenderTarget(0, renderTargetID, 0, video::SColor(255,0,0,0)); // draw debug rt driver->draw2DImage(renderTargetTex[0], core::position2d(0,0)); diff --git a/tests/orthoCam.cpp b/tests/orthoCam.cpp index a65e9e2d..e7feee4b 100644 --- a/tests/orthoCam.cpp +++ b/tests/orthoCam.cpp @@ -36,7 +36,7 @@ static bool testOrthoCam(video::E_DRIVER_TYPE driverType) light->setRadius(500.f); light->getLightData().DiffuseColor.set(0,1,1); - device->getVideoDriver()->beginScene (true, true, 0); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); device->getSceneManager()->drawAll(); device->getVideoDriver()->endScene(); @@ -74,7 +74,7 @@ static bool testOrthoStencil(video::E_DRIVER_TYPE driverType) light->setRadius(500.f); light->getLightData().DiffuseColor.set(0,1,1); - device->getVideoDriver()->beginScene (true, true, 0); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); device->getSceneManager()->drawAll(); device->getVideoDriver()->endScene(); diff --git a/tests/planeMatrix.cpp b/tests/planeMatrix.cpp index 702cd3dd..1132a15b 100644 --- a/tests/planeMatrix.cpp +++ b/tests/planeMatrix.cpp @@ -72,7 +72,7 @@ static bool drawScaledOctree(void) (void)smgr->addCameraSceneNode(0, core::vector3df(0,0,0), core::vector3df(40,100,30)); - driver->beginScene(true, true, video::SColor(255,255,255,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0)); smgr->drawAll(); driver->endScene(); diff --git a/tests/projectionMatrix.cpp b/tests/projectionMatrix.cpp index 3c85bedc..0bdeaaf6 100644 --- a/tests/projectionMatrix.cpp +++ b/tests/projectionMatrix.cpp @@ -25,7 +25,7 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType) bool result = true; - driver->beginScene(true, false, SColor(255,0,0,0)); + driver->beginScene(video::ECBF_COLOR, SColor(255,0,0,0)); SMaterial mat; mat.MaterialType = EMT_SOLID; diff --git a/tests/renderTargetTexture.cpp b/tests/renderTargetTexture.cpp index 2fb2a980..f8fbee0c 100644 --- a/tests/renderTargetTexture.cpp +++ b/tests/renderTargetTexture.cpp @@ -43,7 +43,7 @@ static bool testWith2DImage(video::E_DRIVER_TYPE driverType) video::SColor colors[4]={0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff}; //draw the image : - driver->beginScene (true, true, video::SColor (255, 200, 200, 200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor (255, 200, 200, 200)); driver->draw2DImage (image, core::rect < s32 > (64 - image->getSize ().Width / 2, @@ -62,7 +62,7 @@ static bool testWith2DImage(video::E_DRIVER_TYPE driverType) scene::ISceneNode *modelNode = smgr->addMeshSceneNode(modelMesh); modelNode->setMaterialTexture (0, RTT_texture); - driver->beginScene (true, true, video::SColor (255, 200, 200, 200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor (255, 200, 200, 200)); smgr->drawAll(); driver->endScene(); @@ -72,7 +72,7 @@ static bool testWith2DImage(video::E_DRIVER_TYPE driverType) //it's now fliped... for (u32 i=0; i<10; ++i) { - driver->beginScene (true, true, video::SColor (255, 200, 200, 200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor (255, 200, 200, 200)); //draw img driver->draw2DImage (image, @@ -189,10 +189,10 @@ bool rttAndZBuffer(video::E_DRIVER_TYPE driverType) mesh->drop(); { - vd->beginScene(true, true, video::SColor(255, 0, 0, 0)); - vd->setRenderTarget(renderTarget, 0, true, true, false); + vd->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 0, 0)); + vd->setRenderTarget(renderTarget, 0, video::ECBF_COLOR | video::ECBF_DEPTH); sm->drawAll(); - vd->setRenderTarget(0, 0, false, false, false); + vd->setRenderTarget((video::IRenderTarget*)0, 0, 0); vd->setTransform(video::ETS_WORLD, core::IdentityMatrix); vd->setTransform(video::ETS_VIEW, core::IdentityMatrix); vd->setTransform(video::ETS_PROJECTION, core::IdentityMatrix); @@ -241,11 +241,11 @@ bool rttAndText(video::E_DRIVER_TYPE driverType) stabilizeScreenBackground(driver); - driver->beginScene(true, true, video::SColor(255,255, 255, 255)); - driver->setRenderTarget(renderTarget, 0, true, true, false, video::SColor(255,255,0,255)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255, 255, 255)); + driver->setRenderTarget(renderTarget, 0, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255)); driver->draw2DImage(driver->getTexture("../media/fireball.bmp"), core::recti(0, 0, renderTargetTex->getSize().Width, renderTargetTex->getSize().Height), core::recti(0, 0, 64, 64)); guienv->getBuiltInFont()->draw(L"OMGGG =!", core::rect(120, 100, 256, 256), video::SColor(255, 0, 0, 255)); - driver->setRenderTarget(0, 0, false, false, false); + driver->setRenderTarget((video::IRenderTarget*)0, 0, 0); driver->endScene(); scene::ISceneManager* smgr = device->getSceneManager(); @@ -259,7 +259,7 @@ bool rttAndText(video::E_DRIVER_TYPE driverType) // create a long text to produce much difference in failing result pictures gui::IGUIStaticText* text = guienv->addStaticText(L"asdddddddoamgmoasmgom\nfoaomsodommogdd\nddddddddd", core::rect(10, 20, 100, 160)); - driver->beginScene(true, true, video::SColor(255,255, 255, 255)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255, 255, 255)); cube->setVisible(false); smgr->drawAll(); guienv->drawAll(); @@ -286,7 +286,7 @@ static void Render(IrrlichtDevice* device, video::IRenderTarget* rt, core::vecto core::vector3df& pos2, scene::IAnimatedMesh* sphereMesh, core::vector3df& pos3, core::vector3df& pos4) { video::IVideoDriver* driver = device->getVideoDriver(); - driver->setRenderTarget(rt, 0, true, true, false); + driver->setRenderTarget(rt, 0, video::ECBF_COLOR | video::ECBF_DEPTH); device->getSceneManager()->drawAll(); video::SMaterial mat; @@ -390,7 +390,7 @@ bool rttAndAntiAliasing(video::E_DRIVER_TYPE driverType) renderTarget4->setTexture(renderTargetTex4, renderTargetDepth); device->getSceneManager()->setActiveCamera(cam); - device->getVideoDriver()->beginScene(); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,0)); #if 1 st->setText(L"Texture Rendering"); Render(device, renderTarget1, pos1, pos2, sphereMesh, pos3, pos4); @@ -398,7 +398,7 @@ bool rttAndAntiAliasing(video::E_DRIVER_TYPE driverType) Render(device, renderTarget3, pos1, pos2, sphereMesh, pos3, pos4); Render(device, renderTarget4, pos1, pos2, sphereMesh, pos3, pos4); - device->getVideoDriver()->setRenderTarget(0, 0, false, false, false); + device->getVideoDriver()->setRenderTarget((video::IRenderTarget*)0, 0, 0); device->getVideoDriver()->draw2DImage(renderTargetTex1, core::position2di(0, 0)); device->getVideoDriver()->draw2DImage(renderTargetTex2, core::position2di(80, 0)); device->getVideoDriver()->draw2DImage(renderTargetTex3, core::position2di(0, 60)); diff --git a/tests/sceneCollisionManager.cpp b/tests/sceneCollisionManager.cpp index 7b8c3d2c..b75ae75e 100644 --- a/tests/sceneCollisionManager.cpp +++ b/tests/sceneCollisionManager.cpp @@ -300,7 +300,7 @@ static bool checkBBoxIntersection(IrrlichtDevice * device, bool result=true; for (u32 round=0; round<2; ++round) { - driver->beginScene(true, true, video::SColor(100, 50, 50, 100)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(100, 50, 50, 100)); smgr->drawAll(); driver->endScene(); @@ -364,7 +364,7 @@ static bool checkBBoxIntersection(IrrlichtDevice * device, u32 count=0; for (u32 i=0; i<30; ++i) { - driver->beginScene(true, true, video::SColor(100, 50, 50, 100)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(100, 50, 50, 100)); smgr->drawAll(); driver->endScene(); @@ -402,7 +402,7 @@ static bool compareGetSceneNodeFromRayBBWithBBIntersectsWithLine(IrrlichtDevice // add a cube to pick scene::ISceneNode* cube = smgr->addCubeSceneNode(15); - driver->beginScene(true, true, video::SColor(100, 50, 50, 100)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(100, 50, 50, 100)); smgr->drawAll(); driver->endScene(); diff --git a/tests/screenshot.cpp b/tests/screenshot.cpp index c674a17c..51f31489 100644 --- a/tests/screenshot.cpp +++ b/tests/screenshot.cpp @@ -42,7 +42,7 @@ bool testShots(video::E_DRIVER_TYPE type) node->setAnimationSpeed(0); device->run(); - driver->beginScene(true, true, video::SColor(255, 255, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 255, 255, 0)); smgr->drawAll(); driver->endScene(); diff --git a/tests/softwareDevice.cpp b/tests/softwareDevice.cpp index 9ed67a17..e9bace12 100644 --- a/tests/softwareDevice.cpp +++ b/tests/softwareDevice.cpp @@ -37,7 +37,7 @@ bool softwareDevice(void) (void)smgr->addCameraSceneNode(0, core::vector3df(0,0,-40), core::vector3df(0,0,0)); - driver->beginScene(true, true, video::SColor(255,255,255,0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0)); smgr->drawAll(); driver->setMaterial(material); diff --git a/tests/stencilshadow.cpp b/tests/stencilshadow.cpp index b6faadf6..eb520e6d 100644 --- a/tests/stencilshadow.cpp +++ b/tests/stencilshadow.cpp @@ -31,7 +31,7 @@ static bool shadows(video::E_DRIVER_TYPE driverType) light->setRadius(500.f); light->getLightData().DiffuseColor.set(0,1,1); - device->getVideoDriver()->beginScene (true, true, 0); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); device->getSceneManager()->drawAll(); device->getVideoDriver()->endScene(); @@ -48,7 +48,7 @@ static bool shadows(video::E_DRIVER_TYPE driverType) cam->setPosition(core::vector3df(0,55,-30)); cam->setTarget(core::vector3df(60,45,150)); - device->getVideoDriver()->beginScene (true, true, 0); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); device->getSceneManager()->drawAll(); device->getVideoDriver()->endScene(); diff --git a/tests/terrainSceneNode.cpp b/tests/terrainSceneNode.cpp index 181dc68d..7c336618 100644 --- a/tests/terrainSceneNode.cpp +++ b/tests/terrainSceneNode.cpp @@ -45,7 +45,7 @@ bool terrainRecalc(void) // This shouldn't cause a recalc camera->setUpVector(vector3df(1.f, 0.f, .01f).normalize()); device->run(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); @@ -59,7 +59,7 @@ bool terrainRecalc(void) // This is big enough to cause a recalc camera->setUpVector(vector3df(1.f, 0.f, .1f).normalize()); device->run(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); @@ -105,7 +105,7 @@ bool terrainGaps() terrain->setMaterialFlag(video::EMF_WIREFRAME, !terrain->getMaterial(0).Wireframe); } - irrVideo->beginScene(true, true, video::SColor(0,150,150,150)); + irrVideo->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,150,150,150)); irrScene->drawAll(); irrVideo->endScene(); diff --git a/tests/testGeometryCreator.cpp b/tests/testGeometryCreator.cpp index 58539225..9be0e33b 100644 --- a/tests/testGeometryCreator.cpp +++ b/tests/testGeometryCreator.cpp @@ -73,7 +73,7 @@ bool testGeometryCreator(void) bool result = false; device->run(); - if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80))) + if (driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0, 80, 80, 80))) { smgr->drawAll(); driver->endScene(); @@ -110,7 +110,7 @@ bool testGeometryCreator(void) anode->setPosition(core::vector3df(-5000,0,-5000)); } - driver->beginScene(); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); driver->endScene(); diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index 5f36cfcc..ba2553a9 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -338,7 +338,7 @@ void stabilizeScreenBackground(irr::video::IVideoDriver * driver, { for(int i = 0; i < 10000; ++i) { - driver->beginScene(true, true, color); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, color); driver->endScene(); irr::video::IImage * screenshot = driver->createScreenShot(); diff --git a/tests/textureFeatures.cpp b/tests/textureFeatures.cpp index de7560ed..d1a51b50 100644 --- a/tests/textureFeatures.cpp +++ b/tests/textureFeatures.cpp @@ -69,7 +69,7 @@ bool renderMipLevels(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, core::vector3df(10,0,-30)); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); @@ -142,7 +142,7 @@ bool lockAllMipLevels(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); @@ -247,7 +247,7 @@ bool lockWithAutoMipmap(video::E_DRIVER_TYPE driverType) } (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); diff --git a/tests/textureRenderStates.cpp b/tests/textureRenderStates.cpp index 77f7bb58..b0d965b2 100644 --- a/tests/textureRenderStates.cpp +++ b/tests/textureRenderStates.cpp @@ -47,7 +47,7 @@ static bool manyTextures(video::E_DRIVER_TYPE driverType) mesh->setDirty(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); // set camera smgr->drawAll(); // draw meshbuffer @@ -86,13 +86,13 @@ static bool renderAndLoad(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); driver->draw2DImage(tex1, position2di(0,0)); driver->endScene(); driver->getTexture("../media/tools.png"); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); driver->draw2DImage(tex1, position2di(0,0)); driver->endScene(); @@ -121,7 +121,7 @@ static bool renderAndRemove(video::E_DRIVER_TYPE driverType) logTestString("Testing driver %ls\n", driver->getName()); - driver->beginScene (true, true, video::SColor(255, 0, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 255, 0)); smgr->drawAll(); driver->endScene(); @@ -130,14 +130,14 @@ static bool renderAndRemove(video::E_DRIVER_TYPE driverType) scene::ISceneNode * img = smgr->addCubeSceneNode(); img->setMaterialTexture(0, texture); - driver->beginScene (true, true, video::SColor (255, 0, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor (255, 0, 255, 0)); smgr->drawAll(); driver->endScene(); smgr->clear(); // Remove anything that used the texture driver->removeTexture(texture); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); @@ -146,7 +146,7 @@ static bool renderAndRemove(video::E_DRIVER_TYPE driverType) img = smgr->addCubeSceneNode(); img->setMaterialTexture(0, texture); - driver->beginScene (true, true, irr::video::SColor (255, 0, 255, 0)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, irr::video::SColor (255, 0, 255, 0)); smgr->drawAll(); driver->endScene(); @@ -201,7 +201,7 @@ static bool testTextureMatrixInMixedScenes(video::E_DRIVER_TYPE driverType) scene::IAnimatedMesh* pmesh = sceneManager->addHillPlaneMesh("testMesh",dimension2d(50,50),dimension2d(6,6),&mat); sceneManager->addAnimatedMeshSceneNode(pmesh); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); sceneManager->drawAll(); gui->drawAll(); driver->endScene(); @@ -261,7 +261,7 @@ static bool textureMatrix(video::E_DRIVER_TYPE driverType) trans.X += 0.0005f; textureMatrix.buildTextureTransform(0.f, rcenter, trans, scale); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); sceneManager->drawAll(); driver->endScene(); @@ -270,7 +270,7 @@ static bool textureMatrix(video::E_DRIVER_TYPE driverType) trans.X += 0.45f; textureMatrix.buildTextureTransform(0.f, rcenter, trans, scale); - driver->beginScene(true, true, video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140)); sceneManager->drawAll(); driver->endScene(); @@ -325,7 +325,7 @@ bool danglingTexturePointer() device->run(); { - driver->beginScene(true, true, irr::video::SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, irr::video::SColor(255,100,101,140)); // This is required to trigger the white appearance (this unbinds the // texture, forcing draw2DImage to rebind the logo3 texture (#2)). diff --git a/tests/transparentMaterials.cpp b/tests/transparentMaterials.cpp index c6b757ee..e411b674 100644 --- a/tests/transparentMaterials.cpp +++ b/tests/transparentMaterials.cpp @@ -47,7 +47,7 @@ bool testTransparentAlphaChannelRef(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, vector3df(0, 0, -15)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); @@ -99,7 +99,7 @@ bool testTransparentAlphaChannel(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, vector3df(0, 0, -15)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); @@ -158,7 +158,7 @@ bool testTransparentVertexAlpha(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, vector3df(0, 0, -15)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); @@ -220,7 +220,7 @@ bool testTransparentReflection2Layer(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, vector3df(0, 0, -15)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); @@ -272,7 +272,7 @@ bool testTransparentAddColor(video::E_DRIVER_TYPE driverType) (void)smgr->addCameraSceneNode(0, vector3df(0, 0, -15)); - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); smgr->drawAll(); driver->endScene(); @@ -335,7 +335,7 @@ bool testTransparentVertexAlphaMore(E_DRIVER_TYPE driverType) smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); - driver->beginScene(true, true, SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(0,200,200,200)); smgr->drawAll(); driver->endScene(); diff --git a/tests/triangleSelector.cpp b/tests/triangleSelector.cpp index 5c5c8361..e435a478 100644 --- a/tests/triangleSelector.cpp +++ b/tests/triangleSelector.cpp @@ -90,7 +90,7 @@ bool octree() bool result = true; { camera->setPosition(core::vector3df(-620,-20,550)); - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); core::aabbox3df box(boxPosition.X - BOX_SIZE1, boxPosition.Y - BOX_SIZE1, boxPosition.Z - BOX_SIZE1, @@ -114,7 +114,7 @@ bool octree() } { camera->setPosition(core::vector3df(120,40,50)); - driver->beginScene(true, true, 0); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0)); smgr->drawAll(); core::aabbox3df box(boxPosition.X - BOX_SIZE2, boxPosition.Y - BOX_SIZE2, boxPosition.Z - BOX_SIZE2, @@ -203,7 +203,7 @@ bool triangle() bool result = true; { - driver->beginScene(true, true, 0xff00ffff); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0xff00ffff)); smgr->drawAll(); core::aabbox3df box(boxPosition.X - BOX_SIZE, boxPosition.Y - BOX_SIZE, boxPosition.Z - BOX_SIZE, @@ -227,7 +227,7 @@ bool triangle() } { boxPosition.Z -= 10.f; - driver->beginScene(true, true, 0xff00ffff); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0xff00ffff)); smgr->drawAll(); core::aabbox3df box(boxPosition.X - BOX_SIZE, boxPosition.Y - BOX_SIZE, boxPosition.Z - BOX_SIZE, @@ -251,7 +251,7 @@ bool triangle() } { boxPosition.Z -= 20.f; - driver->beginScene(true, true, 0xff00ffff); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0xff00ffff)); smgr->drawAll(); core::aabbox3df box(boxPosition.X - BOX_SIZE, boxPosition.Y - BOX_SIZE, boxPosition.Z - BOX_SIZE, diff --git a/tests/userClipPlane.cpp b/tests/userClipPlane.cpp index 6e6347f7..ab87cfeb 100644 --- a/tests/userClipPlane.cpp +++ b/tests/userClipPlane.cpp @@ -36,7 +36,7 @@ static bool withSphere(video::E_DRIVER_TYPE type) device->run(); // while(device->run()) { - driver->beginScene(true, true, video::SColor(255,113,113,133)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133)); driver->setClipPlane(3, core::plane3df(core::vector3df(-8,0,0), core::vector3df(1,0,0)), true); driver->setClipPlane(4, core::plane3df(core::vector3df(0,0,8), core::vector3df(0,0,-1))); driver->setClipPlane(5, core::plane3df(core::vector3df(0,0,-8), core::vector3df(0,0,1))); diff --git a/tests/viewPort.cpp b/tests/viewPort.cpp index 9c1755d5..9afd9e27 100644 --- a/tests/viewPort.cpp +++ b/tests/viewPort.cpp @@ -43,7 +43,7 @@ static bool viewPortText(E_DRIVER_TYPE driverType) smgr->addCubeSceneNode(); smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); smgr->drawAll(); env->drawAll(); driver->setViewPort(rect(0,0,160/2,120/2)); diff --git a/tests/writeImageToFile.cpp b/tests/writeImageToFile.cpp index 36e719c0..22608ca7 100644 --- a/tests/writeImageToFile.cpp +++ b/tests/writeImageToFile.cpp @@ -30,7 +30,7 @@ bool writeImageToFile(void) cube->setMaterialFlag(video::EMF_LIGHTING, false); (void)smgr->addCameraSceneNode(); - driver->beginScene(true, true, SColor(255,100,101,140)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140)); smgr->drawAll(); // Test for benign handling of offscreen pixel values as well as onscreen ones. diff --git a/tools/GUIEditor/main.cpp b/tools/GUIEditor/main.cpp index b7eb2ffc..d591c147 100644 --- a/tools/GUIEditor/main.cpp +++ b/tools/GUIEditor/main.cpp @@ -65,7 +65,7 @@ int main() wchar_t caption[512]; swprintf_irr(caption, 512, L"screen (%4u/%4u)", screenSize.Width, screenSize.Height); device->setWindowCaption(caption); - driver->beginScene(true, true, video::SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,200,200,200)); smgr->drawAll(); env->drawAll(); driver->endScene(); diff --git a/tools/IrrFontTool/newFontTool/CVectorFontTool.h b/tools/IrrFontTool/newFontTool/CVectorFontTool.h index 05a9c79a..aac5dbcc 100644 --- a/tools/IrrFontTool/newFontTool/CVectorFontTool.h +++ b/tools/IrrFontTool/newFontTool/CVectorFontTool.h @@ -347,7 +347,7 @@ public: //while(Device->getTimer()->getTime() < endt ) //{ Device->run(); - Device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); + Device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); for (u32 v=0;vgetTimer()->getTime()-stt) % 500) / 500.0f; device->run(); - device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); for (u32 g=0;ggetTimer()->getTime()-stt) % 500) / 500.0f; device->run(); - device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); for (u32 g=0;ggetTimer()->getTime() < endt ) { device->run(); - device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); + device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); for (u32 g=0;gisWindowActive()) { - driver->beginScene(true, true, video::SColor(0,200,200,200)); + driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,200,200,200)); smgr->drawAll(); env->drawAll(); driver->endScene();