CB-Pastel1.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 CBPastel1 : 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-Pastel1.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-Pastel1");
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.122867923365625) {\n"
59 " return -5.81788489736069E+02 * x + 2.50471590909091E+02;\n"
60 " } else if (x < 0.2449046174927113) {\n"
61 " return 1.99984352773830E+02 * x + 1.54416785206258E+02;\n"
62 " } else if (x < 0.3729729104526915) {\n"
63 " return 1.43786086956516E+02 * x + 1.68180000000001E+02;\n"
64 " } else if (x < 0.5011116081610979) {\n"
65 " return 2.52012802275928E+02 * x + 1.27814366998585E+02;\n"
66 " } else if (x < 0.6239282365941264) {\n"
67 " return 7.85450500555661E+00 * x + 2.50164923989616E+02;\n"
68 " } else if (x < 0.7520403577351265) {\n"
69 " return -2.00555718475049E+02 * x + 3.80197947214058E+02;\n"
70 " } else if (x < 0.8796535309192707) {\n"
71 " return 1.86622408963526E+02 * x + 8.90243697479360E+01;\n"
72 " } else {\n"
73 " return -9.30674082313196E+01 * x + 3.35054505005547E+02;\n"
74 " }\n"
75 "}\n"
76 "\n"
77 "float colormap_green(float x) {\n"
78 " if (x < 0.2498801528138394) {\n"
79 " return 2.21725710445469E+02 * x + 1.79002480158730E+02;\n"
80 " } else if (x < 0.3735167574956272) {\n"
81 " return -2.52975806451616E+02 * x + 2.97620967741935E+02;\n"
82 " } else if (x < 0.5007872003710714) {\n"
83 " return 1.09439266615749E+02 * x + 1.62252864782272E+02;\n"
84 " } else if (x < 0.6262274652716027) {\n"
85 " return 3.02956451612894E+02 * x + 6.53419354838611E+01;\n"
86 " } else if (x < 0.752848702686641) {\n"
87 " return -3.10470307917895E+02 * x + 4.49486620234600E+02;\n"
88 " } else if (x < 0.8827503622135592) {\n"
89 " return 2.27675070027963E+01 * x + 1.98608963585427E+02;\n"
90 " } else {\n"
91 " return 1.95678708265011E+02 * x + 4.59715380404256E+01;\n"
92 " }\n"
93 "}\n"
94 "\n"
95 "float colormap_blue(float x) {\n"
96 " if (x < 0.1232989588096424) {\n"
97 " return 4.29695747800585E+02 * x + 1.74153409090909E+02;\n"
98 " } else if (x < 0.2476314320040304) {\n"
99 " return -2.40499266862156E+02 * x + 2.56787756598238E+02;\n"
100 " } else if (x < 0.3742360961829455) {\n"
101 " return 2.41095161290329E+02 * x + 1.37529838709676E+02;\n"
102 " } else if (x < 0.4998594481260504) {\n"
103 " return -4.90936497326148E+02 * x + 4.11482508912633E+02;\n"
104 " } else if (x < 0.6256351261233096) {\n"
105 " return 2.96955882352941E+02 * x + 1.76470588235230E+01;\n"
106 " } else if (x < 0.7525509527474964) {\n"
107 " return -1.11771301446066E+02 * x + 2.73361142009640E+02;\n"
108 " } else if (x < 0.8785969154660433) {\n"
109 " return 3.73063712757765E+02 * x - 9.15019098547990E+01;\n"
110 " } else {\n"
111 " return 4.55448275862047E+01 * x + 1.96255172413811E+02;\n"
112 " }\n"
113 "}\n"
114 "\n"
115 "vec4 colormap(float x) {\n"
116 " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
117 " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
118 " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
119 " return vec4(r, g, b, 1.0);\n"
120 "}\n");
121 }
122 };
123
124 } // namespace IDL
125} // namespace colormap
constexpr T c
std::string getCategory() const override
Definition CB-Pastel1.h:48
std::string getSource() const override
Definition CB-Pastel1.h:54
Color getColor(double x) const override
Definition CB-Pastel1.h:29
std::string getTitle() const override
Definition CB-Pastel1.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