aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/particle/je_particle.h
blob: 474e15b65f4787033dbee9b634434cd8e3c29fc3 (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
#ifndef __JE_PARTICLE_H
#define __JE_PARTICLE_H

#include "../../math/je_vector2.hpp"

namespace JinEngine
{
    namespace Graphics
    {

        class ParticleSystem;

        ///
        /// A single particle contains various properties of particle, such as position, accelaration, color and 
        /// other attributes changed over time.
        ///
        struct Particle
        {
            ///
            /// Whole life time.
            ///
            float lifeTime = 0.0f;

            ///
            /// Current life time.
            ///
            float life = 0.0f;

            ///
            /// Current position.
            ///
            float position[2] = {0,0};

            ///
            /// Emitte direction.
            /// 
            float direction = 0; 

            Math::Vector2<float> speed; 
            Math::Vector2<float> linearAcceleration;
            float radialAcceleration = 0; 
            float tangetialAcceleration = 0;

            ///
            /// Size over lifetime.
            ///
            float size = 1; 
            float sizeBegin = 1; 
            float sizeEnd = 1;

            float rotation = 0;
            float angle = 0;

            ///
            /// Color over lifetime.
            ///
            Color color = Color::WHITE;
            Color colorStart = Color::WHITE;
            Color colorEnd = Color::WHITE;

            ///
            /// Is particle still alive? Alive is equivalent to NOT available in particle pool.
            ///
            bool alive = false;

        };

    } // namespace Graphics
} // namespace JinEngine

#endif