CB-RdGy.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 CBRdGy : 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-RdGy.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-RdGy");
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_f(float x) {\n"
54  " if (x < 0.8110263645648956) {\n"
55  " return (((4.41347880412638E+03 * x - 1.18250308887283E+04) * x + 1.13092070303101E+04) * x - 4.94879610401395E+03) * x + 1.10376673162241E+03;\n"
56  " } else {\n"
57  " return (4.44045986053970E+02 * x - 1.34196160353499E+03) * x + 9.26518306556645E+02;\n"
58  " }\n"
59  "}\n"
60  "\n"
61  "float colormap_red(float x) {\n"
62  " if (x < 0.09384074807167053) {\n"
63  " return 7.56664615384615E+02 * x + 1.05870769230769E+02;\n"
64  " } else if (x < 0.3011957705020905) {\n"
65  " return (-2.97052932130813E+02 * x + 4.43575866219751E+02) * x + 1.37867123966178E+02;\n"
66  " } else if (x < 0.3963058760920129) {\n"
67  " return 8.61868131868288E+01 * x + 2.18562881562874E+02;\n"
68  " } else if (x < 0.5) {\n"
69  " return 2.19915384615048E+01 * x + 2.44003846153861E+02;\n"
70  " } else {\n"
71  " return colormap_f(x);\n"
72  " }\n"
73  "}\n"
74  "\n"
75  "float colormap_green(float x) {\n"
76  " if (x < 0.09568486400411116) {\n"
77  " return 2.40631111111111E+02 * x + 1.26495726495727E+00;\n"
78  " } else if (x < 0.2945883673263987) {\n"
79  " return 7.00971783488427E+02 * x - 4.27826773670273E+01;\n"
80  " } else if (x < 0.3971604611945229) {\n"
81  " return 5.31775726495706E+02 * x + 7.06051282052287E+00;\n"
82  " } else if (x < 0.5) {\n"
83  " return 3.64925470085438E+02 * x + 7.33268376068493E+01;\n"
84  " } else {\n"
85  " return colormap_f(x);\n"
86  " }\n"
87  "}\n"
88  "\n"
89  "float colormap_blue(float x) {\n"
90  " if (x < 0.09892375498249567) {\n"
91  " return 1.30670329670329E+02 * x + 3.12116402116402E+01;\n"
92  " } else if (x < 0.1985468629735229) {\n"
93  " return 3.33268034188035E+02 * x + 1.11699145299146E+01;\n"
94  " } else if (x < 0.2928770209555256) {\n"
95  " return 5.36891330891336E+02 * x - 2.92588522588527E+01;\n"
96  " } else if (x < 0.4061551302245808) {\n"
97  " return 6.60915763546766E+02 * x - 6.55827586206742E+01;\n"
98  " } else if (x < 0.5) {\n"
99  " return 5.64285714285700E+02 * x - 2.63359683794383E+01;\n"
100  " } else {\n"
101  " return colormap_f(x);\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::CBRdGy::getCategory
std::string getCategory() const override
Definition: CB-RdGy.h:45
colormap::IDL::CBRdGy
Definition: CB-RdGy.h:13
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBRdGy::getSource
std::string getSource() const override
Definition: CB-RdGy.h:50
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::CBRdGy::getColor
Color getColor(double x) const override
Definition: CB-RdGy.h:28
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::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
colormap::IDL::CBRdGy::getTitle
std::string getTitle() const override
Definition: CB-RdGy.h:40