saturn.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 transform
11 {
12
13 class Saturn : 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/transform_saturn.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("saturn");
45 }
46
47 std::string
48 getCategory() const override
49 {
50 return std::string("transform");
51 }
52
53 std::string
54 getSource() const override
55 {
56 return std::string(
57 "float colormap_f1(float x) {\n"
58 " return -510.0 * x + 255.0;\n"
59 "}\n"
60 "\n"
61 "float colormap_f2(float x) {\n"
62 " return (-1891.7 * x + 217.46) * x + 255.0;\n"
63 "}\n"
64 "\n"
65 "float colormap_f3(float x) {\n"
66 " return 9.26643676359015e1 * sin((x - 4.83450094847127e-1) * 9.93) + "
67 "1.35940451627965e2;\n"
68 "}\n"
69 "\n"
70 "float colormap_f4(float x) {\n"
71 " return -510.0 * x + 510.0;\n"
72 "}\n"
73 "\n"
74 "float colormap_f5(float x) {\n"
75 " float xx = x - 197169.0 / 251000.0;\n"
76 " return (2510.0 * xx - 538.31) * xx;\n"
77 "}\n"
78 "\n"
79 "float colormap_red(float x) {\n"
80 " if (x < 0.0) {\n"
81 " return 1.0;\n"
82 " } else if (x < 10873.0 / 94585.0) {\n"
83 " float xx = colormap_f2(x);\n"
84 " if (xx > 255.0) {\n"
85 " return (510.0 - xx) / 255.0;\n"
86 " } else {\n"
87 " return xx / 255.0;\n"
88 " }\n"
89 " } else if (x < 0.5) {\n"
90 " return 1.0;\n"
91 " } else if (x < 146169.0 / 251000.0) {\n"
92 " return colormap_f4(x) / 255.0;\n"
93 " } else if (x < 197169.0 / 251000.0) {\n"
94 " return colormap_f5(x) / 255.0;\n"
95 " } else {\n"
96 " return 0.0;\n"
97 " }\n"
98 "}\n"
99 "\n"
100 "float colormap_green(float x) {\n"
101 " if (x < 10873.0 / 94585.0) {\n"
102 " return 1.0;\n"
103 " } else if (x < 36373.0 / 94585.0) {\n"
104 " return colormap_f2(x) / 255.0;\n"
105 " } else if (x < 0.5) {\n"
106 " return colormap_f1(x) / 255.0;\n"
107 " } else if (x < 197169.0 / 251000.0) {\n"
108 " return 0.0;\n"
109 " } else if (x <= 1.0) {\n"
110 " return abs(colormap_f5(x)) / 255.0;\n"
111 " } else {\n"
112 " return 0.0;\n"
113 " }\n"
114 "}\n"
115 "\n"
116 "float colormap_blue(float x) {\n"
117 " if (x < 0.0) {\n"
118 " return 0.0;\n"
119 " } else if (x < 36373.0 / 94585.0) {\n"
120 " return colormap_f1(x) / 255.0;\n"
121 " } else if (x < 146169.0 / 251000.0) {\n"
122 " return colormap_f3(x) / 255.0;\n"
123 " } else if (x <= 1.0) {\n"
124 " return colormap_f4(x) / 255.0;\n"
125 " } else {\n"
126 " return 0.0;\n"
127 " }\n"
128 "}\n"
129 "\n"
130 "vec4 colormap(float x) {\n"
131 " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n"
132 "}\n");
133 }
134 };
135
136 } // namespace transform
137} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition saturn.h:48
std::string getSource() const override
Definition saturn.h:54
Color getColor(double x) const override
Definition saturn.h:29
std::string getTitle() const override
Definition saturn.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