carnation.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 Carnation : 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_carnation.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("carnation");
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) {\n"
58 " return ((-9.93427e0 * x + 1.56301e1) * x + 2.44663e2 * x) / 255.0;\n"
59 "}\n"
60 "\n"
61 "float colormap_blue(float x) {\n"
62 " if (x < 0.0) {\n"
63 " return 11.0 / 255.0;\n"
64 " } else if (x < 0.16531216481302) {\n"
65 " return (((-1635.0 * x) + 1789.0) * x + 3.938) / 255.0;\n"
66 " } else if (x < 0.50663669203696) {\n"
67 " return 1.0;\n"
68 " } else if (x < 0.67502056695956) {\n"
69 " return ((((1.28932e3 * x) - 7.74147e2) * x - 9.47634e2) * x + "
70 "7.65071e2) / 255.0;\n"
71 " } else if (x < 1.0) {\n"
72 " return colormap_f(x);\n"
73 " } else {\n"
74 " return 251.0 / 255.0;\n"
75 " }\n"
76 "}\n"
77 "\n"
78 "float colormap_green(float x) {\n"
79 " if (x < 0.0) {\n"
80 " return 0.0;\n"
81 " } else if (x < 0.33807590140751) {\n"
82 " return colormap_f(x);\n"
83 " } else if (x < 0.50663669203696) {\n"
84 " return (((-5.83014e2 * x - 8.38523e2) * x + 2.03823e3) * x - "
85 "4.86592e2) / 255.0;\n"
86 " } else if (x < 0.84702285244773) {\n"
87 " return 1.0;\n"
88 " } else if (x < 1.0) {\n"
89 " return (((-5.03306e2 * x + 2.95545e3) * x - 4.19210e3) * x + "
90 "1.99128e3) / 255.0;\n"
91 " } else {\n"
92 " return 251.0 / 255.0;\n"
93 " }\n"
94 "}\n"
95 "\n"
96 "float colormap_red(float x) {\n"
97 " if (x < 0.16531216481302) {\n"
98 " return 1.0;\n"
99 " } else if (x < 0.33807590140751) {\n"
100 " return (((-5.15164e3 * x + 5.30564e3) * x - 2.65098e3) * x + "
101 "5.70771e2) / 255.0;\n"
102 " } else if (x < 0.67502056695956) {\n"
103 " return colormap_f(x);\n"
104 " } else if (x < 0.84702285244773) {\n"
105 " return (((3.34136e3 * x - 9.01976e3) * x + 8.39740e3) * x - "
106 "2.41682e3) / 255.0;\n"
107 " } else {\n"
108 " return 1.0;\n"
109 " }\n"
110 "}\n"
111 "\n"
112 "vec4 colormap(float x) {\n"
113 " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n"
114 "}\n");
115 }
116 };
117
118 } // namespace transform
119} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition carnation.h:48
std::string getSource() const override
Definition carnation.h:54
Color getColor(double x) const override
Definition carnation.h:29
std::string getTitle() const override
Definition carnation.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