Changeset 8434 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/fog_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/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
Note: See TracChangeset
for help on using the changeset viewer.