Blue_Waves.h
Go to the documentation of this file.
1/**
2 * This file was automatically created with "create_c++_header.sh".
3 * Do not edit manually.
4 */
5#pragma once
6#include "../../colormap.h"
7
8namespace colormap
9{
10 namespace IDL
11 {
12
13 class BlueWaves : public Colormap
14 {
15 private:
16 class Wrapper : public WrapperBase
17 {
18 public:
19#ifdef float
20#error "TODO"
21#endif
22#define float local_real_t
23#include "../../../../shaders/glsl/IDL_Blue_Waves.frag"
24#undef float
25 };
26
27 public:
28 Color
29 getColor(double x) const override
30 {
31 Wrapper w;
32 vec4 c = w.colormap(x);
33 Color result;
34 result.r = std::max(0.0, std::min(1.0, c.r));
35 result.g = std::max(0.0, std::min(1.0, c.g));
36 result.b = std::max(0.0, std::min(1.0, c.b));
37 result.a = std::max(0.0, std::min(1.0, c.a));
38 return result;
39 }
40
41 std::string
42 getTitle() const override
43 {
44 return std::string("Blue_Waves");
45 }
46
47 std::string
48 getCategory() const override
49 {
50 return std::string("IDL");
51 }
52
53 std::string
54 getSource() const override
55 {
56 return std::string(
57 "float colormap_red(float x) {\n"
58 " const float pi = 3.141592653589793238462643383279502884197169399;\n"
59 " const float a = 94.58052830612496;\n"
60 " const float b = 0.5059881077994055;\n"
61 " const float c = 0.5079410623689743;\n"
62 " const float d = 86.68342149719986;\n"
63 " float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n"
64 " if (v < 0.0) {\n"
65 " return -v;\n"
66 " } else {\n"
67 " return v;\n"
68 " }\n"
69 "}\n"
70 "\n"
71 "float colormap_green(float x) {\n"
72 " const float pi = 3.141592653589793238462643383279502884197169399;\n"
73 " const float a = 99.19361086687104;\n"
74 " const float b = 1.095358975873744;\n"
75 " const float c = 0.3679001899352902;\n"
76 " const float d = 0.7603616684267874;\n"
77 " const float e = 219.7852186508229;\n"
78 " const float f = 1.161240703555854;\n"
79 " float v = (a * x + b) * sin(2.0 * pi * (x / c + d)) + e * x + f;\n"
80 " if (v > 255.0) {\n"
81 " return 510.0 - v;\n"
82 " } else {\n"
83 " return v;\n"
84 " }\n"
85 "}\n"
86 "\n"
87 "float colormap_blue(float x) {\n"
88 " const float pi = 3.141592653589793238462643383279502884197169399;\n"
89 " const float a = 253.8552881642787;\n"
90 " const float b = 0.5059881077994055;\n"
91 " const float c = 0.5079410623689743;\n"
92 " const float d = 226.7149651787587;\n"
93 " float v = a * sin(2.0 * pi * (x / b + c)) + d;\n"
94 " if (v > 255.0) {\n"
95 " return 510.0 - v;\n"
96 " } else if (v < 0.0) {\n"
97 " return -v;\n"
98 " } else {\n"
99 " return v;\n"
100 " }\n"
101 "}\n"
102 "\n"
103 "vec4 colormap(float x) {\n"
104 " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
105 " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
106 " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
107 " return vec4(r, g, b, 1.0);\n"
108 "}\n");
109 }
110 };
111
112 } // namespace IDL
113} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition Blue_Waves.h:48
std::string getSource() const override
Definition Blue_Waves.h:54
Color getColor(double x) const override
Definition Blue_Waves.h:29
std::string getTitle() const override
Definition Blue_Waves.h:42
uint32_t Color
RGBA color.
Definition color.h:8
This file offers overloads of toIce() and fromIce() functions for STL container types.
This file was automatically created with "create_c++_header.sh".
Definition colormap.h:10