Changeset 8356 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects
- Timestamp:
- Jun 14, 2006, 2:15:03 AM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8327 r8356 24 24 SHELL_COMMAND(activate, FogEffect, activateFog); 25 25 SHELL_COMMAND(deactivate, FogEffect, deactivateFog); 26 SHELL_COMMAND(startfogging, FogEffect, startFogging); 26 SHELL_COMMAND(fadein, FogEffect, fadeInFog); 27 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog); 28 27 29 28 30 using namespace std; … … 137 139 this->fogFadeDensity = progress * this->fogDensity; 138 140 } 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 } 139 146 } 140 147 141 void FogEffect:: startFogging() {148 void FogEffect::fadeInFog() { 142 149 143 150 if (this->fogActivate) … … 150 157 this->activate(); 151 158 159 } 160 161 162 void 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(); 152 172 } 153 173 -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8267 r8356 38 38 inline void setFogOption(const std::string& option) { if (option == "activate") this->fogActivate = true; } 39 39 40 void startFogging(); 40 void fadeInFog(); 41 void fadeOutFog(); 42 41 43 42 44 private: -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8327 r8356 31 31 SHELL_COMMAND(activate, RainEffect, activateRain); 32 32 SHELL_COMMAND(deactivate, RainEffect, deactivateRain); 33 34 SHELL_COMMAND(st artRaining, RainEffect, startRaining);33 SHELL_COMMAND(startraining, RainEffect, startRaining); 34 SHELL_COMMAND(stopraining, RainEffect, stopRaining); 35 35 36 36 using namespace std; … … 210 210 // this->soundSource.fadein(this->rainBuffer, 10); 211 211 } 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); 231 } 212 232 213 233 } … … 225 245 226 246 } 247 248 void RainEffect::stopRaining() { 249 250 if (this->rainActivate) 251 this->deactivate(); 252 253 if (!this->rainFadeOutDuration > 0) 254 this->rainFadeOutDuration = 20; 255 256 this->localTimer = 0; 257 this->activate(); 258 259 } -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
r8267 r8356 35 35 virtual bool deactivate(); 36 36 37 inline void activateRain() { this->activate(); } 38 inline void deactivateRain() { this->deactivate(); } 39 37 40 virtual void tick(float dt); 38 41 39 inline void activateRain() { this->activate(); }40 inline void deactivateRain() { this->deactivate(); }41 42 void startRaining(); 43 void stopRaining(); 42 44 43 45 inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } … … 47 49 inline void setRainLife(float life) { this->rainLife = life; } 48 50 inline void setRainWind(int force) { this->rainWindForce = force; } 49 inline void setRainStart(float duration) { this->rainFadeInDuration = duration; }50 51 51 52 inline void setRainFadeIn(float fadein) { this->rainFadeInDuration = fadein; } 52 53 inline void setRainFadeOut(float fadeout) { this->rainFadeOutDuration = fadeout; } 53 54 54 55 55 inline void setRainOption(const std::string& option) {
Note: See TracChangeset
for help on using the changeset viewer.