Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 14, 2006, 2:15:03 AM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: fadeins generalized

File:
1 edited

Legend:

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

    r8327 r8356  
    2424SHELL_COMMAND(activate, FogEffect, activateFog);
    2525SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
    26 SHELL_COMMAND(startfogging, FogEffect, startFogging);
     26SHELL_COMMAND(fadein, FogEffect, fadeInFog);
     27SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
     28
    2729
    2830using namespace std;
     
    137139                this->fogFadeDensity = progress * this->fogDensity;
    138140        }
     141        else if (this->fogFadeOutDuration > 0 && this->localTimer < this->fogFadeOutDuration) {
     142                this->localTimer += dt;
     143                float progress = this->localTimer / this->fogFadeInDuration;
     144                this->fogFadeDensity = 1 - progress * this->fogDensity;
     145        }
    139146}
    140147
    141 void FogEffect::startFogging() {
     148void FogEffect::fadeInFog() {
    142149
    143150        if (this->fogActivate)
     
    150157        this->activate();
    151158
     159}
     160
     161
     162void FogEffect::fadeOutFog() {
     163
     164        if (this->fogActivate)
     165                this->deactivate();
     166
     167        if (!this->fogFadeOutDuration > 0)
     168                this->fogFadeOutDuration = 20;
     169
     170        this->localTimer = 0;
     171        this->activate();
    152172}
    153173
Note: See TracChangeset for help on using the changeset viewer.