mirror of
https://github.com/glest/glest-source.git
synced 2025-09-25 15:09:03 +02: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:
@@ -1152,14 +1152,13 @@ void Game::render2d(){
|
|||||||
//debug info
|
//debug info
|
||||||
|
|
||||||
string str;
|
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+= "MouseXY: " + intToStr(mouseX) + "," + intToStr(mouseY)+"\n";
|
||||||
str+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\n";
|
str+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\n";
|
||||||
str+= "Render FPS: "+intToStr(lastRenderFps)+"\n";
|
str+= "Render FPS: "+intToStr(lastRenderFps)+"\n";
|
||||||
str+= "Update FPS: "+intToStr(lastUpdateFps)+"\n";
|
str+= "Update FPS: "+intToStr(lastUpdateFps)+"\n";
|
||||||
str+= "GameCamera pos: "+floatToStr(gameCamera.getPos().x)+","+floatToStr(gameCamera.getPos().y)+","+floatToStr(gameCamera.getPos().z)+"\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: "+floatToStr(world.getTimeFlow()->getTime(),8)+"\n";
|
||||||
//str+= "Time Increment: "+floatToStr(world.getTimeFlow()->getTimeInc(),8)+"\n";
|
|
||||||
str+= "Triangle count: "+intToStr(renderer.getTriangleCount())+"\n";
|
str+= "Triangle count: "+intToStr(renderer.getTriangleCount())+"\n";
|
||||||
str+= "Vertex count: "+intToStr(renderer.getPointCount())+"\n";
|
str+= "Vertex count: "+intToStr(renderer.getPointCount())+"\n";
|
||||||
str+= "Frame count:"+intToStr(world.getFrameCount())+"\n";
|
str+= "Frame count:"+intToStr(world.getFrameCount())+"\n";
|
||||||
@@ -1197,7 +1196,8 @@ void Game::render2d(){
|
|||||||
SurfaceCell *sc= map->getSurfaceCell(mapPos.x, mapPos.y);
|
SurfaceCell *sc= map->getSurfaceCell(mapPos.x, mapPos.y);
|
||||||
Object *o= sc->getObject();
|
Object *o= sc->getObject();
|
||||||
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
||||||
if(isExplored == true) {
|
bool isVisible = (sc->isVisible(thisTeamIndex) && o!=NULL);
|
||||||
|
if(isExplored == true && isVisible == true) {
|
||||||
visibleObjectCount++;
|
visibleObjectCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1215,7 +1215,7 @@ void Game::render2d(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.getBool("DebugMode") && gui.getShowDebugUI() == true) {
|
if(gui.getShowDebugUI() == true) {
|
||||||
renderer.renderText(str, coreData.getMenuFontNormal(),
|
renderer.renderText(str, coreData.getMenuFontNormal(),
|
||||||
Vec3f(1.0f), 10, 500, false);
|
Vec3f(1.0f), 10, 500, false);
|
||||||
|
|
||||||
@@ -1239,7 +1239,7 @@ void Game::render2d(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//resource info
|
//resource info
|
||||||
if(!config.getBool("PhotoMode")) {
|
if(config.getBool("PhotoMode") == false) {
|
||||||
renderer.renderResourceStatus();
|
renderer.renderResourceStatus();
|
||||||
renderer.renderConsole(&console,showFullConsole);
|
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);
|
SurfaceCell *sc= map->getSurfaceCell(mapPos.x, mapPos.y);
|
||||||
Object *o= sc->getObject();
|
Object *o= sc->getObject();
|
||||||
bool isExplored = (sc->isExplored(thisTeamIndex) && o!=NULL);
|
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) {
|
if(renderFps < MIN_RENDER_FPS_ALLOWED) {
|
||||||
int renderLag = worldFrameCount - o->getLastRenderFrame();
|
int renderLag = worldFrameCount - o->getLastRenderFrame();
|
||||||
@@ -2826,8 +2827,10 @@ void Renderer::renderObjectsFast() {
|
|||||||
Vec2i mapPos = Map::toSurfCoords(pos);
|
Vec2i mapPos = Map::toSurfCoords(pos);
|
||||||
SurfaceCell *sc= map->getSurfaceCell(mapPos);
|
SurfaceCell *sc= map->getSurfaceCell(mapPos);
|
||||||
Object *o= sc->getObject();
|
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();
|
const Model *objModel= sc->getObject()->getModel();
|
||||||
Vec3f v= o->getPos();
|
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{
|
bool World::toRenderUnit(const Unit *unit) const{
|
||||||
|
|
||||||
return
|
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 &&
|
(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){
|
void World::createUnit(const string &unitName, int factionIndex, const Vec2i &pos){
|
||||||
|
Reference in New Issue
Block a user