Changeset 8716 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
- Timestamp:
- Jun 22, 2006, 1:57:16 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8704 r8716 78 78 this->fogFadeOutDuration = 0; 79 79 this->fogFadeDensity = 0; 80 this->fogFadeEnd = 0; 81 80 82 this->localTimer = 0; 81 83 this->fogActivate = false; … … 123 125 // If Fog Fade 124 126 if ( this->fogFadeInActivate || this->fogFadeOutActivate ) { 125 glDisable(GL_FOG); 126 127 GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0}; 128 glFogi(GL_FOG_MODE, this->fogMode); 129 glFogfv(GL_FOG_COLOR, fogColor); 130 glHint(GL_FOG_HINT, GL_DONT_CARE); 131 glFogf(GL_FOG_DENSITY, this->fogFadeDensity); 132 glFogf(GL_FOG_START, this->fogStart); 133 glFogf(GL_FOG_END, this->fogEnd); 134 135 glEnable(GL_FOG); 127 if ( this->fogMode == GL_LINEAR) 128 glFogf(GL_FOG_END, this->fogFadeEnd); 129 else 130 glFogf(GL_FOG_DENSITY, this->fogFadeDensity); 136 131 } 137 132 } … … 144 139 if ( this->fogFadeInActivate ) { 145 140 this->localTimer += dt; 146 this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity; 147 148 if ( this->localTimer >= this->fogFadeOutDuration ) 141 142 if ( this->fogMode == GL_LINEAR) 143 this->fogFadeEnd = 2000 * (1 - ( this->localTimer / this->fogFadeInDuration )) + this->fogEnd; 144 else 145 this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity; 146 147 if ( this->localTimer >= this->fogFadeInDuration ) 149 148 this->fogFadeInActivate = false; 150 149 } … … 152 151 if ( this->fogFadeOutActivate ) { 153 152 this->localTimer += dt; 154 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity); 153 154 if ( this->fogMode == GL_LINEAR) 155 this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeInDuration ) + this->fogEnd; 156 else 157 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity); 155 158 156 159 if ( this->localTimer >= this->fogFadeOutDuration ) … … 175 178 this->localTimer = 0; 176 179 180 // Activate Fog 181 this->activate(); 182 177 183 // set FogFadeIn activate 178 184 this->fogFadeInActivate = true; 179 180 // Activate Fog181 this->activate();182 185 183 186 }
Note: See TracChangeset
for help on using the changeset viewer.