blob: 742a03a6a691774d4e26645129269cd0ab438463 (
plain)
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
168
169
|
/*
render/particle.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#ifndef __INCLUDED_RENDER_PARTICLE_H__
#define __INCLUDED_RENDER_PARTICLE_H__
#include "math/axis.h"
#include "math/color.h"
#include "math/vector3f.h"
namespace render {
/* ---- class Particle --------------------------------------------- */
/**
* @brief One particle
* */
class Particle
{
public:
Particle(const math::Vector3f &location, const unsigned long timestamp);
Particle(const math::Vector3f &location, const math::Axis &axis, const unsigned long timestamp);
/* ---- inspectors ----------------------------------------- */
/**
* @brief location of the particle
* Depending on the attached setting of the ejector
* location can be in world coordinates or in model coordinates,
* */
inline const math::Vector3f &location() const {
return particle_location;
}
/**
* @brief axis vector of the particle
* */
inline const math::Axis &axis() const {
return particle_axis;
}
/**
* @brief speed of the particle
* */
const float speed() const
{
return particle_speed;
}
/**
* @brief radius of the particle
* */
const float radius() const
{
return particle_radius;
}
/**
* @brief color of the particle
* */
const math::Color color() const
{
return particle_color;
}
/**
* @brief rotation of the particle, in radians
* */
const float rotation() const
{
return particle_rotation;
}
/**
* @brief particle creation timestamp
* */
inline const unsigned long timestamp() const {
return particle_timestamp;
}
/* ---- mutators ------------------------------------------- */
/**
* @brief reference to the location of the particle
* */
inline math::Vector3f &get_location() {
return particle_location;
}
/**
* @brief reference axis vector of the particle
* */
inline math::Axis &get_axis() {
return particle_axis;
}
/**
* @brief set the location of the particle
* */
inline void set_location(const math::Vector3f &location)
{
particle_location.assign(location);
}
/**
* @brief set the axis of the particle
* */
inline void set_axis(const math::Axis &axis)
{
particle_axis.assign(axis);
}
/**
* @brief set the speed of the particle
* */
inline void set_speed(const float speed)
{
particle_speed = speed;
}
/**
* @brief set the radius of the particle
* */
inline void set_radius(const float radius)
{
particle_radius = radius;
}
/**
* @brief set the color of the particle
* */
inline void set_color(const math::Color color)
{
particle_color.assign(color);
}
/**
* @brief return a reference to the color of the particle
* */
math::Color & get_color()
{
return particle_color;
}
/**
* @brief set the rotation of the particle, in radians
* This value is used to rotate the texture when rendering the particle
* */
inline void set_rotation(const float rotation)
{
particle_rotation = rotation;
}
protected:
math::Vector3f particle_location;
math::Color particle_color;
math::Axis particle_axis;
float particle_radius;
float particle_rotation;
float particle_speed;
unsigned long particle_timestamp;
};
} // namespace
#endif // __INCLUDED_RENDER_PARTICLE_H__
|