Hue_Sat_Lightness_2.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
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_Hue_Sat_Lightness_2.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("Hue_Sat_Lightness_2");
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_up(float x) {\n"
58 " return (1.88200166286601E-03 * x - 4.65545143706978E-01) * x + "
59 "2.51008231568770E+02;\n"
60 "}\n"
61 "\n"
62 "float colormap_low(float x) {\n"
63 " return (-1.90879354636631E-03 * x - 5.05775136749144E-01) * x + "
64 "2.51839633472648E+02;\n"
65 "}\n"
66 "\n"
67 "float colormap_r1(float x) {\n"
68 " float t = x - 84.41170691108532;\n"
69 " return ((-1.30664056487685E-04 * t - 2.23609578814399E-02) * t - "
70 "1.63427831229829E+00) * t + colormap_low(84.41170691108532);\n"
71 "}\n"
72 "\n"
73 "float colormap_r2(float x) {\n"
74 " float t = (x - 172.4679464259528);\n"
75 " return (3.39051205856669E-02 * t + 1.53777364753859E+00) * t + "
76 "colormap_low(172.4679464259528);\n"
77 "}\n"
78 "\n"
79 "float colormap_g1(float x) {\n"
80 " return (2.06966753567031E-02 * x - 3.81765550976615E+00) * x + "
81 "3.70329541512642E+02;\n"
82 "}\n"
83 "\n"
84 "float colormap_g2(float x) {\n"
85 " float t = x - 215.8140719563986;\n"
86 " return (-2.93369381849802E-02 * t - 4.45609461245051E+00) * t + "
87 "colormap_up(215.8140719563986);\n"
88 "}\n"
89 "\n"
90 "float colormap_b1(float x) {\n"
91 " float t = (x - 129.0039558892991);\n"
92 " return (-2.69029805601284E-02 * t - 1.46365429919324E+00) * t + "
93 "colormap_up(129.0039558892991);\n"
94 "}\n"
95 "\n"
96 "float colormap_red(float x) {\n"
97 " if (x < 84.41170691108532) {\n"
98 " return colormap_r1(x);\n"
99 " } else if (x < 172.4679464259528) {\n"
100 " return colormap_low(x);\n"
101 " } else if (x < 215.8140719563986) {\n"
102 " return colormap_r2(x);\n"
103 " } else {\n"
104 " return colormap_up(x);\n"
105 " }\n"
106 "}\n"
107 "\n"
108 "float colormap_green(float x) {\n"
109 " if (x < 84.41170691108532) {\n"
110 " return colormap_low(x);\n"
111 " } else if (x < 129.0039558892991) {\n"
112 " return colormap_g1(x);\n"
113 " } else if (x < 215.8140719563986) {\n"
114 " return colormap_up(x);\n"
115 " } else {\n"
116 " return colormap_g2(x);\n"
117 " }\n"
118 "}\n"
119 "\n"
120 "float colormap_blue(float x) {\n"
121 " if (x < 129.0039558892991) {\n"
122 " return colormap_up(x);\n"
123 " } else if (x < 172.4679464259528) {\n"
124 " return colormap_b1(x);\n"
125 " } else {\n"
126 " return colormap_low(x);\n"
127 " }\n"
128 "}\n"
129 "\n"
130 "// G1 = low\n"
131 "// => [x=62.09621943267293,x=84.41170691108532]\n"
132 "\n"
133 "// G1 = up\n"
134 "// => [x=49.16072666680554,x=129.0039558892991]\n"
135 "\n"
136 "// B1 = low\n"
137 "// => [x=66.91982278615977,x=172.4679464259528]\n"
138 "\n"
139 "// R2 = up\n"
140 "// => [x=86.8352194379599,x=215.8140719563986]\n"
141 "\n"
142 "// low(172.4679464259528) = 107.83220272\n"
143 "// up(215.8140719563986) = 238.192608973\n"
144 "\n"
145 "vec4 colormap(float x) {\n"
146 " float t = x * 255.0;\n"
147 " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n"
148 " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n"
149 " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n"
150 " return vec4(r, g, b, 1.0);\n"
151 "}\n");
152 }
153 };
154
155 } // namespace IDL
156} // namespace colormap
constexpr T c
std::string getCategory() const override
std::string getSource() const override
Color getColor(double x) const override
std::string getTitle() const override
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