- more rendering improvements when fps starts to drop to 20 or less

This commit is contained in:
Mark Vejvoda 2010-07-17 12:41:05 +00:00
parent d58a3d948c
commit 81af3c7f8c
1 changed files with 11 additions and 2 deletions

View File

@ -151,6 +151,8 @@ const Vec4f Renderer::defColor= Vec4f(1.f, 1.f, 1.f, 1.f);
//const float Renderer::maxLightDist= 100.f;
const float Renderer::maxLightDist= 1000.f;
const int MIN_FPS_NORMAL_RENDERING = 20;
// ==================== constructor and destructor ====================
Renderer::Renderer(){
@ -1300,7 +1302,8 @@ void Renderer::renderObjects(const int renderFps, const int worldFrameCount) {
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_FOG_BIT | GL_LIGHTING_BIT | GL_TEXTURE_BIT);
if(shadows==sShadowMapping){
if(renderFps >= MIN_FPS_NORMAL_RENDERING &&
shadows == sShadowMapping){
glActiveTexture(shadowTexUnit);
glEnable(GL_TEXTURE_2D);
@ -1550,6 +1553,11 @@ void Renderer::renderUnits(const int renderFps, const int worldFrameCount) {
glPopMatrix();
unit->setVisible(true);
if(allowRenderUnitTitles == true) {
// Add to the pending render unit title list
renderUnitTitleList.push_back(std::pair<Unit *,Vec3f>(unit,computeScreenPosition(unit->getCurrVectorFlat())) );
}
}
else
{
@ -2275,7 +2283,8 @@ void Renderer::computeSelected(Selection::UnitContainer &units, const Vec2i &pos
// ==================== shadows ====================
void Renderer::renderShadowsToTexture(const int renderFps){
if(shadows==sProjected || shadows==sShadowMapping){
if(renderFps >= MIN_FPS_NORMAL_RENDERING &&
(shadows==sProjected || shadows==sShadowMapping)) {
shadowMapFrame= (shadowMapFrame + 1) % (shadowFrameSkip + 1);