CB-Set1.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 CBSet1 : 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-Set1.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-Set1");
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.1218978105733187) {\n"
59 " return -1.41278189149560E+03 * x + 2.27681818181818E+02;\n"
60 " } else if (x < 0.2479420725675653) {\n"
61 " return 1.71483957219249E+02 * x + 3.45632798573976E+01;\n"
62 " } else if (x < 0.3737958863310976) {\n"
63 " return 5.93826871657766E+02 * x - 7.01532976827142E+01;\n"
64 " } else if (x < 0.5581935583402973) {\n"
65 " return 8.16999193548379E+02 * x - 1.53574193548385E+02;\n"
66 " } else if (x < 0.7521306441106583) {\n"
67 " return -7.03338903743339E+02 * x + 6.95068738859197E+02;\n"
68 " } else if (x < 0.8778625049273406) {\n"
69 " return 6.43286656891390E+02 * x - 3.17769611436878E+02;\n"
70 " } else {\n"
71 " return -7.44200222469495E+02 * x + 9.00253096032687E+02;\n"
72 " }\n"
73 "}\n"
74 "\n"
75 "float colormap_green(float x) {\n"
76 " if (x < 0.1210132014777112) {\n"
77 " return 8.22324999999999E+02 * x + 2.59536290322581E+01;\n"
78 " } else if (x < 0.2482778857828818) {\n"
79 " return 3.90762700534761E+02 * x + 7.81783645276292E+01;\n"
80 " } else if (x < 0.3736981279637023) {\n"
81 " return -7.75174853372465E+02 * x + 3.67654875366580E+02;\n"
82 " } else if (x < 0.5000834495110191) {\n"
83 " return 3.88169354838696E+02 * x - 6.70846774193464E+01;\n"
84 " } else if (x < 0.6259565510341616) {\n"
85 " return 1.01632587976547E+03 * x - 3.81215359237582E+02;\n"
86 " } else if (x < 0.7519260802219788) {\n"
87 " return -1.34046122994658E+03 * x + 1.09403097147954E+03;\n"
88 " } else if (x < 0.8802211108953331) {\n"
89 " return 3.40231932773057E+02 * x - 1.69726050420116E+02;\n"
90 " } else {\n"
91 " return 1.89186206896551E+02 * x - 3.67724137931057E+01;\n"
92 " }\n"
93 "}\n"
94 "\n"
95 "float colormap_blue(float x) {\n"
96 " if (x < 0.1216936022984158) {\n"
97 " return 1.28638709677419E+03 * x + 2.74375000000001E+01;\n"
98 " } else if (x < 0.2481802512682617) {\n"
99 " return -8.68609237536630E+02 * x + 2.89686766862165E+02;\n"
100 " } else if (x < 0.3738953463082063) {\n"
101 " return 7.06041788856318E+02 * x - 1.01110520527863E+02;\n"
102 " } else if (x < 0.499829701274646) {\n"
103 " return -1.29118218475062E+03 * x + 6.45642228738955E+02;\n"
104 " } else if (x < 0.6262008893543518) {\n"
105 " return 3.99252005347605E+02 * x - 1.99286987522289E+02;\n"
106 " } else if (x < 0.752318389825417) {\n"
107 " return -8.38814516128947E+01 * x + 1.03251612903218E+02;\n"
108 " } else if (x < 0.8779851862270176) {\n"
109 " return 1.20109970674463E+03 * x - 8.63463343108315E+02;\n"
110 " } else {\n"
111 " return -3.03613348164648E+02 * x + 4.57652428624434E+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-Set1.h:48
std::string getSource() const override
Definition CB-Set1.h:54
Color getColor(double x) const override
Definition CB-Set1.h:29
std::string getTitle() const override
Definition CB-Set1.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