Some more cleanup

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-07-04 23:41:46 +02:00
parent 93d856b394
commit 5ac4a23bd3

View file

@ -559,6 +559,48 @@ void renderScene(bool forceFullDetail, bool bloom)
// *************************************************************************************************************************** // ***************************************************************************************************************************
void updateWaterEnvMap()
{
#ifdef USE_WATER_ENV_MAP
if (WaterEnvMapRefCount > 0) // water env map needed
{
if (!WaterEnvMap)
{
CSky &sky = ContinentMngr.cur()->CurrentSky;
if (sky.getScene())
{
nlassert(WaterEnvMapSkyCam.empty());
WaterEnvMapSkyCam = sky.getScene()->createCamera(); // deleted in unselect
nlassert(WaterEnvMapCanopyCam.empty());
WaterEnvMapCanopyCam = SceneRoot->createCamera(); // deleted in unselect
// Create water env map if not already created
WaterEnvMap = Driver->createWaterEnvMap();
if(WaterEnvMap)
{
WaterEnvMap->init(128, 256, ClientCfg.WaterEnvMapUpdateTime);
WaterEnvMap->setWaterEnvMapRenderCallback(&WaterEnvMapRdr);
Scene->setWaterEnvMap(WaterEnvMap);
}
}
}
WaterEnvMapRdr.CurrDate = SmoothedClientDate;
WaterEnvMapRdr.AnimationDate = SmoothedClientDate;
if (ClientCfg.R2EDEnabled && R2::getEditor().getFixedLighting())
{
WaterEnvMapRdr.CurrDate.Hour = 12.f;
}
WaterEnvMapRdr.CurrFogColor = MainFogState.FogColor;
WaterEnvMapRdr.CurrTime = TimeInSec - FirstTimeInSec;
WaterEnvMapRdr.CurrWeather = WeatherManager.getWeatherValue();
CSky &sky = ContinentMngr.cur()->CurrentSky;
WaterEnvMap->setAlpha(sky.getWaterEnvMapAlpha());
Scene->updateWaterEnvMaps(TimeInSec - FirstTimeInSec);
}
#endif
}
// ***************************************************************************************************************************
void updateWeather() void updateWeather()
{ {
H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather ) H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather )
@ -999,6 +1041,14 @@ bool mainLoop()
while( !UserEntity->permanentDeath() while( !UserEntity->permanentDeath()
&& !game_exit ) && !game_exit )
{ {
// If an action handler execute. NB: MUST BE DONE BEFORE ANY THING ELSE PROFILE CRASH!!!!!!!!!!!!!!!!!
testLaunchProfile();
// Test and may run a VBLock profile (only once)
testLaunchProfileVBLock();
// Start Bench
H_AUTO_USE ( RZ_Client_Main_Loop )
if (isBGDownloadEnabled()) if (isBGDownloadEnabled())
{ {
@ -1073,11 +1123,6 @@ bool mainLoop()
} }
{ {
// If an action handler execute. NB: MUST BE DONE BEFORE ANY THING ELSE PROFILE CRASH!!!!!!!!!!!!!!!!!
testLaunchProfile();
// Test and may run a VBLock profile (only once)
testLaunchProfileVBLock();
// Stop the Outgame music, with fade effect // Stop the Outgame music, with fade effect
outgameFader.fade(); outgameFader.fade();
@ -1085,10 +1130,6 @@ bool mainLoop()
// update quit feature // update quit feature
updateGameQuitting(); updateGameQuitting();
// Start Bench
H_AUTO_USE ( RZ_Client_Main_Loop )
// update module manager // update module manager
NLNET::IModuleManager::getInstance().updateModules(); NLNET::IModuleManager::getInstance().updateModules();
@ -1523,40 +1564,8 @@ bool mainLoop()
// Render // Render
if(Render) if(Render)
{ {
#ifdef USE_WATER_ENV_MAP // Update water env map (happens when continent changed etc)
if (WaterEnvMapRefCount > 0) // water env map needed updateWaterEnvMap();
{
if (!WaterEnvMap)
{
CSky &sky = ContinentMngr.cur()->CurrentSky;
if (sky.getScene())
{
WaterEnvMapSkyCam = sky.getScene()->createCamera(); // deleted in unselect
WaterEnvMapCanopyCam = SceneRoot->createCamera(); // deleted in unselect
// Create water env map if not already created
WaterEnvMap = Driver->createWaterEnvMap();
if(WaterEnvMap)
{
WaterEnvMap->init(128, 256, ClientCfg.WaterEnvMapUpdateTime);
WaterEnvMap->setWaterEnvMapRenderCallback(&WaterEnvMapRdr);
Scene->setWaterEnvMap(WaterEnvMap);
}
}
}
WaterEnvMapRdr.CurrDate = SmoothedClientDate;
WaterEnvMapRdr.AnimationDate = SmoothedClientDate;
if (ClientCfg.R2EDEnabled && R2::getEditor().getFixedLighting())
{
WaterEnvMapRdr.CurrDate.Hour = 12.f;
}
WaterEnvMapRdr.CurrFogColor = MainFogState.FogColor;
WaterEnvMapRdr.CurrTime = TimeInSec - FirstTimeInSec;
WaterEnvMapRdr.CurrWeather = WeatherManager.getWeatherValue();
CSky &sky = ContinentMngr.cur()->CurrentSky;
WaterEnvMap->setAlpha(sky.getWaterEnvMapAlpha());
Scene->updateWaterEnvMaps(TimeInSec - FirstTimeInSec);
}
#endif
// Update weather // Update weather
updateWeather(); updateWeather();