Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8716 in orxonox.OLD for branches/atmospheric_engine/src


Ignore:
Timestamp:
Jun 22, 2006, 1:57:16 PM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: FogFade finally fixed

Location:
branches/atmospheric_engine/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc

    r8704 r8716  
    7878    this->fogFadeOutDuration = 0;
    7979    this->fogFadeDensity = 0;
     80    this->fogFadeEnd = 0;
     81
    8082    this->localTimer = 0;
    8183    this->fogActivate = false;
     
    123125    // If Fog Fade
    124126    if ( this->fogFadeInActivate || this->fogFadeOutActivate ) {
    125       glDisable(GL_FOG);
    126 
    127       GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
    128       glFogi(GL_FOG_MODE, this->fogMode);
    129       glFogfv(GL_FOG_COLOR, fogColor);
    130       glHint(GL_FOG_HINT, GL_DONT_CARE);
    131       glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
    132       glFogf(GL_FOG_START, this->fogStart);
    133       glFogf(GL_FOG_END, this->fogEnd);
    134 
    135       glEnable(GL_FOG);
     127        if ( this->fogMode == GL_LINEAR)
     128            glFogf(GL_FOG_END, this->fogFadeEnd);
     129        else
     130            glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
    136131    }
    137132}
     
    144139    if ( this->fogFadeInActivate ) {
    145140        this->localTimer += dt;
    146         this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity;
    147 
    148         if ( this->localTimer >= this->fogFadeOutDuration )
     141
     142        if ( this->fogMode == GL_LINEAR)
     143          this->fogFadeEnd = 2000 * (1 - ( this->localTimer / this->fogFadeInDuration )) + this->fogEnd;
     144        else
     145            this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity;
     146
     147        if ( this->localTimer >= this->fogFadeInDuration )
    149148            this->fogFadeInActivate = false;
    150149    }
     
    152151    if ( this->fogFadeOutActivate ) {
    153152        this->localTimer += dt;
    154         this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity);
     153
     154        if ( this->fogMode == GL_LINEAR)
     155          this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeInDuration ) + this->fogEnd;
     156        else
     157            this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity);
    155158
    156159        if ( this->localTimer >= this->fogFadeOutDuration )
     
    175178    this->localTimer = 0;
    176179
     180    // Activate Fog
     181    this->activate();
     182
    177183    // set FogFadeIn activate
    178184    this->fogFadeInActivate = true;
    179 
    180     // Activate Fog
    181     this->activate();
    182185
    183186}
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h

    r8700 r8716  
    8989    GLfloat       fogStart;
    9090    GLfloat       fogEnd;
     91    GLfloat       fogFadeEnd;
     92
    9193    Vector        colorVector;
    9294};
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc

    r8713 r8716  
    145145  if (this->thunderBuffer != NULL)
    146146    ResourceManager::getInstance()->unload(this->thunderBuffer);
    147   this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.ogg", OGG);
     147  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
    148148
    149149}
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc

    r8702 r8716  
    5757    if (this->rainBuffer != NULL)
    5858        ResourceManager::getInstance()->unload(this->rainBuffer);
    59     this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.ogg", OGG);
     59    this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV);
    6060
    6161    //load wind sound
     
    6363        if (this->windBuffer != NULL)
    6464            ResourceManager::getInstance()->unload(this->windBuffer);
    65         this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.ogg", OGG);
     65        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
    6666    }
    6767
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc

    r8702 r8716  
    5050                if (this->windBuffer != NULL)
    5151                        ResourceManager::getInstance()->unload(this->windBuffer);
    52                         this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.ogg", OGG);
     52                        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
    5353        }
    5454
  • branches/atmospheric_engine/src/world_entities/effects/lightning_bolt.cc

    r8702 r8716  
    6464  if (this->thunderBuffer != NULL)
    6565    ResourceManager::getInstance()->unload(this->thunderBuffer);
    66   this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.ogg", OGG);
     66  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
    6767}
    6868
Note: See TracChangeset for help on using the changeset viewer.