Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2006, 8:03:04 AM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: ups, forgot that

File:
1 edited

Legend:

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

    r8119 r8180  
    5555
    5656        //load wind sound
    57         if (this->rainWindForce > 0) {
     57        if (this->rainWindForce != 0) {
    5858                if (this->windBuffer != NULL)
    5959                        ResourceManager::getInstance()->unload(this->windBuffer);
     
    8686        LoadParam(root, "life", this, RainEffect, setRainLife);
    8787        LoadParam(root, "wind", this, RainEffect, setRainWind);
     88        LoadParam(root, "startraining", this, RainEffect, setRainStart);
    8889
    8990        LOAD_PARAM_START_CYCLE(root, element);
     
    108109        this->rainMaxParticles = this->rainRate * this->rainLife;
    109110        this->rainWindForce  = 0;
     111        this->rainStartDuration = 0;
     112        this->localTimer = 0;
     113        this->soundRainVolume = 0.8f;
    110114
    111115        this->emitter = new PlaneEmitter(this->rainSize);
     
    144148        this->emitter->setSpread(this->rainWindForce / 50, 0.2);
    145149       
    146         this->soundSource.loop(this->rainBuffer, 0.8f);
    147         if (this->rainWindForce > 0)
    148                 this->soundSource.loop(this->windBuffer, 0.5f);
     150        this->soundSource.loop(this->rainBuffer, this->soundRainVolume);
     151        if (this->rainWindForce != 0) this->soundSource.loop(this->windBuffer, 0.1f * this->rainWindForce);
    149152
    150153        lightMan->setAmbientColor(.1,.1,.1);
     
    168171                this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z);
    169172        }
     173
     174        if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) {
     175                this->localTimer += dt;
     176                float progress = this->localTimer / this->rainStartDuration;
     177
     178                // use alpha in color to fade in
     179                RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
     180                RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
     181                RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey
     182
     183                // increase radius for more "heavy" rain
     184                RainEffect::rainParticles->setRadius(0, 0.03 * progress);
     185                RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
     186                RainEffect::rainParticles->setRadius(1, 0.01 * progress);
     187
     188                // increase sound volume
     189                this->soundSource.loop(this->rainBuffer, this->soundRainVolume * progress);
     190
     191        }
    170192}
    171193
    172 /**
    173 *  Slowly starts rain
    174 *  @param duration duration of the fade in process in seconds
    175 */
    176 void RainEffect::startRaining(float duration)
    177 {
    178         // use alpha in color to fade in
    179         // increase radius for more "heavy" rain
    180         // increase sound volume
     194void RainEffect::startRaining() {
     195        this->rainStartDuration = 10;
     196        // this->activate;
    181197}
Note: See TracChangeset for help on using the changeset viewer.