CB-Spectral.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 CBSpectral : 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-Spectral.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-Spectral");
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.09752005946586478) {\n"
59  " return 5.63203907203907E+02 * x + 1.57952380952381E+02;\n"
60  " } else if (x < 0.2005235116443438) {\n"
61  " return 3.02650769230760E+02 * x + 1.83361538461540E+02;\n"
62  " } else if (x < 0.2974133397506856) {\n"
63  " return 9.21045429665647E+01 * x + 2.25581007115501E+02;\n"
64  " } else if (x < 0.5003919130598823) {\n"
65  " return 9.84288115246108E+00 * x + 2.50046722689075E+02;\n"
66  " } else if (x < 0.5989021956920624) {\n"
67  " return -2.48619704433547E+02 * x + 3.79379310344861E+02;\n"
68  " } else if (x < 0.902860552072525) {\n"
69  " return ((2.76764884219295E+03 * x - 6.08393126459837E+03) * x + "
70  "3.80008072407485E+03) * x - 4.57725185424742E+02;\n"
71  " } else {\n"
72  " return 4.27603478260530E+02 * x - 3.35293188405479E+02;\n"
73  " }\n"
74  "}\n"
75  "\n"
76  "float colormap_green(float x) {\n"
77  " if (x < 0.09785836420571035) {\n"
78  " return 6.23754529914529E+02 * x + 7.26495726495790E-01;\n"
79  " } else if (x < 0.2034012006283468) {\n"
80  " return 4.60453201970444E+02 * x + 1.67068965517242E+01;\n"
81  " } else if (x < 0.302409765476316) {\n"
82  " return 6.61789401709441E+02 * x - 2.42451282051364E+01;\n"
83  " } else if (x < 0.4005965758690823) {\n"
84  " return 4.82379130434784E+02 * x + 3.00102898550747E+01;\n"
85  " } else if (x < 0.4981907026473237) {\n"
86  " return 3.24710622710631E+02 * x + 9.31717541717582E+01;\n"
87  " } else if (x < 0.6064345916502067) {\n"
88  " return -9.64699507389807E+01 * x + 3.03000000000023E+02;\n"
89  " } else if (x < 0.7987472620841592) {\n"
90  " return -2.54022986425337E+02 * x + 3.98545610859729E+02;\n"
91  " } else {\n"
92  " return -5.71281628959223E+02 * x + 6.51955082956207E+02;\n"
93  " }\n"
94  "}\n"
95  "\n"
96  "float colormap_blue(float x) {\n"
97  " if (x < 0.0997359608740309) {\n"
98  " return 1.26522393162393E+02 * x + 6.65042735042735E+01;\n"
99  " } else if (x < 0.1983790695667267) {\n"
100  " return -1.22037851037851E+02 * x + 9.12946682946686E+01;\n"
101  " } else if (x < 0.4997643530368805) {\n"
102  " return (5.39336225400169E+02 * x + 3.55461986381562E+01) * x + "
103  "3.88081126069087E+01;\n"
104  " } else if (x < 0.6025972254407099) {\n"
105  " return -3.79294261294313E+02 * x + 3.80837606837633E+02;\n"
106  " } else if (x < 0.6990141388105746) {\n"
107  " return 1.15990231990252E+02 * x + 8.23805453805459E+01;\n"
108  " } else if (x < 0.8032653181119567) {\n"
109  " return 1.68464957265204E+01 * x + 1.51683418803401E+02;\n"
110  " } else if (x < 0.9035796343050095) {\n"
111  " return 2.40199023199020E+02 * x - 2.77279202279061E+01;\n"
112  " } else {\n"
113  " return -2.78813846153774E+02 * x + 4.41241538461485E+02;\n"
114  " }\n"
115  "}\n"
116  "\n"
117  "vec4 colormap(float x) {\n"
118  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
119  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
120  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
121  " return vec4(r, g, b, 1.0);\n"
122  "}\n");
123  }
124  };
125 
126  } // namespace IDL
127 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBSpectral::getCategory
std::string getCategory() const override
Definition: CB-Spectral.h:48
colormap::IDL::CBSpectral
Definition: CB-Spectral.h:13
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::CBSpectral::getSource
std::string getSource() const override
Definition: CB-Spectral.h:54
Color
uint32_t Color
RGBA color.
Definition: color.h:8
colormap::IDL::CBSpectral::getColor
Color getColor(double x) const override
Definition: CB-Spectral.h:29
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:51
colormap::Color
Definition: colormap.h:12
colormap::IDL::CBSpectral::getTitle
std::string getTitle() const override
Definition: CB-Spectral.h:42
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