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
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("CB-Dark2");
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 < 0.1420141309011431) {\n"
59  " return 1.34039497392129E+03 * x + 2.69843527738265E+01; // R1\n"
60  " } else if (x < 0.2832372296870317) {\n"
61  " return -7.10676962676977E+02 * x + 3.18265551265554E+02; // R2\n"
62  " } else if (x < 0.4289458478001075) {\n"
63  " return 7.81992413466075E+02 * x - 1.04513987671874E+02; // R3\n"
64  " } else if (x < 0.5708308530153928) {\n"
65  " return -9.08417760617793E+02 * x + 6.20580437580458E+02; // R4\n"
66  " } else if (x < 0.7161145088911144) {\n"
67  " return 8.78642484589930E+02 * x - 3.99528686581363E+02; // R5\n"
68  " } else {\n"
69  " return -4.46088623062543E+02 * x + 5.49130479987969E+02; // R6\n"
70  " }\n"
71  "}\n"
72  "\n"
73  "float colormap_green(float x) {\n"
74  " if (x < 0.1423373623518399) {\n"
75  " return -4.42075062917170E+02 * x + 1.57882591093117E+02;\n"
76  " } else if (x < 0.2834256193936661) {\n"
77  " return 1.20312044817928E+02 * x + 7.78338935574229E+01;\n"
78  " } else if (x < 0.4289129211292926) {\n"
79  " return -4.87706495969635E+02 * x + 2.50161925082971E+02;\n"
80  " } else if (x < 0.5707509745277107) {\n"
81  " return 8.81285199485221E+02 * x - 3.37016302016313E+02;\n"
82  " } else if (x < 0.7167318372796874) {\n"
83  " return 3.38425794215443E+01 * x + 1.46662399241347E+02;\n"
84  " } else if (x < 0.8574321486576632) {\n"
85  " return -3.74788931788816E+02 * x + 4.39541613041524E+02;\n"
86  " } else {\n"
87  " return -1.11864607464601E+02 * x + 2.14101844701848E+02;\n"
88  " }\n"
89  "}\n"
90  "\n"
91  "float colormap_blue(float x) {\n"
92  " if (x < 0.1416506418642016) {\n"
93  " return -8.25590327169275E+02 * x + 1.19073968705548E+02;\n"
94  " } else if (x < 0.283798849411819) {\n"
95  " return 1.24433848133849E+03 * x - 1.74132775632779E+02;\n"
96  " } else if (x < 0.4285299211147395) {\n"
97  " return -2.82844476054998E+02 * x + 2.59279990516832E+02;\n"
98  " } else if (x < 0.5700066234111405) {\n"
99  " return -7.58992535392565E+02 * x + 4.63323680823696E+02;\n"
100  " } else if (x < 0.7144281197454347) {\n"
101  " return -1.96085154061629E+02 * x + 1.42462745098042E+02;\n"
102  " } else if (x < 0.8576876140758521) {\n"
103  " return 1.84489769121314E+02 * x - 1.29430681693811E+02;\n"
104  " } else {\n"
105  " return 4.99467953667967E+02 * x - 3.99583569283573E+02;\n"
106  " }\n"
107  "}\n"
108  "\n"
109  "vec4 colormap(float x) {\n"
110  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
111  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
112  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
113  " return vec4(r, g, b, 1.0);\n"
114  "}\n");
115  }
116  };
117 
118  } // namespace IDL
119 } // 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:29
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBDark2::getCategory
std::string getCategory() const override
Definition: CB-Dark2.h:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
colormap::Colormap::vec4
Definition: colormap.h:33
Color
uint32_t Color
RGBA color.
Definition: color.h:8
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:51
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:42
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:146
colormap::IDL::CBDark2::getSource
std::string getSource() const override
Definition: CB-Dark2.h:54
min
T min(T t1, T t2)
Definition: gdiam.h:44