Hue_Sat_Value_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
13 class HueSatValue2 : 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_Hue_Sat_Value_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_Value_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_low(float x) {\n"
58 " return -9.89123311722871E-01 * x + 2.54113856910082E+02;\n"
59 "}\n"
60 "\n"
61 "float colormap_r1(float x) {\n"
62 " float t = x - 44.52807774916808;\n"
63 " return (-2.10743035084859E-02 * t - 1.14339819510944E+00) * t + 255.0;\n"
64 "}\n"
65 "\n"
66 "float colormap_r2(float x) {\n"
67 " float t = x - 173.2142990353825;\n"
68 " return (2.10464655909683E-02 * t + 3.09770350177039E+00) * t + "
69 "82.7835558104;\n"
70 "}\n"
71 "\n"
72 "float colormap_g1(float x) {\n"
73 " float t = x - 87.18599073927922;\n"
74 " return (2.18814766236433E-02 * t + 1.07683877405025E+00) * t + "
75 "167.876161014;\n"
76 "}\n"
77 "\n"
78 "float colormap_g2(float x) {\n"
79 " float t = x - 216.2347301863598;\n"
80 " return (-1.75617661106684E-02 * t - 5.19390917463437E+00) * t + 255.0;\n"
81 "}\n"
82 "\n"
83 "float colormap_b2(float x) {\n"
84 " float t = x - 130.3078696041572;\n"
85 " return (-1.97675474706200E-02 * t - 3.16561290370380E+00) * t + 255.0;\n"
86 "}\n"
87 "\n"
88 "float colormap_red(float x) {\n"
89 " if (x < 44.52807774916808) {\n"
90 " return 255.0;\n"
91 " } else if (x < 87.18599073927922) {\n"
92 " return colormap_r1(x);\n"
93 " } else if (x < 173.2142990353825) {\n"
94 " return colormap_low(x);\n"
95 " } else if (x < 216.2347301863598) {\n"
96 " return colormap_r2(x);\n"
97 " } else {\n"
98 " return 255.0;\n"
99 " }\n"
100 "}\n"
101 "\n"
102 "float colormap_green(float x) {\n"
103 " if (x < 87.18599073927922) {\n"
104 " return colormap_low(x);\n"
105 " } else if (x < 130.3078696041572) {\n"
106 " return colormap_g1(x);\n"
107 " } else if (x < 216.2347301863598) {\n"
108 " return 255.0;\n"
109 " } else {\n"
110 " return colormap_g2(x);\n"
111 " }\n"
112 "}\n"
113 "\n"
114 "float colormap_blue(float x) {\n"
115 " if (x < 44.52807774916808) {\n"
116 " return (2.31958376441286E-02 * x - 1.01298265446011E+00) * x + "
117 "2.54114630079813E+02; // B1\n"
118 " } else if (x < 130.3078696041572) {\n"
119 " return 255.0;\n"
120 " } else if (x < 173.2142990353825) {\n"
121 " return colormap_b2(x);\n"
122 " } else {\n"
123 " return colormap_low(x);\n"
124 " }\n"
125 "}\n"
126 "\n"
127 "// B1 - 255 = 0\n"
128 "// => [x=-0.8571972230440585,x=44.52807774916808]\n"
129 "\n"
130 "// R1 - low = 0\n"
131 "// => [x=-5.450356335481052,x=87.18599073927922]\n"
132 "\n"
133 "// G1 - 255 = 0\n"
134 "// => [x=-5.148233003947013,x=130.3078696041572]\n"
135 "\n"
136 "// B2 - low = 0\n"
137 "// => [x=-22.70273917535556,x=173.2142990353825]\n"
138 "\n"
139 "// R2 - 255 = 0\n"
140 "// => [x=-16.99015635858727,x=216.2347301863598]\n"
141 "\n"
142 "// low(87.18599073927922) = 167.876161014\n"
143 "// low(173.2142990353825) = 82.7835558104\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