Blue-Pastel-Red.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 BluePastelRed : 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_Blue-Pastel-Red.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("Blue-Pastel-Red");
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.1131206452846527) {\n"
55  " return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + 3.28713709677420E+01;\n"
56  " } else if (x < 0.5116005837917328) {\n"
57  " return 0.0;\n"
58  " } else if (x < 0.5705677568912506) {\n"
59  " return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - 8.29909138655453E+02;\n"
60  " } else if (x < 0.622047244) {\n"
61  " return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - 7.12389120879120E+03;\n"
62  " } else if (x < 0.7922459542751312) {\n"
63  " return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + 6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) * x - 2.35682532934682E+05;\n"
64  " } else {\n"
65  " return 3.34889230769210E+02 * x - 1.41006123680226E+02;\n"
66  " }\n"
67  "}\n"
68  "\n"
69  "float colormap_green(float x) {\n"
70  " if (x < 0.114394336938858) {\n"
71  " return 0.0;\n"
72  " } else if (x < 0.4417250454425812) {\n"
73  " return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - 3.37113020096108E+01;\n"
74  " } else if (x < 0.4964917968308496) {\n"
75  " return 3.11150000000070E+02 * x + 9.54249999999731E+01;\n"
76  " } else if (x < 0.6259051214039278) {\n"
77  " return -1.03272635599706E+03 * x + 7.62648586707481E+02;\n"
78  " } else if (x < 0.8049814403057098) {\n"
79  " return -2.92799028677160E+02 * x + 2.99524283071235E+02;\n"
80  " } else {\n"
81  " return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + 1.40880802982723E+03;\n"
82  " }\n"
83  "}\n"
84  "\n"
85  "float colormap_blue(float x) {\n"
86  " if (x < 0.4424893036638088) {\n"
87  " return 3.09636968527514E+02 * x + 9.62203074056821E+01;\n"
88  " } else if (x < 0.5) {\n"
89  " return -4.59921428571535E+02 * x + 4.36741666666678E+02;\n"
90  " } else if (x < 0.5691165986930345) {\n"
91  " return -1.81364912280674E+03 * x + 1.05392982456125E+03;\n"
92  " } else if (x < 0.6279306709766388) {\n"
93  " return 1.83776470588197E+02 * x - 8.28382352940910E+01;\n"
94  " } else {\n"
95  " return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - 1.80428756181930E+04) * x + 4.44421976986281E+03;\n"
96  " }\n"
97  "}\n"
98  "\n"
99  "vec4 colormap(float x) {\n"
100  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
101  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
102  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
103  " return vec4(r, g, b, 1.0);\n"
104  "}\n"
105  );
106  }
107  };
108 
109  } // namespace IDL
110 } // namespace colormap
colormap::IDL::BluePastelRed::getTitle
std::string getTitle() const override
Definition: Blue-Pastel-Red.h:40
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::Color::a
double a
Definition: colormap.h:14
colormap::IDL::BluePastelRed
Definition: Blue-Pastel-Red.h:13
colormap::IDL::BluePastelRed::getSource
std::string getSource() const override
Definition: Blue-Pastel-Red.h:50
colormap::Color::b
double b
Definition: colormap.h:14
max
T max(T t1, T t2)
Definition: gdiam.h:48
colormap::IDL::BluePastelRed::getColor
Color getColor(double x) const override
Definition: Blue-Pastel-Red.h:28
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
colormap::IDL::BluePastelRed::getCategory
std::string getCategory() const override
Definition: Blue-Pastel-Red.h:45
min
T min(T t1, T t2)
Definition: gdiam.h:42