Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7650 in orxonox.OLD for branches/atmospheric_engine/src


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

branches/atmospheric_engine: work on the snow effect

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

Legend:

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

    r7649 r7650  
    2121#include "debug.h"
    2222
     23#include "p_node.h"
    2324#include "state.h"
    2425#include "sprite_particles.h"
     
    8990  angle = 0;
    9091  randomAngle = 0.3;
     92  alpha = 0.5;
    9193  snowSize = Vector2D(1200, 1200);
    9294  snowCoord = Vector(100, 600, 200);
     95 
     96  activated = false;
    9397}
    9498
     
    98102{
    99103  PRINTF(0)("Activating SnowEffect\n");
     104  activated = true;
    100105 
    101106  SnowEffect::snowParticles = new SpriteParticles(particles);
     
    107112  SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius);
    108113  SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
    109   SnowEffect::snowParticles->setColor(0,1, 1, 1,.5);
    110   SnowEffect::snowParticles->setColor(.5, .6, .6, .6, .2);
     114  SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
     115  SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
    111116  SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
    112117
     
    126131{
    127132  PRINTF(0)("Deactivating SnowEffect\n");
     133  activated = false;
    128134 
    129135  this->emitter->setSystem(NULL);
     
    146152void SnowEffect::tick(float dt)
    147153{
     154  float distance = (State::getCameraNode()->getAbsCoor() - snowCoord).len();
     155  if( activated && ( distance > 0.6*snowSize.x || distance > 0.6*snowSize.y) )
     156    this->deactivate();
     157  if( !activated && ( distance < 0.6*snowSize.x || distance < 0.6*snowSize.y ))
     158    this->activate();
    148159}
    149160
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h

    r7649 r7650  
    1515class SpriteParticles;
    1616class PlaneEmitter;
     17class PNode;
    1718
    1819class SnowEffect : public WeatherEffect
     
    5556    float velocity, randomVelocity;
    5657    float angle, randomAngle;
     58    float alpha;
    5759    Vector snowCoord;
    5860    Vector2D snowSize;
    5961
     62    bool activated;
     63   
    6064    static SpriteParticles* snowParticles;
    6165   
Note: See TracChangeset for help on using the changeset viewer.