From 5c568c6ea0130160651c8b80828dc1a6d9584ca1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 4 Jul 2013 22:26:31 +0200 Subject: [PATCH] Correctly apply bloom on oversize screenshots --HG-- branch : multipass-stereo --- .../src/interface_v3/action_handler_misc.cpp | 2 +- code/ryzom/client/src/main_loop.cpp | 47 +++++++++++++------ code/ryzom/client/src/main_loop.h | 2 +- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 7a68f7872..2d1fba931 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -542,7 +542,7 @@ void renderSceneScreenShot (uint left, uint right, uint top, uint bottom, uint s CCameraBackup cbScene = setupCameraForScreenshot(*Scene, left, right, top, bottom, screenShotWidth, screenShotHeight); CCameraBackup cbCanopy = setupCameraForScreenshot(*SceneRoot, left, right, top, bottom, screenShotWidth, screenShotHeight); // sky setup are copied from main scene before rendering so no setup done here - renderScene(ClientCfg.ScreenShotFullDetail); + renderScene(ClientCfg.ScreenShotFullDetail, ClientCfg.Bloom); restoreCamera(*Scene, cbScene); restoreCamera(*SceneRoot, cbCanopy); } diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 6e11d3a2a..8cd0aea63 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -487,6 +487,8 @@ static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode) #endif } +// *************************************************************************************************************************** +// Utility to force full detail struct CForceFullDetail { public: @@ -519,8 +521,16 @@ private: }; static CForceFullDetail s_ForceFullDetail; -void renderScene(bool forceFullDetail) +void renderScene(bool forceFullDetail, bool bloom) { + if (bloom) + { + // set bloom parameters before applying bloom effect + CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); + CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); + // init bloom + CBloomEffect::getInstance().initBloom(); + } if (forceFullDetail) { s_ForceFullDetail.backup(); @@ -531,21 +541,18 @@ void renderScene(bool forceFullDetail) { s_ForceFullDetail.restore(); } + if (bloom) + { + // apply bloom effect + CBloomEffect::getInstance().endBloom(); + CBloomEffect::getInstance().endInterfacesDisplayBloom(); + } } // *************************************************************************************************************************** // Render all scenes void renderScene() { - if (ClientCfg.Bloom) - { - // set bloom parameters before applying bloom effect - CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); - CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); - // init bloom - CBloomEffect::getInstance().initBloom(); - } - { H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather ) @@ -673,10 +680,6 @@ void renderScene() // reset depth range Driver->setDepthRange(0.f, CANOPY_DEPTH_RANGE_START); - - // apply bloom effect - if (ClientCfg.Bloom) - CBloomEffect::getInstance().endBloom(); } @@ -1539,6 +1542,14 @@ bool mainLoop() } #endif + if (ClientCfg.Bloom) + { + // set bloom parameters before applying bloom effect + CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); + CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); + // init bloom + CBloomEffect::getInstance().initBloom(); + } // nb : force full detail if a screenshot is asked // todo : move outside render code bool fullDetail = ScreenshotRequest != ScreenshotRequestNone && ClientCfg.ScreenShotFullDetail; @@ -1547,11 +1558,19 @@ bool mainLoop() s_ForceFullDetail.backup(); s_ForceFullDetail.set(); } + + // Render scene renderScene(); + if (fullDetail) { s_ForceFullDetail.restore(); } + if (ClientCfg.Bloom) + { + // apply bloom effect + CBloomEffect::getInstance().endBloom(); + } // for that frame and // tmp : display height grid diff --git a/code/ryzom/client/src/main_loop.h b/code/ryzom/client/src/main_loop.h index f2f650b3e..82137969a 100644 --- a/code/ryzom/client/src/main_loop.h +++ b/code/ryzom/client/src/main_loop.h @@ -30,7 +30,7 @@ bool mainLoop(); // render all void renderScene(); -void renderScene(bool forceFullDetail); +void renderScene(bool forceFullDetail, bool bloom); void setDefaultChatWindow(CChatWindow *defaultChatWindow); void updateDayNightCycleHour();