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 HEADER_SMOKE_HPP
20 #define HEADER_SMOKE_HPP
21 
22 namespace irr
23 {
24  namespace scene { class ISceneNode; class IParticleEmitter; }
25 }
26 using namespace irr;
27 
28 #include "utils/leak_check.hpp"
29 #include "utils/no_copy.hpp"
30 #include "utils/vec3.hpp"
31 
32 class Material;
33 class ParticleKind;
34 class STKParticle;
35 class Track;
36 
41 class ParticleEmitter : public NoCopy
42 {
43 private:
46 
47  Vec3 m_position;
48 
49  scene::ISceneNode* m_parent;
50 
53  scene::IParticleEmitter *m_emitter;
54 
55  const ParticleKind *m_particle_type;
56 
57  unsigned int m_magic_number;
58 
61 
63  float m_min_rate, m_max_rate;
64 
65  bool m_randomize_initial_y;
66 
67  bool m_important;
68 
69 public:
70 
71  LEAK_CHECK()
72 
73  ParticleEmitter (const ParticleKind* type,
74  const Vec3 &position,
75  scene::ISceneNode* parent = NULL,
76  bool randomize_initial_y = false,
77  bool important = false);
78  virtual ~ParticleEmitter();
79  virtual void update (float dt);
80  void setCreationRateAbsolute(float fraction);
81  void setCreationRateRelative(float f);
82  int getCreationRate();
83  float getCreationRateFloat() {return m_min_rate;}
84 
85  void setPosition(const Vec3 &pos);
86  void setRotation(const Vec3 &rot);
87 
88  const ParticleKind* getParticlesInfo() const { return m_particle_type; }
89 
90  void setParticleType(const ParticleKind* p);
91 
92  void resizeBox(float size);
93 
94  STKParticle* getNode() { return m_node; }
95 
97  void unsetNode() { m_node = NULL; }
98 
99  void addHeightMapAffector(Track* t);
100 
101  bool randomizeInitialY() const { return m_randomize_initial_y; }
102 };
103 #endif
104 
105 
type of particles
Definition: particle_kind.hpp:41
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:34
scene::IParticleEmitter * m_emitter
The emitters.
Definition: particle_emitter.hpp:53
manages smoke particle effects
Definition: particle_emitter.hpp:41
void unsetNode()
call this if the node was freed otherwise
Definition: particle_emitter.hpp:97
Definition: stk_particle.hpp:32
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:25
STKParticle * m_node
STK particle systems.
Definition: particle_emitter.hpp:45
Definition: material.hpp:46
float m_min_rate
The irrlicht emitter contains this info, but as an int.
Definition: particle_emitter.hpp:63
Definition: track.hpp:96
int m_emission_decay_rate
Decay of emission rate, in particles per second.
Definition: particle_emitter.hpp:60