- updated debug stats to use render cache
This commit is contained in:
parent
0783b23e12
commit
cc9bde39af
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user