Blue-Pastel-Red.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 BluePastelRed : 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_Blue-Pastel-Red.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("Blue-Pastel-Red");
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.1131206452846527) {\n"
59 " return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + "
60 "3.28713709677420E+01;\n"
61 " } else if (x < 0.5116005837917328) {\n"
62 " return 0.0;\n"
63 " } else if (x < 0.5705677568912506) {\n"
64 " return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - "
65 "8.29909138655453E+02;\n"
66 " } else if (x < 0.622047244) {\n"
67 " return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - "
68 "7.12389120879120E+03;\n"
69 " } else if (x < 0.7922459542751312) {\n"
70 " return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + "
71 "6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) "
72 "* x - 2.35682532934682E+05;\n"
73 " } else {\n"
74 " return 3.34889230769210E+02 * x - 1.41006123680226E+02;\n"
75 " }\n"
76 "}\n"
77 "\n"
78 "float colormap_green(float x) {\n"
79 " if (x < 0.114394336938858) {\n"
80 " return 0.0;\n"
81 " } else if (x < 0.4417250454425812) {\n"
82 " return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - "
83 "3.37113020096108E+01;\n"
84 " } else if (x < 0.4964917968308496) {\n"
85 " return 3.11150000000070E+02 * x + 9.54249999999731E+01;\n"
86 " } else if (x < 0.6259051214039278) {\n"
87 " return -1.03272635599706E+03 * x + 7.62648586707481E+02;\n"
88 " } else if (x < 0.8049814403057098) {\n"
89 " return -2.92799028677160E+02 * x + 2.99524283071235E+02;\n"
90 " } else {\n"
91 " return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + "
92 "1.40880802982723E+03;\n"
93 " }\n"
94 "}\n"
95 "\n"
96 "float colormap_blue(float x) {\n"
97 " if (x < 0.4424893036638088) {\n"
98 " return 3.09636968527514E+02 * x + 9.62203074056821E+01;\n"
99 " } else if (x < 0.5) {\n"
100 " return -4.59921428571535E+02 * x + 4.36741666666678E+02;\n"
101 " } else if (x < 0.5691165986930345) {\n"
102 " return -1.81364912280674E+03 * x + 1.05392982456125E+03;\n"
103 " } else if (x < 0.6279306709766388) {\n"
104 " return 1.83776470588197E+02 * x - 8.28382352940910E+01;\n"
105 " } else {\n"
106 " return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - "
107 "1.80428756181930E+04) * x + 4.44421976986281E+03;\n"
108 " }\n"
109 "}\n"
110 "\n"
111 "vec4 colormap(float x) {\n"
112 " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
113 " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
114 " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
115 " return vec4(r, g, b, 1.0);\n"
116 "}\n");
117 }
118 };
119
120 } // namespace IDL
121} // namespace colormap
constexpr T c
std::string getCategory() const override
std::string getSource() const override
Color getColor(double x) const override
std::string getTitle() const override
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