- bugfix to clear surface data cache on game exit (lest we overfill system RAM)

This commit is contained in:
Mark Vejvoda 2011-02-05 05:50:42 +00:00
parent 25f1cdaae6
commit 6052ee6cc7
3 changed files with 8 additions and 0 deletions

View File

@ -1683,6 +1683,7 @@ void Game::render2d(){
str+= "Render FPS: " + intToStr(lastRenderFps) + "[" + intToStr(avgRenderFps) + "]\n";
str+= "Update FPS: " + intToStr(lastUpdateFps) + "[" + intToStr(avgUpdateFps) + "]\n";
str+= "GameCamera pos: " + floatToStr(gameCamera.getPos().x)+","+floatToStr(gameCamera.getPos().y)+","+floatToStr(gameCamera.getPos().z)+"\n";
str+= "Cached surfacedata: " + intToStr(renderer.getCachedSurfaceDataSize());
str+= "Time: " + floatToStr(world.getTimeFlow()->getTime(),2)+"\n";
if(SystemFlags::getThreadedLoggerRunning() == true) {
str+= "Log buffer count: " + intToStr(SystemFlags::getLogEntryBufferCount())+"\n";

View File

@ -154,6 +154,7 @@ Renderer::Renderer() {
textRenderer = NULL;
particleRenderer = NULL;
saveScreenShotThread = NULL;
mapSurfaceData.clear();
lastRenderFps=MIN_FPS_NORMAL_RENDERING;
shadowsOffDueToMinRender=false;
@ -231,6 +232,7 @@ Renderer::~Renderer() {
}
}
mapSurfaceData.clear();
this->menu = NULL;
this->game = NULL;
}
@ -310,6 +312,7 @@ void Renderer::initGame(const Game *game){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
SurfaceData::nextUniqueId = 1;
mapSurfaceData.clear();
this->game= game;
worldToScreenPosCache.clear();
@ -430,6 +433,8 @@ void Renderer::end() {
//delete 2d list
glDeleteLists(list2d, 1);
mapSurfaceData.clear();
}
void Renderer::endGame() {
@ -449,6 +454,7 @@ void Renderer::endGame() {
worldToScreenPosCache.clear();
ReleaseSurfaceVBOs();
mapSurfaceData.clear();
}
void Renderer::endMenu() {

View File

@ -428,6 +428,7 @@ public:
void renderProgressBar(int size, int x, int y, Font2D *font,int customWidth=-1, string prefixLabel="");
static Texture2D * findFactionLogoTexture(string logoFilename);
int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); }
private:
//private misc