Changeset 8434 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
- Timestamp:
- Jun 15, 2006, 1:01:31 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8356 r8434 38 38 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); 39 39 40 // TODO: Dim Light with Rain, Finish preCaching, check out if multiple rain emitters work, Think about what happens with building poss. to hang movewithcam off, benchmark, possible to activate lightening, turn off visibility when in a building, variable emitter size depending on playable, also rain velocity 40 /* TODO: 41 - preCaching 42 - test multiple rain emitters 43 - Think about what happens with building poss. to hang movewithcam off 44 - Possible to activate lightening 45 - turn off visibility when in a building 46 - variable emitter size depending on playable 47 */ 41 48 42 49 RainEffect::RainEffect(const TiXmlElement* root) … … 158 165 if (this->rainWindForce != 0) this->soundSource.loop(this->windBuffer, 0.1f * this->rainWindForce); 159 166 160 lightMan->setAmbientColor(.1,.1,.1); 167 if (this->rainFadeInDuration == 0) 168 lightMan->setAmbientColor(.1,.1,.1); 161 169 162 170 return 0; … … 195 203 196 204 // Dim Light 197 lightMan->setAmbientColor(1 .1 - progress, 1.1 - progress, 1.1 - progress);205 lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9); 198 206 199 207 // use alpha in color to fade in … … 210 218 // this->soundSource.fadein(this->rainBuffer, 10); 211 219 } 212 else if (this->rainFadeOutDuration != 0 && this->localTimer < this->rainFadeOutDuration) { 213 this->localTimer += dt; 214 float progress = 1 - (this->localTimer / this->rainFadeOutDuration); 215 216 // Dim Light 217 lightMan->setAmbientColor(1.1 - progress, 1.1 - progress, 1.1 - progress); 218 219 // use alpha in color to fade in 220 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 221 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 222 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 223 224 // increase radius for more "heavy" rain 225 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 226 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 227 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 228 229 // increase sound volume 230 // this->soundSource.fadein(this->rainBuffer, 10); 220 else if ( this->rainFadeOutDuration != 0 ) { 221 if ( this->localTimer < this->rainFadeOutDuration ) { 222 this->localTimer += dt; 223 float progress = 1 - (this->localTimer / this->rainFadeOutDuration); 224 225 // Fade In Light 226 lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9); 227 228 // use alpha in color to fade out 229 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 230 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 231 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 232 233 // decrease radius 234 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 235 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 236 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 237 238 // decrease sound volume 239 // this->soundSource.fadeout(this->rainBuffer, 10); 240 } 241 else 242 this->deactivate(); 231 243 } 232 244 … … 242 254 243 255 this->localTimer = 0; 256 244 257 this->activate(); 245 258 … … 248 261 void RainEffect::stopRaining() { 249 262 250 if ( this->rainActivate)251 this-> deactivate();263 if (!this->rainActivate) 264 this->activate(); 252 265 253 266 if (!this->rainFadeOutDuration > 0) … … 255 268 256 269 this->localTimer = 0; 257 this->activate(); 258 259 } 270 271 }
Note: See TracChangeset
for help on using the changeset viewer.