Changeset 8180 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
- Timestamp:
- Jun 7, 2006, 8:03:04 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8119 r8180 55 55 56 56 //load wind sound 57 if (this->rainWindForce >0) {57 if (this->rainWindForce != 0) { 58 58 if (this->windBuffer != NULL) 59 59 ResourceManager::getInstance()->unload(this->windBuffer); … … 86 86 LoadParam(root, "life", this, RainEffect, setRainLife); 87 87 LoadParam(root, "wind", this, RainEffect, setRainWind); 88 LoadParam(root, "startraining", this, RainEffect, setRainStart); 88 89 89 90 LOAD_PARAM_START_CYCLE(root, element); … … 108 109 this->rainMaxParticles = this->rainRate * this->rainLife; 109 110 this->rainWindForce = 0; 111 this->rainStartDuration = 0; 112 this->localTimer = 0; 113 this->soundRainVolume = 0.8f; 110 114 111 115 this->emitter = new PlaneEmitter(this->rainSize); … … 144 148 this->emitter->setSpread(this->rainWindForce / 50, 0.2); 145 149 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); 149 152 150 153 lightMan->setAmbientColor(.1,.1,.1); … … 168 171 this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z); 169 172 } 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 } 170 192 } 171 193 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 194 void RainEffect::startRaining() { 195 this->rainStartDuration = 10; 196 // this->activate; 181 197 }
Note: See TracChangeset
for help on using the changeset viewer.