Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2006, 11:29:10 AM (18 years ago)
Author:
bensch
Message:

merged the mountain-lake back here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/effects/cloud_effect.cc

    r9006 r9112  
    3939bool      CloudEffect::fadeCloud;
    4040float     CloudEffect::fadeTime;
    41 bool      CloudEffect::flashSkyActivate;
    42 float     CloudEffect::localTimer;
    43 float     CloudEffect::flashTime;
    4441
    4542using namespace std;
     
    5350CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT,
    5451                        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))
    5655                       );
    5756
     
    9493    fadeCloud = false;
    9594
    96     flashSkyActivate = false;
    97     localTimer = 0;
    98     flashTime = 0;
    9995
    10096    skyColor = Vector(0.0f, 0.0f, 0.8f);
     
    192188    if (this->cloudActivate) {
    193189
    194         localTimer += dt;
    195 
    196190        this->offsetZ += 0.05 * dt * this->animationSpeed;
    197191
    198192        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();
    210221            }
    211222
    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();
    242252            }
    243253
    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);
    273256        }
    274257
     
    316299void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) {
    317300    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 
    326301}
    327302
Note: See TracChangeset for help on using the changeset viewer.