CB-YIGnBu.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 CBYIGnBu : 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-YIGnBu.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-YIGnBu");
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.2523055374622345) {\n"
55  " return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + 2.53829637096771E+02;\n"
56  " } else if (x < 0.6267540156841278) {\n"
57  " return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - 5.30725139102868E+03) * x + 8.58474724851723E+02) * x + 2.03329669375107E+02;\n"
58  " } else if (x < 0.8763731146612115) {\n"
59  " return 3.28717357910916E+01 * x + 8.82117255504255E+00;\n"
60  " } else {\n"
61  " return -2.29186583577707E+02 * x + 2.38482038123159E+02;\n"
62  " }\n"
63  "}\n"
64  "\n"
65  "float colormap_green(float x) {\n"
66  " if (x < 0.4578040540218353) {\n"
67  " return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + 2.09812296466262E+01) * x + 2.52987561849833E+02;\n"
68  " } else {\n"
69  " return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + 1.52699334501816E+03) * x - 6.48190622715140E+01;\n"
70  " }\n"
71  "}\n"
72  "\n"
73  "float colormap_blue(float x) {\n"
74  " if (x < 0.1239372193813324) {\n"
75  " return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + 2.17553885630496E+02;\n"
76  " } else if (x < 0.7535201013088226) {\n"
77  " return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + 6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) * x + 1.56774650431396E+02;\n"
78  " } else {\n"
79  " return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x - 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - 6.55080846112976E+07) * x + 2.27664953009389E+07) * x - 3.28811994253461E+06;\n"
80  " }\n"
81  "}\n"
82  "\n"
83  "vec4 colormap(float x) {\n"
84  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
85  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
86  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
87  " return vec4(r, g, b, 1.0);\n"
88  "}\n"
89  );
90  }
91  };
92 
93  } // namespace IDL
94 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBYIGnBu::getCategory
std::string getCategory() const override
Definition: CB-YIGnBu.h:45
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBYIGnBu
Definition: CB-YIGnBu.h:13
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::IDL::CBYIGnBu::getSource
std::string getSource() const override
Definition: CB-YIGnBu.h:50
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::CBYIGnBu::getTitle
std::string getTitle() const override
Definition: CB-YIGnBu.h:40
colormap::Color::a
double a
Definition: colormap.h:14
colormap::IDL::CBYIGnBu::getColor
Color getColor(double x) const override
Definition: CB-YIGnBu.h:28
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