Changeset 8434 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics
- Timestamp:
- Jun 15, 2006, 1:01:31 AM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8373 r8434 123 123 void FogEffect::draw() const { 124 124 125 // If Fog Fade In 125 126 if (this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration) 126 glFogf(GL_FOG_DENSITY, this->fogFadeDensity); 127 //else 128 // glFogf(GL_FOG_DENSITY, this->fogDensity); 127 glFogf(GL_FOG_DENSITY, this->fogFadeInDensity); 128 129 // If Fog Fade Out 130 else if (this->fogFadeOutDuration > 0 && this->localTimer < this->fogFadeOutDuration) 131 glFogf(GL_FOG_DENSITY, this->fogFadeOutDensity); 132 133 // Normal Fog activate 134 else 135 glFogf(GL_FOG_DENSITY, this->fogDensity); 129 136 130 137 } … … 134 141 return; 135 142 136 if ( this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration) {143 if ( this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration ) { 137 144 this->localTimer += dt; 138 145 float progress = this->localTimer / this->fogFadeInDuration; 139 this->fogFade Density = progress * this->fogDensity;146 this->fogFadeInDensity = progress * this->fogDensity; 140 147 } 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; 148 else if ( this->fogFadeOutDuration > 0 ) { 149 if ( this->localTimer < this->fogFadeOutDuration ) { 150 this->localTimer += dt; 151 float progress = this->localTimer / this->fogFadeInDuration; 152 this->fogFadeOutDensity = 1 - progress * this->fogDensity; 153 } 154 else 155 this->deactivate(); 145 156 } 146 157 } … … 148 159 void FogEffect::fadeInFog() { 149 160 161 // If Fog is already on, turn it off first 150 162 if (this->fogActivate) 151 163 this->deactivate(); 152 164 165 // If no manual FadeIn value was set, set a default value 153 166 if (!this->fogFadeInDuration > 0) 154 167 this->fogFadeInDuration = 20; 155 168 169 // Reset local timer 156 170 this->localTimer = 0; 171 172 // Activate Fog 157 173 this->activate(); 158 174 … … 162 178 void FogEffect::fadeOutFog() { 163 179 164 if (this->fogActivate) 165 this->deactivate(); 166 180 // If Fog is off, turn it on first 181 if (!this->fogActivate) 182 this->activate(); 183 184 // If no manual FadeOut value was set, set a default value 167 185 if (!this->fogFadeOutDuration > 0) 168 186 this->fogFadeOutDuration = 20; 169 187 188 // Reset local timer 170 189 this->localTimer = 0; 171 this->activate(); 190 172 191 } 173 192 -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8356 r8434 53 53 GLint fogMode; 54 54 GLfloat fogDensity; 55 GLfloat fogFadeDensity; 55 GLfloat fogFadeInDensity; 56 GLfloat fogFadeOutDensity; 56 57 57 58 GLfloat fogStart; -
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.