Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/world_entities/weather_effects/snow_effect.h @ 9805

Last change on this file since 9805 was 9805, checked in by bensch, 18 years ago

orxonox/new_class_id: SoundSource completely added as a Resource

File size: 3.2 KB
Line 
1/**
2* @file snow_effect.h
3*/
4
5#ifndef _SNOW_EFFECT
6#define _SNOW_EFFECT
7
8#include "vector.h"
9#include "particles/particle_system.h"
10#include "material.h"
11#include "vector2D.h"
12
13#include "weather_effect.h"
14
15class SpriteParticles;
16class PlaneEmitter;
17class PNode;
18class CloudEffect;
19
20#include "sound_source.h"
21#include "sound_buffer.h"
22
23class SnowEffect : public WeatherEffect
24{
25  ObjectListDeclaration(SnowEffect);
26public:
27  SnowEffect(const TiXmlElement* root = NULL);
28  virtual ~SnowEffect();
29
30  virtual void loadParams(const TiXmlElement* root);
31
32  virtual void init();
33
34  virtual void activate();
35  virtual void deactivate();
36
37  inline void activateSnow()
38  {
39    this->activate();
40  }
41  inline void deactivateSnow()
42  {
43    this->deactivate();
44  }
45
46  virtual void draw() const;
47  virtual void tick(float dt);
48
49
50  inline void numParticles(int n)
51  {
52    this->particles = n;
53  }
54  inline void materialTexture(const std::string& texture)
55  {
56    this->texture = texture;
57  }
58  inline void lifeSpan(float lifeSpan, float randomLifeSpan)
59  {
60    this->snowLife = lifeSpan;
61    this->randomLife = randomLifeSpan;
62  }
63  inline void radius(float radius, float randomRadius)
64  {
65    this->snowRadius = radius;
66    this->randomRadius = randomRadius;
67  }
68  inline void mass(float mass, float randomMass)
69  {
70    this->snowMass = mass;
71    this->randomMass = randomMass;
72  }
73  inline void emissionRate(float emissionRate)
74  {
75    this->rate = emissionRate;
76  }
77  inline void emissionVelocity(float velocity, float randomVelocity)
78  {
79    this->velocity = velocity;
80    this->randomVelocity = randomVelocity;
81  }
82  inline void size(float sizeX, float sizeY)
83  {
84    this->snowSize = Vector2D(sizeX, sizeY);
85  }
86  inline void coord(float x, float y, float z)
87  {
88    this->snowCoord = Vector(x, y, z);
89  }
90  inline void wind(int force)
91  {
92    this->snowWindForce = force;
93  }
94  inline void setCloudColor(float colorX, float colorY, float colorZ)
95  {
96    this->cloudColor = Vector(colorX, colorY, colorZ);
97  }
98  inline void setSkyColor(float colorX, float colorY, float colorZ)
99  {
100    this->skyColor = Vector(colorX, colorY, colorZ);
101  }
102  inline void setFadeTime(float time)
103  {
104    this->fadeTime = time;
105  }
106
107  inline void setSnowOption(const std::string& option)
108  {
109    /*if (option == "fade") this->snowFade = true;*/
110    if (option == "movesnow")
111      this->snowMove = true;
112    if (option == "activate")
113      this->snowActivate = true;
114  }
115
116
117private:
118  int               particles;
119  std::string       texture;
120  float             snowLife, randomLife;
121  float             snowRadius, randomRadius;
122  float             snowMass, randomMass;
123  float             rate;
124  float             velocity, randomVelocity;
125  float             angle, randomAngle;
126  float             alpha;
127  float             fadeTime;
128  Vector            snowCoord;
129  Vector2D          snowSize;
130  int               snowWindForce;
131
132  bool              snowMove;
133  bool              snowActivate;
134
135  PlaneEmitter*     emitter;
136
137  static SpriteParticles*   snowParticles;
138  OrxSound::SoundSource     soundSource;
139  OrxSound::SoundBuffer     windBuffer;
140
141  Vector            oldSkyColor;
142  Vector            oldCloudColor;
143  Vector            skyColor;
144  Vector            cloudColor;
145};
146
147
148#endif  /* _SNOW_EFFECT */
Note: See TracBrowser for help on using the repository browser.