- updated debug stats to use render cache

This commit is contained in:
Mark Vejvoda 2010-09-10 09:09:12 +00:00
parent 0783b23e12
commit cc9bde39af
2 changed files with 13 additions and 3 deletions

View File

@ -1535,6 +1535,9 @@ void Game::render2d(){
str+= "\n";
str+= "Visible quad area: " + floatToStr(visibleQuad.area()) +"\n";
VisibleQuadContainerCache &qCache =renderer.getQuadCache();
int visibleUnitCount = qCache.visibleQuadUnitList.size();
/*
int visibleUnitCount = 0;
for(int i=0; i< world.getFactionCount(); ++i){
for(int j=0; j< world.getFaction(i)->getUnitCount(); ++j){
@ -1544,8 +1547,11 @@ void Game::render2d(){
}
}
}
*/
str+= "Visible unit count: " + intToStr(visibleUnitCount) +"\n";
int visibleObjectCount = qCache.visibleObjectList.size();
/*
int visibleObjectCount = 0;
Map *map= world.getMap();
int thisTeamIndex= world.getThisTeamIndex();
@ -1565,6 +1571,7 @@ void Game::render2d(){
}
}
}
*/
str+= "Visible object count: " + intToStr(visibleObjectCount) +"\n";
// resources

View File

@ -3773,7 +3773,10 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
const Faction *faction = world->getFaction(i);
for(int j = 0; j < faction->getUnitCount(); ++j) {
Unit *unit= faction->getUnit(j);
if(world->toRenderUnit(unit, visibleQuad)) {
bool insideQuad = visibleQuad.isInside(unit->getPos());
bool renderInMap = world->toRenderUnit(unit);
if(insideQuad == true && renderInMap == true) {
quadCache.visibleQuadUnitList.push_back(unit);
}
else {
@ -3782,7 +3785,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
//quadCache.inVisibleUnitList.push_back(unit);
}
if(world->toRenderUnit(unit)) {
if(renderInMap == true) {
quadCache.visibleUnitList.push_back(unit);
}
}
@ -3805,7 +3808,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
SurfaceCell *sc = map->getSurfaceCell(mapPos);
Object *o = sc->getObject();
bool isExplored = (sc->isExplored(world->getThisTeamIndex()) && o != NULL);
//bool isVisible = (sc->isVisible(thisTeamIndex) && o!=NULL);
//bool isVisible = (sc->isVisible(world->getThisTeamIndex()) && o != NULL);
bool isVisible = true;
if(isExplored == true && isVisible == true) {