ether.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 transform
11 {
12
13 class Ether : 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/transform_ether.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("ether");
45 }
46
47 std::string
48 getCategory() const override
49 {
50 return std::string("transform");
51 }
52
53 std::string
54 getSource() const override
55 {
56 return std::string(
57 "float colormap_f(float x, float b) {\n"
58 " float x2 = x * x;\n"
59 " return ((-1.89814e5 * x2 + 1.50967e4) * x2 + b) / 255.0;\n"
60 "}\n"
61 "\n"
62 "float colormap_f2(float x, float b) {\n"
63 " float x2 = x * x;\n"
64 " return ((1.88330e5 * x2 - 1.50839e4) * x2 + b) / 255.0;\n"
65 "}\n"
66 "\n"
67 "float colormap_blue(float x) {\n"
68 " if (x < 0.0e0) {\n"
69 " return 246.0 / 255.0;\n"
70 " } else if (x < 0.25) {\n"
71 " return colormap_f(x - 32.0 / 256.0, 65.0);\n"
72 " } else if (x < 130.0 / 256.0) {\n"
73 " return colormap_f2(x - 97.0 / 256.0, 190.0);\n"
74 " } else if (x < 193.0 / 256.0) {\n"
75 " return colormap_f(x - 161.0 / 256.0, 65.0);\n"
76 " } else if (x < 1.0) {\n"
77 " return colormap_f2(x - 226.0 / 256.0, 190.0);\n"
78 " } else {\n"
79 " return 18.0 / 255.0;\n"
80 " }\n"
81 "}\n"
82 "\n"
83 "float colormap_green(float x) {\n"
84 " if (x < 0.0) {\n"
85 " return 0.0;\n"
86 " } else if (x < 0.20615790927912) {\n"
87 " return ((((-3.81619e4 * x - 2.94574e3) * x + 2.61347e3) * x - "
88 "7.92183e1) * x) / 255.0;\n"
89 " } else if (x < 0.54757171958025) {\n"
90 " return (((((2.65271e5 * x - 4.14808e5) * x + 2.26118e5) * x - "
91 "5.16491e4) * x + 5.06893e3) * x - 1.80630e2) / 255.0;\n"
92 " } else if (x < 0.71235558668792) {\n"
93 " return ((((1.77058e5 * x - 4.62571e5) * x + 4.39628e5) * x - "
94 "1.80143e5) * x + 2.68555e4) / 255.0;\n"
95 " } else if (x < 1.0) {\n"
96 " float xx = ((((1.70556e5 * x - 6.20429e5) * x + 8.28331e5) * x - "
97 "4.80913e5) * x + 1.02608e5);\n"
98 " if (xx > 255.0) {\n"
99 " return (510.0 - xx) / 255.0;\n"
100 " } else {\n"
101 " return xx / 255.0;\n"
102 " }\n"
103 " } else {\n"
104 " return 154.0 / 255.0;\n"
105 " }\n"
106 "}\n"
107 "\n"
108 "float colormap_red(float x) {\n"
109 " if (x < 0.0) {\n"
110 " return 2.0 / 255.0;\n"
111 " } else if (x < 1.0) {\n"
112 " float xx = 2.83088e2 * x + 8.17847e-1;\n"
113 " if (xx > 255.0) {\n"
114 " return (510.0 - xx) / 255.0;\n"
115 " } else {\n"
116 " return xx / 255.0;\n"
117 " }\n"
118 " } else {\n"
119 " return 226.0 / 255.0;\n"
120 " }\n"
121 "}\n"
122 "\n"
123 "vec4 colormap(float x) {\n"
124 " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n"
125 "}\n");
126 }
127 };
128
129 } // namespace transform
130} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition ether.h:48
std::string getSource() const override
Definition ether.h:54
Color getColor(double x) const override
Definition ether.h:29
std::string getTitle() const override
Definition ether.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