Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2006, 3:44:12 PM (19 years ago)
Author:
bensch
Message:

merged the atmos back with command: https://svn.orxonox.net/orxonox/branches/atmospheric_engine

File:
1 edited

Legend:

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

    r7810 r8255  
    5353        }
    5454
    55         this->activate();
     55        if(snowActivate)
     56                this->activate();
    5657}
    5758
     
    7576        LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
    7677        LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
    77   LoadParam(root, "wind", this, SnowEffect, wind);
     78        LoadParam(root, "wind", this, SnowEffect, wind);
    7879        LoadParam(root, "size", this, SnowEffect, size);
    7980        LoadParam(root, "coord", this, SnowEffect, coord);
     81 
     82        LOAD_PARAM_START_CYCLE(root, element);
     83        {
     84                LoadParam_CYCLE(element, "option", this, SnowEffect, setSnowOption);
     85        }
     86        LOAD_PARAM_END_CYCLE(element);
    8087}
    8188
     
    8592
    8693        // Default values
     94        this->snowActivate = false;
     95        this->snowMove = false;
    8796        this->particles = 12000;
    8897        this->texture = "maps/snow_flake_01_32x32.png";
     
    100109        this->alpha = 0.5;
    101110        this->snowSize = Vector2D(2500, 2500);
    102   this->snowCoord = Vector(100,450,400);
     111        this->snowCoord = Vector(100,450,400);
    103112        this->snowWindForce = 1;
    104 
    105         this->activated = false;
    106113}
    107114
     
    109116{
    110117        PRINTF(0)("Activating SnowEffect\n");
    111         activated = true;
     118
     119        this->snowActivate = true;
    112120
    113121        SnowEffect::snowParticles = new SpriteParticles(particles);
     
    131139        this->emitter->setSize(snowSize);
    132140
    133   //SnowEffect::snowParticles->precache(8);
     141        // SnowEffect::snowParticles->precache(8);
    134142
    135143        if (this->snowWindForce > 1)
     
    141149{
    142150        PRINTF(0)("Deactivating SnowEffect\n");
    143         activated = false;
    144 
     151
     152        this->snowActivate = false;
    145153        this->emitter->setSystem(NULL);
    146154
     
    150158}
    151159
    152 void SnowEffect::activateSnow()
    153 {
     160void SnowEffect::draw() const
     161{
     162        if (!this->snowActivate)
     163                return;
     164}
     165
     166void SnowEffect::tick(float dt)
     167{
     168        if (!this->snowActivate)
     169                return;
     170
     171        /*
     172        float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
     173       
     174        if(activated)
     175        {
     176        if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
     177                        this->deactivate();
     178        else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
     179        this->alpha = 0.15;
     180        else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
     181        this->alpha = 0.25;
     182        else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
     183        this->alpha = 0.4;
     184       
     185        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     186        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
     187        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
     188        }
     189        else
     190        {
     191        if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
    154192        this->activate();
    155 }
    156 
    157 void SnowEffect::deactivateSnow()
    158 {
    159         this->deactivate();
    160 }
    161 
    162 void SnowEffect::draw() const
    163 {
    164 }
    165 
    166 void SnowEffect::tick(float dt)
    167 {
    168   float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
    169  
    170   if(activated)
    171   {
    172     if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
    173                   this->deactivate();
    174     else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
    175       this->alpha = 0.15;
    176     else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
    177       this->alpha = 0.25;
    178     else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
    179       this->alpha = 0.4;
    180 
    181     SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
    182     SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
    183     SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
    184   }
    185   else
    186   {
    187   if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
    188     this->activate();
    189   if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
    190     this->alpha = 0.25;
    191   else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
    192     this->alpha = 0.4;
    193   else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
    194     this->alpha = 0.5;
    195 
    196     SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
    197     SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
    198     SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
    199   }
    200 }
    201 
     193        if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
     194        this->alpha = 0.25;
     195        else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
     196        this->alpha = 0.4;
     197        else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
     198        this->alpha = 0.5;
     199       
     200        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     201        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
     202        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
     203        }*/
     204
     205        if (this->snowMove) {
     206                this->snowCoord = State::getCameraNode()->getAbsCoor();
     207                this->emitter->setRelCoor(this->snowCoord.x , this->snowCoord.y+300, this->snowCoord.z);
     208        }
     209}
Note: See TracChangeset for help on using the changeset viewer.