Mac_Style.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 MacStyle : 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_Mac_Style.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("Mac_Style");
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("float colormap_h(float x) {\n"
57 " return -7.44992704834645E-01 * x + 7.47986634976377E-01;\n"
58 "}\n"
59 "\n"
60 "float colormap_s(float x) {\n"
61 " return 1.0;\n"
62 "}\n"
63 "\n"
64 "float colormap_v(float x) {\n"
65 " float i = mod(mod(x * 256.0, 2.0) + 2.0, 2.0);\n"
66 " if (0.0 <= i && i < 1.0) {\n"
67 " return 1.0;\n"
68 " } else {\n"
69 " return 254.0 / 255.0;\n"
70 " }\n"
71 "}\n"
72 "\n"
73 "vec4 colormap_hsv2rgb(float h, float s, float v) {\n"
74 " float r = v;\n"
75 " float g = v;\n"
76 " float b = v;\n"
77 " if (s > 0.0) {\n"
78 " h *= 6.0;\n"
79 " int i = int(h);\n"
80 " float f = h - float(i);\n"
81 " if (i == 1) {\n"
82 " r *= 1.0 - s * f;\n"
83 " b *= 1.0 - s;\n"
84 " } else if (i == 2) {\n"
85 " r *= 1.0 - s;\n"
86 " b *= 1.0 - s * (1.0 - f);\n"
87 " } else if (i == 3) {\n"
88 " r *= 1.0 - s;\n"
89 " g *= 1.0 - s * f;\n"
90 " } else if (i == 4) {\n"
91 " r *= 1.0 - s * (1.0 - f);\n"
92 " g *= 1.0 - s;\n"
93 " } else if (i == 5) {\n"
94 " g *= 1.0 - s;\n"
95 " b *= 1.0 - s * f;\n"
96 " } else {\n"
97 " g *= 1.0 - s * (1.0 - f);\n"
98 " b *= 1.0 - s;\n"
99 " }\n"
100 " }\n"
101 " return vec4(r, g, b, 1.0);\n"
102 "}\n"
103 "\n"
104 "vec4 colormap(float x) {\n"
105 " float h = colormap_h(clamp(x, 0.0, 1.0));\n"
106 " float s = colormap_s(clamp(x, 0.0, 1.0));\n"
107 " float v = colormap_v(clamp(x, 0.0, 1.0));\n"
108 " return colormap_hsv2rgb(h, s, v);\n"
109 "}\n");
110 }
111 };
112
113 } // namespace IDL
114} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition Mac_Style.h:48
std::string getSource() const override
Definition Mac_Style.h:54
Color getColor(double x) const override
Definition Mac_Style.h:29
std::string getTitle() const override
Definition Mac_Style.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