| 1 | /** | 
|---|
| 2 | * @file snow_effect.h | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | #ifndef _SNOW_EFFECT | 
|---|
| 6 | #define _SNOW_EFFECT | 
|---|
| 7 |  | 
|---|
| 8 | #include "vector.h" | 
|---|
| 9 | #include "particle_system.h" | 
|---|
| 10 | #include "material.h" | 
|---|
| 11 | #include "vector2D.h" | 
|---|
| 12 |  | 
|---|
| 13 | #include "weather_effect.h" | 
|---|
| 14 |  | 
|---|
| 15 | class SpriteParticles; | 
|---|
| 16 | class PlaneEmitter; | 
|---|
| 17 | class PNode; | 
|---|
| 18 |  | 
|---|
| 19 | #include "sound_source.h" | 
|---|
| 20 | #include "sound_buffer.h" | 
|---|
| 21 |  | 
|---|
| 22 | class SnowEffect : public WeatherEffect | 
|---|
| 23 | { | 
|---|
| 24 |         public: | 
|---|
| 25 |                 SnowEffect(const TiXmlElement* root = NULL); | 
|---|
| 26 |                 virtual ~SnowEffect(); | 
|---|
| 27 |  | 
|---|
| 28 |                 virtual void loadParams(const TiXmlElement* root); | 
|---|
| 29 |  | 
|---|
| 30 |                 virtual bool init(); | 
|---|
| 31 |  | 
|---|
| 32 |                 virtual bool activate(); | 
|---|
| 33 |                 virtual bool deactivate(); | 
|---|
| 34 |  | 
|---|
| 35 |                 virtual void draw() const; | 
|---|
| 36 |                 virtual void tick(float dt); | 
|---|
| 37 |  | 
|---|
| 38 |                 void activateSnow(); | 
|---|
| 39 |                 void deactivateSnow(); | 
|---|
| 40 |  | 
|---|
| 41 |                 inline void numParticles(int n) { this->particles = n; } | 
|---|
| 42 |                 inline void materialTexture(const std::string& texture) { this->texture = texture; } | 
|---|
| 43 |                 inline void lifeSpan(float lifeSpan, float randomLifeSpan) { this->life = lifeSpan; this->randomLife = randomLifeSpan; } | 
|---|
| 44 |                 inline void radius(float radius, float randomRadius) { this->snowRadius = radius; this->randomRadius = randomRadius; } | 
|---|
| 45 |                 inline void mass(float mass, float randomMass) { this->snowMass = mass; this->randomMass = randomMass; } | 
|---|
| 46 |                 inline void emissionRate(float emissionRate){ this->rate = emissionRate; } | 
|---|
| 47 |                 inline void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; } | 
|---|
| 48 |                 inline void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); } | 
|---|
| 49 |                 inline void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); } | 
|---|
| 50 |     inline void wind(int force) { this->snowWindForce = force; } | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 |         private: | 
|---|
| 54 |                 int                                                                                                                             particles; | 
|---|
| 55 |                 std::string                                                                                             texture; | 
|---|
| 56 |                 float                                                                                                                   life, randomLife; | 
|---|
| 57 |                 float                                                                                                                           snowRadius, randomRadius; | 
|---|
| 58 |                 float                                                                                                                           snowMass, randomMass; | 
|---|
| 59 |                 float                                                                                                                   rate; | 
|---|
| 60 |                 float                                                                                                                   velocity, randomVelocity; | 
|---|
| 61 |                 float                                                                                                                   angle, randomAngle; | 
|---|
| 62 |                 float                                                                                                                   alpha; | 
|---|
| 63 |                 Vector                                                                                                                  snowCoord; | 
|---|
| 64 |                 Vector2D                                                                                                                snowSize; | 
|---|
| 65 |                 int                                                                                                                                     snowWindForce; | 
|---|
| 66 |  | 
|---|
| 67 |                 bool                                                                                                                            activated; | 
|---|
| 68 |  | 
|---|
| 69 |                 PlaneEmitter*                                                                                           emitter; | 
|---|
| 70 |  | 
|---|
| 71 |                 static SpriteParticles*                                                 snowParticles; | 
|---|
| 72 |                 OrxSound::SoundSource              soundSource; | 
|---|
| 73 |                 OrxSound::SoundBuffer*             windBuffer; | 
|---|
| 74 |  | 
|---|
| 75 | }; | 
|---|
| 76 |  | 
|---|
| 77 |  | 
|---|
| 78 | #endif  /* _SNOW_EFFECT */ | 
|---|