OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
particleeffect.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef PARTICLEEFFECT_H
19 #define PARTICLEEFFECT_H
20 
21 #include "index.h"
22 
23 namespace Engine
24 {
25 
26 class ParticleEffectManager;
27 class ParticleManager;
28 
29 static const int PARTICLE_LIVE = 1;
30 static const int PARTICLE_DEAD = 0;
31 
35 struct Particle
36 {
37  Vector3f position; //Position
38 
39  Vector4f color;
40 
41  int live; //Leben = 1 / Dead = 0
42 
43  float size; //Größe
44 
45  float weight; //Gewicht
46 
47  float velocity; //Speed
48 
49  float angle; //Winkel
50 };
51 
52 using Particles = std::vector< Particle * >;
53 
58 {
59  public:
60 
61  friend class ParticleEffectManager;
62  friend class ParticleManager;
63 
64  explicit ParticleEffect( const std::string & effect_name )
65  : m_effect_name( effect_name ) ,
66  m_position( Vector3f(0,0,0) ) {}
67 
68  virtual ~ParticleEffect(){}
69 
70  virtual void create( int particle_count );
71 
72  virtual void simulate( float delta )=0;
73 
74  void createParticleData(void);
75  int getParticleSize(void);
76 
77  std::vector< float > getParticleVertexData();
78  std::vector< Vector4f > getParticleTBOData();
79 
80  protected:
81 
82  std::string m_effect_name;
83 
84  std::vector<float> m_particle_vertex_data;
85  std::vector<Vector4f> m_particle_tbo_data;
86 
87  Vector3f m_position;
88  Particles m_particles;
89 };
90 
91 }
92 
93 #endif // PARTICLEEFFECT_H
The Particle struct.
Definition: particleeffect.h:35
Definition: element.h:23
The ParticleEffect - abstract class.
Definition: particleeffect.h:57
Definition: particleeffectmanager.h:35
Definition: particlemanager.h:32