Changeset 9112 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jul 4, 2006, 11:29:10 AM (18 years ago)
- Location:
- trunk/src/lib/graphics/effects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/effects/cloud_effect.cc
r9006 r9112 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)) 53 ->addMethod("activate", ExecutorLua0<CloudEffect>(&CloudEffect::activate)) 54 ->addMethod("deactivate", ExecutorLua0<CloudEffect>(&CloudEffect::deactivate)) 56 55 ); 57 56 … … 94 93 fadeCloud = false; 95 94 96 flashSkyActivate = false;97 localTimer = 0;98 flashTime = 0;99 95 100 96 skyColor = Vector(0.0f, 0.0f, 0.8f); … … 192 188 if (this->cloudActivate) { 193 189 194 localTimer += dt;195 196 190 this->offsetZ += 0.05 * dt * this->animationSpeed; 197 191 198 192 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"); 193 this->offset->set 194 (0.0f, 0.0f, offsetZ); 195 196 if(cloudColor != newCloudColor) { 197 198 if(fadeCloud) { 199 200 this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX); 201 this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT); 202 this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY); 203 this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT); 204 this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ); 205 this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 206 207 this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR); 208 this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR); 209 210 this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR); 211 this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR); 212 213 this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR); 214 this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR); 215 216 fadeCloud = false; 217 218 this->cloudColorFadeX->replay(); 219 this->cloudColorFadeY->replay(); 220 this->cloudColorFadeZ->replay(); 210 221 } 211 222 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); 223 this->cloudcolor->set 224 (this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 225 } 226 227 if(skyColor != newSkyColor) { 228 229 if(fadeSky) { 230 231 this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX); 232 this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT); 233 this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY); 234 this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT); 235 this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ); 236 this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 237 238 this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR); 239 this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR); 240 241 this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR); 242 this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR); 243 244 this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR); 245 this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR); 246 247 fadeSky = false; 248 249 this->skyColorFadeX->replay(); 250 this->skyColorFadeY->replay(); 251 this->skyColorFadeZ->replay(); 242 252 } 243 253 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 } 254 this->skycolor->set 255 (this->skyColor.x, this->skyColor.y, this->skyColor.z); 273 256 } 274 257 … … 316 299 void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) { 317 300 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 301 } 327 302 -
trunk/src/lib/graphics/effects/cloud_effect.h
r9006 r9112 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 }; -
trunk/src/lib/graphics/effects/fog_effect.cc
r9006 r9112 19 19 20 20 #include "shell_command.h" 21 #include "script_class.h" 21 22 22 23 // Define shell commands … … 27 28 28 29 using namespace std; 30 31 CREATE_SCRIPTABLE_CLASS(FogEffect, CL_FOG_EFFECT, 32 addMethod("fadeIn", ExecutorLua0<FogEffect>(&FogEffect::fadeInFog)) 33 ->addMethod("fadeOut", ExecutorLua0<FogEffect>(&FogEffect::fadeOutFog)) 34 ->addMethod("activate", ExecutorLua0<FogEffect>(&FogEffect::activate)) 35 ->addMethod("deactivate", ExecutorLua0<FogEffect>(&FogEffect::deactivate)) 36 ); 29 37 30 38 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); -
trunk/src/lib/graphics/effects/lightning_effect.cc
r9006 r9112 29 29 #include "light.h" 30 30 #include "cloud_effect.h" 31 #include "script_class.h" 31 32 32 33 SHELL_COMMAND(activate, LightningEffect, activateLightning); … … 34 35 35 36 using namespace std; 37 38 CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT, 39 addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate)) 40 ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate)) 41 ); 36 42 37 43 CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT); … … 199 205 this->flashLight->setSpecularColor(1,1,1); 200 206 201 CloudEffect::flashSky(0.02);202 207 203 208 // Play thunder sound … … 223 228 this->flashLight->setDiffuseColor(0,0,0); 224 229 this->flashLight->setSpecularColor(0,0,0); 225 CloudEffect::changeSkyColor(Vector(0,0,1), 0.02);226 230 227 231 this->newCoordinates(); -
trunk/src/lib/graphics/effects/rain_effect.cc
r9006 r9112 29 29 #include "light.h" 30 30 #include "cloud_effect.h" 31 #include "script_class.h" 31 32 32 33 #include "parser/tinyxml/tinyxml.h" … … 39 40 40 41 using namespace std; 42 43 CREATE_SCRIPTABLE_CLASS(RainEffect, CL_RAIN_EFFECT, 44 addMethod("startRaining", ExecutorLua0<RainEffect>(&RainEffect::startRaining)) 45 ->addMethod("stopRaining", ExecutorLua0<RainEffect>(&RainEffect::stopRaining)) 46 ->addMethod("activate", ExecutorLua0<RainEffect>(&RainEffect::activate)) 47 ->addMethod("deactivate", ExecutorLua0<RainEffect>(&RainEffect::deactivate)) 48 ); 41 49 42 50 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); -
trunk/src/lib/graphics/effects/snow_effect.cc
r9006 r9112 27 27 #include "plane_emitter.h" 28 28 #include "shell_command.h" 29 #include "script_class.h" 29 30 30 31 #include "parser/tinyxml/tinyxml.h" … … 34 35 35 36 using namespace std; 37 38 CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT, 39 addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate)) 40 ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate)) 41 ); 36 42 37 43 CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT);
Note: See TracChangeset
for help on using the changeset viewer.