CB-RdYiBu.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 CBRdYiBu : 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-RdYiBu.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-RdYiBu");
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.09790863520700754) {\n"
59  " return 5.14512820512820E+02 * x + 1.64641025641026E+02;\n"
60  " } else if (x < 0.2001887081633112) {\n"
61  " return 2.83195402298854E+02 * x + 1.87288998357964E+02;\n"
62  " } else if (x < 0.3190117539655621) {\n"
63  " return 9.27301587301214E+01 * x + 2.25417989417999E+02;\n"
64  " } else if (x < 0.500517389125164) {\n"
65  " return 255.0;\n"
66  " } else if (x < 0.6068377196788788) {\n"
67  " return -3.04674876847379E+02 * x + 4.07495073891681E+02;\n"
68  " } else if (x < 0.9017468988895416) {\n"
69  " return (1.55336390191951E+02 * x - 7.56394659038288E+02) * x + "
70  "6.24412733169483E+02;\n"
71  " } else {\n"
72  " return -1.88350769230735E+02 * x + 2.38492307692292E+02;\n"
73  " }\n"
74  "}\n"
75  "\n"
76  "float colormap_green(float x) {\n"
77  " if (x < 0.09638568758964539) {\n"
78  " return 4.81427692307692E+02 * x + 4.61538461538488E-01;\n"
79  " } else if (x < 0.4987066686153412) {\n"
80  " return ((((3.25545903568267E+04 * x - 4.24067109461319E+04) * x + "
81  "1.83751375886345E+04) * x - 3.19145329617892E+03) * x + 8.08315127034676E+02) "
82  "* x - 1.44611527812961E+01;\n"
83  " } else if (x < 0.6047312345537269) {\n"
84  " return -1.18449917898218E+02 * x + 3.14234811165860E+02;\n"
85  " } else if (x < 0.7067635953426361) {\n"
86  " return -2.70822112753102E+02 * x + 4.06379036672115E+02;\n"
87  " } else {\n"
88  " return (-4.62308723214883E+02 * x + 2.42936159122279E+02) * x + "
89  "2.74203431802418E+02;\n"
90  " }\n"
91  "}\n"
92  "\n"
93  "float colormap_blue(float x) {\n"
94  " if (x < 0.09982818011951204) {\n"
95  " return 1.64123076923076E+01 * x + 3.72646153846154E+01;\n"
96  " } else if (x < 0.2958717460833126) {\n"
97  " return 2.87014675052409E+02 * x + 1.02508735150248E+01;\n"
98  " } else if (x < 0.4900527540014758) {\n"
99  " return 4.65475113122167E+02 * x - 4.25505279034673E+01;\n"
100  " } else if (x < 0.6017014681258838) {\n"
101  " return 5.61032967032998E+02 * x - 8.93789173789407E+01;\n"
102  " } else if (x < 0.7015737100463595) {\n"
103  " return -1.51655677655728E+02 * x + 3.39446886446912E+02;\n"
104  " } else if (x < 0.8237156500567735) {\n"
105  " return -2.43405347593559E+02 * x + 4.03816042780725E+02;\n"
106  " } else {\n"
107  " return -3.00296889157305E+02 * x + 4.50678495922638E+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  } // namespace IDL
121 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::Color::g
double g
Definition: colormap.h:14
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
colormap::Colormap::vec4
Definition: colormap.h:33
colormap::IDL::CBRdYiBu::getColor
Color getColor(double x) const override
Definition: CB-RdYiBu.h:29
colormap::IDL::CBRdYiBu::getCategory
std::string getCategory() const override
Definition: CB-RdYiBu.h:48
Color
uint32_t Color
RGBA color.
Definition: color.h:8
colormap::Color::a
double a
Definition: colormap.h:14
colormap::IDL::CBRdYiBu
Definition: CB-RdYiBu.h:13
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::IDL::CBRdYiBu::getTitle
std::string getTitle() const override
Definition: CB-RdYiBu.h:42
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
colormap::IDL::CBRdYiBu::getSource
std::string getSource() const override
Definition: CB-RdYiBu.h:54