Changeset 9028 in orxonox.OLD for branches/mountain_lake/src/lib
- Timestamp:
- Jul 3, 2006, 11:48:53 AM (18 years ago)
- Location:
- branches/mountain_lake/src/lib/graphics/effects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.cc
r9006 r9028 39 39 bool CloudEffect::fadeCloud; 40 40 float CloudEffect::fadeTime; 41 bool CloudEffect::flashSkyActivate;42 float CloudEffect::localTimer;43 float CloudEffect::flashTime;44 41 45 42 using namespace std; … … 53 50 CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT, 54 51 addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 55 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))52 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) 56 53 ); 57 54 … … 94 91 fadeCloud = false; 95 92 96 flashSkyActivate = false;97 localTimer = 0;98 flashTime = 0;99 93 100 94 skyColor = Vector(0.0f, 0.0f, 0.8f); … … 192 186 if (this->cloudActivate) { 193 187 194 localTimer += dt;195 196 188 this->offsetZ += 0.05 * dt * this->animationSpeed; 197 189 198 190 this->shader->activateShader(); 199 this->offset->set(0.0f, 0.0f, offsetZ); 200 201 if (flashSkyActivate) { 202 203 this->skycolor->set(1, 1, 1); 204 PRINTF(0)("SkyColor set to white\n"); 205 206 if (localTimer > flashTime) { 207 flashSkyActivate = false; 208 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 209 PRINTF(0)("SkyColor reset\n"); 191 this->offset->set 192 (0.0f, 0.0f, offsetZ); 193 194 if(cloudColor != newCloudColor) { 195 196 if(fadeCloud) { 197 198 this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX); 199 this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT); 200 this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY); 201 this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT); 202 this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ); 203 this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 204 205 this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR); 206 this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR); 207 208 this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR); 209 this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR); 210 211 this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR); 212 this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR); 213 214 fadeCloud = false; 215 216 this->cloudColorFadeX->replay(); 217 this->cloudColorFadeY->replay(); 218 this->cloudColorFadeZ->replay(); 210 219 } 211 220 212 } else { 213 214 if(cloudColor != newCloudColor) { 215 216 if(fadeCloud) { 217 218 this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX); 219 this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT); 220 this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY); 221 this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT); 222 this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ); 223 this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 224 225 this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR); 226 this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR); 227 228 this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR); 229 this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR); 230 231 this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR); 232 this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR); 233 234 fadeCloud = false; 235 236 this->cloudColorFadeX->replay(); 237 this->cloudColorFadeY->replay(); 238 this->cloudColorFadeZ->replay(); 239 } 240 241 this->cloudcolor->set(this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 221 this->cloudcolor->set 222 (this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 223 } 224 225 if(skyColor != newSkyColor) { 226 227 if(fadeSky) { 228 229 this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX); 230 this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT); 231 this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY); 232 this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT); 233 this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ); 234 this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 235 236 this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR); 237 this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR); 238 239 this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR); 240 this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR); 241 242 this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR); 243 this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR); 244 245 fadeSky = false; 246 247 this->skyColorFadeX->replay(); 248 this->skyColorFadeY->replay(); 249 this->skyColorFadeZ->replay(); 242 250 } 243 251 244 if(skyColor != newSkyColor) { 245 246 if(fadeSky) { 247 248 this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX); 249 this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT); 250 this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY); 251 this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT); 252 this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ); 253 this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 254 255 this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR); 256 this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR); 257 258 this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR); 259 this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR); 260 261 this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR); 262 this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR); 263 264 fadeSky = false; 265 266 this->skyColorFadeX->replay(); 267 this->skyColorFadeY->replay(); 268 this->skyColorFadeZ->replay(); 269 } 270 271 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 272 } 252 this->skycolor->set 253 (this->skyColor.x, this->skyColor.y, this->skyColor.z); 273 254 } 274 255 … … 316 297 void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) { 317 298 changeCloudColor( Vector(colorX, colorY, colorZ), time); 318 }319 320 void CloudEffect::flashSky( float time ) {321 322 flashSkyActivate = true;323 localTimer = 0;324 flashTime = time;325 326 299 } 327 300 -
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h
r9006 r9028 119 119 void shellCloudColor(float colorX, float colorY, float colorZ, float time); 120 120 121 static void flashSky(float time);122 121 123 122 private: … … 167 166 int BM; 168 167 169 static bool flashSkyActivate;170 static float localTimer;171 static float flashTime;172 168 173 169 }; -
branches/mountain_lake/src/lib/graphics/effects/lightning_effect.cc
r9006 r9028 199 199 this->flashLight->setSpecularColor(1,1,1); 200 200 201 CloudEffect::flashSky(0.02);202 201 203 202 // Play thunder sound … … 223 222 this->flashLight->setDiffuseColor(0,0,0); 224 223 this->flashLight->setSpecularColor(0,0,0); 225 CloudEffect::changeSkyColor(Vector(0,0,1), 0.02);226 224 227 225 this->newCoordinates();
Note: See TracChangeset
for help on using the changeset viewer.