hx3d  1
2D/3D Simple Game Framework
interpolation.hpp
1 /*
2  Interpolation functions.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_MATH_INTERPOLATION
22 #define HX3D_MATH_INTERPOLATION
23 
24 #include <glm/vec2.hpp>
25 #include <functional>
26 
27 #include "hx3d/math/constants.hpp"
28 #include "hx3d/graphics/color.hpp"
29 
30 namespace hx3d {
31 namespace math {
32 
36 enum class Interpolation {
37  Linear = 0,
38 
39  InQuad,
40  OutQuad,
41  InOutQuad,
42 
43  InCubic,
44  OutCubic,
45  InOutCubic,
46 
47  InQuart,
48  OutQuart,
49  InOutQuart,
50 
51  InQuint,
52  OutQuint,
53  InOutQuint,
54 
55  InSine,
56  OutSine,
57  InOutSine,
58 
59  InExpo,
60  OutExpo,
61  InOutExpo,
62 
63  InCirc,
64  OutCirc,
65  InOutCirc,
66 
67  InBack,
68  OutBack,
69  InOutBack,
70 
71  InBounce,
72  OutBounce,
73  InOutBounce,
74 
75  InElastic,
76  OutElastic,
77  InOutElastic
78 };
79 
90 template <class T>
91 T interpolate(T a, T b, float t, Interpolation type);
92 
93 template <>
95 
96 } /* math */
97 } /* hx3d */
98 
99 #include "hx3d/math/_inline/interpolation.inl.hpp"
100 
101 #endif
Four [0..255] components defined color.
Definition: color.hpp:32
T interpolate(T a, T b, float t, Interpolation type)
Interpolate between two values.
hx3d framework namespace
Definition: audio.hpp:26
Interpolation
Interpolate using functions.