CB-Set2.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 CBSet2 : 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-Set2.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-Set2");
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.1417230259672803) {\n"
55  " return 1.05935704125178E+03 * x + 1.01981507823613E+02;\n"
56  " } else if (x < 0.2832918395614404) {\n"
57  " return -7.84521574205797E+02 * x + 3.63301564722620E+02;\n"
58  " } else if (x < 0.4297095252306736) {\n"
59  " return 6.13507692307669E+02 * x - 3.27487179487109E+01;\n"
60  " } else if (x < 0.5711437760817145) {\n"
61  " return -4.56971171171184E+02 * x + 4.27246246246258E+02;\n"
62  " } else if (x < 0.7170125543394245) {\n"
63  " return 6.08443812233345E+02 * x - 1.81258890469442E+02;\n"
64  " } else if (x < 0.8601498726198596) {\n"
65  " return -1.86129554655803E+02 * x + 3.88460188933823E+02;\n"
66  " } else {\n"
67  " return -3.44927731092377E+02 * x + 5.25050420168008E+02;\n"
68  " }\n"
69  "}\n"
70  "\n"
71  "float colormap_green(float x) {\n"
72  " if (x < 0.1415748781045371) {\n"
73  " return -3.73352299668090E+02 * x + 1.93944523470839E+02;\n"
74  " } else if (x < 0.2833646736626308) {\n"
75  " return 1.32720720720722E+02 * x + 1.22297297297298E+02;\n"
76  " } else if (x < 0.4289465541806786) {\n"
77  " return -1.49887515045407E+02 * x + 2.02378487799539E+02;\n"
78  " } else if (x < 0.5702226800496928) {\n"
79  " return 5.49972024656235E+02 * x - 9.78238501659562E+01;\n"
80  " } else if (x < 0.7146023128494844) {\n"
81  " return 8.99797570850851E+00 * x + 2.10651821862350E+02;\n"
82  " } else if (x < 0.8745816247778255) {\n"
83  " return -1.44022832980902E+02 * x + 3.20000845665901E+02;\n"
84  " } else {\n"
85  " return -1.15363546797967E+02 * x + 2.94935960591057E+02;\n"
86  " }\n"
87  "}\n"
88  "\n"
89  "float colormap_blue(float x) {\n"
90  " if (x < 0.1415014758409641) {\n"
91  " return -4.74217638691322E+02 * x + 1.65038406827880E+02;\n"
92  " } else if (x < 0.2835702564175819) {\n"
93  " return 7.39899952584171E+02 * x - 6.76102418207873E+00;\n"
94  " } else if (x < 0.4295821637397355) {\n"
95  " return -5.64243717401478E+01 * x + 2.19052868658126E+02;\n"
96  " } else if (x < 0.5693521153970126) {\n"
97  " return -7.86119327731098E+02 * x + 5.32516806722689E+02;\n"
98  " } else if (x < 0.7156505014449713) {\n"
99  " return -2.61647700331917E+02 * x + 2.33907776197252E+02;\n"
100  " } else if (x < 0.858726752429748) {\n"
101  " return 7.09638034795805E+02 * x - 4.61193347193250E+02;\n"
102  " } else {\n"
103  " return 2.09176470588245E+02 * x - 3.14336134453805E+01;\n"
104  " }\n"
105  "}\n"
106  "\n"
107  "vec4 colormap(float x) {\n"
108  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
109  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
110  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
111  " return vec4(r, g, b, 1.0);\n"
112  "}\n"
113  );
114  }
115  };
116 
117  } // namespace IDL
118 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::Color::g
double g
Definition: colormap.h:14
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::CBSet2::getTitle
std::string getTitle() const override
Definition: CB-Set2.h:40
colormap::IDL::CBSet2::getSource
std::string getSource() const override
Definition: CB-Set2.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::CBSet2::getColor
Color getColor(double x) const override
Definition: CB-Set2.h:28
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::IDL::CBSet2::getCategory
std::string getCategory() const override
Definition: CB-Set2.h:45
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::CBSet2
Definition: CB-Set2.h:13
min
T min(T t1, T t2)
Definition: gdiam.h:42