Correctly apply bloom on oversize screenshots

This commit is contained in:
kaetemi 2013-07-04 22:26:31 +02:00
parent ee227aaf9c
commit bfae91eb88
3 changed files with 35 additions and 16 deletions

View file

@ -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 cbScene = setupCameraForScreenshot(*Scene, left, right, top, bottom, screenShotWidth, screenShotHeight);
CCameraBackup cbCanopy = setupCameraForScreenshot(*SceneRoot, 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 // 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(*Scene, cbScene);
restoreCamera(*SceneRoot, cbCanopy); restoreCamera(*SceneRoot, cbCanopy);
} }

View file

@ -487,6 +487,8 @@ static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode)
#endif #endif
} }
// ***************************************************************************************************************************
// Utility to force full detail
struct CForceFullDetail struct CForceFullDetail
{ {
public: public:
@ -519,8 +521,16 @@ private:
}; };
static CForceFullDetail s_ForceFullDetail; 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) if (forceFullDetail)
{ {
s_ForceFullDetail.backup(); s_ForceFullDetail.backup();
@ -531,21 +541,18 @@ void renderScene(bool forceFullDetail)
{ {
s_ForceFullDetail.restore(); s_ForceFullDetail.restore();
} }
if (bloom)
{
// apply bloom effect
CBloomEffect::getInstance().endBloom();
CBloomEffect::getInstance().endInterfacesDisplayBloom();
}
} }
// *************************************************************************************************************************** // ***************************************************************************************************************************
// Render all scenes // Render all scenes
void renderScene() 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 ) H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather )
@ -673,10 +680,6 @@ void renderScene()
// reset depth range // reset depth range
Driver->setDepthRange(0.f, CANOPY_DEPTH_RANGE_START); Driver->setDepthRange(0.f, CANOPY_DEPTH_RANGE_START);
// apply bloom effect
if (ClientCfg.Bloom)
CBloomEffect::getInstance().endBloom();
} }
@ -1539,6 +1542,14 @@ bool mainLoop()
} }
#endif #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 // nb : force full detail if a screenshot is asked
// todo : move outside render code // todo : move outside render code
bool fullDetail = ScreenshotRequest != ScreenshotRequestNone && ClientCfg.ScreenShotFullDetail; bool fullDetail = ScreenshotRequest != ScreenshotRequestNone && ClientCfg.ScreenShotFullDetail;
@ -1547,11 +1558,19 @@ bool mainLoop()
s_ForceFullDetail.backup(); s_ForceFullDetail.backup();
s_ForceFullDetail.set(); s_ForceFullDetail.set();
} }
// Render scene
renderScene(); renderScene();
if (fullDetail) if (fullDetail)
{ {
s_ForceFullDetail.restore(); s_ForceFullDetail.restore();
} }
if (ClientCfg.Bloom)
{
// apply bloom effect
CBloomEffect::getInstance().endBloom();
}
// for that frame and // for that frame and
// tmp : display height grid // tmp : display height grid

View file

@ -30,7 +30,7 @@ bool mainLoop();
// render all // render all
void renderScene(); void renderScene();
void renderScene(bool forceFullDetail); void renderScene(bool forceFullDetail, bool bloom);
void setDefaultChatWindow(CChatWindow *defaultChatWindow); void setDefaultChatWindow(CChatWindow *defaultChatWindow);
void updateDayNightCycleHour(); void updateDayNightCycleHour();