Changeset 7650 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- May 17, 2006, 2:58:18 PM (18 years ago)
- 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 21 21 #include "debug.h" 22 22 23 #include "p_node.h" 23 24 #include "state.h" 24 25 #include "sprite_particles.h" … … 89 90 angle = 0; 90 91 randomAngle = 0.3; 92 alpha = 0.5; 91 93 snowSize = Vector2D(1200, 1200); 92 94 snowCoord = Vector(100, 600, 200); 95 96 activated = false; 93 97 } 94 98 … … 98 102 { 99 103 PRINTF(0)("Activating SnowEffect\n"); 104 activated = true; 100 105 101 106 SnowEffect::snowParticles = new SpriteParticles(particles); … … 107 112 SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius); 108 113 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); 111 116 SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0); 112 117 … … 126 131 { 127 132 PRINTF(0)("Deactivating SnowEffect\n"); 133 activated = false; 128 134 129 135 this->emitter->setSystem(NULL); … … 146 152 void SnowEffect::tick(float dt) 147 153 { 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(); 148 159 } 149 160 -
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h
r7649 r7650 15 15 class SpriteParticles; 16 16 class PlaneEmitter; 17 class PNode; 17 18 18 19 class SnowEffect : public WeatherEffect … … 55 56 float velocity, randomVelocity; 56 57 float angle, randomAngle; 58 float alpha; 57 59 Vector snowCoord; 58 60 Vector2D snowSize; 59 61 62 bool activated; 63 60 64 static SpriteParticles* snowParticles; 61 65
Note: See TracChangeset
for help on using the changeset viewer.