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
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-YIGnBu");
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.2523055374622345) {\n"
59  " return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + "
60  "2.53829637096771E+02;\n"
61  " } else if (x < 0.6267540156841278) {\n"
62  " return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - "
63  "5.30725139102868E+03) * x + 8.58474724851723E+02) * x + "
64  "2.03329669375107E+02;\n"
65  " } else if (x < 0.8763731146612115) {\n"
66  " return 3.28717357910916E+01 * x + 8.82117255504255E+00;\n"
67  " } else {\n"
68  " return -2.29186583577707E+02 * x + 2.38482038123159E+02;\n"
69  " }\n"
70  "}\n"
71  "\n"
72  "float colormap_green(float x) {\n"
73  " if (x < 0.4578040540218353) {\n"
74  " return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + "
75  "2.09812296466262E+01) * x + 2.52987561849833E+02;\n"
76  " } else {\n"
77  " return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + "
78  "1.52699334501816E+03) * x - 6.48190622715140E+01;\n"
79  " }\n"
80  "}\n"
81  "\n"
82  "float colormap_blue(float x) {\n"
83  " if (x < 0.1239372193813324) {\n"
84  " return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + "
85  "2.17553885630496E+02;\n"
86  " } else if (x < 0.7535201013088226) {\n"
87  " return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + "
88  "6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) "
89  "* x + 1.56774650431396E+02;\n"
90  " } else {\n"
91  " return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x "
92  "- 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - "
93  "6.55080846112976E+07) * x + 2.27664953009389E+07) * x - "
94  "3.28811994253461E+06;\n"
95  " }\n"
96  "}\n"
97  "\n"
98  "vec4 colormap(float x) {\n"
99  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
100  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
101  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
102  " return vec4(r, g, b, 1.0);\n"
103  "}\n");
104  }
105  };
106 
107  } // namespace IDL
108 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBYIGnBu::getCategory
std::string getCategory() const override
Definition: CB-YIGnBu.h:48
colormap::Color::g
double g
Definition: colormap.h:14
colormap::IDL::CBYIGnBu
Definition: CB-YIGnBu.h:13
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
colormap::IDL::CBYIGnBu::getSource
std::string getSource() const override
Definition: CB-YIGnBu.h:54
colormap::Colormap::vec4
Definition: colormap.h:33
Color
uint32_t Color
RGBA color.
Definition: color.h:8
colormap::IDL::CBYIGnBu::getTitle
std::string getTitle() const override
Definition: CB-YIGnBu.h:42
colormap::Color::a
double a
Definition: colormap.h:14
colormap::IDL::CBYIGnBu::getColor
Color getColor(double x) const override
Definition: CB-YIGnBu.h:29
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::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:146
min
T min(T t1, T t2)
Definition: gdiam.h:44