CB-Set1.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 CBSet1 : 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-Set1.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-Set1");
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.1218978105733187) {\n"
55  " return -1.41278189149560E+03 * x + 2.27681818181818E+02;\n"
56  " } else if (x < 0.2479420725675653) {\n"
57  " return 1.71483957219249E+02 * x + 3.45632798573976E+01;\n"
58  " } else if (x < 0.3737958863310976) {\n"
59  " return 5.93826871657766E+02 * x - 7.01532976827142E+01;\n"
60  " } else if (x < 0.5581935583402973) {\n"
61  " return 8.16999193548379E+02 * x - 1.53574193548385E+02;\n"
62  " } else if (x < 0.7521306441106583) {\n"
63  " return -7.03338903743339E+02 * x + 6.95068738859197E+02;\n"
64  " } else if (x < 0.8778625049273406) {\n"
65  " return 6.43286656891390E+02 * x - 3.17769611436878E+02;\n"
66  " } else {\n"
67  " return -7.44200222469495E+02 * x + 9.00253096032687E+02;\n"
68  " }\n"
69  "}\n"
70  "\n"
71  "float colormap_green(float x) {\n"
72  " if (x < 0.1210132014777112) {\n"
73  " return 8.22324999999999E+02 * x + 2.59536290322581E+01;\n"
74  " } else if (x < 0.2482778857828818) {\n"
75  " return 3.90762700534761E+02 * x + 7.81783645276292E+01;\n"
76  " } else if (x < 0.3736981279637023) {\n"
77  " return -7.75174853372465E+02 * x + 3.67654875366580E+02;\n"
78  " } else if (x < 0.5000834495110191) {\n"
79  " return 3.88169354838696E+02 * x - 6.70846774193464E+01;\n"
80  " } else if (x < 0.6259565510341616) {\n"
81  " return 1.01632587976547E+03 * x - 3.81215359237582E+02;\n"
82  " } else if (x < 0.7519260802219788) {\n"
83  " return -1.34046122994658E+03 * x + 1.09403097147954E+03;\n"
84  " } else if (x < 0.8802211108953331) {\n"
85  " return 3.40231932773057E+02 * x - 1.69726050420116E+02;\n"
86  " } else {\n"
87  " return 1.89186206896551E+02 * x - 3.67724137931057E+01;\n"
88  " }\n"
89  "}\n"
90  "\n"
91  "float colormap_blue(float x) {\n"
92  " if (x < 0.1216936022984158) {\n"
93  " return 1.28638709677419E+03 * x + 2.74375000000001E+01;\n"
94  " } else if (x < 0.2481802512682617) {\n"
95  " return -8.68609237536630E+02 * x + 2.89686766862165E+02;\n"
96  " } else if (x < 0.3738953463082063) {\n"
97  " return 7.06041788856318E+02 * x - 1.01110520527863E+02;\n"
98  " } else if (x < 0.499829701274646) {\n"
99  " return -1.29118218475062E+03 * x + 6.45642228738955E+02;\n"
100  " } else if (x < 0.6262008893543518) {\n"
101  " return 3.99252005347605E+02 * x - 1.99286987522289E+02;\n"
102  " } else if (x < 0.752318389825417) {\n"
103  " return -8.38814516128947E+01 * x + 1.03251612903218E+02;\n"
104  " } else if (x < 0.8779851862270176) {\n"
105  " return 1.20109970674463E+03 * x - 8.63463343108315E+02;\n"
106  " } else {\n"
107  " return -3.03613348164648E+02 * x + 4.57652428624434E+02;\n"
108  " }\n"
109  "}\n"
110  "\n"
111  "vec4 colormap(float x) {\n"
112  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
113  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
114  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
115  " return vec4(r, g, b, 1.0);\n"
116  "}\n"
117  );
118  }
119  };
120 
121  } // namespace IDL
122 } // namespace colormap
colormap::IDL::CBSet1
Definition: CB-Set1.h:13
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBSet1::getColor
Color getColor(double x) const override
Definition: CB-Set1.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::CBSet1::getCategory
std::string getCategory() const override
Definition: CB-Set1.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::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::CBSet1::getSource
std::string getSource() const override
Definition: CB-Set1.h:50
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::CBSet1::getTitle
std::string getTitle() const override
Definition: CB-Set1.h:40