space.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 Space : 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_space.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("space");
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_red(float x) {\n"
58 " if (x < 37067.0 / 158860.0) {\n"
59 " return 0.0;\n"
60 " } else if (x < 85181.0 / 230350.0) {\n"
61 " float xx = x - 37067.0 / 158860.0;\n"
62 " return (780.25 * xx + 319.71) * xx / 255.0;\n"
63 " } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) {\n"
64 " return ((1035.33580904442 * x - 82.5380748768798) * x - "
65 "52.8985266363332) / 255.0;\n"
66 " } else if (x < 231408.0 / 362695.0) {\n"
67 " return (339.41 * x - 33.194) / 255.0;\n"
68 " } else if (x < 152073.0 / 222340.0) {\n"
69 " return (1064.8 * x - 496.01) / 255.0;\n"
70 " } else if (x < 294791.0 / 397780.0) {\n"
71 " return (397.78 * x - 39.791) / 255.0;\n"
72 " } else if (x < 491189.0 / 550980.0) {\n"
73 " return 1.0;\n"
74 " } else if (x < 1.0) {\n"
75 " return (5509.8 * x + 597.91) * x / 255.0;\n"
76 " } else {\n"
77 " return 1.0;\n"
78 " }\n"
79 "}\n"
80 "\n"
81 "float colormap_green(float x) {\n"
82 " float xx;\n"
83 " if (x < 0.0) {\n"
84 " return 0.0;\n"
85 " } else if (x < (-sqrt(166317494.0) + 39104.0) / 183830.0) {\n"
86 " return (-1838.3 * x + 464.36) * x / 255.0;\n"
87 " } else if (x < 37067.0 / 158860.0) {\n"
88 " return (-317.72 * x + 74.134) / 255.0;\n"
89 " } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) {\n"
90 " return 0.0;\n"
91 " } else if (x < 294791.0 / 397780.0) {\n"
92 " xx = x - (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0;\n"
93 " return (-1945.0 * xx + 1430.2) * xx / 255.0;\n"
94 " } else if (x < 491189.0 / 550980.0) {\n"
95 " return ((-1770.0 * x + 3.92813840044638e3) * x - 1.84017494792245e3) "
96 "/ 255.0;\n"
97 " } else {\n"
98 " return 1.0;\n"
99 " }\n"
100 "}\n"
101 "\n"
102 "float colormap_blue(float x) {\n"
103 " if (x < 0.0) {\n"
104 " return 0.0;\n"
105 " } else if (x < 51987.0 / 349730.0) {\n"
106 " return (458.79 * x) / 255.0;\n"
107 " } else if (x < 85181.0 / 230350.0) {\n"
108 " return (109.06 * x + 51.987) / 255.0;\n"
109 " } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) {\n"
110 " return (339.41 * x - 33.194) / 255.0;\n"
111 " } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) {\n"
112 " return ((-1552.4 * x + 1170.7) * x - 92.996) / 255.0;\n"
113 " } else if (x < 27568.0 / 38629.0) {\n"
114 " return 0.0;\n"
115 " } else if (x < 81692.0 / 96241.0) {\n"
116 " return (386.29 * x - 275.68) / 255.0;\n"
117 " } else if (x <= 1.0) {\n"
118 " return (1348.7 * x - 1092.6) / 255.0;\n"
119 " } else {\n"
120 " return 1.0;\n"
121 " }\n"
122 "}\n"
123 "\n"
124 "vec4 colormap(float x) {\n"
125 " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n"
126 "}\n");
127 }
128 };
129
130 } // namespace transform
131} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition space.h:48
std::string getSource() const override
Definition space.h:54
Color getColor(double x) const override
Definition space.h:29
std::string getTitle() const override
Definition space.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