-
Notifications
You must be signed in to change notification settings - Fork 0
/
Particle.h
72 lines (54 loc) · 1.78 KB
/
Particle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef PARTICLE_H
#define PARTICLE_H
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#ifdef WIN32
#include <GL/glew.h>
#else
#define GL3_PROTOTYPES 1
#include <GL3/gl3.h>
#endif
class Particle
{
public:
Particle(glm::vec2 pos, glm::vec2 velocity, float lifespan, bool rotation, glm::vec3 rotationAxis, float rotationAngle):
m_pos(pos), m_velocity(velocity), m_lifespan(lifespan), m_life(lifespan), m_rotation(rotation), m_rotationAxis(rotationAxis), m_deltaAngle(rotationAngle), m_rotationAngle(0)
{};
virtual ~Particle();
virtual void draw(glm::mat4 &projection, GLuint progID) = 0;
virtual void update(float deltaTime) = 0;
float getLifespan() { return m_lifespan; };
protected:
glm::vec2 m_pos;
glm::vec2 m_velocity;
float m_lifespan;
float m_life;
bool m_rotation;
glm::vec3 m_rotationAxis;
float m_deltaAngle;
float m_rotationAngle;
};
class ParticleOne : public Particle
{
public:
ParticleOne(glm::vec2 pos, glm::vec2 velocity, float lifespan, bool rotation, glm::vec3 rotationAxis, float rotationAngle, float size);
virtual ~ParticleOne();
void draw(glm::mat4 &projection, GLuint progID);
void update(float deltaTime);
private:
float m_vertices[198];
float m_color[264];
};
class ParticleZero : public Particle
{
public:
ParticleZero(glm::vec2 pos, glm::vec2 velocity, float lifespan, bool rotation, glm::vec3 rotationAxis, float rotationAngle, float size);
virtual ~ParticleZero();
void draw(glm::mat4 &projection, GLuint progID);
void update(float deltaTime);
private:
float m_vertices[432];
float m_color[576];
};
#endif // PARTICLE_H