CB-Set2.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 CBSet2 : 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-Set2.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-Set2");
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.1417230259672803) {\n"
59 " return 1.05935704125178E+03 * x + 1.01981507823613E+02;\n"
60 " } else if (x < 0.2832918395614404) {\n"
61 " return -7.84521574205797E+02 * x + 3.63301564722620E+02;\n"
62 " } else if (x < 0.4297095252306736) {\n"
63 " return 6.13507692307669E+02 * x - 3.27487179487109E+01;\n"
64 " } else if (x < 0.5711437760817145) {\n"
65 " return -4.56971171171184E+02 * x + 4.27246246246258E+02;\n"
66 " } else if (x < 0.7170125543394245) {\n"
67 " return 6.08443812233345E+02 * x - 1.81258890469442E+02;\n"
68 " } else if (x < 0.8601498726198596) {\n"
69 " return -1.86129554655803E+02 * x + 3.88460188933823E+02;\n"
70 " } else {\n"
71 " return -3.44927731092377E+02 * x + 5.25050420168008E+02;\n"
72 " }\n"
73 "}\n"
74 "\n"
75 "float colormap_green(float x) {\n"
76 " if (x < 0.1415748781045371) {\n"
77 " return -3.73352299668090E+02 * x + 1.93944523470839E+02;\n"
78 " } else if (x < 0.2833646736626308) {\n"
79 " return 1.32720720720722E+02 * x + 1.22297297297298E+02;\n"
80 " } else if (x < 0.4289465541806786) {\n"
81 " return -1.49887515045407E+02 * x + 2.02378487799539E+02;\n"
82 " } else if (x < 0.5702226800496928) {\n"
83 " return 5.49972024656235E+02 * x - 9.78238501659562E+01;\n"
84 " } else if (x < 0.7146023128494844) {\n"
85 " return 8.99797570850851E+00 * x + 2.10651821862350E+02;\n"
86 " } else if (x < 0.8745816247778255) {\n"
87 " return -1.44022832980902E+02 * x + 3.20000845665901E+02;\n"
88 " } else {\n"
89 " return -1.15363546797967E+02 * x + 2.94935960591057E+02;\n"
90 " }\n"
91 "}\n"
92 "\n"
93 "float colormap_blue(float x) {\n"
94 " if (x < 0.1415014758409641) {\n"
95 " return -4.74217638691322E+02 * x + 1.65038406827880E+02;\n"
96 " } else if (x < 0.2835702564175819) {\n"
97 " return 7.39899952584171E+02 * x - 6.76102418207873E+00;\n"
98 " } else if (x < 0.4295821637397355) {\n"
99 " return -5.64243717401478E+01 * x + 2.19052868658126E+02;\n"
100 " } else if (x < 0.5693521153970126) {\n"
101 " return -7.86119327731098E+02 * x + 5.32516806722689E+02;\n"
102 " } else if (x < 0.7156505014449713) {\n"
103 " return -2.61647700331917E+02 * x + 2.33907776197252E+02;\n"
104 " } else if (x < 0.858726752429748) {\n"
105 " return 7.09638034795805E+02 * x - 4.61193347193250E+02;\n"
106 " } else {\n"
107 " return 2.09176470588245E+02 * x - 3.14336134453805E+01;\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
constexpr T c
std::string getCategory() const override
Definition CB-Set2.h:48
std::string getSource() const override
Definition CB-Set2.h:54
Color getColor(double x) const override
Definition CB-Set2.h:29
std::string getTitle() const override
Definition CB-Set2.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