CB-RdYiGn.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 CBRdYiGn : 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-RdYiGn.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-RdYiGn");
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.09825118520770205) {\n"
55  " return 5.07556923076926E+02 * x + 1.64923076923077E+02;\n"
56  " } else if (x < 0.2009111350471108) {\n"
57  " return 2.86362637362647E+02 * x + 1.86655677655676E+02;\n"
58  " } else if (x < 0.2994418666360456) {\n"
59  " return 8.90415982485030E+01 * x + 2.26299671592774E+02;\n"
60  " } else if (x < 0.5001300871372223) {\n"
61  " return 9.81627851140242E+00 * x + 2.50023049219689E+02;\n"
62  " } else if (x < 0.9039205014705658) {\n"
63  " return ((-3.30848798119696E+01 * x - 5.65722561191396E+02) * x + 2.78046782759626E+02) * x + 2.61515979057614E+02;\n"
64  " } else {\n"
65  " return -2.53583846153761E+02 * x + 2.55396153846073E+02;\n"
66  " }\n"
67  "}\n"
68  "\n"
69  "float colormap_green(float x) {\n"
70  " if (x < 0.1105575469849737) {\n"
71  " return 4.79433455433456E+02 * x + 3.65079365079361E-01;\n"
72  " } else if (x < 0.3151890079472769) {\n"
73  " return 6.25896582484846E+02 * x - 1.58275246854709E+01;\n"
74  " } else if (x < 0.4023888287265409) {\n"
75  " return 4.80700000000005E+02 * x + 2.99368421052611E+01;\n"
76  " } else if (x < 0.5007980763912201) {\n"
77  " return 3.22042124542111E+02 * x + 9.37789987790044E+01;\n"
78  " } else if (x < 0.9266376793384552) {\n"
79  " return ((-2.91150627193739E+02 * x + 2.73891595228739E+02) * x - 1.97954551648389E+02) * x + 3.22069054828072E+02;\n"
80  " } else {\n"
81  " return -4.70385384615211E+02 * x + 5.78034615384465E+02;\n"
82  " }\n"
83  "}\n"
84  "\n"
85  "float colormap_blue(float x) {\n"
86  " if (x < 0.1007720845701718) {\n"
87  " return 1.66813186813184E+01 * x + 3.72910052910053E+01;\n"
88  " } else if (x < 0.2891807195246389) {\n"
89  " return 2.86155895159223E+02 * x + 1.01354904806627E+01;\n"
90  " } else if (x < 0.4061884871072265) {\n"
91  " return 4.02182758620675E+02 * x - 2.34172413793071E+01;\n"
92  " } else if (x < 0.5018816861329155) {\n"
93  " return 5.35500000000025E+02 * x - 7.75691699604942E+01;\n"
94  " } else if (x < 0.604070194492165) {\n"
95  " return -5.10170329670400E+02 * x + 4.47233618233660E+02;\n"
96  " } else if (x < 0.7060918916718424) {\n"
97  " return -3.26878215654109E+02 * x + 3.36512315270959E+02;\n"
98  " } else if (x < 0.812819402403008) {\n"
99  " return -6.62557264957455E+01 * x + 1.52488888888906E+02;\n"
100  " } else {\n"
101  " return -2.16444081632622E+02 * x + 2.74564897959153E+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::CBRdYiGn::getColor
Color getColor(double x) const override
Definition: CB-RdYiGn.h:28
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::CBRdYiGn::getCategory
std::string getCategory() const override
Definition: CB-RdYiGn.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::IDL::CBRdYiGn::getSource
std::string getSource() const override
Definition: CB-RdYiGn.h:50
colormap::Color::r
double r
Definition: colormap.h:14
colormap::IDL::CBRdYiGn
Definition: CB-RdYiGn.h:13
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::CBRdYiGn::getTitle
std::string getTitle() const override
Definition: CB-RdYiGn.h:40
min
T min(T t1, T t2)
Definition: gdiam.h:42