CB-RdGy.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
8namespace colormap
9{
10 namespace IDL
11 {
12
13 class CBRdGy : 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-RdGy.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-RdGy");
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_f(float x) {\n"
58 " if (x < 0.8110263645648956) {\n"
59 " return (((4.41347880412638E+03 * x - 1.18250308887283E+04) * x + "
60 "1.13092070303101E+04) * x - 4.94879610401395E+03) * x + "
61 "1.10376673162241E+03;\n"
62 " } else {\n"
63 " return (4.44045986053970E+02 * x - 1.34196160353499E+03) * x + "
64 "9.26518306556645E+02;\n"
65 " }\n"
66 "}\n"
67 "\n"
68 "float colormap_red(float x) {\n"
69 " if (x < 0.09384074807167053) {\n"
70 " return 7.56664615384615E+02 * x + 1.05870769230769E+02;\n"
71 " } else if (x < 0.3011957705020905) {\n"
72 " return (-2.97052932130813E+02 * x + 4.43575866219751E+02) * x + "
73 "1.37867123966178E+02;\n"
74 " } else if (x < 0.3963058760920129) {\n"
75 " return 8.61868131868288E+01 * x + 2.18562881562874E+02;\n"
76 " } else if (x < 0.5) {\n"
77 " return 2.19915384615048E+01 * x + 2.44003846153861E+02;\n"
78 " } else {\n"
79 " return colormap_f(x);\n"
80 " }\n"
81 "}\n"
82 "\n"
83 "float colormap_green(float x) {\n"
84 " if (x < 0.09568486400411116) {\n"
85 " return 2.40631111111111E+02 * x + 1.26495726495727E+00;\n"
86 " } else if (x < 0.2945883673263987) {\n"
87 " return 7.00971783488427E+02 * x - 4.27826773670273E+01;\n"
88 " } else if (x < 0.3971604611945229) {\n"
89 " return 5.31775726495706E+02 * x + 7.06051282052287E+00;\n"
90 " } else if (x < 0.5) {\n"
91 " return 3.64925470085438E+02 * x + 7.33268376068493E+01;\n"
92 " } else {\n"
93 " return colormap_f(x);\n"
94 " }\n"
95 "}\n"
96 "\n"
97 "float colormap_blue(float x) {\n"
98 " if (x < 0.09892375498249567) {\n"
99 " return 1.30670329670329E+02 * x + 3.12116402116402E+01;\n"
100 " } else if (x < 0.1985468629735229) {\n"
101 " return 3.33268034188035E+02 * x + 1.11699145299146E+01;\n"
102 " } else if (x < 0.2928770209555256) {\n"
103 " return 5.36891330891336E+02 * x - 2.92588522588527E+01;\n"
104 " } else if (x < 0.4061551302245808) {\n"
105 " return 6.60915763546766E+02 * x - 6.55827586206742E+01;\n"
106 " } else if (x < 0.5) {\n"
107 " return 5.64285714285700E+02 * x - 2.63359683794383E+01;\n"
108 " } else {\n"
109 " return colormap_f(x);\n"
110 " }\n"
111 "}\n"
112 "\n"
113 "vec4 colormap(float x) {\n"
114 " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
115 " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
116 " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
117 " return vec4(r, g, b, 1.0);\n"
118 "}\n");
119 }
120 };
121
122 } // namespace IDL
123} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition CB-RdGy.h:48
std::string getSource() const override
Definition CB-RdGy.h:54
Color getColor(double x) const override
Definition CB-RdGy.h:29
std::string getTitle() const override
Definition CB-RdGy.h:42
uint32_t Color
RGBA color.
Definition color.h:8
This file offers overloads of toIce() and fromIce() functions for STL container types.
This file was automatically created with "create_c++_header.sh".
Definition colormap.h:10