Unravel Engine C++ Reference
Loading...
Searching...
No Matches
gradient.cpp
Go to the documentation of this file.
1#include "gradient.h"
2
3namespace math
4{
5
6
7template<>
8auto gradient_lerp(const vec4& start, const vec4& end, float progress) -> vec4
9{
10 return glm::lerp(start, end, vec4(progress));
11}
12
13template<>
14auto gradient_lerp(const vec3& start, const vec3& end, float progress) -> vec3
15{
16 return glm::lerp(start, end, vec3(progress));
17}
18
19template<>
20auto gradient_lerp(const vec2& start, const vec2& end, float progress) -> vec2
21{
22 return glm::lerp(start, end, vec2(progress));
23}
24
25
26template<>
27auto gradient_lerp(const float& start, const float& end, float progress) -> float
28{
29 return glm::lerp(start, end, progress);
30}
31
32template<>
33auto gradient_lerp(const color& start, const color& end, float progress) -> color
34{
35 return color(gradient_lerp(start.value, end.value, progress));
36}
38{
39 switch(mode)
40 {
42 return "constant";
44 return "linear";
45 default:
46 return "constant";
47 }
48
49}
51{
52 if(mode == "constant")
53 {
55 }
56 else if(mode == "linear")
57 {
59 }
60
62}
63
64
65
66} // namespace math
Definition bbox.cpp:5
auto gradient_lerp(const vec4 &start, const vec4 &end, float progress) -> vec4
Definition gradient.cpp:8
auto interpolation_mode_from_string(const std::string &mode) -> gradient_interpolation_mode_t
Definition gradient.cpp:50
gradient_interpolation_mode_t
Definition gradient.h:22
auto to_string(gradient_interpolation_mode_t mode) -> std::string
Definition gradient.cpp:37