CB-Pastel1.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 CBPastel1 : 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-Pastel1.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-Pastel1");
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.122867923365625) {\n"
55  " return -5.81788489736069E+02 * x + 2.50471590909091E+02;\n"
56  " } else if (x < 0.2449046174927113) {\n"
57  " return 1.99984352773830E+02 * x + 1.54416785206258E+02;\n"
58  " } else if (x < 0.3729729104526915) {\n"
59  " return 1.43786086956516E+02 * x + 1.68180000000001E+02;\n"
60  " } else if (x < 0.5011116081610979) {\n"
61  " return 2.52012802275928E+02 * x + 1.27814366998585E+02;\n"
62  " } else if (x < 0.6239282365941264) {\n"
63  " return 7.85450500555661E+00 * x + 2.50164923989616E+02;\n"
64  " } else if (x < 0.7520403577351265) {\n"
65  " return -2.00555718475049E+02 * x + 3.80197947214058E+02;\n"
66  " } else if (x < 0.8796535309192707) {\n"
67  " return 1.86622408963526E+02 * x + 8.90243697479360E+01;\n"
68  " } else {\n"
69  " return -9.30674082313196E+01 * x + 3.35054505005547E+02;\n"
70  " }\n"
71  "}\n"
72  "\n"
73  "float colormap_green(float x) {\n"
74  " if (x < 0.2498801528138394) {\n"
75  " return 2.21725710445469E+02 * x + 1.79002480158730E+02;\n"
76  " } else if (x < 0.3735167574956272) {\n"
77  " return -2.52975806451616E+02 * x + 2.97620967741935E+02;\n"
78  " } else if (x < 0.5007872003710714) {\n"
79  " return 1.09439266615749E+02 * x + 1.62252864782272E+02;\n"
80  " } else if (x < 0.6262274652716027) {\n"
81  " return 3.02956451612894E+02 * x + 6.53419354838611E+01;\n"
82  " } else if (x < 0.752848702686641) {\n"
83  " return -3.10470307917895E+02 * x + 4.49486620234600E+02;\n"
84  " } else if (x < 0.8827503622135592) {\n"
85  " return 2.27675070027963E+01 * x + 1.98608963585427E+02;\n"
86  " } else {\n"
87  " return 1.95678708265011E+02 * x + 4.59715380404256E+01;\n"
88  " }\n"
89  "}\n"
90  "\n"
91  "float colormap_blue(float x) {\n"
92  " if (x < 0.1232989588096424) {\n"
93  " return 4.29695747800585E+02 * x + 1.74153409090909E+02;\n"
94  " } else if (x < 0.2476314320040304) {\n"
95  " return -2.40499266862156E+02 * x + 2.56787756598238E+02;\n"
96  " } else if (x < 0.3742360961829455) {\n"
97  " return 2.41095161290329E+02 * x + 1.37529838709676E+02;\n"
98  " } else if (x < 0.4998594481260504) {\n"
99  " return -4.90936497326148E+02 * x + 4.11482508912633E+02;\n"
100  " } else if (x < 0.6256351261233096) {\n"
101  " return 2.96955882352941E+02 * x + 1.76470588235230E+01;\n"
102  " } else if (x < 0.7525509527474964) {\n"
103  " return -1.11771301446066E+02 * x + 2.73361142009640E+02;\n"
104  " } else if (x < 0.8785969154660433) {\n"
105  " return 3.73063712757765E+02 * x - 9.15019098547990E+01;\n"
106  " } else {\n"
107  " return 4.55448275862047E+01 * x + 1.96255172413811E+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::CBPastel1::getSource
std::string getSource() const override
Definition: CB-Pastel1.h:50
colormap::Colormap
Definition: colormap.h:17
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::CBPastel1::getColor
Color getColor(double x) const override
Definition: CB-Pastel1.h:28
colormap::IDL::CBPastel1
Definition: CB-Pastel1.h:13
colormap::Color::a
double a
Definition: colormap.h:14
colormap::IDL::CBPastel1::getTitle
std::string getTitle() const override
Definition: CB-Pastel1.h:40
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::IDL::CBPastel1::getCategory
std::string getCategory() const override
Definition: CB-Pastel1.h:45
colormap::Colormap::WrapperBase
Definition: colormap.h:144
min
T min(T t1, T t2)
Definition: gdiam.h:42