mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 20:03:58 +02:00
- bugfix for language files in scenarios and tutorials
- added numerous performance profiling statements
This commit is contained in:
@@ -339,7 +339,7 @@ void Game::init()
|
|||||||
void Game::update(){
|
void Game::update(){
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// a) Updates non dependant on speed
|
// a) Updates non dependent on speed
|
||||||
|
|
||||||
//misc
|
//misc
|
||||||
updateFps++;
|
updateFps++;
|
||||||
@@ -416,19 +416,27 @@ void Game::updateCamera(){
|
|||||||
// ==================== render ====================
|
// ==================== render ====================
|
||||||
|
|
||||||
//render
|
//render
|
||||||
void Game::render(){
|
void Game::render() {
|
||||||
|
Chrono chrono;
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
renderFps++;
|
renderFps++;
|
||||||
render3d();
|
render3d();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d render3d() took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
chrono.start();
|
||||||
render2d();
|
render2d();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d render3d() took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
chrono.start();
|
||||||
Renderer::getInstance().swapBuffers();
|
Renderer::getInstance().swapBuffers();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d render3d() took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
@@ -820,55 +828,86 @@ void Game::quitGame(){
|
|||||||
// ==================== render ====================
|
// ==================== render ====================
|
||||||
|
|
||||||
void Game::render3d(){
|
void Game::render3d(){
|
||||||
|
Chrono chrono;
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
||||||
//init
|
//init
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
renderer.reset3d();
|
renderer.reset3d();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.computeVisibleQuad();
|
renderer.computeVisibleQuad();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.loadGameCameraMatrix();
|
renderer.loadGameCameraMatrix();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.setupLighting();
|
renderer.setupLighting();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//shadow map
|
//shadow map
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderShadowsToTexture();
|
renderer.renderShadowsToTexture();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//clear buffers
|
//clear buffers
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.clearBuffers();
|
renderer.clearBuffers();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//surface
|
//surface
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderSurface();
|
renderer.renderSurface();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//selection circles
|
//selection circles
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderSelectionEffects();
|
renderer.renderSelectionEffects();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//units
|
//units
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderUnits();
|
renderer.renderUnits();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//objects
|
//objects
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderObjects();
|
renderer.renderObjects();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//water
|
//water
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderWater();
|
renderer.renderWater();
|
||||||
renderer.renderWaterEffects();
|
renderer.renderWaterEffects();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//particles
|
//particles
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderParticleManager(rsGame);
|
renderer.renderParticleManager(rsGame);
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
|
|
||||||
//mouse 3d
|
//mouse 3d
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
chrono.start();
|
||||||
renderer.renderMouse3d();
|
renderer.renderMouse3d();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::render2d(){
|
void Game::render2d(){
|
||||||
|
@@ -1241,6 +1241,9 @@ void Renderer::renderSurface(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::renderObjects(){
|
void Renderer::renderObjects(){
|
||||||
|
Chrono chrono;
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
const World *world= game->getWorld();
|
const World *world= game->getWorld();
|
||||||
const Map *map= world->getMap();
|
const Map *map= world->getMap();
|
||||||
|
|
||||||
@@ -1248,6 +1251,9 @@ void Renderer::renderObjects(){
|
|||||||
const Texture2D *fowTex= world->getMinimap()->getFowTexture();
|
const Texture2D *fowTex= world->getMinimap()->getFowTexture();
|
||||||
Vec3f baseFogColor= world->getTileset()->getFogColor()*computeLightColor(world->getTimeFlow()->getTime());
|
Vec3f baseFogColor= world->getTileset()->getFogColor()*computeLightColor(world->getTimeFlow()->getTime());
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_FOG_BIT | GL_LIGHTING_BIT | GL_TEXTURE_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_FOG_BIT | GL_LIGHTING_BIT | GL_TEXTURE_BIT);
|
||||||
|
|
||||||
if(shadows==sShadowMapping){
|
if(shadows==sShadowMapping){
|
||||||
@@ -1259,15 +1265,22 @@ void Renderer::renderObjects(){
|
|||||||
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(true);
|
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(true);
|
||||||
enableProjectiveTexturing();
|
enableProjectiveTexturing();
|
||||||
}
|
}
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
glActiveTexture(baseTexUnit);
|
glActiveTexture(baseTexUnit);
|
||||||
|
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
glAlphaFunc(GL_GREATER, 0.5f);
|
glAlphaFunc(GL_GREATER, 0.5f);
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
modelRenderer->begin(true, true, false);
|
modelRenderer->begin(true, true, false);
|
||||||
int thisTeamIndex= world->getThisTeamIndex();
|
int thisTeamIndex= world->getThisTeamIndex();
|
||||||
|
|
||||||
|
int loopCount1 = 0;
|
||||||
|
int loopCount2 = 0;
|
||||||
PosQuadIterator pqi(map, visibleQuad, Map::cellScale);
|
PosQuadIterator pqi(map, visibleQuad, Map::cellScale);
|
||||||
while(pqi.next()){
|
while(pqi.next()){
|
||||||
const Vec2i pos= pqi.getPos();
|
const Vec2i pos= pqi.getPos();
|
||||||
@@ -1300,16 +1313,23 @@ void Renderer::renderObjects(){
|
|||||||
pointCount+= objModel->getVertexCount();
|
pointCount+= objModel->getVertexCount();
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
loopCount2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
loopCount1++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modelRenderer->end();
|
modelRenderer->end();
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d loopCount1 = %d loopCount2 = %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,loopCount1,loopCount2,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//restore
|
//restore
|
||||||
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(true);
|
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(true);
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::renderWater(){
|
void Renderer::renderWater(){
|
||||||
@@ -2119,6 +2139,8 @@ void Renderer::computeSelected(Selection::UnitContainer &units, const Vec2i &pos
|
|||||||
// ==================== shadows ====================
|
// ==================== shadows ====================
|
||||||
|
|
||||||
void Renderer::renderShadowsToTexture(){
|
void Renderer::renderShadowsToTexture(){
|
||||||
|
Chrono chrono;
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
if(shadows==sProjected || shadows==sShadowMapping){
|
if(shadows==sProjected || shadows==sShadowMapping){
|
||||||
|
|
||||||
@@ -2126,6 +2148,9 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
|
|
||||||
if(shadowMapFrame==0){
|
if(shadowMapFrame==0){
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT | GL_POLYGON_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT | GL_POLYGON_BIT);
|
||||||
@@ -2141,6 +2166,9 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//clear color buffer
|
//clear color buffer
|
||||||
//
|
//
|
||||||
//set viewport, we leave one texel always in white to avoid problems
|
//set viewport, we leave one texel always in white to avoid problems
|
||||||
@@ -2181,6 +2209,8 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
|
|
||||||
glTranslatef(static_cast<int>(-pos.x), 0, static_cast<int>(-pos.z));
|
glTranslatef(static_cast<int>(-pos.x), 0, static_cast<int>(-pos.z));
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//non directional light
|
//non directional light
|
||||||
@@ -2197,21 +2227,35 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glRotatef(-90, -1, 0, 0);
|
glRotatef(-90, -1, 0, 0);
|
||||||
glTranslatef(-nearestLightPos.x, -nearestLightPos.y-2, -nearestLightPos.z);
|
glTranslatef(-nearestLightPos.x, -nearestLightPos.y-2, -nearestLightPos.z);
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shadows==sShadowMapping){
|
if(shadows==sShadowMapping){
|
||||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
glPolygonOffset(1.0f, 0.001f);
|
glPolygonOffset(1.0f, 0.001f);
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//render 3d
|
//render 3d
|
||||||
renderUnitsFast();
|
renderUnitsFast();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
renderObjectsFast();
|
renderObjectsFast();
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//read color buffer
|
//read color buffer
|
||||||
glBindTexture(GL_TEXTURE_2D, shadowMapHandle);
|
glBindTexture(GL_TEXTURE_2D, shadowMapHandle);
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowTextureSize, shadowTextureSize);
|
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowTextureSize, shadowTextureSize);
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//get elemental matrices
|
//get elemental matrices
|
||||||
Matrix4f matrix1;
|
Matrix4f matrix1;
|
||||||
matrix1[0]= 0.5f; matrix1[4]= 0.f; matrix1[8]= 0.f; matrix1[12]= 0.5f;
|
matrix1[0]= 0.5f; matrix1[4]= 0.f; matrix1[8]= 0.f; matrix1[12]= 0.5f;
|
||||||
@@ -2233,6 +2277,9 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//compute texture matrix
|
//compute texture matrix
|
||||||
glLoadMatrixf(matrix1.ptr());
|
glLoadMatrixf(matrix1.ptr());
|
||||||
glMultMatrixf(matrix2.ptr());
|
glMultMatrixf(matrix2.ptr());
|
||||||
@@ -2245,8 +2292,13 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
chrono.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -305,10 +305,18 @@ int glestMain(int argc, char** argv){
|
|||||||
if(debugWorldSynchLogFile == "") {
|
if(debugWorldSynchLogFile == "") {
|
||||||
debugWorldSynchLogFile = debugLogFile;
|
debugWorldSynchLogFile = debugLogFile;
|
||||||
}
|
}
|
||||||
|
string debugPerformanceLogFile = config.getString("DebugLogFilePerformance","");
|
||||||
|
if(debugPerformanceLogFile == "") {
|
||||||
|
debugPerformanceLogFile = debugLogFile;
|
||||||
|
}
|
||||||
|
string debugNetworkLogFile = config.getString("DebugLogFileNetwork","");
|
||||||
|
if(debugNetworkLogFile == "") {
|
||||||
|
debugNetworkLogFile = debugLogFile;
|
||||||
|
}
|
||||||
|
|
||||||
SystemFlags::getSystemSettingType(SystemFlags::debugSystem).debugLogFileName = debugLogFile;
|
SystemFlags::getSystemSettingType(SystemFlags::debugSystem).debugLogFileName = debugLogFile;
|
||||||
SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).debugLogFileName = debugLogFile;
|
SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).debugLogFileName = debugNetworkLogFile;
|
||||||
SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).debugLogFileName = debugLogFile;
|
SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).debugLogFileName = debugPerformanceLogFile;
|
||||||
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).debugLogFileName = debugWorldSynchLogFile;
|
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).debugLogFileName = debugWorldSynchLogFile;
|
||||||
|
|
||||||
printf("Startup settings are: debugSystem [%d], debugNetwork [%d], debugPerformance [%d], debugWorldSynch [%d]\n",
|
printf("Startup settings are: debugSystem [%d], debugNetwork [%d], debugPerformance [%d], debugWorldSynch [%d]\n",
|
||||||
|
@@ -182,23 +182,25 @@ void Program::keyPress(char c){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Program::loop(){
|
void Program::loop(){
|
||||||
|
Chrono chrono;
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
chrono.start();
|
||||||
|
|
||||||
//render
|
//render
|
||||||
assert(programState != NULL);
|
assert(programState != NULL);
|
||||||
programState->render();
|
programState->render();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d programState->render took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
//update camera
|
//update camera
|
||||||
|
chrono.start();
|
||||||
while(updateCameraTimer.isTime()){
|
while(updateCameraTimer.isTime()){
|
||||||
programState->updateCamera();
|
programState->updateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d programState->updateCamera took msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
//update world
|
//update world
|
||||||
|
chrono.start();
|
||||||
while(updateTimer.isTime()){
|
while(updateTimer.isTime()){
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -218,14 +220,15 @@ void Program::loop(){
|
|||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
//fps timer
|
//fps timer
|
||||||
|
chrono.start();
|
||||||
while(fpsTimer.isTime()){
|
while(fpsTimer.isTime()){
|
||||||
programState->tick();
|
programState->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d msecs: %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::resize(SizeState sizeState){
|
void Program::resize(SizeState sizeState){
|
||||||
|
@@ -574,16 +574,18 @@ string extractFileFromDirectoryPath(string filename)
|
|||||||
|
|
||||||
string extractDirectoryPathFromFile(string filename)
|
string extractDirectoryPathFromFile(string filename)
|
||||||
{
|
{
|
||||||
size_t lastDirectory_Win = filename.find_last_of('\\');
|
size_t lastDirectory = filename.find_last_of("/\\");
|
||||||
size_t lastDirectory_Lin = filename.find_last_of('/');
|
//printf("In [%s::%s Line: %d] filename = [%s] lastDirectory= %u\n",__FILE__,__FUNCTION__,__LINE__,filename.c_str(),lastDirectory);
|
||||||
size_t lastDirectory = (lastDirectory_Win<lastDirectory_Lin)?lastDirectory_Lin:lastDirectory_Win;
|
|
||||||
|
|
||||||
|
string path = "";
|
||||||
//return filename.substr( 0, filename.rfind("/")+1 );
|
//return filename.substr( 0, filename.rfind("/")+1 );
|
||||||
if (lastDirectory == string::npos) {
|
if (lastDirectory != string::npos) {
|
||||||
return "";
|
path = filename.substr( 0, lastDirectory + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return filename.substr( 0, lastDirectory + 1);
|
//printf("In [%s::%s Line: %d] filename = [%s] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,filename.c_str(),path.c_str());
|
||||||
|
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
string extractExtension(const string& filepath) {
|
string extractExtension(const string& filepath) {
|
||||||
|
@@ -96,6 +96,8 @@ int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe,
|
|||||||
|
|
||||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
int charCount, FontMetrics &metrics) {
|
int charCount, FontMetrics &metrics) {
|
||||||
|
// -adecw-screen-medium-r-normal--18-180-75-75-m-160-gb2312.1980-1 this is a Chinese font
|
||||||
|
|
||||||
#ifdef X11_AVAILABLE
|
#ifdef X11_AVAILABLE
|
||||||
Display* display = glXGetCurrentDisplay();
|
Display* display = glXGetCurrentDisplay();
|
||||||
if(display == 0) {
|
if(display == 0) {
|
||||||
|
@@ -203,12 +203,12 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
|
|||||||
|
|
||||||
assert(currentDebugLog.fileStream != NULL);
|
assert(currentDebugLog.fileStream != NULL);
|
||||||
|
|
||||||
//currentDebugLog.mutex->p();
|
currentDebugLog.mutex->p();
|
||||||
|
|
||||||
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf;
|
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf;
|
||||||
(*currentDebugLog.fileStream).flush();
|
(*currentDebugLog.fileStream).flush();
|
||||||
|
|
||||||
//currentDebugLog.mutex->v();
|
currentDebugLog.mutex->v();
|
||||||
}
|
}
|
||||||
// output to console
|
// output to console
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user