SuperTuxKart
particle_emitter.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2011-2015 Joerg Henrichs, Marianne Gagnon
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef SERVER_ONLY
20 
21 #ifndef HEADER_SMOKE_HPP
22 #define HEADER_SMOKE_HPP
23 
24 namespace irr
25 {
26  namespace scene { class ISceneNode; class IParticleEmitter; }
27 }
28 using namespace irr;
29 
30 #include "utils/leak_check.hpp"
31 #include "utils/no_copy.hpp"
32 #include "utils/vec3.hpp"
33 
34 class Material;
35 class ParticleKind;
36 class STKParticle;
37 class Track;
38 
43 class ParticleEmitter : public NoCopy
44 {
45 private:
48 
49  Vec3 m_position;
50 
51  scene::ISceneNode* m_parent;
52 
55  scene::IParticleEmitter *m_emitter;
56 
57  const ParticleKind *m_particle_type;
58 
59  unsigned int m_magic_number;
60 
63 
65  float m_min_rate, m_max_rate;
66 
67  bool m_randomize_initial_y;
68 
69  bool m_important;
70 
71 public:
72 
73  LEAK_CHECK()
74 
75  ParticleEmitter (const ParticleKind* type,
76  const Vec3 &position,
77  scene::ISceneNode* parent = NULL,
78  bool randomize_initial_y = false,
79  bool important = false);
80  virtual ~ParticleEmitter();
81  virtual void update (float dt);
82  void setCreationRateAbsolute(float fraction);
83  void setCreationRateRelative(float f);
84  int getCreationRate();
85  float getCreationRateFloat() {return m_min_rate;}
86 
87  void setPosition(const Vec3 &pos);
88  void setRotation(const Vec3 &rot);
89 
90  const ParticleKind* getParticlesInfo() const { return m_particle_type; }
91 
92  void setParticleType(const ParticleKind* p);
93 
94  void resizeBox(float size);
95 
96  STKParticle* getNode() { return m_node; }
97 
99  void unsetNode() { m_node = NULL; }
100 
101  void addHeightMapAffector(Track* t);
102 
103  bool randomizeInitialY() const { return m_randomize_initial_y; }
104 };
105 #endif // HEADER_SMOKE_HPP
106 
107 #endif // !SERVER_ONLY
108 
109 
Definition: material.hpp:48
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
manages smoke particle effects
Definition: particle_emitter.hpp:44
void unsetNode()
call this if the node was freed otherwise
Definition: particle_emitter.hpp:99
float m_min_rate
The irrlicht emitter contains this info, but as an int.
Definition: particle_emitter.hpp:65
STKParticle * m_node
STK particle systems.
Definition: particle_emitter.hpp:47
int m_emission_decay_rate
Decay of emission rate, in particles per second.
Definition: particle_emitter.hpp:62
scene::IParticleEmitter * m_emitter
The emitters.
Definition: particle_emitter.hpp:55
type of particles
Definition: particle_kind.hpp:42
Definition: stk_particle.hpp:39
Definition: track.hpp:115
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35