mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 04:02:30 +01:00
- a few minor render updates to try to squeeze better performance out of the rendering (only render visible and explored unit and object cells)
This commit is contained in:
parent
39acffa2aa
commit
cad295c912
@ -1152,14 +1152,13 @@ void Game::render2d(){
|
||||
//debug info
|
||||
|
||||
string str;
|
||||
if(config.getBool("DebugMode") || difftime(time(NULL),lastRenderLog2d) >= 1){
|
||||
if(gui.getShowDebugUI() == true || difftime(time(NULL),lastRenderLog2d) >= 1) {
|
||||
str+= "MouseXY: " + intToStr(mouseX) + "," + intToStr(mouseY)+"\n";
|
||||
str+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\n";
|
||||
str+= "Render FPS: "+intToStr(lastRenderFps)+"\n";
|
||||
str+= "Update FPS: "+intToStr(lastUpdateFps)+"\n";
|
||||
str+= "GameCamera pos: "+floatToStr(gameCamera.getPos().x)+","+floatToStr(gameCamera.getPos().y)+","+floatToStr(gameCamera.getPos().z)+"\n";
|
||||
str+= "Time: "+floatToStr(world.getTimeFlow()->getTime(),8)+"\n";
|
||||
//str+= "Time Increment: "+floatToStr(world.getTimeFlow()->getTimeInc(),8)+"\n";
|
||||
str+= "Triangle count: "+intToStr(renderer.getTriangleCount())+"\n";
|
||||
str+= "Vertex count: "+intToStr(renderer.getPointCount())+"\n";
|
||||
str+= "Frame count:"+intToStr(world.getFrameCount())+"\n";
|
||||
@ -1197,7 +1196,8 @@ void Game::render2d(){
|
||||
SurfaceCell *sc= map->getSurfaceCell(mapPos.x, mapPos.y);
|
||||
Object *o= sc->getObject();
|
||||
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
||||
if(isExplored == true) {
|
||||
bool isVisible = (sc->isVisible(thisTeamIndex) && o!=NULL);
|
||||
if(isExplored == true && isVisible == true) {
|
||||
visibleObjectCount++;
|
||||
}
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ void Game::render2d(){
|
||||
}
|
||||
}
|
||||
|
||||
if(config.getBool("DebugMode") && gui.getShowDebugUI() == true) {
|
||||
if(gui.getShowDebugUI() == true) {
|
||||
renderer.renderText(str, coreData.getMenuFontNormal(),
|
||||
Vec3f(1.0f), 10, 500, false);
|
||||
|
||||
@ -1239,7 +1239,7 @@ void Game::render2d(){
|
||||
}
|
||||
|
||||
//resource info
|
||||
if(!config.getBool("PhotoMode")) {
|
||||
if(config.getBool("PhotoMode") == false) {
|
||||
renderer.renderResourceStatus();
|
||||
renderer.renderConsole(&console,showFullConsole);
|
||||
}
|
||||
|
@ -1306,7 +1306,8 @@ void Renderer::renderObjects(const int renderFps, const int worldFrameCount) {
|
||||
SurfaceCell *sc= map->getSurfaceCell(mapPos.x, mapPos.y);
|
||||
Object *o= sc->getObject();
|
||||
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
||||
if(isExplored == true) {
|
||||
bool isVisible = (sc->isVisible(thisTeamIndex) && o!=NULL);
|
||||
if(isExplored == true && isVisible == true) {
|
||||
/*
|
||||
if(renderFps < MIN_RENDER_FPS_ALLOWED) {
|
||||
int renderLag = worldFrameCount - o->getLastRenderFrame();
|
||||
@ -2826,8 +2827,10 @@ void Renderer::renderObjectsFast() {
|
||||
Vec2i mapPos = Map::toSurfCoords(pos);
|
||||
SurfaceCell *sc= map->getSurfaceCell(mapPos);
|
||||
Object *o= sc->getObject();
|
||||
if(sc->isExplored(thisTeamIndex) && o!=NULL){
|
||||
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
||||
bool isVisible = (sc->isVisible(thisTeamIndex) && o!=NULL);
|
||||
|
||||
if(isExplored == true && isVisible == true) {
|
||||
const Model *objModel= sc->getObject()->getModel();
|
||||
Vec3f v= o->getPos();
|
||||
|
||||
|
@ -381,9 +381,11 @@ bool World::toRenderUnit(const Unit *unit, const Quad2i &visibleQuad) const{
|
||||
bool World::toRenderUnit(const Unit *unit) const{
|
||||
|
||||
return
|
||||
map.getSurfaceCell(Map::toSurfCoords(unit->getCenteredPos()))->isVisible(thisTeamIndex) ||
|
||||
(map.getSurfaceCell(Map::toSurfCoords(unit->getCenteredPos()))->isVisible(thisTeamIndex) &&
|
||||
map.getSurfaceCell(Map::toSurfCoords(unit->getCenteredPos()))->isExplored(thisTeamIndex) ) ||
|
||||
(unit->getCurrSkill()->getClass()==scAttack &&
|
||||
map.getSurfaceCell(Map::toSurfCoords(unit->getTargetPos()))->isVisible(thisTeamIndex));
|
||||
map.getSurfaceCell(Map::toSurfCoords(unit->getTargetPos()))->isVisible(thisTeamIndex) &&
|
||||
map.getSurfaceCell(Map::toSurfCoords(unit->getTargetPos()))->isExplored(thisTeamIndex));
|
||||
}
|
||||
|
||||
void World::createUnit(const string &unitName, int factionIndex, const Vec2i &pos){
|
||||
|
Loading…
x
Reference in New Issue
Block a user