Changeset 8242 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
- Timestamp:
- Jun 8, 2006, 2:04:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8181 r8242 125 125 PRINTF(0)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f, moveRain: %s\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity, this->rainMove ? "true" : "false" ); 126 126 127 this->rainActivate = true; 128 127 129 if (unlikely(RainEffect::rainParticles == NULL)) 128 130 { … … 134 136 RainEffect::rainParticles->setRadius(0.2, 0.02); 135 137 RainEffect::rainParticles->setRadius(1, 0.01); 136 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2); 137 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); 138 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2); 138 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2); // grey blue 1 139 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); // grey blue 2 140 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2); // light grey 139 141 } 140 142 … … 158 160 { 159 161 PRINTF(0)("Deactivating RainEffect\n"); 162 163 this->rainActivate = false; 160 164 this->emitter->setSystem(NULL); 161 162 165 this->soundSource.stop(); 163 166 … … 167 170 void RainEffect::tick (float dt) 168 171 { 169 if (RainEffect::rainParticles != NULL) { 170 if (this->rainMove) { 171 this->rainCoord = State::getCameraNode()->getAbsCoor(); 172 this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z); 173 } 172 if (!this->rainActivate) 173 return; 174 175 if (this->rainMove) { 176 this->rainCoord = State::getCameraNode()->getAbsCoor(); 177 this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z); 178 } 179 180 if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) { 181 this->localTimer += dt; 182 float progress = this->localTimer / this->rainStartDuration; 183 184 // PRINTF(0)("Progress %f: \n", progress); 185 186 // use alpha in color to fade in 187 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 188 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 189 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 190 191 // increase radius for more "heavy" rain 192 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 193 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 194 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 195 196 // increase sound volume 197 // this->soundSource.fadein(this->rainBuffer, 10); 198 } 174 199 175 if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) {176 this->localTimer += dt;177 float progress = this->localTimer / this->rainStartDuration;178 179 // PRINTF(0)("Progress %f: \n", progress);180 181 // use alpha in color to fade in182 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1183 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2184 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey185 186 // increase radius for more "heavy" rain187 RainEffect::rainParticles->setRadius(0, 0.03 * progress);188 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);189 RainEffect::rainParticles->setRadius(1, 0.01 * progress);190 191 // increase sound volume192 // this->soundSource.fadein(this->rainBuffer, 10);193 }194 }195 200 } 196 201 197 202 void RainEffect::startRaining() { 198 203 199 if ( RainEffect::rainParticles != NULL)204 if (this->rainActivate) 200 205 this->deactivate(); 201 206
Note: See TracChangeset
for help on using the changeset viewer.