[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 | |
---|
[7652] | 35 | virtual void draw() const; |
---|
| 36 | virtual void tick(float dt); |
---|
[7649] | 37 | |
---|
[7652] | 38 | void activateSnow(); |
---|
| 39 | void deactivateSnow(); |
---|
[7651] | 40 | |
---|
[7696] | 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 | |
---|
[7652] | 53 | private: |
---|
[7696] | 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; |
---|
[7651] | 66 | |
---|
[7696] | 67 | bool activated; |
---|
[7573] | 68 | |
---|
[7696] | 69 | PlaneEmitter* emitter; |
---|
[7651] | 70 | |
---|
[7696] | 71 | static SpriteParticles* snowParticles; |
---|
[7810] | 72 | OrxSound::SoundSource soundSource; |
---|
| 73 | OrxSound::SoundBuffer* windBuffer; |
---|
[7651] | 74 | |
---|
[7573] | 75 | }; |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | #endif /* _SNOW_EFFECT */ |
---|