Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9028 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2006, 11:48:53 AM (18 years ago)
Author:
amaechler
Message:


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  
    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))
    5653                       );
    5754
     
    9491    fadeCloud = false;
    9592
    96     flashSkyActivate = false;
    97     localTimer = 0;
    98     flashTime = 0;
    9993
    10094    skyColor = Vector(0.0f, 0.0f, 0.8f);
     
    192186    if (this->cloudActivate) {
    193187
    194         localTimer += dt;
    195 
    196188        this->offsetZ += 0.05 * dt * this->animationSpeed;
    197189
    198190        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();
    210219            }
    211220
    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();
    242250            }
    243251
    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);
    273254        }
    274255
     
    316297void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) {
    317298    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 
    326299}
    327300
  • branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h

    r9006 r9028  
    119119    void shellCloudColor(float colorX, float colorY, float colorZ, float time);
    120120
    121     static void flashSky(float time);
    122121
    123122private:
     
    167166    int              BM;
    168167
    169     static bool      flashSkyActivate;
    170     static float     localTimer;
    171     static float     flashTime;
    172168
    173169};
  • branches/mountain_lake/src/lib/graphics/effects/lightning_effect.cc

    r9006 r9028  
    199199        this->flashLight->setSpecularColor(1,1,1);
    200200
    201         CloudEffect::flashSky(0.02);
    202201
    203202        // Play thunder sound
     
    223222        this->flashLight->setDiffuseColor(0,0,0);
    224223        this->flashLight->setSpecularColor(0,0,0);
    225         CloudEffect::changeSkyColor(Vector(0,0,1), 0.02);
    226224
    227225        this->newCoordinates();
Note: See TracChangeset for help on using the changeset viewer.