CB-Pastel2.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 CBPastel2 : 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_CB-Pastel2.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("CB-Pastel2");
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 < 0.1414470427532423) {\n"
55  " return 5.23716927453769E+02 * x + 1.79102418207681E+02;\n"
56  " } else if (x < 0.2832126252873305) {\n"
57  " return -3.55011583011593E+02 * x + 3.03395967395968E+02;\n"
58  " } else if (x < 0.4293789173286286) {\n"
59  " return 2.81737389211071E+02 * x + 1.23060619323778E+02;\n"
60  " } else if (x < 0.5703484841123749) {\n"
61  " return -9.85406162465110E+01 * x + 2.86343977591045E+02;\n"
62  " } else if (x < 0.7170614267751989) {\n"
63  " return 1.69092460881909E+02 * x + 1.33699857752520E+02;\n"
64  " } else if (x < 0.859829619768543) {\n"
65  " return -9.94710581026121E+01 * x + 3.26276397855329E+02;\n"
66  " } else {\n"
67  " return -2.57056149732620E+02 * x + 4.61772727272750E+02;\n"
68  " }\n"
69  "}\n"
70  "\n"
71  "float colormap_green(float x) {\n"
72  " if (x < 0.1411063922737659) {\n"
73  " return -1.49220483641537E+02 * x + 2.26007112375533E+02;\n"
74  " } else if (x < 0.2816283290590322) {\n"
75  " return 5.77629343629288E+01 * x + 1.96800429000430E+02;\n"
76  " } else if (x < 0.4291887492428612) {\n"
77  " return -7.38876244665610E+01 * x + 2.33876955903267E+02;\n"
78  " } else if (x < 0.571830104540257) {\n"
79  " return 3.01873399715509E+02 * x + 7.26045519203479E+01;\n"
80  " } else if (x < 0.7190262682310248) {\n"
81  " return -2.25206477732972E+01 * x + 2.58102834008109E+02;\n"
82  " } else if (x < 0.8491803538380496) {\n"
83  " return -1.16468292682893E+02 * x + 3.25653658536549E+02;\n"
84  " } else {\n"
85  " return -1.44447728516695E+02 * x + 3.49413245758086E+02;\n"
86  " }\n"
87  "}\n"
88  "\n"
89  "float colormap_blue(float x) {\n"
90  " if (x < 0.1425168965591466) {\n"
91  " return -2.26903238866400E+02 * x + 2.04742307692308E+02;\n"
92  " } else if (x < 0.2851292529683606) {\n"
93  " return 4.18120091673021E+02 * x + 1.12815584415585E+02;\n"
94  " } else if (x < 0.4319360871262316) {\n"
95  " return -3.09335813546247E+01 * x + 2.40853922748656E+02;\n"
96  " } else if (x < 0.7146533590447866) {\n"
97  " return -1.88956299440485E+02 * x + 3.09109637275714E+02;\n"
98  " } else if (x < 0.8619542566532371) {\n"
99  " return 2.06196082722327E+02 * x + 2.67126600285119E+01;\n"
100  " } else {\n"
101  " return -6.48097784562050E+00 * x + 2.10030557677552E+02;\n"
102  " }\n"
103  "}\n"
104  "\n"
105  "vec4 colormap(float x) {\n"
106  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
107  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
108  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
109  " return vec4(r, g, b, 1.0);\n"
110  "}\n"
111  );
112  }
113  };
114 
115  } // namespace IDL
116 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBPastel2::getColor
Color getColor(double x) const override
Definition: CB-Pastel2.h:28
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::CBPastel2::getCategory
std::string getCategory() const override
Definition: CB-Pastel2.h:45
colormap::IDL::CBPastel2::getSource
std::string getSource() const override
Definition: CB-Pastel2.h:50
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::IDL::CBPastel2
Definition: CB-Pastel2.h:13
colormap
This file was automatically created with "create_c++_header.sh".
Definition: colormap.h:9
colormap::IDL::CBPastel2::getTitle
std::string getTitle() const override
Definition: CB-Pastel2.h:40
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
min
T min(T t1, T t2)
Definition: gdiam.h:42