Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9112 in orxonox.OLD


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

merged the mountain-lake back here

Location:
trunk/src/lib
Files:
7 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
  • trunk/src/lib/graphics/effects/cloud_effect.h

    r9006 r9112  
    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};
  • trunk/src/lib/graphics/effects/fog_effect.cc

    r9006 r9112  
    1919
    2020#include "shell_command.h"
     21#include "script_class.h"
    2122
    2223// Define shell commands
     
    2728
    2829using namespace std;
     30
     31CREATE_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                       );
    2937
    3038CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
  • trunk/src/lib/graphics/effects/lightning_effect.cc

    r9006 r9112  
    2929#include "light.h"
    3030#include "cloud_effect.h"
     31#include "script_class.h"
    3132
    3233SHELL_COMMAND(activate, LightningEffect, activateLightning);
     
    3435
    3536using namespace std;
     37
     38CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT,
     39                        addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate))
     40                            ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate))
     41                       );
    3642
    3743CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT);
     
    199205        this->flashLight->setSpecularColor(1,1,1);
    200206
    201         CloudEffect::flashSky(0.02);
    202207
    203208        // Play thunder sound
     
    223228        this->flashLight->setDiffuseColor(0,0,0);
    224229        this->flashLight->setSpecularColor(0,0,0);
    225         CloudEffect::changeSkyColor(Vector(0,0,1), 0.02);
    226230
    227231        this->newCoordinates();
  • trunk/src/lib/graphics/effects/rain_effect.cc

    r9006 r9112  
    2929#include "light.h"
    3030#include "cloud_effect.h"
     31#include "script_class.h"
    3132
    3233#include "parser/tinyxml/tinyxml.h"
     
    3940
    4041using namespace std;
     42
     43CREATE_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                       );
    4149
    4250CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT);
  • trunk/src/lib/graphics/effects/snow_effect.cc

    r9006 r9112  
    2727#include "plane_emitter.h"
    2828#include "shell_command.h"
     29#include "script_class.h"
    2930
    3031#include "parser/tinyxml/tinyxml.h"
     
    3435
    3536using namespace std;
     37
     38CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT,
     39                            addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate))
     40                            ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate))
     41                       );
    3642
    3743CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT);
  • trunk/src/lib/shell/shell_command.cc

    r8894 r9112  
    373373    else
    374374    {
    375       if(this->completors[parameter] == NULL)
    376       //delete this->completors[parameter];
    377       this->completors[parameter] = completorPlugin.clone();
     375//       if(this->completors[parameter] == NULL)
     376//       delete this->completors[parameter];
     377//       this->completors[parameter] = completorPlugin.clone();
    378378    }
    379379    return this;
Note: See TracChangeset for help on using the changeset viewer.