Standard_Gamma-II.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_Standard_Gamma-II.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("Standard_Gamma-II");
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 < (8.75333333333333E+01 + 2.19676470588235E+02) / "
59 "(4.76470588235294E+00 + 1.00000000000000E-01)) { // 63.1507456671\n"
60 " return 4.76470588235294E+00 * x - 2.19676470588235E+02;\n"
61 " } else if (x < (8.75333333333333E+01 + 3.11000000000000E+02) / "
62 "(5.00000000000000E+00 + 1.00000000000000E-01)) { // 78.1437908497\n"
63 " return -1.00000000000000E-01 * x + 8.75333333333333E+01;\n"
64 " } else if (x < (-3.11000000000000E+02 + 3.42345454545455E+02) / "
65 "(5.32727272727273E+00 - 5.00000000000000E+00)) { // 95.7777777778\n"
66 " return 5.00000000000000E+00 * x - 3.11000000000000E+02;\n"
67 " } else if (x < (255.0 + 3.42345454545455E+02) / 5.32727272727273E+00) { "
68 "// 112.129692833\n"
69 " return 5.32727272727273E+00 * x - 3.42345454545455E+02;\n"
70 " } else if (x < (1.49279020979021E+03 - 255.0) / 7.68531468531468E+00) { "
71 "// 161.059144677\n"
72 " return 255.0;\n"
73 " } else if (x < (1.49279020979021E+03 + 7.19657722738218E+02) / "
74 "(5.10010319917441E+00 + 7.68531468531468E+00)) { // 173.04463198\n"
75 " return -7.68531468531468E+00 * x + 1.49279020979021E+03;\n"
76 " } else if (x < (255.0 + 7.19657722738218E+02) / 5.10010319917441E+00) { "
77 "// 191.105490355\n"
78 " return 5.10010319917441E+00 * x - 7.19657722738218E+02;\n"
79 " } else {\n"
80 " return 255.0;\n"
81 " }\n"
82 "}\n"
83 "\n"
84 "float colormap_green(float x) {\n"
85 " if (x < (163.0 + 5.65896810850440E+02) / 5.07239736070381E+00) { // "
86 "143.69868112\n"
87 " return 5.07239736070381E+00 * x - 5.65896810850440E+02;\n"
88 " } else if (x < (163.0 + 9.06153846153846E+02) / 6.10769230769231E+00) { "
89 "// 175.050377834\n"
90 " return 163.0;\n"
91 " } else {\n"
92 " return 6.10769230769231E+00 * x - 9.06153846153846E+02;\n"
93 " }\n"
94 "}\n"
95 "\n"
96 "float colormap_blue(float x) {\n"
97 " if (x < (5.16164662349676E+02 - 4.77795918367347E+00) / "
98 "(5.20142857142857E+00 + 5.42900092506938E+00)) { // 48.1059305585\n"
99 " return 5.20142857142857E+00 * x + 4.77795918367347E+00;\n"
100 " } else if (x < 5.16164662349676E+02 / 5.42900092506938E+00) { // "
101 "95.0754419595\n"
102 " return -5.42900092506938E+00 * x + 5.16164662349676E+02;\n"
103 " } else if (x < 6.16058823529412E+02 / 4.84558823529412E+00) { // "
104 "127.138088012\n"
105 " return 0.0;\n"
106 " } else if (x < (9.31184615384615E+02 + 6.16058823529412E+02) / "
107 "(4.84558823529412E+00 + 5.89230769230769E+00)) { // 144.091863932\n"
108 " return 4.84558823529412E+00 * x - 6.16058823529412E+02;\n"
109 " } else if (x < 9.31184615384615E+02 / 5.89230769230769E+00) { // "
110 "158.033942559\n"
111 " return -5.89230769230769E+00 * x + 9.31184615384615E+02;\n"
112 " } else if (x < 5.64142909048289E+02 / 3.22177684013127E+00) { // "
113 "175.103036939\n"
114 " return 0.0;\n"
115 " } else {\n"
116 " return 3.22177684013127E+00 * x - 5.64142909048289E+02;\n"
117 " }\n"
118 "}\n"
119 "\n"
120 "vec4 colormap(float x) {\n"
121 " float t = x * 255.0;\n"
122 " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n"
123 " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n"
124 " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n"
125 " return vec4(r, g, b, 1.0);\n"
126 "}\n");
127 }
128 };
129
130 } // namespace IDL
131} // 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