Beach.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 Beach : 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_Beach.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("Beach");
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 " if (x <= 0.5) {\n"
59 " return 1.07069284759359E+03 * x - 3.92901626559718E+02; // R1\n"
60 " } else if (x < (4.62452380952399E+02 - 3.16199999999948E+02) / "
61 "(1.05778571428574E+03 - 8.03199999999881E+02)) { // 0.57447206479\n"
62 " return 1.05778571428574E+03 * x - 4.62452380952399E+02; // R2\n"
63 " } else if (x < (2.16218045113087E+01 + 3.16199999999948E+02) / "
64 "(8.03199999999881E+02 - 2.93462406015021E+02)) { // 0.66273668746\n"
65 " return 8.03199999999881E+02 * x - 3.16199999999948E+02; // R3\n"
66 " } else if (x < 0.7332708626326772) {\n"
67 " return 2.93462406015021E+02 * x + 2.16218045113087E+01; // R4\n"
68 " } else {\n"
69 " return 0.0;\n"
70 " }\n"
71 "}\n"
72 "\n"
73 "float colormap_green(float x) {\n"
74 " if (x < (2.51230508474576E+02 - 2.71026069518750E+01) / "
75 "(4.27421457219241E+02 + 5.35095032144939E+02)) { // 0.23285616817\n"
76 " return -5.35095032144939E+02 * x + 2.51230508474576E+02; // G1\n"
77 " } else if (x < (6.91824598930488E+02 - 2.71026069518750E+01) / "
78 "(4.27421457219241E+02 + 1.39121879297175E+03)) { // 0.36550493804\n"
79 " return 4.27421457219241E+02 * x + 2.71026069518750E+01; // G2\n"
80 " } else if (x < (6.91824598930488E+02 + 5.16725562656262E+02) / "
81 "(1.02304642956372E+03 + 1.39121879297175E+03)) { // 0.500587156\n"
82 " return -1.39121879297175E+03 * x + 6.91824598930488E+02; // G3\n"
83 " } else if (x < 0.7332708626326772) {\n"
84 " return 1.02304642956372E+03 * x - 5.16725562656262E+02; // G4\n"
85 " } else {\n"
86 " return 0.0;\n"
87 " }\n"
88 "}\n"
89 "\n"
90 "float colormap_blue(float x) {\n"
91 " if (x < 0.3584754040051419) {\n"
92 " return 1.07130443548384E+03 * x - 2.48036290322570E+02; // B1\n"
93 " } else if (x < 123.0 / 251.0) {\n"
94 " return 136.0;\n"
95 " } else if (x < 0.7332708626326772) {\n"
96 " return -1.01758796992489E+03 * x + 5.87035338345905E+02; // B2\n"
97 " } else {\n"
98 " return 8.98509790209691E+02 * x - 6.58851048950966E+02; // B3\n"
99 " }\n"
100 "}\n"
101 "\n"
102 "// R2 - R3 = 0\n"
103 "// => [x=0.5744720647924222]\n"
104 "\n"
105 "// B1 - 136 = 0\n"
106 "// => [x=0.3584754040051419]\n"
107 "\n"
108 "// B3 = 0\n"
109 "// => [x=0.7332708626326772]\n"
110 "\n"
111 "vec4 colormap(float x) {\n"
112 " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
113 " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
114 " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
115 " return vec4(r, g, b, 1.0);\n"
116 "}\n");
117 }
118 };
119
120 } // namespace IDL
121} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition Beach.h:48
std::string getSource() const override
Definition Beach.h:54
Color getColor(double x) const override
Definition Beach.h:29
std::string getTitle() const override
Definition Beach.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