-
Notifications
You must be signed in to change notification settings - Fork 0
/
smoke.h
78 lines (62 loc) · 2.01 KB
/
smoke.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
#ifndef SMOKE_H
#define SMOKE_H
#define MAX_PARTICLES 1000 // Number Of Particles To Create
#include <QGLViewer/vec.h>
#include <vector>
#include "particle.h"
#include "renderable.h"
/*
* This class represents a dynamic system made of particles
* linked together with damped springs, within a medium with
* gravity and viscosity.
* Particles a represented by small spheres, with a radius and a mass.
* The initial scene is composed of a fixed plane, a static particle
* that can be controlled by the mouse, and a dynamic particle.
*/
typedef struct // Create A Structure For Particle
{
bool active; // Active (Yes/No)
float life; // Particle Life
float fade; // Fade Speed
float r; // Red Value
float g; // Green Value
float b; // Blue Value
float x; // X Position
float y; // Y Position
float z; // Z Position
float xi; // X Direction
float yi; // Y Direction
float zi; // Z Direction
float xg; // X Gravity
float yg; // Y Gravity
float zg; // Z Gravity
}
particlesSmoke; // Particles Structure
class Smoke : public Renderable
{
private:
float slowdown; // Slow Down Particles
float xspeed; // Base X Speed (To Allow Keyboard Direction Of Tail)
float yspeed; // Base Y Speed (To Allow Keyboard Direction Of Tail)
float intensity;
GLuint loop; // Misc Loop Variable
GLuint delay; // Rainbow Effect Delay
particlesSmoke particle[MAX_PARTICLES]; // Particle Array (Room For Particle Info)
public:
Smoke(float intensity);
virtual ~Smoke();
float getIntensity();
void setIntensity(float i);
private:
// Reset the scene (remove all particles and springs)
void clear();
// Renderable methods
public:
// Init the particle-spring system
void init(Viewer &);
// Draw the particle-spring system
void draw();
// Update positions and velocities of dynamic objects
void animate();
};
#endif // SMOKE_H