Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7683 in orxonox.OLD


Ignore:
Timestamp:
May 18, 2006, 2:56:01 PM (18 years ago)
Author:
hdavid
Message:

branches/atmospheric_engine: finished snow effect

Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc

    r7652 r7683  
    3535       
    3636        this->fogMode = GL_LINEAR;
    37         this->fogDensity = 0.001f;
    38         this->fogStart = 10.0f;
    39         this->fogEnd = 1000.0f;
     37        this->fogDensity = 0.1f;
     38        this->fogStart = 0.0f;
     39        this->fogEnd = 5000.0f;
     40  this->colorVector = Vector(0.7, 0.7, 0.7);
    4041
    4142        if (root != NULL)
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc

    r7652 r7683  
    6767        LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
    6868        LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
    69         LoadParam(root, "spread", this, SnowEffect, spread);
     69  LoadParam(root, "wind", this, SnowEffect, wind);
    7070        LoadParam(root, "size", this, SnowEffect, size);
    7171        LoadParam(root, "coord", this, SnowEffect, coord);
     
    7777
    7878        // Default values
    79         particles = 10000;
     79        particles = 12000;
    8080        texture = "maps/snow_flake_01_32x32.png";
    8181        life = 8;
     
    8888        velocity = -100;
    8989        randomVelocity = 5;
    90         angle = 0;
    91         randomAngle = 0.3;
     90        angle = 0.5;
     91        randomAngle = 0.2;
    9292        alpha = 0.5;
    93         snowSize = Vector2D(1200, 1200);
    94         snowCoord = Vector(100, 600, 200);
     93        snowSize = Vector2D(2500, 2500);
     94  snowCoord = Vector(100,450,400);
    9595
    9696        activated = false;
     
    107107        SnowEffect::snowParticles->setLifeSpan(life, randomLife);
    108108        SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius);
    109         SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius);
    110         SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius);
     109        SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius*0.8);
     110        SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius*0.5);
    111111        SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
    112112        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     
    116116        this->emitter->setSystem(SnowEffect::snowParticles);
    117117
    118 // this->updateNode(0);
    119118        this->emitter->setRelCoor(snowCoord);
    120119        this->emitter->setEmissionRate(rate);
     
    122121        this->emitter->setSpread(angle, randomAngle);
    123122        this->emitter->setSize(snowSize);
     123 
     124  //SnowEffect::snowParticles->precache(8);
    124125}
    125126
     
    149150void SnowEffect::tick(float dt)
    150151{
    151         float distance = (State::getCameraNode()->getAbsCoor() - snowCoord).len();
    152         if( activated && ( distance > 0.6*snowSize.x || distance > 0.6*snowSize.y) )
    153                 this->deactivate();
    154         if( !activated && ( distance < 0.6*snowSize.x || distance < 0.6*snowSize.y ))
    155                 this->activate();
     152  float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
     153 
     154  if(activated)
     155  {
     156    if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
     157                  this->deactivate();
     158    else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
     159      this->alpha = 0.15;
     160    else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
     161      this->alpha = 0.25;
     162    else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
     163      this->alpha = 0.4;
     164
     165    SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     166    SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
     167    SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
     168  }
     169  else
     170  {
     171  if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
     172    this->activate();
     173  if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
     174    this->alpha = 0.25;
     175  else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
     176    this->alpha = 0.4;
     177  else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
     178    this->alpha = 0.5;
     179
     180    SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     181    SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
     182    SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
     183  }
    156184}
    157185
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h

    r7652 r7683  
    4444                void emissionRate(float emissionRate){ this->rate = emissionRate; }
    4545                void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; }
    46                 void spread(float angle, float randomAngle) { this->angle = angle; this->randomAngle = randomAngle; }
    4746                void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); }
    4847                void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); }
     48    void wind(int force) { this->angle = angle*force; this->randomAngle = randomAngle*force; }
    4949
    5050                int particles;
Note: See TracChangeset for help on using the changeset viewer.