1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See http://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 /** ***************************************************************************
12 *** \file    particle_keyframe.h
13 *** \author  Raj Sharma, roos@allacrost.org
14 *** \author  Yohann Ferreira, yohann ferreira orange fr
15 *** \brief   Header file for particle keyframes
16 ***
17 *** Particle properties are keyframed- for example, you can vary the size of a
18 *** particle along its lifetime, to create some interesting effects. The
19 *** ParticleKeyframe class contains all of the keyframed properties for a given
20 *** snapshot in time (time ranges from 0.0 to 1.0), and these keyframes are stored
21 *** in the ParticleSystemDef class.
22 *** **************************************************************************/
23 
24 #ifndef __PARTICLE_KEYFRAME_HEADER__
25 #define __PARTICLE_KEYFRAME_HEADER__
26 
27 #include "color.h"
28 #include "common/position_2d.h"
29 
30 namespace vt_mode_manager
31 {
32 
33 /*!***************************************************************************
34  *  \brief Keyframes, consist of a _time, plus various properties. These are
35  *         used to specify how the properties of a particle vary over time.
36  *         For example, in most systems, we'll want particles to fade out over
37  *         their lifetime, so this could be done by creating 2 keyframes, where
38  *         the alpha component of the 2nd keyframe's _color is zero.
39  *****************************************************************************/
40 
41 class ParticleKeyframe
42 {
43 public:
44 
ParticleKeyframe()45     ParticleKeyframe():
46         size(0.0f, 0.0f),
47         color(0.0f, 0.0f, 0.0f, 0.0f),
48         rotation_speed(0.0f),
49         size_variation(0.0f, 0.0f),
50         rotation_speed_variation(0.0f),
51         color_variation(0.0f, 0.0f, 0.0f, 0.0f),
52         time(0.0f)
53     {}
54 
55     //! width and height scale. 1.0 means to use the normal height
56     vt_common::Position2D size;
57 
58     //! color (includes alpha)
59     vt_video::Color color;
60 
61     //! rotation speed, radians per second clockwise
62     float rotation_speed;
63 
64     //! random variation added to size
65     vt_common::Position2D size_variation;
66 
67     //! random variation added to rotation speed
68     float rotation_speed_variation;
69 
70     //! random variation added to color (each channel contains
71     //! the variation for that channel)
72     vt_video::Color color_variation;
73 
74     float time;
75 };
76 
77 }  // namespace vt_mode_manager
78 
79 #endif  //! __PARTICLE_KEYFRAME_HEADER__
80