CB-RdBu.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 CBRdBu : 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-RdBu.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-RdBu");
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.09771832105856419) {\n"
59  " return 7.60263247863246E+02 * x + 1.02931623931624E+02;\n"
60  " } else if (x < 0.3017162107441106) {\n"
61  " return (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + "
62  "1.37642085716717E+02;\n"
63  " } else if (x < 0.4014205790737471) {\n"
64  " return 8.67103448276151E+01 * x + 2.18034482758611E+02;\n"
65  " } else if (x < 0.5019932233215039) {\n"
66  " return -6.15461538461498E+01 * x + 2.77547692307680E+02;\n"
67  " } else if (x < 0.5969483882550937) {\n"
68  " return -3.77588522588624E+02 * x + 4.36198819698878E+02;\n"
69  " } else if (x < 0.8046060096654594) {\n"
70  " return (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + "
71  "3.17674951640855E+02;\n"
72  " } else {\n"
73  " return -3.08431855203590E+02 * x + 3.12956742081421E+02;\n"
74  " }\n"
75  "}\n"
76  "\n"
77  "float colormap_green(float x) {\n"
78  " if (x < 0.09881640500975222) {\n"
79  " return 2.41408547008547E+02 * x + 3.50427350427364E-01;\n"
80  " } else if (x < 0.5000816285610199) {\n"
81  " return ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + "
82  "1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) "
83  "* x - 4.82944517518776E+01;\n"
84  " } else if (x < 0.8922355473041534) {\n"
85  " return (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + "
86  "1.45172137257997E+04) * x - 5.80944127411621E+03) * x + "
87  "1.12477959061948E+03;\n"
88  " } else {\n"
89  " return -5.28313797313699E+02 * x + 5.78459299959206E+02;\n"
90  " }\n"
91  "}\n"
92  "\n"
93  "float colormap_blue(float x) {\n"
94  " if (x < 0.1033699568661857) {\n"
95  " return 1.30256410256410E+02 * x + 3.08518518518519E+01;\n"
96  " } else if (x < 0.2037526071071625) {\n"
97  " return 3.38458128078815E+02 * x + 9.33004926108412E+00;\n"
98  " } else if (x < 0.2973267734050751) {\n"
99  " return (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - "
100  "3.81852747252658E+01;\n"
101  " } else if (x < 0.4029109179973602) {\n"
102  " return 6.68959706959723E+02 * x - 7.00740740740798E+01;\n"
103  " } else if (x < 0.5006715489526758) {\n"
104  " return 4.87348695652202E+02 * x + 3.09898550724286E+00;\n"
105  " } else if (x < 0.6004396902588283) {\n"
106  " return -6.85799999999829E+01 * x + 2.81436666666663E+02;\n"
107  " } else if (x < 0.702576607465744) {\n"
108  " return -1.81331701891043E+02 * x + 3.49137263626287E+02;\n"
109  " } else if (x < 0.9010407030582428) {\n"
110  " return (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + "
111  "5.26198653917172E+02;\n"
112  " } else {\n"
113  " return -7.36990769230737E+02 * x + 8.36652307692262E+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::IDL::CBRdBu::getCategory
std::string getCategory() const override
Definition: CB-RdBu.h:48
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBRdBu::getTitle
std::string getTitle() const override
Definition: CB-RdBu.h:42
colormap::Color::g
double g
Definition: colormap.h:14
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
colormap::IDL::CBRdBu::getSource
std::string getSource() const override
Definition: CB-RdBu.h:54
colormap::Colormap::vec4
Definition: colormap.h:33
colormap::IDL::CBRdBu::getColor
Color getColor(double x) const override
Definition: CB-RdBu.h:29
Color
uint32_t Color
RGBA color.
Definition: color.h:8
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::IDL::CBRdBu
Definition: CB-RdBu.h:13
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