-
Notifications
You must be signed in to change notification settings - Fork 0
/
Particle.h
167 lines (156 loc) · 11 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#ifndef PARTICLE_H
#define PARTICLE_H
/// @file Particle.h
/// @brief A Particle class, with all its variables and mutator/accessor functions
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include <iostream>
#include <cmath>
#include "glm/glm.hpp"
#include "SDL2/SDL.h"
/// \author Moira Shooter
/// \version
/// \date Last Revision 16 MAY 2017
/// \class Particle
/// \brief Creates the particle, has an update function and a draw functions, and get and sets methods
/// \todo
class Particle
{
public:
//--------------------------------------------------------------------------------------------------------------------
/// @brief the default constructor for particle
//--------------------------------------------------------------------------------------------------------------------
Particle(){;}
//--------------------------------------------------------------------------------------------------------------------
/// @brief function to update the particle's position
/// @param[in] _deltaTime the elapsed time that updated the last frame
//--------------------------------------------------------------------------------------------------------------------
void update(float _deltaTime);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function to draw the particle
//--------------------------------------------------------------------------------------------------------------------
void draw();
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that checks if the particle is dead
//--------------------------------------------------------------------------------------------------------------------
int isDead();
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that set the position of the particle
/// @param[in] _position the position of the particle
//--------------------------------------------------------------------------------------------------------------------
void setPosition(glm::vec3 _position);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the velocity of the particle
/// @param[in] _velocity the velocity of the particle
//--------------------------------------------------------------------------------------------------------------------
void setVelocity(glm::vec3 _velocity);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the colour of the particle
/// @param[in] _colour the colour of the particle
//--------------------------------------------------------------------------------------------------------------------
void setColour(glm::vec3 _colour);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the delta colour of the particle
/// @param[in] _deltaColour the delta colour of of the particle
//--------------------------------------------------------------------------------------------------------------------
void setDeltaColour(glm::vec3 _deltaColour);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the transparency of the particle
/// @param[in] _transparency the transparancy of the particle
//--------------------------------------------------------------------------------------------------------------------
void setTransparency(float _transparency);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the delta transparency of the particle
/// @param[in] _deltaTransparency the delta transparancy of the particle
//--------------------------------------------------------------------------------------------------------------------
void setDeltaTransparency(float _deltaTransparency);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the size of the particle
/// @param[in] _size the size of the particle
//--------------------------------------------------------------------------------------------------------------------
void setSize(float _size);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the delta size of the particle
/// @param[in] _deltaSize the delta size of the particle
//--------------------------------------------------------------------------------------------------------------------
void setDeltaSize(float _deltaSize);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the lifespan of the particle
/// @param[in] _lifespan the lifespan of the particle
//--------------------------------------------------------------------------------------------------------------------
void setLifeSpan(float _lifeSpan);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the delta lifespan of the particle
/// @param[in] _deltaLifespan the delta lifespan of the particle
//--------------------------------------------------------------------------------------------------------------------
void setDeltaLifeSpan(float _deltaLifeSpan);
//--------------------------------------------------------------------------------------------------------------------
/// @brief funciton that sets the life limit of the particle
/// @param[in] _lifelimit the lifelimit of the particle
//--------------------------------------------------------------------------------------------------------------------
void setLifeLimit(float _lifeLimit);
//--------------------------------------------------------------------------------------------------------------------
/// @brief function that sets the acceleration of the particle
/// @param[in] _acceleration the acceleration of the particle
//--------------------------------------------------------------------------------------------------------------------
void setAcceleration(glm::vec3 _acceleration);
//--------------------------------------------------------------------------------------------------------------------
/// @brief accessor function that access the y position of the particles
//--------------------------------------------------------------------------------------------------------------------
float getYPosition() const;
private:
//--------------------------------------------------------------------------------------------------------------------
/// @brief position of the particle
//--------------------------------------------------------------------------------------------------------------------
glm::vec3 m_position;
//--------------------------------------------------------------------------------------------------------------------
/// @brief velocity of the particle
//--------------------------------------------------------------------------------------------------------------------
glm::vec3 m_velocity;
//--------------------------------------------------------------------------------------------------------------------
/// @brief acceleration of the particle
//--------------------------------------------------------------------------------------------------------------------
glm::vec3 m_acceleration;
//--------------------------------------------------------------------------------------------------------------------
/// @brief colour of the particle
//--------------------------------------------------------------------------------------------------------------------
glm::vec3 m_colour;
//--------------------------------------------------------------------------------------------------------------------
/// @brief delta colour of the particle
//--------------------------------------------------------------------------------------------------------------------
glm::vec3 m_deltaColour;
//--------------------------------------------------------------------------------------------------------------------
/// @brief alpha channel of the particle (transparency)
//--------------------------------------------------------------------------------------------------------------------
float m_transparency;
//--------------------------------------------------------------------------------------------------------------------
/// @brief delta alpha channel of the particle
//--------------------------------------------------------------------------------------------------------------------
float m_deltaTransparency;
//--------------------------------------------------------------------------------------------------------------------
/// @brief the size of the particle
//--------------------------------------------------------------------------------------------------------------------
float m_size;
//--------------------------------------------------------------------------------------------------------------------
/// @brief the change of size of the particle
//--------------------------------------------------------------------------------------------------------------------
float m_deltaSize;
//--------------------------------------------------------------------------------------------------------------------
/// @brief the lifespan of the particle; shows how long the particle has been alive
//--------------------------------------------------------------------------------------------------------------------
float m_lifeSpan;
//--------------------------------------------------------------------------------------------------------------------
/// @brief the delta lifespan of the particle; shows how long the particle has been alive
//--------------------------------------------------------------------------------------------------------------------
float m_deltaLifeSpan;
//--------------------------------------------------------------------------------------------------------------------
/// @brief the life limit of the particle; till when the particle can be alive
//--------------------------------------------------------------------------------------------------------------------
float m_lifeLimit;
};
#endif // PARTICLE_H