Remove a useless global terrain update when modifying environment settings in Atlas.

Also make sure that the settings are updated in the game view in a
non-hacky way.

This was SVN commit r16855.
This commit is contained in:
Nicolas Auvray 2015-07-14 17:08:02 +00:00
parent b0386d7fab
commit 9f1b85d562
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games. /* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -102,13 +102,16 @@ public:
g_Renderer.GetWaterManager()->RecomputeWindStrength(); g_Renderer.GetWaterManager()->RecomputeWindStrength();
g_Renderer.GetWaterManager()->CreateWaveMeshes(); g_Renderer.GetWaterManager()->CreateWaveMeshes();
} }
// Tell the terrain it'll need to recompute its cached render data // Tell the terrain it'll need to recompute its cached render data
GetSimContext().GetTerrain().MakeDirty(RENDERDATA_UPDATE_VERTICES); GetSimContext().GetTerrain().MakeDirty(RENDERDATA_UPDATE_VERTICES);
} }
virtual void SetWaterLevel(entity_pos_t h) virtual void SetWaterLevel(entity_pos_t h)
{ {
if (m_WaterHeight == h)
return;
m_WaterHeight = h; m_WaterHeight = h;
// Tell the terrain it'll need to recompute its cached render data // Tell the terrain it'll need to recompute its cached render data
@ -116,7 +119,7 @@ public:
if (CRenderer::IsInitialised()) if (CRenderer::IsInitialised())
g_Renderer.GetWaterManager()->m_WaterHeight = h.ToFloat(); g_Renderer.GetWaterManager()->m_WaterHeight = h.ToFloat();
CMessageWaterChanged msg; CMessageWaterChanged msg;
GetSimContext().GetComponentManager().BroadcastMessage(msg); GetSimContext().GetComponentManager().BroadcastMessage(msg);
} }

View File

@ -142,6 +142,8 @@ void SetSettings(const sEnvironmentSettings& s)
COLOR(s.unitcolor, g_LightEnv.m_UnitsAmbientColor); COLOR(s.unitcolor, g_LightEnv.m_UnitsAmbientColor);
COLOR(s.fogcolor, g_LightEnv.m_FogColor); COLOR(s.fogcolor, g_LightEnv.m_FogColor);
#undef COLOR #undef COLOR
cmpWaterManager->RecomputeWaterData();
} }
BEGIN_COMMAND(SetEnvironmentSettings) BEGIN_COMMAND(SetEnvironmentSettings)