[7573] | 1 | /** |
---|
[7652] | 2 | * @file snow_effect.h |
---|
| 3 | */ |
---|
[7573] | 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; |
---|
[7576] | 16 | class PlaneEmitter; |
---|
[7650] | 17 | class PNode; |
---|
[7573] | 18 | |
---|
[7810] | 19 | #include "sound_source.h" |
---|
[7696] | 20 | #include "sound_buffer.h" |
---|
| 21 | |
---|
[7573] | 22 | class SnowEffect : public WeatherEffect |
---|
| 23 | { |
---|
[7652] | 24 | public: |
---|
| 25 | SnowEffect(const TiXmlElement* root = NULL); |
---|
| 26 | virtual ~SnowEffect(); |
---|
[7573] | 27 | |
---|
[7652] | 28 | virtual void loadParams(const TiXmlElement* root); |
---|
[7573] | 29 | |
---|
[7652] | 30 | virtual bool init(); |
---|
[7573] | 31 | |
---|
[7652] | 32 | virtual bool activate(); |
---|
| 33 | virtual bool deactivate(); |
---|
[7573] | 34 | |
---|
[8255] | 35 | inline void activateSnow() { this->activate(); } |
---|
| 36 | inline void deactivateSnow() { this->deactivate(); } |
---|
| 37 | |
---|
[7652] | 38 | virtual void draw() const; |
---|
| 39 | virtual void tick(float dt); |
---|
[7649] | 40 | |
---|
[7651] | 41 | |
---|
[7696] | 42 | inline void numParticles(int n) { this->particles = n; } |
---|
| 43 | inline void materialTexture(const std::string& texture) { this->texture = texture; } |
---|
| 44 | inline void lifeSpan(float lifeSpan, float randomLifeSpan) { this->life = lifeSpan; this->randomLife = randomLifeSpan; } |
---|
| 45 | inline void radius(float radius, float randomRadius) { this->snowRadius = radius; this->randomRadius = randomRadius; } |
---|
| 46 | inline void mass(float mass, float randomMass) { this->snowMass = mass; this->randomMass = randomMass; } |
---|
| 47 | inline void emissionRate(float emissionRate){ this->rate = emissionRate; } |
---|
| 48 | inline void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; } |
---|
| 49 | inline void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); } |
---|
| 50 | inline void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); } |
---|
[8255] | 51 | inline void wind(int force) { this->snowWindForce = force; } |
---|
[7696] | 52 | |
---|
[8255] | 53 | inline void setSnowOption(const std::string& option) { |
---|
| 54 | /*if (option == "fade") this->snowFade = true;*/ |
---|
| 55 | if (option == "movesnow") this->snowMove = true; |
---|
| 56 | if (option == "activate") this->snowActivate = true; |
---|
| 57 | } |
---|
[7696] | 58 | |
---|
[8255] | 59 | |
---|
[7652] | 60 | private: |
---|
[8255] | 61 | int particles; |
---|
| 62 | std::string texture; |
---|
| 63 | float life, randomLife; |
---|
| 64 | float snowRadius, randomRadius; |
---|
| 65 | float snowMass, randomMass; |
---|
| 66 | float rate; |
---|
| 67 | float velocity, randomVelocity; |
---|
| 68 | float angle, randomAngle; |
---|
| 69 | float alpha; |
---|
| 70 | Vector snowCoord; |
---|
| 71 | Vector2D snowSize; |
---|
| 72 | int snowWindForce; |
---|
[7651] | 73 | |
---|
[8255] | 74 | bool snowMove; |
---|
| 75 | bool snowActivate; |
---|
[7573] | 76 | |
---|
[8255] | 77 | PlaneEmitter* emitter; |
---|
[7651] | 78 | |
---|
[8255] | 79 | static SpriteParticles* snowParticles; |
---|
| 80 | OrxSound::SoundSource soundSource; |
---|
| 81 | OrxSound::SoundBuffer* windBuffer; |
---|
[7651] | 82 | |
---|
[7573] | 83 | }; |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | #endif /* _SNOW_EFFECT */ |
---|