CB-Dark2.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 CBDark2 : 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-Dark2.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-Dark2");
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.1420141309011431) {\n"
55  " return 1.34039497392129E+03 * x + 2.69843527738265E+01; // R1\n"
56  " } else if (x < 0.2832372296870317) {\n"
57  " return -7.10676962676977E+02 * x + 3.18265551265554E+02; // R2\n"
58  " } else if (x < 0.4289458478001075) {\n"
59  " return 7.81992413466075E+02 * x - 1.04513987671874E+02; // R3\n"
60  " } else if (x < 0.5708308530153928) {\n"
61  " return -9.08417760617793E+02 * x + 6.20580437580458E+02; // R4\n"
62  " } else if (x < 0.7161145088911144) {\n"
63  " return 8.78642484589930E+02 * x - 3.99528686581363E+02; // R5\n"
64  " } else {\n"
65  " return -4.46088623062543E+02 * x + 5.49130479987969E+02; // R6\n"
66  " }\n"
67  "}\n"
68  "\n"
69  "float colormap_green(float x) {\n"
70  " if (x < 0.1423373623518399) {\n"
71  " return -4.42075062917170E+02 * x + 1.57882591093117E+02;\n"
72  " } else if (x < 0.2834256193936661) {\n"
73  " return 1.20312044817928E+02 * x + 7.78338935574229E+01;\n"
74  " } else if (x < 0.4289129211292926) {\n"
75  " return -4.87706495969635E+02 * x + 2.50161925082971E+02;\n"
76  " } else if (x < 0.5707509745277107) {\n"
77  " return 8.81285199485221E+02 * x - 3.37016302016313E+02;\n"
78  " } else if (x < 0.7167318372796874) {\n"
79  " return 3.38425794215443E+01 * x + 1.46662399241347E+02;\n"
80  " } else if (x < 0.8574321486576632) {\n"
81  " return -3.74788931788816E+02 * x + 4.39541613041524E+02;\n"
82  " } else {\n"
83  " return -1.11864607464601E+02 * x + 2.14101844701848E+02;\n"
84  " }\n"
85  "}\n"
86  "\n"
87  "float colormap_blue(float x) {\n"
88  " if (x < 0.1416506418642016) {\n"
89  " return -8.25590327169275E+02 * x + 1.19073968705548E+02;\n"
90  " } else if (x < 0.283798849411819) {\n"
91  " return 1.24433848133849E+03 * x - 1.74132775632779E+02;\n"
92  " } else if (x < 0.4285299211147395) {\n"
93  " return -2.82844476054998E+02 * x + 2.59279990516832E+02;\n"
94  " } else if (x < 0.5700066234111405) {\n"
95  " return -7.58992535392565E+02 * x + 4.63323680823696E+02;\n"
96  " } else if (x < 0.7144281197454347) {\n"
97  " return -1.96085154061629E+02 * x + 1.42462745098042E+02;\n"
98  " } else if (x < 0.8576876140758521) {\n"
99  " return 1.84489769121314E+02 * x - 1.29430681693811E+02;\n"
100  " } else {\n"
101  " return 4.99467953667967E+02 * x - 3.99583569283573E+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::IDL::CBDark2
Definition: CB-Dark2.h:13
colormap::IDL::CBDark2::getColor
Color getColor(double x) const override
Definition: CB-Dark2.h:28
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBDark2::getCategory
std::string getCategory() const override
Definition: CB-Dark2.h:45
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
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::IDL::CBDark2::getTitle
std::string getTitle() const override
Definition: CB-Dark2.h:40
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::CBDark2::getSource
std::string getSource() const override
Definition: CB-Dark2.h:50
min
T min(T t1, T t2)
Definition: gdiam.h:42