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 
8 namespace colormap
9 {
10  namespace IDL
11  {
12 
13  class StandardGammaII : 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_Standard_Gamma-II.frag"
24 #undef float
25  };
26 
27  public:
28  Color getColor(double x) const override
29  {
30  Wrapper w;
31  vec4 c = w.colormap(x);
32  Color result;
33  result.r = std::max(0.0, std::min(1.0, c.r));
34  result.g = std::max(0.0, std::min(1.0, c.g));
35  result.b = std::max(0.0, std::min(1.0, c.b));
36  result.a = std::max(0.0, std::min(1.0, c.a));
37  return result;
38  }
39 
40  std::string getTitle() const override
41  {
42  return std::string("Standard_Gamma-II");
43  }
44 
45  std::string getCategory() const override
46  {
47  return std::string("IDL");
48  }
49 
50  std::string getSource() const override
51  {
52  return std::string(
53  "float colormap_red(float x) {\n"
54  " if (x < (8.75333333333333E+01 + 2.19676470588235E+02) / (4.76470588235294E+00 + 1.00000000000000E-01)) { // 63.1507456671\n"
55  " return 4.76470588235294E+00 * x - 2.19676470588235E+02;\n"
56  " } else if (x < (8.75333333333333E+01 + 3.11000000000000E+02) / (5.00000000000000E+00 + 1.00000000000000E-01)) { // 78.1437908497\n"
57  " return -1.00000000000000E-01 * x + 8.75333333333333E+01;\n"
58  " } else if (x < (-3.11000000000000E+02 + 3.42345454545455E+02) / (5.32727272727273E+00 - 5.00000000000000E+00)) { // 95.7777777778\n"
59  " return 5.00000000000000E+00 * x - 3.11000000000000E+02;\n"
60  " } else if (x < (255.0 + 3.42345454545455E+02) / 5.32727272727273E+00) { // 112.129692833\n"
61  " return 5.32727272727273E+00 * x - 3.42345454545455E+02;\n"
62  " } else if (x < (1.49279020979021E+03 - 255.0) / 7.68531468531468E+00) { // 161.059144677\n"
63  " return 255.0;\n"
64  " } else if (x < (1.49279020979021E+03 + 7.19657722738218E+02) / (5.10010319917441E+00 + 7.68531468531468E+00)) { // 173.04463198\n"
65  " return -7.68531468531468E+00 * x + 1.49279020979021E+03;\n"
66  " } else if (x < (255.0 + 7.19657722738218E+02) / 5.10010319917441E+00) { // 191.105490355\n"
67  " return 5.10010319917441E+00 * x - 7.19657722738218E+02;\n"
68  " } else {\n"
69  " return 255.0;\n"
70  " }\n"
71  "}\n"
72  "\n"
73  "float colormap_green(float x) {\n"
74  " if (x < (163.0 + 5.65896810850440E+02) / 5.07239736070381E+00) { // 143.69868112\n"
75  " return 5.07239736070381E+00 * x - 5.65896810850440E+02;\n"
76  " } else if (x < (163.0 + 9.06153846153846E+02) / 6.10769230769231E+00) { // 175.050377834\n"
77  " return 163.0;\n"
78  " } else {\n"
79  " return 6.10769230769231E+00 * x - 9.06153846153846E+02;\n"
80  " }\n"
81  "}\n"
82  "\n"
83  "float colormap_blue(float x) {\n"
84  " if (x < (5.16164662349676E+02 - 4.77795918367347E+00) / (5.20142857142857E+00 + 5.42900092506938E+00)) { // 48.1059305585\n"
85  " return 5.20142857142857E+00 * x + 4.77795918367347E+00;\n"
86  " } else if (x < 5.16164662349676E+02 / 5.42900092506938E+00) { // 95.0754419595\n"
87  " return -5.42900092506938E+00 * x + 5.16164662349676E+02;\n"
88  " } else if (x < 6.16058823529412E+02 / 4.84558823529412E+00) { // 127.138088012\n"
89  " return 0.0;\n"
90  " } else if (x < (9.31184615384615E+02 + 6.16058823529412E+02) / (4.84558823529412E+00 + 5.89230769230769E+00)) { // 144.091863932\n"
91  " return 4.84558823529412E+00 * x - 6.16058823529412E+02;\n"
92  " } else if (x < 9.31184615384615E+02 / 5.89230769230769E+00) { // 158.033942559\n"
93  " return -5.89230769230769E+00 * x + 9.31184615384615E+02;\n"
94  " } else if (x < 5.64142909048289E+02 / 3.22177684013127E+00) { // 175.103036939\n"
95  " return 0.0;\n"
96  " } else {\n"
97  " return 3.22177684013127E+00 * x - 5.64142909048289E+02;\n"
98  " }\n"
99  "}\n"
100  "\n"
101  "vec4 colormap(float x) {\n"
102  " float t = x * 255.0;\n"
103  " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n"
104  " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n"
105  " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n"
106  " return vec4(r, g, b, 1.0);\n"
107  "}\n"
108  );
109  }
110  };
111 
112  } // namespace IDL
113 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::StandardGammaII
Definition: Standard_Gamma-II.h:13
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::StandardGammaII::getColor
Color getColor(double x) const override
Definition: Standard_Gamma-II.h:28
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::StandardGammaII::getCategory
std::string getCategory() const override
Definition: Standard_Gamma-II.h:45
colormap::Color::a
double a
Definition: colormap.h:14
colormap::Color::b
double b
Definition: colormap.h:14
max
T max(T t1, T t2)
Definition: gdiam.h:48
colormap::Color
Definition: colormap.h:12
colormap
This file was automatically created with "create_c++_header.sh".
Definition: colormap.h:9
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::StandardGammaII::getSource
std::string getSource() const override
Definition: Standard_Gamma-II.h:50
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::StandardGammaII::getTitle
std::string getTitle() const override
Definition: Standard_Gamma-II.h:40