Changeset 8443 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- Jun 15, 2006, 11:27:47 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
r8434 r8443 98 98 glFogi(GL_FOG_MODE, this->fogMode); 99 99 glFogfv(GL_FOG_COLOR, fogColor); 100 glFogf(GL_FOG_DENSITY, this->fogDensity);101 100 glHint(GL_FOG_HINT, GL_DONT_CARE); 102 101 glFogf(GL_FOG_START, this->fogStart); 103 102 glFogf(GL_FOG_END, this->fogEnd); 104 103 104 // glFogf(GL_FOG_DENSITY, this->fogDensity); 105 105 106 glEnable(GL_FOG); 106 // glClearColor(0.5, 0.5, 0.5, 1.0);107 107 108 108 return 0; … … 114 114 PRINTF(0)("Deactivating FogEffect\n"); 115 115 116 this->fogFadeInActivate = false; 117 this->fogFadeOutActivate = false; 116 118 this->fogActivate = false; 117 119 … … 124 126 125 127 // If Fog Fade In 126 if ( this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration)128 if ( this->fogFadeInActivate ) { 127 129 glFogf(GL_FOG_DENSITY, this->fogFadeInDensity); 128 130 PRINTF(0)( "this->fogFadeInDensity: %f", this->fogFadeInDensity); 131 } 129 132 // If Fog Fade Out 130 else if ( this->fogFadeOutDuration > 0 && this->localTimer < this->fogFadeOutDuration)133 else if ( this->fogFadeOutActivate ) 131 134 glFogf(GL_FOG_DENSITY, this->fogFadeOutDensity); 132 135 … … 136 139 137 140 } 141 138 142 void FogEffect::tick(float dt) 139 143 { … … 141 145 return; 142 146 143 if ( this->fogFadeIn Duration > 0 && this->localTimer < this->fogFadeInDuration) {147 if ( this->fogFadeInActivate ) { 144 148 this->localTimer += dt; 145 149 float progress = this->localTimer / this->fogFadeInDuration; 146 150 this->fogFadeInDensity = progress * this->fogDensity; 147 } 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 151 152 if ( this->localTimer >= this->fogFadeOutDuration ) 153 this->fogFadeInActivate = false; 154 } 155 else if ( this->fogFadeOutActivate ) { 156 this->localTimer += dt; 157 float progress = this->localTimer / this->fogFadeInDuration; 158 this->fogFadeOutDensity = 1 - progress * this->fogDensity; 159 160 if ( this->localTimer >= this->fogFadeOutDuration ) 155 161 this->deactivate(); 156 162 } … … 158 164 159 165 void FogEffect::fadeInFog() { 166 167 // If Fog is already fading out, stop it 168 this->fogFadeOutActivate = false; 160 169 161 170 // If Fog is already on, turn it off first … … 170 179 this->localTimer = 0; 171 180 181 // set FogFadeIn activate 182 this->fogFadeInActivate = true; 183 172 184 // Activate Fog 173 185 this->activate(); … … 177 189 178 190 void FogEffect::fadeOutFog() { 191 192 // If Fog is already fading in, stop it 193 this->fogFadeInActivate = false; 179 194 180 195 // If Fog is off, turn it on first … … 185 200 if (!this->fogFadeOutDuration > 0) 186 201 this->fogFadeOutDuration = 20; 202 203 // set FogFadeOut activate 204 this->fogFadeOutActivate = true; 187 205 188 206 // Reset local timer -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8434 r8443 46 46 47 47 bool fogActivate; 48 49 bool fogFadeInActivate; 50 bool fogFadeOutActivate; 51 48 52 GLfloat fogFadeInDuration; 49 53 GLfloat fogFadeOutDuration; -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8434 r8443 143 143 RainEffect::rainParticles = new SparkParticles((int) this->rainMaxParticles); 144 144 RainEffect::rainParticles->setName("RainParticles"); 145 RainEffect::rainParticles->precache((int)this->rainLife );145 RainEffect::rainParticles->precache((int)this->rainLife, 30); // TODO: Why doesnt this work?? 146 146 RainEffect::rainParticles->setLifeSpan(this->rainLife, 2); 147 147 RainEffect::rainParticles->setRadius(0, 0.03);
Note: See TracChangeset
for help on using the changeset viewer.