diff --git a/colormap-shaders/.gitignore b/colormap-shaders/.gitignore new file mode 100644 index 0000000..bed0bd2 --- /dev/null +++ b/colormap-shaders/.gitignore @@ -0,0 +1,5 @@ +/Makefile +/CmakeFiles +/cmake_install.cmake +/CMakeCache.txt +/build diff --git a/colormap-shaders/.gitmodules b/colormap-shaders/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/colormap-shaders/LICENSE b/colormap-shaders/LICENSE new file mode 100644 index 0000000..2dae58d --- /dev/null +++ b/colormap-shaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 kbinani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/colormap-shaders/README.md b/colormap-shaders/README.md new file mode 100644 index 0000000..27ffe6f --- /dev/null +++ b/colormap-shaders/README.md @@ -0,0 +1,208 @@ +# colormap-shaders + +A collection of shaders to draw color map like this: + +![rainbow](sample/transform_rainbow.png). + +# usage + +Each `*.frag` shader sources provides a `colormap` function, which takes an `float` argument `x` (`x` should be: `0.0 <= x <= 1.0`). The `colormap` function returns a `vec4` value which represents an RGBA color. + +``` +vec4 colormap(float x); + +void main() { + gl_FragColor = colormap(gl_TexCoord[0].x); +} + +/* include "shaders/rainbow.frag" here, for example. */ +``` + +## special case + +### gnuplot.frag + +This shader emulates `gnuplot`'s `rgbformulae`, and the signature of `colormap` is: +``` +vec4 colormap(float x, int red_type, int green_type, int blue_type); +``` + +It takes additional 3 arguments, with same meanings to `rgbformulae`'s 3 arguments respectively. + +# usage from c++ + +```c++ +#include +#include + +int main() +{ + using namespace colormap; + + // Print RGB table of MATLAB::Jet colormap. + MATLAB::Jet jet; + std::cout << "category: " << jet.getCategory() << std::endl; + std::cout << "title: " << jet.getTitle() << std::endl; + int const size = 256; + for (int i = 0; i < size; ++i) { + float const x = i / (float)size; + Color c = jet.getColor(x); + std::cout << x << "\t" << c.r << "\t" << c.g << "\t" << c.b << std::endl; + } + + // Dump category and title of all colormaps. + for (std::shared_ptr const& c : ColormapList::getAll()) { + std::cout << c->getCategory() << " : " << c->getTitle() << std::endl; + } + return 0; +} +``` + +# samples + +## MATLAB + +* http://www.mathworks.com/products/matlab/ + +|name |sample | +|--------------|-----------------------------| +|MATLAB\_autumn|![](sample/MATLAB_autumn.png)| +|MATLAB\_bone |![](sample/MATLAB_bone.png) | +|MATLAB\_cool |![](sample/MATLAB_cool.png) | +|MATLAB\_copper|![](sample/MATLAB_copper.png)| +|MATLAB\_hot |![](sample/MATLAB_hot.png) | +|MATLAB\_hsv |![](sample/MATLAB_hsv.png) | +|MATLAB\_jet |![](sample/MATLAB_jet.png) | +|MATLAB\_parula|![](sample/MATLAB_parula.png)| +|MATLAB\_pink |![](sample/MATLAB_pink.png) | +|MATLAB\_spring|![](sample/MATLAB_spring.png)| +|MATLAB\_summer|![](sample/MATLAB_summer.png)| +|MATLAB\_winter|![](sample/MATLAB_winter.png)| + +## gnuplot + +* http://www.gnuplot.info/ + +|name |sample | +|-----------------------|--------------------------------| +|rgbformulae(7, 5, 15) |![](sample/gnuplot_7_5_15.png) | +|rgbformulae(3, 11, 6) |![](sample/gnuplot_3_11_6.png) | +|rgbformulae(23, 28, 3) |![](sample/gnuplot_23_28_3.png) | +|rgbformulae(21, 22, 23)|![](sample/gnuplot_21_22_23.png)| +|rgbformulae(30, 31, 32)|![](sample/gnuplot_30_31_32.png)| +|rgbformulae(33, 13, 10)|![](sample/gnuplot_33_13_10.png)| +|rgbformulae(34, 35, 36)|![](sample/gnuplot_34_35_36.png)| + +## IDL + +* http://www.exelisvis.com/ProductsServices/IDL.aspx + +|name |sample | +|-----------------------------|-------------------------------------------| +|IDL\_Black-White\_Linear |![](sample/IDL_Black-White_Linear.png) | +|IDL\_Blue-White\_Linear |![](sample/IDL_Blue-White_Linear.png) | +|IDL\_Green\-Red\-Blue\-White |![](sample/IDL_Green-Red-Blue-White.png) | +|IDL\_Red\_Temperature |![](sample/IDL_Red_Temperature.png) | +|IDL\_Blue-Green-Red-Yellow |![](sample/IDL_Blue-Green-Red-Yellow.png) | +|IDL\_Standard\_Gamma-II |![](sample/IDL_Standard_Gamma-II.png) | +|IDL\_Prism |![](sample/IDL_Prism.png) | +|IDL\_Red-Purple |![](sample/IDL_Red-Purple.png) | +|IDL\_Green-White\_Linear |![](sample/IDL_Green-White_Linear.png) | +|IDL\_Green-White\_Exponential|![](sample/IDL_Green-White_Exponential.png)| +|IDL\_Green-Pink |![](sample/IDL_Green-Pink.png) | +|IDL\_Blue-Red |![](sample/IDL_Blue-Red.png) | +|IDL\_16\_Level |![](sample/IDL_16_Level.png) | +|IDL\_Rainbow |![](sample/IDL_Rainbow.png) | +|IDL\_Steps |![](sample/IDL_Steps.png) | +|IDL\_Stern\_Special |![](sample/IDL_Stern_Special.png) | +|IDL\_Haze |![](sample/IDL_Haze.png) | +|IDL\_Blue\-Pastel\-Red |![](sample/IDL_Blue-Pastel-Red.png) | +|IDL\_Pastels |![](sample/IDL_Pastels.png) | +|IDL\_Hue\_Sat\_Lightness\_1 |![](sample/IDL_Hue_Sat_Lightness_1.png) | +|IDL\_Hue\_Sat\_Lightness\_2 |![](sample/IDL_Hue_Sat_Lightness_2.png) | +|IDL\_Hue\_Sat\_Value\_1 |![](sample/IDL_Hue_Sat_Value_1.png) | +|IDL\_Hue\_Sat\_Value\_2 |![](sample/IDL_Hue_Sat_Value_2.png) | +|IDL\_Purple\-Red\+Stripes |![](sample/IDL_Purple-Red+Stripes.png) | +|IDL\_Beach |![](sample/IDL_Beach.png) | +|IDL\_Mac\_Style |![](sample/IDL_Mac_Style.png) | +|IDL\_Eos\_A |![](sample/IDL_Eos_A.png) | +|IDL\_Eos\_B |![](sample/IDL_Eos_B.png) | +|IDL\_Hardcandy |![](sample/IDL_Hardcandy.png) | +|IDL\_Nature |![](sample/IDL_Nature.png) | +|IDL\_Ocean |![](sample/IDL_Ocean.png) | +|IDL\_Peppermint |![](sample/IDL_Peppermint.png) | +|IDL\_Plasma |![](sample/IDL_Plasma.png) | +|IDL\_Blue-Red\_2 |![](sample/IDL_Blue-Red_2.png) | +|IDL\_Rainbow\_2 |![](sample/IDL_Rainbow_2.png) | +|IDL\_Blue\_Waves |![](sample/IDL_Blue_Waves.png) | +|IDL\_Volcano |![](sample/IDL_Volcano.png) | +|IDL\_Waves |![](sample/IDL_Waves.png) | +|IDL\_Rainbow\_18 |![](sample/IDL_Rainbow_18.png) | +|IDL\_Rainbow\+White |![](sample/IDL_Rainbow+White.png) | +|IDL\_Rainbow\+Black |![](sample/IDL_Rainbow+Black.png) | +|IDL\_CB\-Accent |![](sample/IDL_CB-Accent.png) | +|IDL\_CB\-Dark2 |![](sample/IDL_CB-Dark2.png) | +|IDL\_CB\-Paired |![](sample/IDL_CB-Paired.png) | +|IDL\_CB\-Pastel1 |![](sample/IDL_CB-Pastel1.png) | +|IDL\_CB\-Pastel2 |![](sample/IDL_CB-Pastel2.png) | +|IDL\_CB\-Set1 |![](sample/IDL_CB-Set1.png) | +|IDL\_CB\-Set2 |![](sample/IDL_CB-Set2.png) | +|IDL\_CB\-Set3 |![](sample/IDL_CB-Set3.png) | +|IDL\_CB\-Blues |![](sample/IDL_CB-Blues.png) | +|IDL\_CB\-BuGn |![](sample/IDL_CB-BuGn.png) | +|IDL\_CB\-BuPu |![](sample/IDL_CB-BuPu.png) | +|IDL\_CB\-GnBu |![](sample/IDL_CB-GnBu.png) | +|IDL\_CB\-Greens |![](sample/IDL_CB-Greens.png) | +|IDL\_CB\-Greys |![](sample/IDL_CB-Greys.png) | +|IDL\_CB\-Oranges |![](sample/IDL_CB-Oranges.png) | +|IDL\_CB\-OrRd |![](sample/IDL_CB-OrRd.png) | +|IDL\_CB\-PuBu |![](sample/IDL_CB-PuBu.png) | +|IDL\_CB\-PuBuGn |![](sample/IDL_CB-PuBuGn.png) | +|IDL\_CB\-PuRdn |![](sample/IDL_CB-PuRd.png) | +|IDL\_CB\-Purples |![](sample/IDL_CB-Purples.png) | +|IDL\_CB\-RdPu |![](sample/IDL_CB-RdPu.png) | +|IDL\_CB\-Reds |![](sample/IDL_CB-Reds.png) | +|IDL\_CB\-YIGn |![](sample/IDL_CB-YIGn.png) | +|IDL\_CB\-YIGnBu |![](sample/IDL_CB-YIGnBu.png) | +|IDL\_CB\-YIOrBr |![](sample/IDL_CB-YIOrBr.png) | +|IDL\_CB\-BrBG |![](sample/IDL_CB-BrBG.png) | +|IDL\_CB\-PiYG |![](sample/IDL_CB-PiYG.png) | +|IDL\_CB\-PRGn |![](sample/IDL_CB-PRGn.png) | +|IDL\_CB\-PuOr |![](sample/IDL_CB-PuOr.png) | +|IDL\_CB\-RdBu |![](sample/IDL_CB-RdBu.png) | +|IDL\_CB\-RdGy |![](sample/IDL_CB-RdGy.png) | +|IDL\_CB\-RdYiBu |![](sample/IDL_CB-RdYiBu.png) | +|IDL\_CB\-RdYiGn |![](sample/IDL_CB-RdYiGn.png) | +|IDL\_CB\-Spectral |![](sample/IDL_CB-Spectral.png) | + +## transform + +* http://web.archive.org/web/20000520021207/http://www.fortner.com/docs/product_transform.html + +|name |sample | +|--------------------------|---------------------------------------| +|transform\_rainbow |![](sample/transform_rainbow.png) | +|transform\_apricot |![](sample/transform_apricot.png) | +|transform\_carnation |![](sample/transform_carnation.png) | +|transform\_ether |![](sample/transform_ether.png) | +|transform\_grayscale\_banded |![](sample/transform_grayscale_banded.png) | +|transform\_hot\_metal |![](sample/transform_hot_metal.png) | +|transform\_lava\_waves |![](sample/transform_lava_waves.png) | +|transform\_malachite |![](sample/transform_malachite.png) | +|transform\_seismic |![](sample/transform_seismic.png) | +|transform\_space |![](sample/transform_space.png) | +|transform\_morning\_glory |![](sample/transform_morning_glory.png) | +|transform\_peanut\_butter\_and\_jerry|![](sample/transform_peanut_butter_and_jerry.png)| +|transform\_purple\_haze |![](sample/transform_purple_haze.png) | +|transform\_rose |![](sample/transform_rose.png) | +|transform\_saturn |![](sample/transform_saturn.png) | +|transform\_supernova |![](sample/transform_supernova.png) | + +## kbinani +|name |sample | +|-----------------|--------------------------------| +|kbinani\_altitude|![](sample/kbinani_altitude.png)| + +# license + +The MIT License. See 'LICENSE' file for detail. diff --git a/colormap-shaders/include/colormap/colormap.h b/colormap-shaders/include/colormap/colormap.h new file mode 100644 index 0000000..a6f8871 --- /dev/null +++ b/colormap-shaders/include/colormap/colormap.h @@ -0,0 +1,194 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +namespace colormap +{ + +struct Color +{ + double r, g, b, a; +}; + +class Colormap +{ +public: + virtual ~Colormap() + {} + + virtual Color getColor(double x) const = 0; + + virtual std::string getTitle() const = 0; + + virtual std::string getCategory() const = 0; + + virtual std::string getSource() const = 0; + +protected: + struct vec4 + { + vec4(double a0, double a1, double a2, double a3) + : x(a0) + , y(a1) + , z(a2) + , w(a3) + { + } + + double operator[](size_t index) const + { + assert(index < 4); + if (index < 2) { + if (index < 1) { + return x; + } else { + return y; + } + } else { + if (index < 3) { + return z; + } else { + return w; + } + } + } + + double& operator[](size_t index) + { + assert(index < 4); + if (index < 2) { + if (index < 1) { + return x; + } else { + return y; + } + } else { + if (index < 3) { + return z; + } else { + return w; + } + } + } + + bool operator==(vec4 const& o) const + { + return x == o.x && y == o.y && z == o.z && w == o.w; + } + + vec4 operator*(double v) const + { + return vec4(r * v, g * v, b * v, a * v); + } + + vec4 operator+(vec4 const& v) const + { + return vec4(r + v.r, g + v.g, b + v.b, a + v.a); + } + + std::string to_string() const + { + return + std::string("{") + + std::to_string(x) + std::string(",") + + std::to_string(y) + std::string(",") + + std::to_string(z) + std::string(",") + + std::to_string(w) + + std::string("}"); + } + + union { + double r; + double x; + }; + union { + double g; + double y; + }; + union { + double b; + double z; + }; + union { + double a; + double w; + }; + }; + + class WrapperBase + { + public: + virtual ~WrapperBase() + {} + + protected: + using local_real_t = double; + + template + typename std::common_type::type clamp(Value v, MinMax min, MinMax max) const + { + if (v < min) { + return min; + } else if (max < v) { + return max; + } else { + return v; + } + } + + template + Value sign(Value v) const + { + if (v < (Value)0) { + return (Value)-1; + } else if ((Value)0 < v) { + return (Value)1; + } else { + return (Value)0; + } + } + + local_real_t abs(local_real_t v) const + { + return std::fabs(v); + } + + local_real_t mod(local_real_t x, local_real_t y) const + { + return std::fmod(x, y); + } + }; +}; + +} // namespace colormap + +#include "./private/all_colormaps.h" + +namespace colormap +{ +class ColormapList +{ +public: + static std::vector> getAll() + { + return { + #include "./private/init_colormap_list.inc" + }; + } + +private: + ColormapList() + { + } + + ColormapList(ColormapList const&) = delete; + ColormapList(ColormapList&&) = delete; + ColormapList& operator=(ColormapList const&) = delete; + ColormapList& operator=(ColormapList&&) = delete; +}; + +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/16_Level.h b/colormap-shaders/include/colormap/private/IDL/16_Level.h new file mode 100644 index 0000000..84e1de1 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/16_Level.h @@ -0,0 +1,108 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class SixteenLevel : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_16_Level.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("16_Level"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " if (x < 0.0) {\n" + " return vec4(0.0, 0.0, 0.0, 1.0);\n" + " } else if (1.0 < x) {\n" + " return vec4(1.0, 1.0, 1.0, 1.0);\n" + " } else if (x < 1.0 / 16.0) {\n" + " return vec4(0.0, 84.0 / 255.0, 0.0, 1.0);\n" + " } else if (x < 2.0 / 16.0) {\n" + " return vec4(0.0, 168.0 / 255.0, 0.0, 1.0);\n" + " } else if (x < 3.0 / 16.0) {\n" + " return vec4(0.0, 1.0, 0.0, 1.0);\n" + " } else if (x < 4.0 / 16.0) {\n" + " return vec4(0.0, 1.0, 84.0 / 255.0, 1.0);\n" + " } else if (x < 5.0 / 16.0) {\n" + " return vec4(0.0, 1.0, 168.0 / 255.0, 1.0);\n" + " } else if (x < 6.0 / 16.0) {\n" + " return vec4(0.0, 1.0, 1.0, 1.0);\n" + " } else if (x < 7.0 / 16.0) {\n" + " return vec4(0.0, 0.0, 1.0, 1.0);\n" + " } else if (x < 8.0 / 16.0) {\n" + " return vec4(128.0 / 255.0, 0.0, 1.0, 1.0);\n" + " } else if (x < 9.0 / 16.0) {\n" + " return vec4(1.0, 0.0, 220.0 / 255.0, 1.0);\n" + " } else if (x < 10.0 / 16.0) {\n" + " return vec4(1.0, 0.0, 180.0 / 255.0, 1.0);\n" + " } else if (x < 11.0 / 16.0) {\n" + " return vec4(1.0, 0.0, 128.0 / 255.0, 1.0);\n" + " } else if (x < 12.0 / 16.0) {\n" + " return vec4(1.0, 0.0, 64.0 / 255.0, 1.0);\n" + " } else if (x < 13.0 / 16.0) {\n" + " return vec4(1.0, 0.0, 0.0, 1.0);\n" + " } else if (x < 14.0 / 16.0) {\n" + " return vec4(220.0 / 255.0, 190.0 / 255.0, 190.0 / 255.0, 1.0);\n" + " } else if (x < 15.0 / 16.0) {\n" + " return vec4(220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0, 1.0);\n" + " } else {\n" + " return vec4(1.0, 1.0, 1.0, 1.0);\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Beach.h b/colormap-shaders/include/colormap/private/IDL/Beach.h new file mode 100644 index 0000000..44097a3 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Beach.h @@ -0,0 +1,124 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Beach : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Beach.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Beach"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x <= 0.5) {\n" + " return 1.07069284759359E+03 * x - 3.92901626559718E+02; // R1\n" + " } else if (x < (4.62452380952399E+02 - 3.16199999999948E+02) / (1.05778571428574E+03 - 8.03199999999881E+02)) { // 0.57447206479\n" + " return 1.05778571428574E+03 * x - 4.62452380952399E+02; // R2\n" + " } else if (x < (2.16218045113087E+01 + 3.16199999999948E+02) / (8.03199999999881E+02 - 2.93462406015021E+02)) { // 0.66273668746\n" + " return 8.03199999999881E+02 * x - 3.16199999999948E+02; // R3\n" + " } else if (x < 0.7332708626326772) {\n" + " return 2.93462406015021E+02 * x + 2.16218045113087E+01; // R4\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (2.51230508474576E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 5.35095032144939E+02)) { // 0.23285616817\n" + " return -5.35095032144939E+02 * x + 2.51230508474576E+02; // G1\n" + " } else if (x < (6.91824598930488E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 1.39121879297175E+03)) { // 0.36550493804\n" + " return 4.27421457219241E+02 * x + 2.71026069518750E+01; // G2\n" + " } else if (x < (6.91824598930488E+02 + 5.16725562656262E+02) / (1.02304642956372E+03 + 1.39121879297175E+03)) { // 0.500587156\n" + " return -1.39121879297175E+03 * x + 6.91824598930488E+02; // G3\n" + " } else if (x < 0.7332708626326772) {\n" + " return 1.02304642956372E+03 * x - 5.16725562656262E+02; // G4\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.3584754040051419) {\n" + " return 1.07130443548384E+03 * x - 2.48036290322570E+02; // B1\n" + " } else if (x < 123.0 / 251.0) {\n" + " return 136.0;\n" + " } else if (x < 0.7332708626326772) {\n" + " return -1.01758796992489E+03 * x + 5.87035338345905E+02; // B2\n" + " } else {\n" + " return 8.98509790209691E+02 * x - 6.58851048950966E+02; // B3\n" + " }\n" + "}\n" + "\n" + "// R2 - R3 = 0\n" + "// => [x=0.5744720647924222]\n" + "\n" + "// B1 - 136 = 0\n" + "// => [x=0.3584754040051419]\n" + "\n" + "// B3 = 0\n" + "// => [x=0.7332708626326772]\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Black-White_Linear.h b/colormap-shaders/include/colormap/private/IDL/Black-White_Linear.h new file mode 100644 index 0000000..c3cd958 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Black-White_Linear.h @@ -0,0 +1,73 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlackWhiteLinear : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Black-White_Linear.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Black-White_Linear"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float d = clamp(x, 0.0, 1.0);\n" + " return vec4(d, d, d, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue-Green-Red-Yellow.h b/colormap-shaders/include/colormap/private/IDL/Blue-Green-Red-Yellow.h new file mode 100644 index 0000000..1723919 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue-Green-Red-Yellow.h @@ -0,0 +1,112 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlueGreenRedYellow : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue-Green-Red-Yellow.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue-Green-Red-Yellow"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (8.40958823529412E+02 - 5.2E+02) / (7.50588235294118 - 5.0)) {\n" + " return 7.50588235294118 * x - 8.40958823529412E+02;\n" + " } else if (x < (5.2E+02 + 1.27747747747748E+02) / (5.0 - 5.0e-1)) {\n" + " return 5.0 * x - 5.2E+02;\n" + " } else {\n" + " return 5.0e-1 * x + 1.27747747747748E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (150.0 + 1.00373100303951E+02) / 3.12386018237082) { // 80.1486256385\n" + " return 3.12386018237082 * x - 1.00373100303951E+02;\n" + " } else if (x < (2.08794117647059E+02 - 150.0) / 6.17647058823529E-01) { // 95.1904761905\n" + " return 150.0;\n" + " } else if (x < (4.19041176470588E+02 - 2.08794117647059E+02) / (-6.17647058823529E-01 + 2.49411764705882E+00)) { // 112.043887147\n" + " return -6.17647058823529E-01 * x + 2.08794117647059E+02;\n" + " } else if (x < (8.97617647058824E+02 - 4.19041176470588E+02) / (-2.49411764705882E+00 - -6.23529411764706E+00)) { // 127.921383648\n" + " return -2.49411764705882E+00 * x + 4.19041176470588E+02;\n" + " } else if (x < (8.97617647058824E+02 - - 3.32600912600913E+02) / (2.30624780624781E+00 - -6.23529411764706E+00)) { // 144.027690857\n" + " return -6.23529411764706E+00 * x + 8.97617647058824E+02;\n" + " } else {\n" + " return 2.30624780624781E+00 * x - 3.32600912600913E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (100.0 - - 3.36734693877551E-01) / 2.07815892314373E+00) {\n" + " return 2.07815892314373E+00 * x - 3.36734693877551E-01;\n" + " } else if (x < (3.49317448680352E+02 - 100.0) / 3.12243401759531E+00) {\n" + " return 100.0;\n" + " } else {\n" + " return -3.12243401759531E+00 * x + 3.49317448680352E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue-Pastel-Red.h b/colormap-shaders/include/colormap/private/IDL/Blue-Pastel-Red.h new file mode 100644 index 0000000..d37f33a --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue-Pastel-Red.h @@ -0,0 +1,121 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BluePastelRed : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue-Pastel-Red.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue-Pastel-Red"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.1131206452846527) {\n" + " return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + 3.28713709677420E+01;\n" + " } else if (x < 0.5116005837917328) {\n" + " return 0.0;\n" + " } else if (x < 0.5705677568912506) {\n" + " return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - 8.29909138655453E+02;\n" + " } else if (x < 0.622047244) {\n" + " return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - 7.12389120879120E+03;\n" + " } else if (x < 0.7922459542751312) {\n" + " return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + 6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) * x - 2.35682532934682E+05;\n" + " } else {\n" + " return 3.34889230769210E+02 * x - 1.41006123680226E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.114394336938858) {\n" + " return 0.0;\n" + " } else if (x < 0.4417250454425812) {\n" + " return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - 3.37113020096108E+01;\n" + " } else if (x < 0.4964917968308496) {\n" + " return 3.11150000000070E+02 * x + 9.54249999999731E+01;\n" + " } else if (x < 0.6259051214039278) {\n" + " return -1.03272635599706E+03 * x + 7.62648586707481E+02;\n" + " } else if (x < 0.8049814403057098) {\n" + " return -2.92799028677160E+02 * x + 2.99524283071235E+02;\n" + " } else {\n" + " return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + 1.40880802982723E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.4424893036638088) {\n" + " return 3.09636968527514E+02 * x + 9.62203074056821E+01;\n" + " } else if (x < 0.5) {\n" + " return -4.59921428571535E+02 * x + 4.36741666666678E+02;\n" + " } else if (x < 0.5691165986930345) {\n" + " return -1.81364912280674E+03 * x + 1.05392982456125E+03;\n" + " } else if (x < 0.6279306709766388) {\n" + " return 1.83776470588197E+02 * x - 8.28382352940910E+01;\n" + " } else {\n" + " return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - 1.80428756181930E+04) * x + 4.44421976986281E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue-Red.h b/colormap-shaders/include/colormap/private/IDL/Blue-Red.h new file mode 100644 index 0000000..558a8d1 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue-Red.h @@ -0,0 +1,100 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlueRed : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue-Red.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue-Red"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return 4.04377880184332E+00 * x - 5.17956989247312E+02;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (5.14022177419355E+02 + 1.13519230769231E+01) / (4.20313644688645E+00 + 4.04233870967742E+00)) {\n" + " return 4.20313644688645E+00 * x - 1.13519230769231E+01;\n" + " } else {\n" + " return -4.04233870967742E+00 * x + 5.14022177419355E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 1.34071303331385E+01 / (4.25125657510228E+00 - 1.0)) { // 4.12367649967\n" + " return x;\n" + " } else if (x < (255.0 + 1.34071303331385E+01) / 4.25125657510228E+00) { // 63.1359518278\n" + " return 4.25125657510228E+00 * x - 1.34071303331385E+01;\n" + " } else if (x < (1.04455240613432E+03 - 255.0) / 4.11010047593866E+00) { // 192.100512082\n" + " return 255.0;\n" + " } else {\n" + " return -4.11010047593866E+00 * x + 1.04455240613432E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue-Red_2.h b/colormap-shaders/include/colormap/private/IDL/Blue-Red_2.h new file mode 100644 index 0000000..8099918 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue-Red_2.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlueRed2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue-Red_2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue-Red_2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.75) {\n" + " return 1012.0 * x - 389.0;\n" + " } else {\n" + " return -1.11322769567548E+03 * x + 1.24461193212872E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.5) {\n" + " return 1012.0 * x - 129.0;\n" + " } else {\n" + " return -1012.0 * x + 899.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.25) {\n" + " return 1012.0 * x + 131.0;\n" + " } else {\n" + " return -1012.0 * x + 643.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue-White_Linear.h b/colormap-shaders/include/colormap/private/IDL/Blue-White_Linear.h new file mode 100644 index 0000000..cfebfa2 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue-White_Linear.h @@ -0,0 +1,95 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlueWhiteLinear : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue-White_Linear.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue-White_Linear"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 1.0 / 3.0) {\n" + " return 4.0 * x - 2.992156863;\n" + " } else if (x < 2.0 / 3.0) {\n" + " return 4.0 * x - 2.9882352941;\n" + " } else if (x < 2.9843137255 / 3.0) {\n" + " return 4.0 * x - 2.9843137255;\n" + " } else {\n" + " return x;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return 1.602642681354730 * x - 5.948580022657070e-1;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return 1.356416928785610 * x + 3.345982835050930e-3;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x), 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Blue_Waves.h b/colormap-shaders/include/colormap/private/IDL/Blue_Waves.h new file mode 100644 index 0000000..a1db5a1 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Blue_Waves.h @@ -0,0 +1,121 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class BlueWaves : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Blue_Waves.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Blue_Waves"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 94.58052830612496;\n" + " const float b = 0.5059881077994055;\n" + " const float c = 0.5079410623689743;\n" + " const float d = 86.68342149719986;\n" + " float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + " if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 99.19361086687104;\n" + " const float b = 1.095358975873744;\n" + " const float c = 0.3679001899352902;\n" + " const float d = 0.7603616684267874;\n" + " const float e = 219.7852186508229;\n" + " const float f = 1.161240703555854;\n" + " float v = (a * x + b) * sin(2.0 * pi * (x / c + d)) + e * x + f;\n" + " if (v > 255.0) {\n" + " return 510.0 - v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 253.8552881642787;\n" + " const float b = 0.5059881077994055;\n" + " const float c = 0.5079410623689743;\n" + " const float d = 226.7149651787587;\n" + " float v = a * sin(2.0 * pi * (x / b + c)) + d;\n" + " if (v > 255.0) {\n" + " return 510.0 - v;\n" + " } else if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Accent.h b/colormap-shaders/include/colormap/private/IDL/CB-Accent.h new file mode 100644 index 0000000..4b76344 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Accent.h @@ -0,0 +1,125 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBAccent : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Accent.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Accent"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.3953623640294495) {\n" + " return 4.43904418116747E+02 * x + 1.27235098111810E+02; // R1\n" + " } else if (x < 0.5707952559161218) {\n" + " return -1.40693770913775E+03 * x + 8.58988416988442E+02; // R2\n" + " } else if (x < 0.7167119613307117) {\n" + " return 1.26199099099112E+03 * x - 6.64423423423499E+02; // R3\n" + " } else if (x < 0.8579249381242428) {\n" + " return -3.45591749644313E+02 * x + 4.87750355618723E+02; // R4\n" + " } else {\n" + " return -6.12161344537705E+02 * x + 7.16447058823441E+02; // R5\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1411385125927322) {\n" + " return -1.90229018492177E+02 * x + 2.01102418207681E+02; // G1\n" + " } else if (x < 0.2839213365162221) {\n" + " return 1.26397818871505E+02 * x + 1.56414177335230E+02; // G2\n" + " } else if (x < 0.4292115788900552) {\n" + " return 4.30655855855847E+02 * x + 7.00288288288335E+01; // G3\n" + " } else if (x < 0.5716859888719092) {\n" + " return -1.03353736732686E+03 * x + 6.98477513951204E+02; // G4\n" + " } else if (x < 0.7167535225418249) {\n" + " return -7.29556302521079E+02 * x + 5.24695798319375E+02; // G5\n" + " } else if (x < 0.8577494771113141) {\n" + " return 6.31469498069341E+02 * x - 4.50824238524115E+02; // G6\n" + " } else {\n" + " return 7.78344916345091E+01 * x + 2.40558987558802E+01; // G7\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1418174223507038) {\n" + " return 5.96339971550497E+02 * x + 1.27334281650071E+02; // B1\n" + " } else if (x < 0.2832901246500529) {\n" + " return -5.48535392535404E+02 * x + 2.89697554697557E+02; // B2\n" + " } else if (x < 0.4021748491445084) {\n" + " return 1.22844950213372E+02 * x + 9.95021337126610E+01; // B3\n" + " } else if (x < 0.5699636786725797) {\n" + " return 1.60703217503224E+02 * x + 8.42764907764923E+01; // B4\n" + " } else if (x < 0.7149788470960766) {\n" + " return -3.30626890756314E+02 * x + 3.64316806722696E+02; // B5\n" + " } else if (x < 0.8584529189762473) {\n" + " return -7.30288215340717E+02 * x + 6.50066199802944E+02; // B6\n" + " } else {\n" + " return 5.42814671814679E+02 * x - 4.42832689832695E+02; // B7\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Blues.h b/colormap-shaders/include/colormap/private/IDL/CB-Blues.h new file mode 100644 index 0000000..f62c807 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Blues.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBBlues : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Blues.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Blues"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.8724578971287745) {\n" + " return ((((-2.98580898761749E+03 * x + 6.75014845489710E+03) * x - 4.96941610635258E+03) * x + 1.20190439358912E+03) * x - 2.94374708396149E+02) * x + 2.48449410219242E+02;\n" + " } else {\n" + " return 8.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.3725897611307026) {\n" + " return -1.30453729372935E+02 * x + 2.51073069306930E+02;\n" + " } else {\n" + " return (-4.97095598364922E+01 * x - 1.77638812495581E+02) * x + 2.75554584848896E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.8782350698420436) {\n" + " return (((-1.66242968759033E+02 * x + 2.50865766027010E+02) * x - 1.82046165445353E+02) * x - 3.29698266187334E+01) * x + 2.53927912915449E+02;\n" + " } else {\n" + " return -3.85153281423831E+02 * x + 4.93849833147981E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-BrBG.h b/colormap-shaders/include/colormap/private/IDL/CB-BrBG.h new file mode 100644 index 0000000..b91cda4 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-BrBG.h @@ -0,0 +1,113 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBBrBG : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-BrBG.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-BrBG"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.4128910005092621) {\n" + " return (-6.30796693758704E+02 * x + 6.59139629181867E+02) * x + 8.16592339699109E+01;\n" + " } else if (x < 0.5004365747118258) {\n" + " return -1.99292307692284E+01 * x + 2.54503076923075E+02;\n" + " } else if (x < 0.6000321805477142) {\n" + " return -4.46903540903651E+02 * x + 4.68176638176691E+02;\n" + " } else {\n" + " return ((2.43537534073204E+03 * x - 5.03831150657605E+03) * x + 2.73595321475367E+03) * x - 1.53778856560153E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.3067105114459991) {\n" + " return (((((-1.43558931121826E+06 * x + 1.21789289489746E+06) * x - 3.88754308517456E+05) * x + 5.87745165729522E+04) * x - 3.61237992835044E+03) * x + 4.00139210969209E+02) * x + 4.80612502318691E+01;\n" + " } else if (x < 0.4045854562297116) {\n" + " return 3.64978461538455E+02 * x + 8.50984615384636E+01;\n" + " } else if (x < 0.5035906732082367) {\n" + " return 1.25827692307720E+02 * x + 1.81855384615367E+02;\n" + " } else {\n" + " return ((((-2.83948052403926E+04 * x + 1.08768529946603E+05) * x - 1.62569302478295E+05) * x + 1.17919256227845E+05) * x - 4.16776268978779E+04) * x + 6.01529271177582E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1012683545126085) {\n" + " return 5.85993431855501E+01 * x + 4.56403940886700E+00;\n" + " } else if (x < 0.2050940692424774) {\n" + " return 3.51072173913048E+02 * x - 2.50542028985514E+01;\n" + " } else if (x < 0.5022056996822357) {\n" + " return (-7.65121475963620E+02 * x + 1.20827362856208E+03) * x - 1.68677387505814E+02;\n" + " } else if (x < 0.5970333516597748) {\n" + " return -1.62299487179500E+02 * x + 3.26660512820525E+02;\n" + " } else {\n" + " return ((1.27993125066091E+03 * x - 3.19799978871341E+03) * x + 2.16242391471484E+03) * x - 1.93738146367890E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-BuGn.h b/colormap-shaders/include/colormap/private/IDL/CB-BuGn.h new file mode 100644 index 0000000..ced94b7 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-BuGn.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBBuGn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-BuGn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-BuGn"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.2494658606560582) {\n" + " return (-1.98833893257484E+02 * x - 1.24389159093545E+02) * x + 2.46504720279718E+02;\n" + " } else {\n" + " return (((-1.85732147540803E+03 * x + 3.95435649372523E+03) * x - 2.78121710759105E+03) * x + 3.94042660425286E+02) * x + 2.23685415320351E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.2248314628132282) {\n" + " return -6.43489926739916E+01 * x + 2.52449038461538E+02;\n" + " } else {\n" + " return ((-5.64618971208984E+01 * x - 2.68370957359183E+01) * x - 1.13001580194466E+02) * x + 2.65385956392887E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.8) {\n" + " return ((((1.59308890502154E+03 * x - 2.88662249445915E+03) * x + 2.00432779052853E+03) * x - 9.47781545884907E+02) * x + 5.68068034974858E+01) * x + 2.51926935643853E+02;\n" + " } else {\n" + " return ((-4.08819825327256E+03 * x + 1.13496840066923E+04) * x - 1.06254795336147E+04) * x + 3.39092424595566E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-BuPu.h b/colormap-shaders/include/colormap/private/IDL/CB-BuPu.h new file mode 100644 index 0000000..675dd7e --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-BuPu.h @@ -0,0 +1,97 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBBuPu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-BuPu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-BuPu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.5) {\n" + " return ((9.36778020337806E+02 * x - 6.50118321723071E+02) * x - 1.17443717298418E+02) * x + 2.45640353186226E+02;\n" + " } else if (x < 0.8774830563107102) {\n" + " return (-1.07698286837105E+02 * x + 1.18941048271099E+02) * x + 1.07226580391914E+02;\n" + " } else {\n" + " return (-9.74524977247347E+01 * x - 2.28433367883516E+02) * x + 4.04152727778340E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.8733318961770479) {\n" + " return ((5.48640317293175E+01 * x - 2.50041384768192E+02) * x - 9.10862643329019E+01) * x + 2.50330566129102E+02;\n" + " } else {\n" + " return (1.99199516170089E+02 * x - 4.99460567863480E+02) * x + 3.00881779984708E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return ((((-5.85479883993044E+02 * x + 1.17558327595144E+03) * x - 8.53086782991886E+02) * x + 1.82921150609850E+02) * x - 9.97610091178212E+01) * x + 2.53898307388663E+02;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Dark2.h b/colormap-shaders/include/colormap/private/IDL/CB-Dark2.h new file mode 100644 index 0000000..be7a166 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Dark2.h @@ -0,0 +1,127 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBDark2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Dark2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Dark2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.1420141309011431) {\n" + " return 1.34039497392129E+03 * x + 2.69843527738265E+01; // R1\n" + " } else if (x < 0.2832372296870317) {\n" + " return -7.10676962676977E+02 * x + 3.18265551265554E+02; // R2\n" + " } else if (x < 0.4289458478001075) {\n" + " return 7.81992413466075E+02 * x - 1.04513987671874E+02; // R3\n" + " } else if (x < 0.5708308530153928) {\n" + " return -9.08417760617793E+02 * x + 6.20580437580458E+02; // R4\n" + " } else if (x < 0.7161145088911144) {\n" + " return 8.78642484589930E+02 * x - 3.99528686581363E+02; // R5\n" + " } else {\n" + " return -4.46088623062543E+02 * x + 5.49130479987969E+02; // R6\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1423373623518399) {\n" + " return -4.42075062917170E+02 * x + 1.57882591093117E+02;\n" + " } else if (x < 0.2834256193936661) {\n" + " return 1.20312044817928E+02 * x + 7.78338935574229E+01;\n" + " } else if (x < 0.4289129211292926) {\n" + " return -4.87706495969635E+02 * x + 2.50161925082971E+02;\n" + " } else if (x < 0.5707509745277107) {\n" + " return 8.81285199485221E+02 * x - 3.37016302016313E+02;\n" + " } else if (x < 0.7167318372796874) {\n" + " return 3.38425794215443E+01 * x + 1.46662399241347E+02;\n" + " } else if (x < 0.8574321486576632) {\n" + " return -3.74788931788816E+02 * x + 4.39541613041524E+02;\n" + " } else {\n" + " return -1.11864607464601E+02 * x + 2.14101844701848E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1416506418642016) {\n" + " return -8.25590327169275E+02 * x + 1.19073968705548E+02;\n" + " } else if (x < 0.283798849411819) {\n" + " return 1.24433848133849E+03 * x - 1.74132775632779E+02;\n" + " } else if (x < 0.4285299211147395) {\n" + " return -2.82844476054998E+02 * x + 2.59279990516832E+02;\n" + " } else if (x < 0.5700066234111405) {\n" + " return -7.58992535392565E+02 * x + 4.63323680823696E+02;\n" + " } else if (x < 0.7144281197454347) {\n" + " return -1.96085154061629E+02 * x + 1.42462745098042E+02;\n" + " } else if (x < 0.8576876140758521) {\n" + " return 1.84489769121314E+02 * x - 1.29430681693811E+02;\n" + " } else {\n" + " return 4.99467953667967E+02 * x - 3.99583569283573E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-GnBu.h b/colormap-shaders/include/colormap/private/IDL/CB-GnBu.h new file mode 100644 index 0000000..ebc6cdd --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-GnBu.h @@ -0,0 +1,100 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBGnBu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-GnBu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-GnBu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " float v = ((((-2.83671754639782E+03 * x + 6.51753994553536E+03) * x - 5.00110948171466E+03) * x + 1.30359712298773E+03) * x - 2.89958300810074E+02) * x + 2.48458039402758E+02;\n" + " if (v < 8.0) {\n" + " return 8.0;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return (((((-1.36304822155833E+03 * x + 4.37691418182849E+03) * x - 5.01802019417285E+03) * x + 2.39971481269598E+03) * x - 5.65401491984724E+02) * x - 1.48189675724133E+01) * x + 2.50507618187374E+02;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.3756393599187693) {\n" + " return (9.62948273917718E+01 * x - 1.96136874142438E+02) * x + 2.41033490809633E+02;\n" + " } else if (x < 0.6215448666633865) {\n" + " return 1.21184043778803E+02 * x + 1.35422939068100E+02;\n" + " } else if (x < 0.8830064316178203) {\n" + " return -1.53052165744713E+02 * x + 3.05873047350666E+02;\n" + " } else {\n" + " return -3.49468965517114E+02 * x + 4.79310344827486E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Greens.h b/colormap-shaders/include/colormap/private/IDL/CB-Greens.h new file mode 100644 index 0000000..4a3c3de --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Greens.h @@ -0,0 +1,95 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBGreens : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Greens.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Greens"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.6193682068820651) {\n" + " return ((1.41021531432983E+02 * x - 3.78122271460656E+02) * x - 1.08403692154170E+02) * x + 2.45743977533647E+02;\n" + " } else {\n" + " return ((-8.63146749682724E+02 * x + 1.76195389457266E+03) * x - 1.43807716183136E+03) * x + 4.86922446232568E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return (-1.37013460576160E+02 * x - 4.54698187198101E+01) * x + 2.52098684286706E+02;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.5062477983469252) {\n" + " return ((3.95067226937040E+02 * x - 4.52381961582927E+02) * x - 1.25304923569201E+02) * x + 2.43770002412197E+02;\n" + " } else {\n" + " return ((2.98249378459208E+02 * x - 6.14859580726999E+02) * x + 2.22299590241459E+02) * x + 1.21998454489668E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Greys.h b/colormap-shaders/include/colormap/private/IDL/CB-Greys.h new file mode 100644 index 0000000..98fc7eb --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Greys.h @@ -0,0 +1,83 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBGreys : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Greys.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Greys"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f1(float x) {\n" + " if (x < 0.3849871446504941) {\n" + " return (-1.97035589869658E+02 * x - 1.04694505989261E+02) * x + 2.54887830314633E+02;\n" + " } else if (x < 0.7524552013985151) {\n" + " return (8.71964614639801E+01 * x - 3.79941007690502E+02) * x + 3.18726712728548E+02;\n" + " } else {\n" + " return (2.28085532626505E+02 * x - 7.25770100421835E+02) * x + 4.99177793972139E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float v = clamp(colormap_f1(x) / 255.0, 0.0, 1.0);\n" + " return vec4(v, v, v, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-OrRd.h b/colormap-shaders/include/colormap/private/IDL/CB-OrRd.h new file mode 100644 index 0000000..5fda752 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-OrRd.h @@ -0,0 +1,111 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBOrRd : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-OrRd.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-OrRd"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_erf(float x) {\n" + " // erf approximation formula\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0));\n" + " float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x));\n" + " return sign(x) * sqrt(v);\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " return 127.0548665301906 * (1.0 - colormap_erf(2.926357498911938 * (x - 1.0)));\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.3619403852314316) {\n" + " return (-1.54198428391755E+02 * x - 1.02444772146395E+02) * x + 2.46537152765234E+02;\n" + " } else {\n" + " return (-9.36243338922068E+01 * x - 2.52981049073614E+02) * x + 2.93087053416795E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.257177186368595) {\n" + " return -3.12872659968267E+02 * x + 2.36904283447911E+02;\n" + " } else if (x < 0.3782584246092673) {\n" + " return -2.10348217636022E+02 * x + 2.10537335834895E+02;\n" + " } else if (x < 0.4977365973504272) {\n" + " return -3.49969458128060E+02 * x + 2.63350246305405E+02;\n" + " } else if (x < 0.6243924786616242) {\n" + " return -1.32763025210105E+02 * x + 1.55238655462198E+02;\n" + " } else if (x < 0.7554357868699768) {\n" + " return -3.23593609804140E+02 * x + 2.74391837181314E+02;\n" + " } else {\n" + " return -2.41701581027554E+02 * x + 2.12527667984095E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Oranges.h b/colormap-shaders/include/colormap/private/IDL/CB-Oranges.h new file mode 100644 index 0000000..0f85390 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Oranges.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBOranges : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Oranges.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Oranges"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.4798405468463898) {\n" + " return 255.0;\n" + " } else if (x < 0.7629524491886985) {\n" + " return (-3.67617638383468E+02 * x + 3.17332748024787E+02) * x + 1.85373720793787E+02;\n" + " } else {\n" + " return (3.68357233392831E+02 * x - 1.00617951362078E+03) * x + 7.66695019519326E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.748539247687408) {\n" + " return (((-8.92644295264035E+01 * x + 3.93421870424412E+02) * x - 4.73834129104390E+02) * x - 5.60962544745416E+01) * x + 2.43354168263028E+02;\n" + " } else {\n" + " return (1.06683260838348E+02 * x - 3.18020138166420E+02) * x + 2.51126712492908E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.76) {\n" + " return ((7.32034492098544E+02 * x - 7.55283914444663E+02) * x - 1.53168890861198E+02) * x + 2.33567667053916E+02;\n" + " } else {\n" + " return 1.23702752385982E+01 * x - 8.09423081765692E+00;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PRGn.h b/colormap-shaders/include/colormap/private/IDL/CB-PRGn.h new file mode 100644 index 0000000..8b85ae4 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PRGn.h @@ -0,0 +1,109 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPRGn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PRGn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PRGn"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09963276982307434) {\n" + " return 5.56064615384614E+02 * x + 6.34200000000000E+01;\n" + " } else if (x < 0.4070911109447479) {\n" + " return ((-1.64134573262743E+03 * x + 1.26126075878571E+03) * x + 8.30228593437549E+01) * x + 9.96536529647110E+01;\n" + " } else if (x < 0.5013306438922882) {\n" + " return 1.64123076923114E+02 * x + 1.64926153846145E+02;\n" + " } else if (x < 0.9049346148967743) {\n" + " return ((((-4.17783076764345E+04 * x + 1.55735420068591E+05) * x - 2.27018068370619E+05) * x + 1.61149115838926E+05) * x - 5.60588504546212E+04) * x + 7.93919652573346E+03;\n" + " } else {\n" + " return -2.67676923076906E+02 * x + 2.68590769230752E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1011035144329071) {\n" + " return 4.30627692307691E+02 * x - 1.56923076923038E-01;\n" + " } else if (x < 0.5013851821422577) {\n" + " return ((2.21240993583109E+02 * x - 7.23499016773187E+02) * x + 8.74292145995924E+02) * x - 3.78460594811949E+01;\n" + " } else {\n" + " return ((((-8.82260255008935E+03 * x + 3.69735516719018E+04) * x - 5.94940784200438E+04) * x + 4.54236515662453E+04) * x - 1.66043372157228E+04) * x + 2.59449114260420E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.50031378865242) {\n" + " return ((((1.32543265346288E+04 * x - 1.82876583834065E+04) * x + 9.17087085537958E+03) * x - 2.45909850441496E+03) * x + 7.42893247681885E+02) * x + 7.26668497072812E+01;\n" + " } else if (x < 0.609173446893692) {\n" + " return -3.50141636141726E+02 * x + 4.22147741147797E+02;\n" + " } else {\n" + " return ((1.79776073728688E+03 * x - 3.80142452792079E+03) * x + 2.10214624189039E+03) * x - 6.74426111651015E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Paired.h b/colormap-shaders/include/colormap/private/IDL/CB-Paired.h new file mode 100644 index 0000000..1042ed2 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Paired.h @@ -0,0 +1,149 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPaired : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Paired.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Paired"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0906416957946237) {\n" + " return -1.48766695652174E+03 * x + 1.65896666666667E+02;\n" + " } else if (x < 0.181137969063194) {\n" + " return 1.62263833992095E+03 * x - 1.16026679841898E+02;\n" + " } else if (x < 0.2716806139960391) {\n" + " return -1.40227075098820E+03 * x + 4.31899209486178E+02;\n" + " } else if (x < 0.3621693275308975) {\n" + " return 2.21145652173927E+03 * x - 5.49880434782653E+02;\n" + " } else if (x < 0.4514347780510689) {\n" + " return -2.73075098814252E+02 * x + 3.49940711462467E+02;\n" + " } else if (x < 0.5478389816716595) {\n" + " return 2.75424347826088E+02 * x + 1.02328985507251E+02;\n" + " } else if (x < 0.6384253260915684) {\n" + " return 1.95770750987722E+01 * x + 2.42492094861655E+02;\n" + " } else if (x < 0.7280391465804739) {\n" + " return -5.92081027667844E+02 * x + 6.32990118576982E+02;\n" + " } else if (x < 0.8191050219893012) {\n" + " return -1.05189130434770E+03 * x + 9.67749999999916E+02;\n" + " } else if (x < 0.9092300295745469) {\n" + " return 1.64974505928811E+03 * x - 1.24517391304309E+03;\n" + " } else {\n" + " return -8.20731225296366E+02 * x + 1.00105731225287E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.09069203671589791) {\n" + " return -9.49076521739127E+02 * x + 2.05970000000000E+02;\n" + " } else if (x < 0.1811205395903491) {\n" + " return 1.14400395256917E+03 * x + 1.61442687747026E+01;\n" + " } else if (x < 0.271076794014141) {\n" + " return -7.04272727272755E+02 * x + 3.50905138339931E+02;\n" + " } else if (x < 0.3618506954718166) {\n" + " return -6.35000000000221E+01 * x + 1.77206521739141E+02;\n" + " } else if (x < 0.4527247821743651) {\n" + " return -1.40603557312254E+03 * x + 6.63003952569178E+02;\n" + " } else if (x < 0.5472660653935183) {\n" + " return 1.73713913043494E+03 * x - 7.59989130434857E+02;\n" + " } else if (x < 0.6379975539161487) {\n" + " return -7.00507905138483E+02 * x + 5.74052371541584E+02;\n" + " } else if (x < 0.7283304980067641) {\n" + " return 5.64723320158019E+02 * x - 2.33162055335916E+02; } else if (x < 0.8189077039268755) {\n" + " return -1.29283992094844E+03 * x + 1.11975790513821E+03; } else if (x < 0.9094178747563795) {\n" + " return 2.14293675889271E+03 * x - 1.69382608695601E+03;\n" + " } else {\n" + " return -1.75290118577070E+03 * x + 1.84911857707505E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1835817221386023) {\n" + " return -4.93278367346940E+02 * x + 2.25853877551021E+02;\n" + " } else if (x < 0.2718482976477959) {\n" + " return -1.04124223602495E+03 * x + 3.26450028232661E+02;\n" + " } else if (x < 0.3623519200472859) {\n" + " return 1.21151976284592E+03 * x - 2.85959486166031E+02;\n" + " } else if (x < 0.4526344257525674) {\n" + " return -1.38645849802374E+03 * x + 6.55422924901199E+02;\n" + " } else if (x < 0.5474992417588231) {\n" + " return 8.80275652173975E+02 * x - 3.70578985507278E+02;\n" + " } else if (x < 0.6375259518892261) {\n" + " return -1.24038339920972E+03 * x + 7.90480237154278E+02;\n" + " } else if (x < 0.7280438873117513) {\n" + " return 2.36255138339872E+03 * x - 1.50648418972297E+03;\n" + " } else if (x < 0.8192397843702398) {\n" + " return -6.51816205533491E+02 * x + 6.88107707509788E+02;\n" + " } else if (x < 0.9092328860678134) {\n" + " return -1.35533596837590E+01 * x + 1.65217391304318E+02;\n" + " } else {\n" + " return -1.19420158102770E+03 * x + 1.23870158102770E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Pastel1.h b/colormap-shaders/include/colormap/private/IDL/CB-Pastel1.h new file mode 100644 index 0000000..b651916 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Pastel1.h @@ -0,0 +1,133 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPastel1 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Pastel1.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Pastel1"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.122867923365625) {\n" + " return -5.81788489736069E+02 * x + 2.50471590909091E+02;\n" + " } else if (x < 0.2449046174927113) {\n" + " return 1.99984352773830E+02 * x + 1.54416785206258E+02;\n" + " } else if (x < 0.3729729104526915) {\n" + " return 1.43786086956516E+02 * x + 1.68180000000001E+02;\n" + " } else if (x < 0.5011116081610979) {\n" + " return 2.52012802275928E+02 * x + 1.27814366998585E+02;\n" + " } else if (x < 0.6239282365941264) {\n" + " return 7.85450500555661E+00 * x + 2.50164923989616E+02;\n" + " } else if (x < 0.7520403577351265) {\n" + " return -2.00555718475049E+02 * x + 3.80197947214058E+02;\n" + " } else if (x < 0.8796535309192707) {\n" + " return 1.86622408963526E+02 * x + 8.90243697479360E+01;\n" + " } else {\n" + " return -9.30674082313196E+01 * x + 3.35054505005547E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.2498801528138394) {\n" + " return 2.21725710445469E+02 * x + 1.79002480158730E+02;\n" + " } else if (x < 0.3735167574956272) {\n" + " return -2.52975806451616E+02 * x + 2.97620967741935E+02;\n" + " } else if (x < 0.5007872003710714) {\n" + " return 1.09439266615749E+02 * x + 1.62252864782272E+02;\n" + " } else if (x < 0.6262274652716027) {\n" + " return 3.02956451612894E+02 * x + 6.53419354838611E+01;\n" + " } else if (x < 0.752848702686641) {\n" + " return -3.10470307917895E+02 * x + 4.49486620234600E+02;\n" + " } else if (x < 0.8827503622135592) {\n" + " return 2.27675070027963E+01 * x + 1.98608963585427E+02;\n" + " } else {\n" + " return 1.95678708265011E+02 * x + 4.59715380404256E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1232989588096424) {\n" + " return 4.29695747800585E+02 * x + 1.74153409090909E+02;\n" + " } else if (x < 0.2476314320040304) {\n" + " return -2.40499266862156E+02 * x + 2.56787756598238E+02;\n" + " } else if (x < 0.3742360961829455) {\n" + " return 2.41095161290329E+02 * x + 1.37529838709676E+02;\n" + " } else if (x < 0.4998594481260504) {\n" + " return -4.90936497326148E+02 * x + 4.11482508912633E+02;\n" + " } else if (x < 0.6256351261233096) {\n" + " return 2.96955882352941E+02 * x + 1.76470588235230E+01;\n" + " } else if (x < 0.7525509527474964) {\n" + " return -1.11771301446066E+02 * x + 2.73361142009640E+02;\n" + " } else if (x < 0.8785969154660433) {\n" + " return 3.73063712757765E+02 * x - 9.15019098547990E+01;\n" + " } else {\n" + " return 4.55448275862047E+01 * x + 1.96255172413811E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Pastel2.h b/colormap-shaders/include/colormap/private/IDL/CB-Pastel2.h new file mode 100644 index 0000000..2d801a6 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Pastel2.h @@ -0,0 +1,127 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPastel2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Pastel2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Pastel2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.1414470427532423) {\n" + " return 5.23716927453769E+02 * x + 1.79102418207681E+02;\n" + " } else if (x < 0.2832126252873305) {\n" + " return -3.55011583011593E+02 * x + 3.03395967395968E+02;\n" + " } else if (x < 0.4293789173286286) {\n" + " return 2.81737389211071E+02 * x + 1.23060619323778E+02;\n" + " } else if (x < 0.5703484841123749) {\n" + " return -9.85406162465110E+01 * x + 2.86343977591045E+02;\n" + " } else if (x < 0.7170614267751989) {\n" + " return 1.69092460881909E+02 * x + 1.33699857752520E+02;\n" + " } else if (x < 0.859829619768543) {\n" + " return -9.94710581026121E+01 * x + 3.26276397855329E+02;\n" + " } else {\n" + " return -2.57056149732620E+02 * x + 4.61772727272750E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1411063922737659) {\n" + " return -1.49220483641537E+02 * x + 2.26007112375533E+02;\n" + " } else if (x < 0.2816283290590322) {\n" + " return 5.77629343629288E+01 * x + 1.96800429000430E+02;\n" + " } else if (x < 0.4291887492428612) {\n" + " return -7.38876244665610E+01 * x + 2.33876955903267E+02;\n" + " } else if (x < 0.571830104540257) {\n" + " return 3.01873399715509E+02 * x + 7.26045519203479E+01;\n" + " } else if (x < 0.7190262682310248) {\n" + " return -2.25206477732972E+01 * x + 2.58102834008109E+02;\n" + " } else if (x < 0.8491803538380496) {\n" + " return -1.16468292682893E+02 * x + 3.25653658536549E+02;\n" + " } else {\n" + " return -1.44447728516695E+02 * x + 3.49413245758086E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1425168965591466) {\n" + " return -2.26903238866400E+02 * x + 2.04742307692308E+02;\n" + " } else if (x < 0.2851292529683606) {\n" + " return 4.18120091673021E+02 * x + 1.12815584415585E+02;\n" + " } else if (x < 0.4319360871262316) {\n" + " return -3.09335813546247E+01 * x + 2.40853922748656E+02;\n" + " } else if (x < 0.7146533590447866) {\n" + " return -1.88956299440485E+02 * x + 3.09109637275714E+02;\n" + " } else if (x < 0.8619542566532371) {\n" + " return 2.06196082722327E+02 * x + 2.67126600285119E+01;\n" + " } else {\n" + " return -6.48097784562050E+00 * x + 2.10030557677552E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PiYG.h b/colormap-shaders/include/colormap/private/IDL/CB-PiYG.h new file mode 100644 index 0000000..1fe45e9 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PiYG.h @@ -0,0 +1,113 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPiYG : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PiYG.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PiYG"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09843078255653381) {\n" + " return 5.57627692307694E+02 * x + 1.42135384615385E+02;\n" + " } else if (x < 0.4093809425830841) {\n" + " return ((-4.21748915649019E+02 * x + 1.28054196831998E+01) * x + 2.64504106766935E+02) * x + 1.71265909327078E+02;\n" + " } else if (x < 0.5037343473981705) {\n" + " return -6.54538461538185E+01 * x + 2.79554615384612E+02;\n" + " } else if (x < 0.5982368290424347) {\n" + " return -1.66852258852308E+02 * x + 3.30632478632496E+02;\n" + " } else {\n" + " return ((1.82001891024969E+03 * x - 4.20447326861499E+03) * x + 2.68838861198902E+03) * x - 2.62418693972160E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.101902037858963) {\n" + " return 2.72322735042735E+02 * x + 5.21367521367536E-01;\n" + " } else if (x < 0.5059849917888641) {\n" + " return ((6.81035433115437E+02 * x - 1.71408042362240E+03) * x + 1.36671536460816E+03) * x - 9.39210546594673E+01;\n" + " } else if (x < 0.5954320132732391) {\n" + " return -2.72768472906136E+01 * x + 2.60800985221660E+02;\n" + " } else {\n" + " return ((1.09164194296742E+03 * x - 3.01508808799416E+03) * x + 2.33004497173996E+03) * x - 3.04306745740377E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.5011215507984161) {\n" + " return (((((-3.44764954376220E+04 * x + 6.98813026428223E+04) * x - 4.87748659515380E+04) * x + 1.31832279253005E+04) * x - 1.26691288614273E+03) * x + 4.73465709444135E+02) * x + 8.21916531938477E+01;\n" + " } else if (x < 0.5958432303492089) {\n" + " return -3.80379731379794E+02 * x + 4.37472934472961E+02;\n" + " } else if (x < 0.790071576833725) {\n" + " return -7.13383710407293E+02 * x + 6.35891101055846E+02;\n" + " } else {\n" + " return (1.19760697610430E+03 * x - 2.36001183205723E+03) * x + 1.18928322234544E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PuBu.h b/colormap-shaders/include/colormap/private/IDL/CB-PuBu.h new file mode 100644 index 0000000..a6229c7 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PuBu.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPuBu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PuBu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PuBu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.7520372909206926) {\n" + " return (((9.68615208861418E+02 * x - 1.16097242960380E+03) * x + 1.06173672031378E+02) * x - 1.68616613530379E+02) * x + 2.56073136099945E+02;\n" + " } else {\n" + " return -1.20830453148990E+01 * x + 1.44337397593436E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.7485333535031721) {\n" + " return (((-4.58537247030064E+02 * x + 5.67323181593790E+02) * x - 2.56714665792882E+02) * x - 1.14205365680507E+02) * x + 2.47073841488433E+02;\n" + " } else {\n" + " return ((-2.99774273328017E+02 * x + 4.12147041403012E+02) * x - 2.49880079288168E+02) * x + 1.93578601034431E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.7628468501376879) {\n" + " return ((-5.44257972228224E+01 * x + 2.70890554876532E+01) * x - 9.12766750739247E+01) * x + 2.52166182860177E+02;\n" + " } else {\n" + " return (((4.55621137729287E+04 * x - 1.59960900638524E+05) * x + 2.09530452721547E+05) * x - 1.21704642900945E+05) * x + 2.66644674068694E+04;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PuBuGn.h b/colormap-shaders/include/colormap/private/IDL/CB-PuBuGn.h new file mode 100644 index 0000000..68714ac --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PuBuGn.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPuBuGn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PuBuGn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PuBuGn"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.4874515235424042) {\n" + " return ((-4.67299169932026E+02 * x - 9.61558801325737E+01) * x - 1.42239969624745E+02) * x + 2.55174176214321E+02;\n" + " } else if (x < 0.7547346238979944) {\n" + " return -4.01060227272736E+02 * x + 3.04365078671334E+02;\n" + " } else {\n" + " return -4.15773809523774E+00 * x + 4.80902777777746E+0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.6119840443134308) {\n" + " return ((-1.86575654193875E+02 * x + 1.34788465541787E+02) * x - 1.76719831637092E+02) * x + 2.46604381236178E+02;\n" + " } else {\n" + " return ((-8.15961797068245E+02 * x + 1.63871690240040E+03) * x - 1.21797539379991E+03) * x + 4.64835362086844E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.626910001039505) {\n" + " return (((1.51117885576561E+02 * x - 3.02884959951043E+02) * x + 1.53322134227491E+02) * x - 1.09362189530744E+02) * x + 2.51508758745276E+02;\n" + " } else {\n" + " return ((6.51665430892026E+02 * x - 1.29049314879284E+03) * x + 4.20233542130992E+02) * x + 2.75096926634035E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PuOr.h b/colormap-shaders/include/colormap/private/IDL/CB-PuOr.h new file mode 100644 index 0000000..765b72c --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PuOr.h @@ -0,0 +1,111 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPuOr : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PuOr.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PuOr"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.3021800816059113) {\n" + " return ((-8.74206463186070E+02 * x - 1.85426300850231E+02) * x + 5.51285275571572E+02) * x + 1.26643739338646E+02;\n" + " } else if (x < 0.5021429359912872) {\n" + " return (-3.88346609612054E+02 * x + 2.84470703793855E+02) * x + 2.01677105728121E+02;\n" + " } else {\n" + " return ((((-1.46535873909592E+04 * x + 5.53022453680932E+04) * x - 8.13970779339075E+04) * x + 5.81771336215697E+04) * x - 2.05245461242988E+04) * x + 3.14144977294882E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.05763718485832214) {\n" + " return 2.95595213675214E+02 * x + 5.90683760683760E+01;\n" + " } else if (x < 0.5007581412792206) {\n" + " return ((((2.62405984206199E+04 * x - 3.27451861162955E+04) * x + 1.22107381531950E+04) * x - 1.00838782028235E+03) * x + 2.70642765981150E+02) * x + 6.36961934872237E+01;\n" + " } else if (x < 0.8994744718074799) {\n" + " return ((-2.60499440597370E+02 * x - 1.69367458674853E+02) * x + 1.12913289561831E+02) * x + 2.65534872970494E+02;\n" + " } else {\n" + " return -3.86892551892486E+02 * x + 3.88498371998310E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.09708546522206818) {\n" + " return -2.18830769230769E+01 * x + 8.03384615384615E+00;\n" + " } else if (x < 0.2041181623935699) {\n" + " return 1.36731800766284E+02 * x - 7.36535303776692E+00;\n" + " } else if (x < 0.4982341825962067) {\n" + " return (-3.57661007879491E+02 * x + 1.02135850891279E+03) * x - 1.73032069862183E+02;\n" + " } else if (x < 0.6063862144947052) {\n" + " return -1.17230769230812E+02 * x + 3.05467236467253E+02;\n" + " } else {\n" + " return (((((6.76307238761902E+05 * x - 3.23892241330779E+06) * x + 6.41842651908440E+06) * x - 6.73646783203943E+06) * x + 3.94913439210334E+06) * x - 1.22625641797298E+06) * x + 1.57856249228480E+05;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-PuRd.h b/colormap-shaders/include/colormap/private/IDL/CB-PuRd.h new file mode 100644 index 0000000..c494a55 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-PuRd.h @@ -0,0 +1,107 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPuRd : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-PuRd.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-PuRd"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 25.0 / 254.0) {\n" + " return -1.41567647058826E+02 * x + 2.46492647058824E+02;\n" + " } else if (x < 0.3715468440779919) {\n" + " return (1.64817020395145E+02 * x - 2.01032852327719E+02) * x + 2.52820173539371E+02;\n" + " } else if (x < 0.6232413065898157) {\n" + " return (((2.61012828741073E+04 * x - 5.18905872811356E+04) * x + 3.78968358931486E+04) * x - 1.19124127524292E+04) * x + 1.55945779375675E+03;\n" + " } else if (x < 0.7481208809057023) {\n" + " return -2.02469919786095E+02 * x + 3.57739416221033E+02;\n" + " } else {\n" + " return -4.08324020737294E+02 * x + 5.11743167562695E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1303350956955242) {\n" + " return -1.59734759358287E+02 * x + 2.44376470588235E+02;\n" + " } else if (x < 0.6227215280200861) {\n" + " return (((1.21347373400442E+03 * x - 2.42854832541048E+03) * x + 1.42039752537243E+03) * x - 6.27806679597789E+02) * x + 2.86280758506240E+02;\n" + " } else {\n" + " return (1.61877993987291E+02 * x - 4.06294499392671E+02) * x + 2.32401278080262E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.7508644163608551) {\n" + " return ((((2.96852143551409E+03 * x - 6.12155011029541E+03) * x + 4.21719423212110E+03) * x - 1.29520280960574E+03) * x + 2.78723913454450E+01) * x + 2.47133504519275E+02;\n" + " } else {\n" + " return ((-6.55064010825706E+02 * x + 1.23635622822904E+03) * x - 8.68481725874416E+02) * x + 3.18158180572088E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Purples.h b/colormap-shaders/include/colormap/private/IDL/CB-Purples.h new file mode 100644 index 0000000..969cd83 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Purples.h @@ -0,0 +1,91 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBPurples : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Purples.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Purples"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return (((-3.03160346735036E+02 * x + 7.95537661771755E+02) * x - 6.68077287777559E+02) * x - 9.83523581613554E+00) * x + 2.49241870138829E+02;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.6238275468349457) {\n" + " return ((((-1.64962450015544E+03 * x + 3.91401450219750E+03) * x - 2.81559997409582E+03) * x + 5.71903768479824E+02) * x - 1.63510103061329E+02) * x + 2.52440721674553E+02;\n" + " } else {\n" + " return (8.00008172182588E+01 * x - 4.62535128626795E+02) * x + 3.83781070034667E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return (((((1.42855146044492E+03 * x - 4.10835541903972E+03) * x + 4.43536620247364E+03) * x - 2.15825854188203E+03) * x + 3.66481133684515E+02) * x - 9.02285603303462E+01) * x + 2.53802694290353E+02;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-RdBu.h b/colormap-shaders/include/colormap/private/IDL/CB-RdBu.h new file mode 100644 index 0000000..a5c16a6 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-RdBu.h @@ -0,0 +1,127 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBRdBu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-RdBu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-RdBu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09771832105856419) {\n" + " return 7.60263247863246E+02 * x + 1.02931623931624E+02;\n" + " } else if (x < 0.3017162107441106) {\n" + " return (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + 1.37642085716717E+02;\n" + " } else if (x < 0.4014205790737471) {\n" + " return 8.67103448276151E+01 * x + 2.18034482758611E+02;\n" + " } else if (x < 0.5019932233215039) {\n" + " return -6.15461538461498E+01 * x + 2.77547692307680E+02;\n" + " } else if (x < 0.5969483882550937) {\n" + " return -3.77588522588624E+02 * x + 4.36198819698878E+02;\n" + " } else if (x < 0.8046060096654594) {\n" + " return (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + 3.17674951640855E+02;\n" + " } else {\n" + " return -3.08431855203590E+02 * x + 3.12956742081421E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.09881640500975222) {\n" + " return 2.41408547008547E+02 * x + 3.50427350427364E-01;\n" + " } else if (x < 0.5000816285610199) {\n" + " return ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + 1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) * x - 4.82944517518776E+01;\n" + " } else if (x < 0.8922355473041534) {\n" + " return (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + 1.45172137257997E+04) * x - 5.80944127411621E+03) * x + 1.12477959061948E+03;\n" + " } else {\n" + " return -5.28313797313699E+02 * x + 5.78459299959206E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1033699568661857) {\n" + " return 1.30256410256410E+02 * x + 3.08518518518519E+01;\n" + " } else if (x < 0.2037526071071625) {\n" + " return 3.38458128078815E+02 * x + 9.33004926108412E+00;\n" + " } else if (x < 0.2973267734050751) {\n" + " return (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - 3.81852747252658E+01;\n" + " } else if (x < 0.4029109179973602) {\n" + " return 6.68959706959723E+02 * x - 7.00740740740798E+01;\n" + " } else if (x < 0.5006715489526758) {\n" + " return 4.87348695652202E+02 * x + 3.09898550724286E+00;\n" + " } else if (x < 0.6004396902588283) {\n" + " return -6.85799999999829E+01 * x + 2.81436666666663E+02;\n" + " } else if (x < 0.702576607465744) {\n" + " return -1.81331701891043E+02 * x + 3.49137263626287E+02;\n" + " } else if (x < 0.9010407030582428) {\n" + " return (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + 5.26198653917172E+02;\n" + " } else {\n" + " return -7.36990769230737E+02 * x + 8.36652307692262E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-RdGy.h b/colormap-shaders/include/colormap/private/IDL/CB-RdGy.h new file mode 100644 index 0000000..cf2da6c --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-RdGy.h @@ -0,0 +1,127 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBRdGy : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-RdGy.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-RdGy"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f(float x) {\n" + " if (x < 0.8110263645648956) {\n" + " return (((4.41347880412638E+03 * x - 1.18250308887283E+04) * x + 1.13092070303101E+04) * x - 4.94879610401395E+03) * x + 1.10376673162241E+03;\n" + " } else {\n" + " return (4.44045986053970E+02 * x - 1.34196160353499E+03) * x + 9.26518306556645E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.09384074807167053) {\n" + " return 7.56664615384615E+02 * x + 1.05870769230769E+02;\n" + " } else if (x < 0.3011957705020905) {\n" + " return (-2.97052932130813E+02 * x + 4.43575866219751E+02) * x + 1.37867123966178E+02;\n" + " } else if (x < 0.3963058760920129) {\n" + " return 8.61868131868288E+01 * x + 2.18562881562874E+02;\n" + " } else if (x < 0.5) {\n" + " return 2.19915384615048E+01 * x + 2.44003846153861E+02;\n" + " } else {\n" + " return colormap_f(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.09568486400411116) {\n" + " return 2.40631111111111E+02 * x + 1.26495726495727E+00;\n" + " } else if (x < 0.2945883673263987) {\n" + " return 7.00971783488427E+02 * x - 4.27826773670273E+01;\n" + " } else if (x < 0.3971604611945229) {\n" + " return 5.31775726495706E+02 * x + 7.06051282052287E+00;\n" + " } else if (x < 0.5) {\n" + " return 3.64925470085438E+02 * x + 7.33268376068493E+01;\n" + " } else {\n" + " return colormap_f(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.09892375498249567) {\n" + " return 1.30670329670329E+02 * x + 3.12116402116402E+01;\n" + " } else if (x < 0.1985468629735229) {\n" + " return 3.33268034188035E+02 * x + 1.11699145299146E+01;\n" + " } else if (x < 0.2928770209555256) {\n" + " return 5.36891330891336E+02 * x - 2.92588522588527E+01;\n" + " } else if (x < 0.4061551302245808) {\n" + " return 6.60915763546766E+02 * x - 6.55827586206742E+01;\n" + " } else if (x < 0.5) {\n" + " return 5.64285714285700E+02 * x - 2.63359683794383E+01;\n" + " } else {\n" + " return colormap_f(x);\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-RdPu.h b/colormap-shaders/include/colormap/private/IDL/CB-RdPu.h new file mode 100644 index 0000000..9176ba3 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-RdPu.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBRdPu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-RdPu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-RdPu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.4668049514293671) {\n" + " return -1.36007661451525E+01 * x + 2.54876081825334E+02;\n" + " } else {\n" + " return ((9.11043267377652E+02 * x - 2.27422817830303E+03) * x + 1.47691217772832E+03) * x - 3.80041369120933E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return ((((-2.12978937384858E+03 * x + 5.05211767883971E+03) * x - 3.95843947196006E+03) * x + 9.49632208843715E+02) * x - 2.70366761763812E+02) * x + 2.48595803511253E+02;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.2484821379184723) {\n" + " return ((1.12923860577866E+02 * x - 2.02431339810602E+02) * x - 1.60306874714734E+02) * x + 2.42581612831587E+02;\n" + " } else if (x < 0.5019654333591461) {\n" + " return (-2.24073120483401E+02 * x + 4.46032892337713E+01) * x + 1.94733826112356E+02;\n" + " } else if (x < 0.7505462467670441) {\n" + " return (-4.08932859712077E+02 * x + 3.70448937862306E+02) * x + 7.77495522761299E+01;\n" + " } else {\n" + " return (-1.99803137524475E+02 * x + 2.71497008797383E+02) * x + 3.42106616941255E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-RdYiBu.h b/colormap-shaders/include/colormap/private/IDL/CB-RdYiBu.h new file mode 100644 index 0000000..46745fb --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-RdYiBu.h @@ -0,0 +1,125 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBRdYiBu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-RdYiBu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-RdYiBu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09790863520700754) {\n" + " return 5.14512820512820E+02 * x + 1.64641025641026E+02;\n" + " } else if (x < 0.2001887081633112) {\n" + " return 2.83195402298854E+02 * x + 1.87288998357964E+02;\n" + " } else if (x < 0.3190117539655621) {\n" + " return 9.27301587301214E+01 * x + 2.25417989417999E+02;\n" + " } else if (x < 0.500517389125164) {\n" + " return 255.0;\n" + " } else if (x < 0.6068377196788788) {\n" + " return -3.04674876847379E+02 * x + 4.07495073891681E+02;\n" + " } else if (x < 0.9017468988895416) {\n" + " return (1.55336390191951E+02 * x - 7.56394659038288E+02) * x + 6.24412733169483E+02;\n" + " } else {\n" + " return -1.88350769230735E+02 * x + 2.38492307692292E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.09638568758964539) {\n" + " return 4.81427692307692E+02 * x + 4.61538461538488E-01;\n" + " } else if (x < 0.4987066686153412) {\n" + " return ((((3.25545903568267E+04 * x - 4.24067109461319E+04) * x + 1.83751375886345E+04) * x - 3.19145329617892E+03) * x + 8.08315127034676E+02) * x - 1.44611527812961E+01;\n" + " } else if (x < 0.6047312345537269) {\n" + " return -1.18449917898218E+02 * x + 3.14234811165860E+02;\n" + " } else if (x < 0.7067635953426361) {\n" + " return -2.70822112753102E+02 * x + 4.06379036672115E+02;\n" + " } else {\n" + " return (-4.62308723214883E+02 * x + 2.42936159122279E+02) * x + 2.74203431802418E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.09982818011951204) {\n" + " return 1.64123076923076E+01 * x + 3.72646153846154E+01;\n" + " } else if (x < 0.2958717460833126) {\n" + " return 2.87014675052409E+02 * x + 1.02508735150248E+01;\n" + " } else if (x < 0.4900527540014758) {\n" + " return 4.65475113122167E+02 * x - 4.25505279034673E+01;\n" + " } else if (x < 0.6017014681258838) {\n" + " return 5.61032967032998E+02 * x - 8.93789173789407E+01;\n" + " } else if (x < 0.7015737100463595) {\n" + " return -1.51655677655728E+02 * x + 3.39446886446912E+02;\n" + " } else if (x < 0.8237156500567735) {\n" + " return -2.43405347593559E+02 * x + 4.03816042780725E+02;\n" + " } else {\n" + " return -3.00296889157305E+02 * x + 4.50678495922638E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-RdYiGn.h b/colormap-shaders/include/colormap/private/IDL/CB-RdYiGn.h new file mode 100644 index 0000000..81b5f51 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-RdYiGn.h @@ -0,0 +1,127 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBRdYiGn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-RdYiGn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-RdYiGn"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09825118520770205) {\n" + " return 5.07556923076926E+02 * x + 1.64923076923077E+02;\n" + " } else if (x < 0.2009111350471108) {\n" + " return 2.86362637362647E+02 * x + 1.86655677655676E+02;\n" + " } else if (x < 0.2994418666360456) {\n" + " return 8.90415982485030E+01 * x + 2.26299671592774E+02;\n" + " } else if (x < 0.5001300871372223) {\n" + " return 9.81627851140242E+00 * x + 2.50023049219689E+02;\n" + " } else if (x < 0.9039205014705658) {\n" + " return ((-3.30848798119696E+01 * x - 5.65722561191396E+02) * x + 2.78046782759626E+02) * x + 2.61515979057614E+02;\n" + " } else {\n" + " return -2.53583846153761E+02 * x + 2.55396153846073E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1105575469849737) {\n" + " return 4.79433455433456E+02 * x + 3.65079365079361E-01;\n" + " } else if (x < 0.3151890079472769) {\n" + " return 6.25896582484846E+02 * x - 1.58275246854709E+01;\n" + " } else if (x < 0.4023888287265409) {\n" + " return 4.80700000000005E+02 * x + 2.99368421052611E+01;\n" + " } else if (x < 0.5007980763912201) {\n" + " return 3.22042124542111E+02 * x + 9.37789987790044E+01;\n" + " } else if (x < 0.9266376793384552) {\n" + " return ((-2.91150627193739E+02 * x + 2.73891595228739E+02) * x - 1.97954551648389E+02) * x + 3.22069054828072E+02;\n" + " } else {\n" + " return -4.70385384615211E+02 * x + 5.78034615384465E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1007720845701718) {\n" + " return 1.66813186813184E+01 * x + 3.72910052910053E+01;\n" + " } else if (x < 0.2891807195246389) {\n" + " return 2.86155895159223E+02 * x + 1.01354904806627E+01;\n" + " } else if (x < 0.4061884871072265) {\n" + " return 4.02182758620675E+02 * x - 2.34172413793071E+01;\n" + " } else if (x < 0.5018816861329155) {\n" + " return 5.35500000000025E+02 * x - 7.75691699604942E+01;\n" + " } else if (x < 0.604070194492165) {\n" + " return -5.10170329670400E+02 * x + 4.47233618233660E+02;\n" + " } else if (x < 0.7060918916718424) {\n" + " return -3.26878215654109E+02 * x + 3.36512315270959E+02;\n" + " } else if (x < 0.812819402403008) {\n" + " return -6.62557264957455E+01 * x + 1.52488888888906E+02;\n" + " } else {\n" + " return -2.16444081632622E+02 * x + 2.74564897959153E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Reds.h b/colormap-shaders/include/colormap/private/IDL/CB-Reds.h new file mode 100644 index 0000000..69b519d --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Reds.h @@ -0,0 +1,95 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBReds : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Reds.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Reds"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.7109796106815338) {\n" + " return (((-9.58108609441667E+02 * x + 8.89060620527714E+02) * x - 2.42747192807495E+02) * x + 9.97906310565304E+00) * x + 2.54641252219400E+02;\n" + " } else {\n" + " return ((-9.93985373158007E+02 * x + 1.96524174972026E+03) * x - 1.54068189744713E+03) * x + 6.72947219603874E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.7679868638515472) {\n" + " return ((((2.66433610509335E+03 * x - 5.05488641558587E+03) * x + 3.69542277742922E+03) * x - 1.36931912848446E+03) * x - 5.12669839132577E+01) * x + 2.41929417192750E+02;\n" + " } else {\n" + " return (-2.11738816337853E+02 * x + 2.78333107855597E+02) * x - 6.66958752910143E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return (((-6.83475279000297E+02 * x + 1.55250107598171E+03) * x - 9.25799053039285E+02) * x - 1.67380812671938E+02) * x + 2.37145226675143E+02;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Set1.h b/colormap-shaders/include/colormap/private/IDL/CB-Set1.h new file mode 100644 index 0000000..e81fdaf --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Set1.h @@ -0,0 +1,133 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBSet1 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Set1.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Set1"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.1218978105733187) {\n" + " return -1.41278189149560E+03 * x + 2.27681818181818E+02;\n" + " } else if (x < 0.2479420725675653) {\n" + " return 1.71483957219249E+02 * x + 3.45632798573976E+01;\n" + " } else if (x < 0.3737958863310976) {\n" + " return 5.93826871657766E+02 * x - 7.01532976827142E+01;\n" + " } else if (x < 0.5581935583402973) {\n" + " return 8.16999193548379E+02 * x - 1.53574193548385E+02;\n" + " } else if (x < 0.7521306441106583) {\n" + " return -7.03338903743339E+02 * x + 6.95068738859197E+02;\n" + " } else if (x < 0.8778625049273406) {\n" + " return 6.43286656891390E+02 * x - 3.17769611436878E+02;\n" + " } else {\n" + " return -7.44200222469495E+02 * x + 9.00253096032687E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1210132014777112) {\n" + " return 8.22324999999999E+02 * x + 2.59536290322581E+01;\n" + " } else if (x < 0.2482778857828818) {\n" + " return 3.90762700534761E+02 * x + 7.81783645276292E+01;\n" + " } else if (x < 0.3736981279637023) {\n" + " return -7.75174853372465E+02 * x + 3.67654875366580E+02;\n" + " } else if (x < 0.5000834495110191) {\n" + " return 3.88169354838696E+02 * x - 6.70846774193464E+01;\n" + " } else if (x < 0.6259565510341616) {\n" + " return 1.01632587976547E+03 * x - 3.81215359237582E+02;\n" + " } else if (x < 0.7519260802219788) {\n" + " return -1.34046122994658E+03 * x + 1.09403097147954E+03;\n" + " } else if (x < 0.8802211108953331) {\n" + " return 3.40231932773057E+02 * x - 1.69726050420116E+02;\n" + " } else {\n" + " return 1.89186206896551E+02 * x - 3.67724137931057E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1216936022984158) {\n" + " return 1.28638709677419E+03 * x + 2.74375000000001E+01;\n" + " } else if (x < 0.2481802512682617) {\n" + " return -8.68609237536630E+02 * x + 2.89686766862165E+02;\n" + " } else if (x < 0.3738953463082063) {\n" + " return 7.06041788856318E+02 * x - 1.01110520527863E+02;\n" + " } else if (x < 0.499829701274646) {\n" + " return -1.29118218475062E+03 * x + 6.45642228738955E+02;\n" + " } else if (x < 0.6262008893543518) {\n" + " return 3.99252005347605E+02 * x - 1.99286987522289E+02;\n" + " } else if (x < 0.752318389825417) {\n" + " return -8.38814516128947E+01 * x + 1.03251612903218E+02;\n" + " } else if (x < 0.8779851862270176) {\n" + " return 1.20109970674463E+03 * x - 8.63463343108315E+02;\n" + " } else {\n" + " return -3.03613348164648E+02 * x + 4.57652428624434E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Set2.h b/colormap-shaders/include/colormap/private/IDL/CB-Set2.h new file mode 100644 index 0000000..4652a97 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Set2.h @@ -0,0 +1,129 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBSet2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Set2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Set2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.1417230259672803) {\n" + " return 1.05935704125178E+03 * x + 1.01981507823613E+02;\n" + " } else if (x < 0.2832918395614404) {\n" + " return -7.84521574205797E+02 * x + 3.63301564722620E+02;\n" + " } else if (x < 0.4297095252306736) {\n" + " return 6.13507692307669E+02 * x - 3.27487179487109E+01;\n" + " } else if (x < 0.5711437760817145) {\n" + " return -4.56971171171184E+02 * x + 4.27246246246258E+02;\n" + " } else if (x < 0.7170125543394245) {\n" + " return 6.08443812233345E+02 * x - 1.81258890469442E+02;\n" + " } else if (x < 0.8601498726198596) {\n" + " return -1.86129554655803E+02 * x + 3.88460188933823E+02;\n" + " } else {\n" + " return -3.44927731092377E+02 * x + 5.25050420168008E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.1415748781045371) {\n" + " return -3.73352299668090E+02 * x + 1.93944523470839E+02;\n" + " } else if (x < 0.2833646736626308) {\n" + " return 1.32720720720722E+02 * x + 1.22297297297298E+02;\n" + " } else if (x < 0.4289465541806786) {\n" + " return -1.49887515045407E+02 * x + 2.02378487799539E+02;\n" + " } else if (x < 0.5702226800496928) {\n" + " return 5.49972024656235E+02 * x - 9.78238501659562E+01;\n" + " } else if (x < 0.7146023128494844) {\n" + " return 8.99797570850851E+00 * x + 2.10651821862350E+02;\n" + " } else if (x < 0.8745816247778255) {\n" + " return -1.44022832980902E+02 * x + 3.20000845665901E+02;\n" + " } else {\n" + " return -1.15363546797967E+02 * x + 2.94935960591057E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1415014758409641) {\n" + " return -4.74217638691322E+02 * x + 1.65038406827880E+02;\n" + " } else if (x < 0.2835702564175819) {\n" + " return 7.39899952584171E+02 * x - 6.76102418207873E+00;\n" + " } else if (x < 0.4295821637397355) {\n" + " return -5.64243717401478E+01 * x + 2.19052868658126E+02;\n" + " } else if (x < 0.5693521153970126) {\n" + " return -7.86119327731098E+02 * x + 5.32516806722689E+02;\n" + " } else if (x < 0.7156505014449713) {\n" + " return -2.61647700331917E+02 * x + 2.33907776197252E+02;\n" + " } else if (x < 0.858726752429748) {\n" + " return 7.09638034795805E+02 * x - 4.61193347193250E+02;\n" + " } else {\n" + " return 2.09176470588245E+02 * x - 3.14336134453805E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Set3.h b/colormap-shaders/include/colormap/private/IDL/CB-Set3.h new file mode 100644 index 0000000..09e2cc0 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Set3.h @@ -0,0 +1,149 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBSet3 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Set3.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Set3"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09082479229584027) {\n" + " return 1.24879652173913E+03 * x + 1.41460000000000E+02;\n" + " } else if (x < 0.1809653122266933) {\n" + " return -7.21339920948626E+02 * x + 3.20397233201581E+02;\n" + " } else if (x < 0.2715720097177793) {\n" + " return 6.77416996047422E+02 * x + 6.72707509881444E+01;\n" + " } else if (x < 0.3619607687891861) {\n" + " return -1.36850782608711E+03 * x + 6.22886666666710E+02;\n" + " } else if (x < 0.4527609316115322) {\n" + " return 1.38118774703557E+03 * x - 3.72395256916997E+02;\n" + " } else if (x < 0.5472860687991931) {\n" + " return -7.81436521739194E+02 * x + 6.06756521739174E+02;\n" + " } else if (x < 0.6360981817705944) {\n" + " return 8.06836521739242E+02 * x - 2.62483188405869E+02;\n" + " } else if (x < 0.8158623444475089) {\n" + " return -3.49616157878512E+02 * x + 4.73134258402717E+02;\n" + " } else if (x < 0.9098023786863947) {\n" + " return 1.72428853754953E+02 * x + 4.72173913043111E+01;\n" + " } else {\n" + " return 5.44142292490101E+02 * x - 2.90968379446626E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.08778161310534617) {\n" + " return 4.88563478260870E+02 * x + 2.10796666666667E+02;\n" + " } else if (x < 0.2697669137324175) {\n" + " return -6.96835646006769E+02 * x + 3.14852913968545E+02;\n" + " } else if (x < 0.3622079895714037) {\n" + " return 5.40799130434797E+02 * x - 1.90200000000068E+01;\n" + " } else if (x < 0.4519795462045253) {\n" + " return 3.23774703557373E+01 * x + 1.65134387351785E+02;\n" + " } else if (x < 0.5466820192751115) {\n" + " return 4.43064347826088E+02 * x - 2.04876811594176E+01;\n" + " } else if (x < 0.6368889369442862) {\n" + " return -1.83472332015826E+02 * x + 3.22028656126484E+02;\n" + " } else if (x < 0.728402572416003) {\n" + " return 1.27250988142231E+02 * x + 1.24132411067220E+02;\n" + " } else if (x < 0.8187333479165154) {\n" + " return -9.82116600790428E+02 * x + 9.32198616600708E+02;\n" + " } else if (x < 0.9094607880855196) {\n" + " return 1.17713438735149E+03 * x - 8.35652173912769E+02;\n" + " } else {\n" + " return 2.13339920948864E+01 * x + 2.15502964426857E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.09081516507716858) {\n" + " return -2.27937391304345E+02 * x + 1.99486666666666E+02;\n" + " } else if (x < 0.1809300436999751) {\n" + " return 4.33958498023703E+02 * x + 1.39376482213440E+02;\n" + " } else if (x < 0.2720053156712806) {\n" + " return -1.14300000000004E+03 * x + 4.24695652173923E+02;\n" + " } else if (x < 0.3616296568054424) {\n" + " return 1.08175889328072E+03 * x - 1.80450592885399E+02;\n" + " } else if (x < 0.4537067088757783) {\n" + " return -1.22681999999994E+03 * x + 6.54399999999974E+02;\n" + " } else if (x < 0.5472726179445029) {\n" + " return 8.30770750988243E+01 * x + 6.00909090909056E+01;\n" + " } else if (x < 0.6374811920489858) {\n" + " return 1.36487351778676E+03 * x - 6.41401185770872E+02;\n" + " } else if (x < 0.7237636846906381) {\n" + " return -1.27390769230737E+02 * x + 3.09889230769173E+02;\n" + " } else if (x < 0.8178226469606309) {\n" + " return -3.01831168831021E+02 * x + 4.36142857142782E+02;\n" + " } else if (x < 0.9094505664375214) {\n" + " return 8.47622811970801E+01 * x + 1.19977978543158E+02;\n" + " } else {\n" + " return -9.06117391304296E+02 * x + 1.02113405797096E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-Spectral.h b/colormap-shaders/include/colormap/private/IDL/CB-Spectral.h new file mode 100644 index 0000000..4384d04 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-Spectral.h @@ -0,0 +1,133 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBSpectral : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-Spectral.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-Spectral"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.09752005946586478) {\n" + " return 5.63203907203907E+02 * x + 1.57952380952381E+02;\n" + " } else if (x < 0.2005235116443438) {\n" + " return 3.02650769230760E+02 * x + 1.83361538461540E+02;\n" + " } else if (x < 0.2974133397506856) {\n" + " return 9.21045429665647E+01 * x + 2.25581007115501E+02;\n" + " } else if (x < 0.5003919130598823) {\n" + " return 9.84288115246108E+00 * x + 2.50046722689075E+02;\n" + " } else if (x < 0.5989021956920624) {\n" + " return -2.48619704433547E+02 * x + 3.79379310344861E+02;\n" + " } else if (x < 0.902860552072525) {\n" + " return ((2.76764884219295E+03 * x - 6.08393126459837E+03) * x + 3.80008072407485E+03) * x - 4.57725185424742E+02;\n" + " } else {\n" + " return 4.27603478260530E+02 * x - 3.35293188405479E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.09785836420571035) {\n" + " return 6.23754529914529E+02 * x + 7.26495726495790E-01;\n" + " } else if (x < 0.2034012006283468) {\n" + " return 4.60453201970444E+02 * x + 1.67068965517242E+01;\n" + " } else if (x < 0.302409765476316) {\n" + " return 6.61789401709441E+02 * x - 2.42451282051364E+01;\n" + " } else if (x < 0.4005965758690823) {\n" + " return 4.82379130434784E+02 * x + 3.00102898550747E+01;\n" + " } else if (x < 0.4981907026473237) {\n" + " return 3.24710622710631E+02 * x + 9.31717541717582E+01;\n" + " } else if (x < 0.6064345916502067) {\n" + " return -9.64699507389807E+01 * x + 3.03000000000023E+02;\n" + " } else if (x < 0.7987472620841592) {\n" + " return -2.54022986425337E+02 * x + 3.98545610859729E+02;\n" + " } else {\n" + " return -5.71281628959223E+02 * x + 6.51955082956207E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0997359608740309) {\n" + " return 1.26522393162393E+02 * x + 6.65042735042735E+01;\n" + " } else if (x < 0.1983790695667267) {\n" + " return -1.22037851037851E+02 * x + 9.12946682946686E+01;\n" + " } else if (x < 0.4997643530368805) {\n" + " return (5.39336225400169E+02 * x + 3.55461986381562E+01) * x + 3.88081126069087E+01;\n" + " } else if (x < 0.6025972254407099) {\n" + " return -3.79294261294313E+02 * x + 3.80837606837633E+02;\n" + " } else if (x < 0.6990141388105746) {\n" + " return 1.15990231990252E+02 * x + 8.23805453805459E+01;\n" + " } else if (x < 0.8032653181119567) {\n" + " return 1.68464957265204E+01 * x + 1.51683418803401E+02;\n" + " } else if (x < 0.9035796343050095) {\n" + " return 2.40199023199020E+02 * x - 2.77279202279061E+01;\n" + " } else {\n" + " return -2.78813846153774E+02 * x + 4.41241538461485E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-YIGn.h b/colormap-shaders/include/colormap/private/IDL/CB-YIGn.h new file mode 100644 index 0000000..e4427ff --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-YIGn.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBYIGn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-YIGn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-YIGn"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.6289940178394318) {\n" + " return ((5.11696133375750E+02 * x - 8.41303218634799E+02) * x + 2.59644604131609E+01) * x + 2.53419788769069E+02;\n" + " } else {\n" + " return (-1.59266359984140E+02 * x - 2.05336652594121E+01) * x + 1.40166356828632E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.7657577693462372) {\n" + " return ((1.07839212106774E+00 * x - 1.91222692546201E+02) * x - 1.99072424271726E+01) * x + 2.55781815734834E+02;\n" + " } else {\n" + " return (-2.23913463560442E+02 * x + 1.41364491447333E+02) * x + 1.51940340657207E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1102530658245087) {\n" + " return (-1.06015269490890E+01 * x - 3.53323657599336E+02) * x + 2.28818914956011E+02;\n" + " } else if (x < 0.7528357207775116) {\n" + " return (((6.02578715483658E+02 * x - 1.15715802822919E+03) * x + 7.15916939803876E+02) * x - 3.43088208134950E+02) * x + 2.19476164232866E+02;\n" + " } else {\n" + " return (-6.54502605847083E+01 * x + 1.22002989630042E+01) * x + 9.46764726107154E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-YIGnBu.h b/colormap-shaders/include/colormap/private/IDL/CB-YIGnBu.h new file mode 100644 index 0000000..2424078 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-YIGnBu.h @@ -0,0 +1,105 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBYIGnBu : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-YIGnBu.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-YIGnBu"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.2523055374622345) {\n" + " return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + 2.53829637096771E+02;\n" + " } else if (x < 0.6267540156841278) {\n" + " return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - 5.30725139102868E+03) * x + 8.58474724851723E+02) * x + 2.03329669375107E+02;\n" + " } else if (x < 0.8763731146612115) {\n" + " return 3.28717357910916E+01 * x + 8.82117255504255E+00;\n" + " } else {\n" + " return -2.29186583577707E+02 * x + 2.38482038123159E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.4578040540218353) {\n" + " return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + 2.09812296466262E+01) * x + 2.52987561849833E+02;\n" + " } else {\n" + " return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + 1.52699334501816E+03) * x - 6.48190622715140E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.1239372193813324) {\n" + " return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + 2.17553885630496E+02;\n" + " } else if (x < 0.7535201013088226) {\n" + " return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + 6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) * x + 1.56774650431396E+02;\n" + " } else {\n" + " return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x - 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - 6.55080846112976E+07) * x + 2.27664953009389E+07) * x - 3.28811994253461E+06;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/CB-YIOrBr.h b/colormap-shaders/include/colormap/private/IDL/CB-YIOrBr.h new file mode 100644 index 0000000..b249b35 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/CB-YIOrBr.h @@ -0,0 +1,93 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class CBYIOrBr : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_CB-YIOrBr.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("CB-YIOrBr"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return ((((1.30858855846896E+03 * x - 2.84649723684787E+03) * x + 1.76048857883363E+03) * x - 3.99775093706324E+02) * x + 2.69759225316811E+01) * x + 2.54587325383574E+02;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return ((((-8.85605750526301E+02 * x + 2.20590941129997E+03) * x - 1.50123293069936E+03) * x + 2.38490009587258E+01) * x - 6.03460495073813E+01) * x + 2.54768707485247E+02;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.2363454401493073) {\n" + " return (-3.68734834041388E+01 * x - 3.28163398692792E+02) * x + 2.27342862588147E+02;\n" + " } else if (x < 0.7571054399013519) {\n" + " return ((((1.60988309475108E+04 * x - 4.18782706486673E+04) * x + 4.14508040221340E+04) * x - 1.88926043556059E+04) * x + 3.50108270140290E+03) * x - 5.28541997751406E+01;\n" + " } else {\n" + " return 1.68513761929930E+01 * x - 1.06424668227935E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Eos_A.h b/colormap-shaders/include/colormap/private/IDL/Eos_A.h new file mode 100644 index 0000000..deed878 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Eos_A.h @@ -0,0 +1,145 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class EosA : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Eos_A.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Eos_A"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_h(float x) {\n" + " if (x < 0.1151580585723306) {\n" + " return (2.25507158009032E+00 * x - 1.17973110308697E+00) * x + 7.72551618145170E-01; // H1\n" + " } else if (x < (9.89643667779019E-01 - 6.61604251019618E-01) / (2.80520737708568E+00 - 1.40111938331467E+00)) {\n" + " return -2.80520737708568E+00 * x + 9.89643667779019E-01; // H2\n" + " } else if (x < (6.61604251019618E-01 - 4.13849520734156E-01) / (1.40111938331467E+00 - 7.00489176507247E-01)) {\n" + " return -1.40111938331467E+00 * x + 6.61604251019618E-01; // H3\n" + " } else if (x < (4.13849520734156E-01 - 2.48319927251200E-01) / (7.00489176507247E-01 - 3.49965224045823E-01)) {\n" + " return -7.00489176507247E-01 * x + 4.13849520734156E-01; // H4\n" + " } else {\n" + " return -3.49965224045823E-01 * x + 2.48319927251200E-01; // H5\n" + " }\n" + "}\n" + "\n" + "float colormap_v(float x) {\n" + " float v = 1.0;\n" + " if (x < 0.5) {\n" + " v = clamp(2.10566088679245E+00 * x + 7.56360684411500E-01, 0.0, 1.0);\n" + " } else {\n" + " v = clamp(-1.70132918347782E+00 * x + 2.20637371757606E+00, 0.0, 1.0);\n" + " }\n" + " float period = 4.0 / 105.0;\n" + " float len = 3.0 / 252.0;\n" + " float t = mod(x + 7.0 / 252.0, period);\n" + " if (0.0 <= t && t < len) {\n" + " if (x < 0.12) {\n" + " v = (1.87862631683169E+00 * x + 6.81498517051705E-01);\n" + " } else if (x < 0.73) {\n" + " v -= 26.0 / 252.0; \n" + " } else {\n" + " v = -1.53215278202992E+00 * x + 1.98649818445446E+00;\n" + " }\n" + " }\n" + " return v;\n" + "}\n" + "\n" + "// H1 - H2 = 0\n" + "// => [x=-0.8359672286003642,x=0.1151580585723306]\n" + "\n" + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float h = colormap_h(clamp(x, 0.0, 1.0));\n" + " float s = 1.0;\n" + " float v = colormap_v(clamp(x, 0.0, 1.0));\n" + " return colormap_hsv2rgb(h, s, v);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Eos_B.h b/colormap-shaders/include/colormap/private/IDL/Eos_B.h new file mode 100644 index 0000000..e8eade9 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Eos_B.h @@ -0,0 +1,170 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class EosB : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Eos_B.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Eos_B"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_h(float x) {\n" + " if (x < 0.1167535483837128) {\n" + " return 2.0 / 3.0; // H1\n" + " } else if (x < 0.1767823398113251) {\n" + " return ((-3.19659402385354E+02 * x + 1.14469539590179E+02) * x - 1.52210982227697E+01) * x + 1.39214703883044E+00; // H2\n" + " } else if (x < 0.2266354262828827) {\n" + " return ((-3.55166097640991E+02 * x + 2.51218596935272E+02) * x - 6.08853752315044E+01) * x + 5.38727123476564E+00; // H3\n" + " } else if (x < (6.95053970124612E-01 - 4.13725796136428E-01) / (1.48914458632691E+00 - 6.97458630656247E-01)) {\n" + " return -1.48914458632691E+00 * x + 6.95053970124612E-01; // H4\n" + " } else if (x < (4.13725796136428E-01 - 2.48329223043123E-01) / (6.97458630656247E-01 - 3.48617475202321E-01)) {\n" + " return -6.97458630656247E-01 * x + 4.13725796136428E-01; // H5\n" + " } else {\n" + " return -3.48617475202321E-01 * x + 2.48329223043123E-01; // H6\n" + " }\n" + "}\n" + "\n" + "float colormap_v(float x) {\n" + " float v = 1.0;\n" + " if (x < 0.115834504365921) {\n" + " v = 4.18575376272140E+00 * x + 5.15145240089963E-01; // V1-Hi\n" + " } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) {\n" + " v = -7.87450803534638E+00 * x + 1.90980360972022E+00; // V2-Hi\n" + " } else if (x < 0.5) {\n" + " v = 7.87450639585523E+00 * x - 9.13724751363001E-01; // V3-Hi\n" + " } else {\n" + " v = -1.87540494049556E+00 * x + 2.33603077812338E+00; // V4-Hi\n" + " }\n" + " v = clamp(v, 0.0, 1.0);\n" + "\n" + " float period = 4.0 / 105.0;\n" + " float len = 3.0 / 252.0;\n" + " float t = mod(x + 7.0 / 252.0, period);\n" + " if (0.0 <= t && t < len) {\n" + " if (x < 0.115834504365921) {\n" + " v = 3.74113124408467E+00 * x + 4.64654322955584E-01; // V1-Lo\n" + " } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) {\n" + " v = -3.97326878048783E+00 * x + 1.25308500609757E+00; // V2-Lo\n" + " } else if (x < 0.25) {\n" + " v = 6.99297032967038E+00 * x - 8.03946549450558E-01; // V3-Lo\n" + " } else if (x < 0.72) {\n" + " v -= 26.0 / 255.0;\n" + " } else {\n" + " v = -1.67870020621040E+00 * x + 2.09414636280895E+00; // V4-Lo\n" + " }\n" + " }\n" + "\n" + " return v;\n" + "}\n" + "\n" + "// H1 - H2 = 0\n" + "// => [x=0.1167535483837128]\n" + "\n" + "// H2 - H3 = 0\n" + "// => [x=0.1767823398113251,x=0.1822494566440582,x=3.492328017950058]\n" + "\n" + "// H3 - H4 = 0\n" + "// => [x=0.2266354262828827]\n" + "\n" + "// V1-Hi - 1 = 0\n" + "// => [x=0.115834504365921]\n" + "\n" + "// V2-Hi - V3-Hi = 0\n" + "// => \n" + "\n" + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float h = colormap_h(clamp(x, 0.0, 1.0));\n" + " float s = 1.0;\n" + " float v = colormap_v(clamp(x, 0.0, 1.0));\n" + " return colormap_hsv2rgb(h, s, v);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Green-Pink.h b/colormap-shaders/include/colormap/private/IDL/Green-Pink.h new file mode 100644 index 0000000..fe09c85 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Green-Pink.h @@ -0,0 +1,116 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class GreenPink : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Green-Pink.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Green-Pink"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (6.20000000000000E+02 - 6.05717647058824E+02) / (5.00000000000000E+00 - 4.87941176470588E+00)) { // 118.43902439\n" + " return 5.00000000000000E+00 * x - 6.20000000000000E+02;\n" + " } else if (x < (6.05717647058824E+02 - 3.12000000000000E+02) / (4.87941176470588E+00 - 3.00000000000000E+00)) { // 156.281690141\n" + " return 4.87941176470588E+00 * x - 6.05717647058824E+02;\n" + " } else if (x < (252.0 + 3.12000000000000E+02) / 3.00000000000000E+00) { // 188\n" + " return 3.00000000000000E+00 * x - 3.12000000000000E+02;\n" + " } else {\n" + " return 252.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (2.04536133198612E+02 + 1.47941176470588E+01) / (9.95833333333333E+00 + 1.14822299345429E+00)) {\n" + " return 9.95833333333333E+00 * x - 1.47941176470588E+01;\n" + " } else if (x < (2.72705547652916E+02 - 2.04536133198612E+02) / (1.69701280227596E+00 - 1.14822299345429E+00)) {\n" + " return -1.14822299345429E+00 * x + 2.04536133198612E+02;\n" + " } else if (x < 2.72705547652916E+02 / 1.69701280227596E+00) {\n" + " return -1.69701280227596E+00 * x + 2.72705547652916E+02;\n" + " } else if (x < 7.52000000000000E+02 / 4.00000000000000E+00) {\n" + " return 0.0;\n" + " } else if (x < (7.52000000000000E+02 - 7.45733990147783E+02) / (4.00000000000000E+00 - 3.95785440613027E+00)) {\n" + " return 4.00000000000000E+00 * x - 7.52000000000000E+02;\n" + " } else {\n" + " return 3.95785440613027E+00 * x - 7.45733990147783E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (2.50785650623886E+02 + 4.04215299263843E+01) / (1.92690173903766E+00 + 4.23796791443850E-01)) {\n" + " return 1.92690173903766E+00 * x - 4.04215299263843E+01;\n" + " } else if (x < (2.50785650623886E+02 - 1.58221357063404E+02) / (1.75528364849833E-01 + 4.23796791443850E-01)) {\n" + " return -4.23796791443850E-01 * x + 2.50785650623886E+02;\n" + " } else if (x < (1.58221357063404E+02 - 1.27826659541169E+01) / (9.48066572508303E-01 - 1.75528364849833E-01)) {\n" + " return 1.75528364849833E-01 * x + 1.58221357063404E+02;\n" + " } else {\n" + " return 9.48066572508303E-01 * x + 1.27826659541169E+01;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Green-Red-Blue-White.h b/colormap-shaders/include/colormap/private/IDL/Green-Red-Blue-White.h new file mode 100644 index 0000000..799a10a --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Green-Red-Blue-White.h @@ -0,0 +1,153 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class GreenRedBlueWhite : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Green-Red-Blue-White.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Green-Red-Blue-White"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.2648221343873518) {\n" + " return 1518.00 * x - 162.00;\n" + " } else if (x < 0.2806324110671937) {\n" + " return 759.00 * x + 39.00;\n" + " } else if (x < 0.2964426877470356) {\n" + " return 252.0;\n" + " } else if (x < 0.3122529644268774) {\n" + " return -253.00 * x + 327.00;\n" + " } else if (x < 0.3280632411067194) {\n" + " return 248.0;\n" + " } else if (x < 0.3596837944664031) {\n" + " return -253.00 * x + 331.00;\n" + " } else if (x < 0.3636363636363636) {\n" + " return 240.0;\n" + " } else if (x < 0.3794466403162055) {\n" + " return -253.00 * x + 332.00;\n" + " } else if (x < 0.391304347826087) {\n" + " return 236.0;\n" + " } else if (x < 0.4229249011857708) {\n" + " return -253.00 * x + 335.00;\n" + " } else if (x < 0.4387351778656127) {\n" + " return 228.0;\n" + " } else if (x < 0.4861660079051384) {\n" + " return -253.00 * x + 339.00;\n" + " } else if (x < 0.5019762845849802) {\n" + " return 216.0;\n" + " } else if (x < 0.549407114624506) {\n" + " return -253.00 * x + 343.00;\n" + " } else if (x < 0.5652173913043478) {\n" + " return 204.0;\n" + " } else if (x < 0.5968379446640316) {\n" + " return -253.00 * x + 347.00;\n" + " } else if (x < 0.6126482213438735) {\n" + " return 196.0;\n" + " } else if (x < 0.6600790513833992) {\n" + " return -253.00 * x + 351.00;\n" + " } else if (x < 0.6758893280632411) {\n" + " return 184.0;\n" + " } else if (x < 0.7075098814229249) {\n" + " return -253.00 * x + 355.00;\n" + " } else if (x < 0.7233201581027668) {\n" + " return 176.0;\n" + " } else if (x < 0.7707509881422925) {\n" + " return -253.00 * x + 359.00;\n" + " } else if (x < 0.7865612648221344) {\n" + " return 164.0;\n" + " } else if (x < 0.83399209486166) {\n" + " return -253.00 * x + 363.00;\n" + " } else if (x < 0.849802371541502) {\n" + " return 152.0;\n" + " } else if (x < 0.8662737248407505) {\n" + " return -253.00 * x + 367.00;\n" + " } else {\n" + " return 8.24946218487293E+02 * x - 5.66796485866989E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.04321209459549381) {\n" + " return 9.10799999999998E+02 * x + 6.80363636363637E+01;\n" + " } else if (x < 0.1067193675889328) {\n" + " return 2277.00 * x + 9.00;\n" + " } else if (x < 0.1225296442687747) {\n" + " return -759.00 * x + 333.00;\n" + " } else if (x < 0.6113554850777934) {\n" + " return -1518.00 * x + 426.00;\n" + " } else if (x < 0.9924501603814814) {\n" + " return 1.97884558823513E+03 * x - 1.71181573083763E+03;\n" + " } else {\n" + " return 253.00 * x + 1.00;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return 5.23682489688790E+02 * x - 1.55016347956506E+02;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Green-White_Exponential.h b/colormap-shaders/include/colormap/private/IDL/Green-White_Exponential.h new file mode 100644 index 0000000..6aff50d --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Green-White_Exponential.h @@ -0,0 +1,102 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class GreenWhiteExponential : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Green-White_Exponential.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Green-White_Exponential"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (5.33164074896858E-01 + 3.69558823529412E+01) / (6.61764705882353E-01 - 3.80845483226613E-01)) { // 133.451339048\n" + " return 3.80845483226613E-01 * x + 5.33164074896858E-01;\n" + " } else if(x < (2.21853643274093E+02 - 3.69558823529412E+01) / (1.86816585713397E+00 - 6.61764705882353E-01)) { // 153.263912861\n" + " return 6.61764705882353E-01 * x - 3.69558823529412E+01;\n" + " } else {\n" + " return 1.86816585713397E+00 * x - 2.21853643274093E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (8.74223522059742E+01 - 3.33294186729301E-01) / (1.34076340457443E+00 - 6.66705813270699E-01)) { // 129.201212393\n" + " return 6.66705813270699E-01 * x - 3.33294186729301E-01;\n" + " } else {\n" + " return 1.34076340457443E+00 * x - 8.74223522059742E+01;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (4.92898927047827E+02 - 4.63219741480611E-01) / (2.93126567624928E+00 - 2.63081042553601E-01)) {\n" + " return 2.63081042553601E-01 * x - 4.63219741480611E-01;\n" + " } else {\n" + " return 2.93126567624928E+00 * x - 4.92898927047827E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Green-White_Linear.h b/colormap-shaders/include/colormap/private/IDL/Green-White_Linear.h new file mode 100644 index 0000000..c72acab --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Green-White_Linear.h @@ -0,0 +1,88 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class GreenWhiteLinear : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Green-White_Linear.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Green-White_Linear"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return 1.61361058036781E+00 * x - 1.55391688559828E+02;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return 9.99817607003891E-01 * x + 1.01544260700389E+00;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return 3.44167852062589E+00 * x - 6.19885917496444E+02;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Hardcandy.h b/colormap-shaders/include/colormap/private/IDL/Hardcandy.h new file mode 100644 index 0000000..e2692df --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Hardcandy.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Hardcandy : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Hardcandy.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Hardcandy"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " float v = sin(2.0 * pi * (1.0 / (2.0 * 0.143365330321852)) * x + 1.55) * (322.0 * x) + 191.0 * x;\n" + " if (v < 0.0) {\n" + " v = -v;\n" + " } else if (v > 255.0) {\n" + " v = 255.0 - (v - 255.0);\n" + " }\n" + " return v;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " float v = sin(2.0 * pi / 0.675 * (x + 0.015)) * 190.0 + 25.0;\n" + " if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " return sin(2.0 * pi * (x * -3.45 - 0.02)) * 127.5 + 127.5;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Haze.h b/colormap-shaders/include/colormap/private/IDL/Haze.h new file mode 100644 index 0000000..39ee68f --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Haze.h @@ -0,0 +1,110 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Haze : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Haze.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Haze"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 167.0;\n" + " } else if (x < (2.54491177159840E+02 + 2.49117061281287E+02) / (1.94999353031535E+00 + 1.94987400471999E+00)) {\n" + " return -1.94987400471999E+00 * x + 2.54491177159840E+02;\n" + " } else if (x <= 255.0) {\n" + " return 1.94999353031535E+00 * x - 2.49117061281287E+02;\n" + " } else {\n" + " return 251.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 112.0;\n" + " } else if (x < (2.13852573128775E+02 + 1.42633630462899E+02) / (1.31530121382008E+00 + 1.39181683887691E+00)) {\n" + " return -1.39181683887691E+00 * x + 2.13852573128775E+02;\n" + " } else if (x <= 255.0) {\n" + " return 1.31530121382008E+00 * x - 1.42633630462899E+02;\n" + " } else {\n" + " return 195.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 255.0;\n" + " } else if (x <= 255.0) {\n" + " return -9.84241021836929E-01 * x + 2.52502692064968E+02;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = colormap_red(t) / 255.0;\n" + " float g = colormap_green(t) / 255.0;\n" + " float b = colormap_blue(t) / 255.0;\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_1.h b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_1.h new file mode 100644 index 0000000..5803f7f --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_1.h @@ -0,0 +1,118 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class HueSatLightness1 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Hue_Sat_Lightness_1.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Hue_Sat_Lightness_1"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_low(float x) {\n" + " return (-1.91005335917480E-03 * x + 1.49751468348116E+00) * x - 6.97037614414503E+00; // lower\n" + "}\n" + "\n" + "float colormap_up(float x) {\n" + " return (1.88420526249161E-03 * x - 5.03556849093925E-01) * x + 2.55777688663313E+02; // upper\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 43.76015739302458) { // first root of `lower = B1`\n" + " return colormap_up(x);\n" + " } else if (x < 86.85552651930304) { // first root of `lower = R1`\n" + " return (3.42882679808412E-02 * x - 7.47424573913507E+00) * x + 4.99200716753466E+02; // R1\n" + " } else if (x < 174.6136813850324) { // first root of `low = B2`\n" + " return colormap_low(x);\n" + " } else {\n" + " return ((1.12237347384081E-04 * x - 7.83534162528667E-02) * x + 1.86033275155350E+01) * x - 1.25879271751642E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 86.85552651930304) {\n" + " return colormap_low(x);\n" + " } else if (x < 130.6514942376722) {\n" + " return (-2.86318899478317E-02 * x + 8.83599571161434E+00) * x - 4.43544771805581E+02; // G1\n" + " } else {\n" + " return colormap_up(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 43.76015739302458) {\n" + " return (-3.50205069618621E-02 * x + 7.15746326474339E+00) * x - 8.79902788903102E+00; // B1\n" + " } else if (x < 130.6514942376722) { // first root of `upper = G1`\n" + " return colormap_up(x);\n" + " } else if (x < 174.6136813850324) { // first root of `low = B2`\n" + " return (1.99506804131033E-02 * x - 6.64847464240324E+00) * x + 7.48898397192062E+02; // B2\n" + " } else {\n" + " return colormap_low(x);\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_2.h b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_2.h new file mode 100644 index 0000000..52c7afb --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Lightness_2.h @@ -0,0 +1,157 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class HueSatLightness2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Hue_Sat_Lightness_2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Hue_Sat_Lightness_2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_up(float x) {\n" + " return (1.88200166286601E-03 * x - 4.65545143706978E-01) * x + 2.51008231568770E+02;\n" + "}\n" + "\n" + "float colormap_low(float x) {\n" + " return (-1.90879354636631E-03 * x - 5.05775136749144E-01) * x + 2.51839633472648E+02;\n" + "}\n" + "\n" + "float colormap_r1(float x) {\n" + " float t = x - 84.41170691108532;\n" + " return ((-1.30664056487685E-04 * t - 2.23609578814399E-02) * t - 1.63427831229829E+00) * t + colormap_low(84.41170691108532);\n" + "}\n" + "\n" + "float colormap_r2(float x) {\n" + " float t = (x - 172.4679464259528);\n" + " return (3.39051205856669E-02 * t + 1.53777364753859E+00) * t + colormap_low(172.4679464259528);\n" + "}\n" + "\n" + "float colormap_g1(float x) {\n" + " return (2.06966753567031E-02 * x - 3.81765550976615E+00) * x + 3.70329541512642E+02;\n" + "}\n" + "\n" + "float colormap_g2(float x) {\n" + " float t = x - 215.8140719563986;\n" + " return (-2.93369381849802E-02 * t - 4.45609461245051E+00) * t + colormap_up(215.8140719563986);\n" + "}\n" + "\n" + "float colormap_b1(float x) {\n" + " float t = (x - 129.0039558892991);\n" + " return (-2.69029805601284E-02 * t - 1.46365429919324E+00) * t + colormap_up(129.0039558892991);\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 84.41170691108532) {\n" + " return colormap_r1(x);\n" + " } else if (x < 172.4679464259528) {\n" + " return colormap_low(x);\n" + " } else if (x < 215.8140719563986) {\n" + " return colormap_r2(x);\n" + " } else {\n" + " return colormap_up(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 84.41170691108532) {\n" + " return colormap_low(x);\n" + " } else if (x < 129.0039558892991) {\n" + " return colormap_g1(x);\n" + " } else if (x < 215.8140719563986) {\n" + " return colormap_up(x);\n" + " } else {\n" + " return colormap_g2(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 129.0039558892991) {\n" + " return colormap_up(x);\n" + " } else if (x < 172.4679464259528) {\n" + " return colormap_b1(x);\n" + " } else {\n" + " return colormap_low(x);\n" + " }\n" + "}\n" + "\n" + "// G1 = low\n" + "// => [x=62.09621943267293,x=84.41170691108532]\n" + "\n" + "// G1 = up\n" + "// => [x=49.16072666680554,x=129.0039558892991]\n" + "\n" + "// B1 = low\n" + "// => [x=66.91982278615977,x=172.4679464259528]\n" + "\n" + "// R2 = up\n" + "// => [x=86.8352194379599,x=215.8140719563986]\n" + "\n" + "// low(172.4679464259528) = 107.83220272\n" + "// up(215.8140719563986) = 238.192608973\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_1.h b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_1.h new file mode 100644 index 0000000..cca9341 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_1.h @@ -0,0 +1,156 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class HueSatValue1 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Hue_Sat_Value_1.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Hue_Sat_Value_1"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_low(float x) {\n" + " return (3.31549320112257E-06 * x + 9.90093135228017E-01) * x - 2.85569629002368E-01;\n" + "}\n" + "\n" + "float colormap_r2(float x) {\n" + " float t = x - 172.2021990097892;\n" + " return (-2.39029325463818E-02 * t + 2.98715296752437E+00) * t + 170.308961782;\n" + "}\n" + "\n" + "float colormap_g1(float x) {\n" + " float t = x - 86.01791713538523;\n" + " return (-2.29102048531908E-02 * t + 4.93089581616270E+00) * t + 84.9047112396;\n" + "}\n" + "\n" + "float colormap_g2(float x) {\n" + " float t = x - 215.6804047700857;\n" + " return ((-2.84214232291614E-04 * t + 3.97502254733824E-02) * t - 1.21659773743153E+00) * t + 255.0;\n" + "}\n" + "\n" + "float colormap_b2(float x) {\n" + " float t = x - 129.1625547389263;\n" + " return (2.47358957372179E-02 * t - 3.03236899995258E+00) * t + 255.0;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 43.15291462916737) {\n" + " return 255.0;\n" + " } else if (x < 86.01791713538523) {\n" + " return (2.31649880284905E-02 * x - 6.92920742890475E+00) * x + 5.09541054138852E+02; // R1\n" + " } else if (x < 172.2021990097892) {\n" + " return colormap_low(x);\n" + " } else if (x < 215.6804047700857) {\n" + " return colormap_r2(x);\n" + " } else {\n" + " return 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 86.01791713538523) {\n" + " return colormap_low(x);\n" + " } else if (x < 129.1625547389263) {\n" + " return colormap_g1(x);\n" + " } else if (x < 215.6804047700857) {\n" + " return 255.0;\n" + " } else {\n" + " return colormap_g2(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 43.15291462916737) {\n" + " return (-2.29056417125175E-02 * x + 6.89833449327894E+00) * x - 2.89480825884616E-02; // B1\n" + " } else if (x < 129.1625547389263) {\n" + " return 255.0;\n" + " } else if (x < 172.2021990097892) {\n" + " return colormap_b2(x);\n" + " } else {\n" + " return colormap_low(x);\n" + " }\n" + "}\n" + "\n" + "// B1 - 255 = 0\n" + "// => [x=43.15291462916737,x=258.0102040408121]\n" + "\n" + "// R1 - low = 0\n" + "// => [x=86.01791713538523,x=255.8961027639475]\n" + "\n" + "// G1 - 255 = 0\n" + "// => [x=129.1625547389263,x=258.1003299995292]\n" + "\n" + "// B2 - low = 0\n" + "// => [x=172.2021990097892,x=248.7957319298701]\n" + "\n" + "// R2 - 255 = 0\n" + "// => [x=215.6804047700857,x=253.6941391396688]\n" + "\n" + "// low(86.01791713538523) = 84.9047112396\n" + "// low(172.2021990097892) = 170.308961782\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_2.h b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_2.h new file mode 100644 index 0000000..2378e6a --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Hue_Sat_Value_2.h @@ -0,0 +1,161 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class HueSatValue2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Hue_Sat_Value_2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Hue_Sat_Value_2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_low(float x) {\n" + " return -9.89123311722871E-01 * x + 2.54113856910082E+02;\n" + "}\n" + "\n" + "float colormap_r1(float x) {\n" + " float t = x - 44.52807774916808;\n" + " return (-2.10743035084859E-02 * t - 1.14339819510944E+00) * t + 255.0;\n" + "}\n" + "\n" + "float colormap_r2(float x) {\n" + " float t = x - 173.2142990353825;\n" + " return (2.10464655909683E-02 * t + 3.09770350177039E+00) * t + 82.7835558104;\n" + "}\n" + "\n" + "float colormap_g1(float x) {\n" + " float t = x - 87.18599073927922;\n" + " return (2.18814766236433E-02 * t + 1.07683877405025E+00) * t + 167.876161014;\n" + "}\n" + "\n" + "float colormap_g2(float x) {\n" + " float t = x - 216.2347301863598;\n" + " return (-1.75617661106684E-02 * t - 5.19390917463437E+00) * t + 255.0;\n" + "}\n" + "\n" + "float colormap_b2(float x) {\n" + " float t = x - 130.3078696041572;\n" + " return (-1.97675474706200E-02 * t - 3.16561290370380E+00) * t + 255.0;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 44.52807774916808) {\n" + " return 255.0;\n" + " } else if (x < 87.18599073927922) {\n" + " return colormap_r1(x);\n" + " } else if (x < 173.2142990353825) {\n" + " return colormap_low(x);\n" + " } else if (x < 216.2347301863598) {\n" + " return colormap_r2(x);\n" + " } else {\n" + " return 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 87.18599073927922) {\n" + " return colormap_low(x);\n" + " } else if (x < 130.3078696041572) {\n" + " return colormap_g1(x);\n" + " } else if (x < 216.2347301863598) {\n" + " return 255.0;\n" + " } else {\n" + " return colormap_g2(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 44.52807774916808) {\n" + " return (2.31958376441286E-02 * x - 1.01298265446011E+00) * x + 2.54114630079813E+02; // B1\n" + " } else if (x < 130.3078696041572) {\n" + " return 255.0;\n" + " } else if (x < 173.2142990353825) {\n" + " return colormap_b2(x);\n" + " } else {\n" + " return colormap_low(x);\n" + " }\n" + "}\n" + "\n" + "// B1 - 255 = 0\n" + "// => [x=-0.8571972230440585,x=44.52807774916808]\n" + "\n" + "// R1 - low = 0\n" + "// => [x=-5.450356335481052,x=87.18599073927922]\n" + "\n" + "// G1 - 255 = 0\n" + "// => [x=-5.148233003947013,x=130.3078696041572]\n" + "\n" + "// B2 - low = 0\n" + "// => [x=-22.70273917535556,x=173.2142990353825]\n" + "\n" + "// R2 - 255 = 0\n" + "// => [x=-16.99015635858727,x=216.2347301863598]\n" + "\n" + "// low(87.18599073927922) = 167.876161014\n" + "// low(173.2142990353825) = 82.7835558104\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Mac_Style.h b/colormap-shaders/include/colormap/private/IDL/Mac_Style.h new file mode 100644 index 0000000..5b4f1d5 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Mac_Style.h @@ -0,0 +1,123 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class MacStyle : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Mac_Style.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Mac_Style"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_h(float x) {\n" + " return -7.44992704834645E-01 * x + 7.47986634976377E-01;\n" + "}\n" + "\n" + "float colormap_s(float x) {\n" + " return 1.0;\n" + "}\n" + "\n" + "float colormap_v(float x) {\n" + " float i = mod(mod(x * 256.0, 2.0) + 2.0, 2.0);\n" + " if (0.0 <= i && i < 1.0) {\n" + " return 1.0;\n" + " } else {\n" + " return 254.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float h = colormap_h(clamp(x, 0.0, 1.0));\n" + " float s = colormap_s(clamp(x, 0.0, 1.0));\n" + " float v = colormap_v(clamp(x, 0.0, 1.0));\n" + " return colormap_hsv2rgb(h, s, v);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Nature.h b/colormap-shaders/include/colormap/private/IDL/Nature.h new file mode 100644 index 0000000..c35bd17 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Nature.h @@ -0,0 +1,130 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Nature : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Nature.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Nature"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.8) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " float v = sin(2.0 * pi * (x * 2.440771851872335 + 0.03082889566781979)) * 94.0 + 86.68712190457872;\n" + " if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + " } else {\n" + " return 82.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.8) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = - 133.8180196373718;\n" + " const float b = 105.5963045788319;\n" + " const float c = 1.192621559448461;\n" + " const float d = 4.00554233186818;\n" + " const float e = 0.04779355732364274;\n" + " const float f = 218.2356517672776;\n" + " const float g = -269.6049419208264;\n" + " float v = (a * x + b) * sin(2.0 * pi / c * (d * x + e)) + f + g * x;\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else {\n" + " return v;\n" + " }\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.8) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 2.443749115965466;\n" + " const float b = 0.02934035424870109;\n" + " const float c = 253.745120022022;\n" + " const float d = 226.671125688366;\n" + " float v = sin(2.0 * pi * (x * a + b))*c + d;\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + " } else {\n" + " return 214.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Ocean.h b/colormap-shaders/include/colormap/private/IDL/Ocean.h new file mode 100644 index 0000000..697653d --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Ocean.h @@ -0,0 +1,134 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Ocean : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Ocean.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Ocean"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.84121424085) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 92.39421034238549;\n" + " const float b = 88.02925388837211;\n" + " const float c = 0.5467741159150409;\n" + " const float d = 0.03040219113949284;\n" + " return a * sin(2.0 * pi / c * (x - d)) + b;\n" + " } else {\n" + " return 105.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.84121424085) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 92.44399971120093;\n" + " const float b = 22.7616696017667;\n" + " const float c = 0.3971750420482239;\n" + " const float d = 0.1428144080827581;\n" + " const float e = 203.7220396611977;\n" + " const float f = 49.51517183258432;\n" + " float v = (a * x + b) * sin(2.0 * pi / c * (x + d)) + (e * x + f);\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else {\n" + " return v;\n" + " }\n" + " } else {\n" + " return 246.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.84121424085) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 251.0868719483008;\n" + " const float b = 0.5472498585835275;\n" + " const float c = 0.02985857858149428;\n" + " const float d = 225.9495771701237;\n" + " float v = a * sin(2.0 * pi / b * (x - c)) + d;\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + " } else {\n" + " return 234.0;\n" + " }\n" + "}\n" + "\n" + "// R1 - 105 = 0\n" + "// => 0.8344881408181015\n" + "\n" + "// B1 - 234 = 0\n" + "// => 0.847940340889657\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Pastels.h b/colormap-shaders/include/colormap/private/IDL/Pastels.h new file mode 100644 index 0000000..a955b43 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Pastels.h @@ -0,0 +1,102 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Pastels : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Pastels.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Pastels"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 129.0) {\n" + " return -1.95881595881596E+00 * x + 4.39831831831832E+02;\n" + " } else {\n" + " return 5.70897317298797E+00 * x - 1.11405615171138E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 129.0) {\n" + " return 0.0;\n" + " } else if (x < 200.0) {\n" + " return 5.72337662337662E+00 * x - 6.06801082251082E+02;\n" + " } else {\n" + " return -5.58823529411765E+00 * x + 1.59313235294118E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 120.0) {\n" + " return 1.95784725990233E+00 * x + 6.90962481913547E+01;\n" + " } else {\n" + " return -5.71881606765328E+00 * x + 1.11517336152220E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Peppermint.h b/colormap-shaders/include/colormap/private/IDL/Peppermint.h new file mode 100644 index 0000000..9139eca --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Peppermint.h @@ -0,0 +1,87 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Peppermint : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Peppermint.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Peppermint"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return float(int(mod(x * 256.0 / 4.0, 4.0))) * 80.0;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return float(int(x * 256.0 / 16.0)) * 16.0;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return float(int(mod(x * 256.0, 4.0))) * 80.0;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Plasma.h b/colormap-shaders/include/colormap/private/IDL/Plasma.h new file mode 100644 index 0000000..7a08f60 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Plasma.h @@ -0,0 +1,116 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Plasma : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Plasma.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Plasma"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 12.16378802377247;\n" + " const float b = 0.05245257017955226;\n" + " const float c = 0.2532139106569052;\n" + " const float d = 0.02076964056039702;\n" + " const float e = 270.124167081014;\n" + " const float f = 1.724941960305955;\n" + " float v = (a * x + b) * sin(2.0 * pi / c * (x - d)) + e * x + f;\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 88.08537391182792;\n" + " const float b = 0.25280516046667;\n" + " const float c = 0.05956080245692388;\n" + " const float d = 106.5684078925541;\n" + " return a * sin(2.0 * pi / b * (x - c)) + d;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 63.89922420106684;\n" + " const float b = 0.4259605778503662;\n" + " const float c = 0.2529247343450655;\n" + " const float d = 0.5150868195804643;\n" + " const float e = 938.1798072557968;\n" + " const float f = 503.0883490697431;\n" + " float v = (a * x + b) * sin(2.0 * pi / c * x + d * 2.0 * pi) - e * x + f;\n" + " if (v > 255.0) {\n" + " return 255.0 - (v - 255.0);\n" + " } else {\n" + " return mod(v, 255.0);\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Prism.h b/colormap-shaders/include/colormap/private/IDL/Prism.h new file mode 100644 index 0000000..2ce4644 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Prism.h @@ -0,0 +1,100 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Prism : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Prism.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Prism"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (5.35651507139080E+02 + 4.75703324808184E-01) / (3.80568385693018E+00 + 4.18112109994712E+00)) {\n" + " return 3.80568385693018E+00 * x - 4.75703324808184E-01;\n" + " } else {\n" + " return -4.18112109994712E+00 * x + 5.35651507139080E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (7.72815970386039E+02 + 2.57000000000000E+02) / (4.00000000000000E+00 + 4.04283447911158E+00)) {\n" + " return 4.00000000000000E+00 * x - 2.57000000000000E+02;\n" + " } else {\n" + " return -4.04283447911158E+00 * x + 7.72815970386039E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (1.03175883256528E+03 + 4.87540173259576E+02) / (3.86517065024528E+00 + 4.04377880184332E+00)) {\n" + " return 3.86517065024528E+00 * x - 4.87540173259576E+02;\n" + " } else {\n" + " return -4.04377880184332E+00 * x + 1.03175883256528E+03;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Purple-Red+Stripes.h b/colormap-shaders/include/colormap/private/IDL/Purple-Red+Stripes.h new file mode 100644 index 0000000..62db4a2 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Purple-Red+Stripes.h @@ -0,0 +1,146 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class PurpleRedStripes : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Purple-Red+Stripes.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Purple-Red+Stripes"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_h(float x) {\n" + " if (x < 0.3310005332481092) {\n" + " return (4.38091557495284E-01 * x - 6.45518032448820E-01) * x + 8.32595065985926E-01; // H1\n" + " } else if (x < 0.836653386) {\n" + " return -9.95987681712782E-01 * x + 9.96092924041492E-01; // H2\n" + " } else if (x < 0.9144920256360881) {\n" + " return (-3.25656183098909E+00 * x + 4.39104086393490E+00) * x - 1.23205476222211E+00; // H3\n" + " } else {\n" + " return (1.68724608409684E+00 * x - 3.93349028637749E+00) * x + 2.24617746415606E+00; // H4\n" + " }\n" + "}\n" + "\n" + "float colormap_s(float x) {\n" + " if (x < 0.9124516770628384) {\n" + " return -2.49531958245657E+00 * x + 3.07915192631601E+00; // S1\n" + " } else {\n" + " return 2.28056601637550E+00 * x - 1.27861289779857E+00; // S2\n" + " }\n" + "}\n" + "\n" + "float colormap_v(float x) {\n" + " float v = clamp(7.55217853407034E-01 * x + 7.48186662435193E-01, 0.0, 1.0);\n" + " float period = 0.039840637;\n" + " float t = x - 0.027888446;\n" + " float tt = t - float(int(t / period)) * period;\n" + " if (0.0 <= tt && tt < 0.007968127) {\n" + " v -= 0.2;\n" + " }\n" + " return v;\n" + "}\n" + "\n" + "// H1 - H2 = 0\n" + "// => [x=-1.186402343934078,x=0.3310005332481092]\n" + "\n" + "// H3 - H4 = 0\n" + "// => [x=0.7693377859773962,x=0.9144920256360881]\n" + "\n" + "// S1 - 1 = 0\n" + "// => [x=0.9124516770628384]\n" + "\n" + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float h = colormap_h(clamp(x, 0.0, 1.0));\n" + " float s = colormap_s(clamp(x, 0.0, 1.0));\n" + " float v = colormap_v(clamp(x, 0.0, 1.0));\n" + " return colormap_hsv2rgb(h, s, v);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Rainbow+Black.h b/colormap-shaders/include/colormap/private/IDL/Rainbow+Black.h new file mode 100644 index 0000000..526abfe --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Rainbow+Black.h @@ -0,0 +1,112 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class RainbowBlack : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Rainbow+Black.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Rainbow+Black"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " if (x < 0.0) {\n" + " return vec4(0.0, 0.0, 0.0, 1.0);\n" + " } else if (1.0 < x) {\n" + " return vec4(0.0, 0.0, 0.0, 1.0);\n" + " } else {\n" + " float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0);\n" + " float s = 1.0;\n" + " float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0);\n" + " return colormap_hsv2rgb(h, s, v);\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Rainbow+White.h b/colormap-shaders/include/colormap/private/IDL/Rainbow+White.h new file mode 100644 index 0000000..ce5c78b --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Rainbow+White.h @@ -0,0 +1,112 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class RainbowWhite : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Rainbow+White.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Rainbow+White"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " if (x < 0.0) {\n" + " return vec4(0.0, 0.0, 0.0, 1.0);\n" + " } else if (1.0 < x) {\n" + " return vec4(1.0, 1.0, 1.0, 1.0);\n" + " } else {\n" + " float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0);\n" + " float s = 1.0;\n" + " float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0);\n" + " return colormap_hsv2rgb(h, s, v);\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Rainbow.h b/colormap-shaders/include/colormap/private/IDL/Rainbow.h new file mode 100644 index 0000000..295f425 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Rainbow.h @@ -0,0 +1,100 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Rainbow : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Rainbow.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Rainbow"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 100.0) {\n" + " return (-9.55123422981038E-02 * x + 5.86981763554179E+00) * x - 3.13964093701986E+00;\n" + " } else {\n" + " return 5.25591836734694E+00 * x - 8.32322857142857E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 150.0) {\n" + " return 5.24448979591837E+00 * x - 3.20842448979592E+02;\n" + " } else {\n" + " return -5.25673469387755E+00 * x + 1.34195877551020E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 80.0) {\n" + " return 4.59774436090226E+00 * x - 2.26315789473684E+00;\n" + " } else {\n" + " return -5.25112244897959E+00 * x + 8.30385102040816E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Rainbow_18.h b/colormap-shaders/include/colormap/private/IDL/Rainbow_18.h new file mode 100644 index 0000000..05f7ff4 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Rainbow_18.h @@ -0,0 +1,107 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Rainbow18 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Rainbow_18.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Rainbow_18"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float x16 = x * 16.0;\n" + " const float a = 255.0;\n" + " const float s = 1.0 / 255.0;\n" + " if (x16 < 1.0) {\n" + " return vec4(150.0, 0.0, 150.0, a) * s;\n" + " } else if (x16 < 2.0) {\n" + " return vec4(200.0, 0.0, 200.0, a) * s;\n" + " } else if (x16 < 3.0) {\n" + " return vec4(100.0, 100.0, 150.0, a) * s;\n" + " } else if (x16 < 4.0) {\n" + " return vec4(100.0, 100.0, 200.0, a) * s;\n" + " } else if (x16 < 5.0) {\n" + " return vec4(100.0, 100.0, 255.0, a) * s;\n" + " } else if (x16 < 6.0) {\n" + " return vec4(0.0, 140.0, 0.0, a) * s;\n" + " } else if (x16 < 7.0) {\n" + " return vec4(150.0, 170.0, 0.0, a) *s;\n" + " } else if (x16 < 8.0) {\n" + " return vec4(200.0, 200.0, 0.0, a) * s;\n" + " } else if (x16 < 9.0) {\n" + " return vec4(150.0, 200.0, 0.0, a) * s;\n" + " } else if (x16 < 10.0) {\n" + " return vec4(200.0, 255.0, 120.0, a) * s;\n" + " } else if (x16 < 11.0) {\n" + " return vec4(255.0, 255.0, 0.0, a) * s;\n" + " } else if (x16 < 12.0) {\n" + " return vec4(255.0, 200.0, 0.0, a) * s;\n" + " } else if (x16 < 13.0) {\n" + " return vec4(255.0, 160.0, 0.0, a) * s;\n" + " } else if (x16 < 14.0) {\n" + " return vec4(255.0, 125.0, 0.0, a) * s;\n" + " } else if (x16 < 15.0) {\n" + " return vec4(200.0, 50.0, 100.0, a) * s;\n" + " } else {\n" + " return vec4(175.0, 50.0, 75.0, a) * s;\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Rainbow_2.h b/colormap-shaders/include/colormap/private/IDL/Rainbow_2.h new file mode 100644 index 0000000..f00047f --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Rainbow_2.h @@ -0,0 +1,106 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Rainbow2 : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Rainbow_2.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Rainbow_2"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap_hsv2rgb(float h, float s, float v) {\n" + " float r = v;\n" + " float g = v;\n" + " float b = v;\n" + " if (s > 0.0) {\n" + " h *= 6.0;\n" + " int i = int(h);\n" + " float f = h - float(i);\n" + " if (i == 1) {\n" + " r *= 1.0 - s * f;\n" + " b *= 1.0 - s;\n" + " } else if (i == 2) {\n" + " r *= 1.0 - s;\n" + " b *= 1.0 - s * (1.0 - f);\n" + " } else if (i == 3) {\n" + " r *= 1.0 - s;\n" + " g *= 1.0 - s * f;\n" + " } else if (i == 4) {\n" + " r *= 1.0 - s * (1.0 - f);\n" + " g *= 1.0 - s;\n" + " } else if (i == 5) {\n" + " g *= 1.0 - s;\n" + " b *= 1.0 - s * f;\n" + " } else {\n" + " g *= 1.0 - s * (1.0 - f);\n" + " b *= 1.0 - s;\n" + " }\n" + " }\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float h = clamp(-7.44981265666511E-01 * x + 7.47965390904122E-01, 0.0, 1.0);\n" + " float s = 1.0;\n" + " float v = 1.0;\n" + " return colormap_hsv2rgb(h, s, v);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Red-Purple.h b/colormap-shaders/include/colormap/private/IDL/Red-Purple.h new file mode 100644 index 0000000..472f89d --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Red-Purple.h @@ -0,0 +1,100 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class RedPurple : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Red-Purple.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Red-Purple"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 25.97288868211422) {\n" + " return 3.07931034482759E+00 * x - 1.62758620689655E+00;\n" + " } else if(x < 154.7883608200706) {\n" + " return (-0.002335409922053 * x + 1.770196213987500) * x + 33.949335775363600;\n" + " } else {\n" + " return 252.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return ((7.125813968310300E-05 * x - 2.223039020276470E-02) * x + 2.367815929630070E+00) * x - 7.739188304766140E+01;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (2.51577880184332E+01 - 5.67741935483871E-01) / (9.88497695852535E-01 - 1.70189098998888E-01)) { // 30.0498444933\n" + " return 1.70189098998888E-01 * x - 5.67741935483871E-01;\n" + " } else if(x < 150.2124460352976) {\n" + " return 9.88497695852535E-01 * x - 2.51577880184332E+01;\n" + " } else {\n" + " return (-3.85393764961783E-03 * x + 2.82261880442729E+00) * x - 2.13706208872841E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Red_Temperature.h b/colormap-shaders/include/colormap/private/IDL/Red_Temperature.h new file mode 100644 index 0000000..1399628 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Red_Temperature.h @@ -0,0 +1,88 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class RedTemperature : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Red_Temperature.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Red_Temperature"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return 1.448953446096850 * x - 5.02253539008443e-1;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return 1.889376646180860 * x - 2.272028094820020e2;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return 3.92613636363636 * x - 7.46528409090909e+2;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Standard_Gamma-II.h b/colormap-shaders/include/colormap/private/IDL/Standard_Gamma-II.h new file mode 100644 index 0000000..f84115b --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Standard_Gamma-II.h @@ -0,0 +1,124 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class StandardGammaII : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Standard_Gamma-II.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Standard_Gamma-II"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (8.75333333333333E+01 + 2.19676470588235E+02) / (4.76470588235294E+00 + 1.00000000000000E-01)) { // 63.1507456671\n" + " return 4.76470588235294E+00 * x - 2.19676470588235E+02;\n" + " } else if (x < (8.75333333333333E+01 + 3.11000000000000E+02) / (5.00000000000000E+00 + 1.00000000000000E-01)) { // 78.1437908497\n" + " return -1.00000000000000E-01 * x + 8.75333333333333E+01;\n" + " } else if (x < (-3.11000000000000E+02 + 3.42345454545455E+02) / (5.32727272727273E+00 - 5.00000000000000E+00)) { // 95.7777777778\n" + " return 5.00000000000000E+00 * x - 3.11000000000000E+02;\n" + " } else if (x < (255.0 + 3.42345454545455E+02) / 5.32727272727273E+00) { // 112.129692833\n" + " return 5.32727272727273E+00 * x - 3.42345454545455E+02;\n" + " } else if (x < (1.49279020979021E+03 - 255.0) / 7.68531468531468E+00) { // 161.059144677\n" + " return 255.0;\n" + " } else if (x < (1.49279020979021E+03 + 7.19657722738218E+02) / (5.10010319917441E+00 + 7.68531468531468E+00)) { // 173.04463198\n" + " return -7.68531468531468E+00 * x + 1.49279020979021E+03;\n" + " } else if (x < (255.0 + 7.19657722738218E+02) / 5.10010319917441E+00) { // 191.105490355\n" + " return 5.10010319917441E+00 * x - 7.19657722738218E+02;\n" + " } else {\n" + " return 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (163.0 + 5.65896810850440E+02) / 5.07239736070381E+00) { // 143.69868112\n" + " return 5.07239736070381E+00 * x - 5.65896810850440E+02;\n" + " } else if (x < (163.0 + 9.06153846153846E+02) / 6.10769230769231E+00) { // 175.050377834\n" + " return 163.0;\n" + " } else {\n" + " return 6.10769230769231E+00 * x - 9.06153846153846E+02;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (5.16164662349676E+02 - 4.77795918367347E+00) / (5.20142857142857E+00 + 5.42900092506938E+00)) { // 48.1059305585\n" + " return 5.20142857142857E+00 * x + 4.77795918367347E+00;\n" + " } else if (x < 5.16164662349676E+02 / 5.42900092506938E+00) { // 95.0754419595\n" + " return -5.42900092506938E+00 * x + 5.16164662349676E+02;\n" + " } else if (x < 6.16058823529412E+02 / 4.84558823529412E+00) { // 127.138088012\n" + " return 0.0;\n" + " } else if (x < (9.31184615384615E+02 + 6.16058823529412E+02) / (4.84558823529412E+00 + 5.89230769230769E+00)) { // 144.091863932\n" + " return 4.84558823529412E+00 * x - 6.16058823529412E+02;\n" + " } else if (x < 9.31184615384615E+02 / 5.89230769230769E+00) { // 158.033942559\n" + " return -5.89230769230769E+00 * x + 9.31184615384615E+02;\n" + " } else if (x < 5.64142909048289E+02 / 3.22177684013127E+00) { // 175.103036939\n" + " return 0.0;\n" + " } else {\n" + " return 3.22177684013127E+00 * x - 5.64142909048289E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Steps.h b/colormap-shaders/include/colormap/private/IDL/Steps.h new file mode 100644 index 0000000..1332d7c --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Steps.h @@ -0,0 +1,112 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Steps : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Steps.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Steps"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_erf(float x) {\n" + " // erf approximation formula\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0));\n" + " float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x));\n" + " return sign(x) * sqrt(v);\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x <= 95.5) {\n" + " return 8.14475806451613E+00 * x - 5.23967741935484E+02;\n" + " } else {\n" + " return colormap_erf((x - 145.0) * 0.028) * 131.0 + 125.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < (3.14410256410256E+02 + 2.14285714285714E-01) / (4.25000000000000E+01 + 9.81196581196581E+00)) {\n" + " return 4.25000000000000E+01 * x - 2.14285714285714E-01;\n" + " } else if (x < 192.0) { // actual root: 193.529143410603\n" + " return -9.81196581196581E+00 * x + 3.14410256410256E+02;\n" + " } else {\n" + " return ((5.35129859215999E-04 * x - 2.98599683017528E-01) * x + 5.69466901216655E+01) * x - 3.71604038989543E+03;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 63.0) {\n" + " return 8.22620967741936E+00 * x - 2.63729032258065E+02;\n" + " } else if (x <= 95.5) {\n" + " return 4.97690615835777E+00 * x - 3.16414039589443E+02;\n" + " } else {\n" + " return (((-7.88871743679920E-05 * x + 7.21525684930384E-02) * x - 2.45956037640571E+01) * x + 3.70824713134765E+03) * x - 2.08852518066406E+05;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0 - 0.5;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Stern_Special.h b/colormap-shaders/include/colormap/private/IDL/Stern_Special.h new file mode 100644 index 0000000..f36be04 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Stern_Special.h @@ -0,0 +1,95 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class SternSpecial : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Stern_Special.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Stern_Special"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < (3.27037346938775E+02 + 9.33750000000000E+00) / (1.81250000000000E+01 + 5.18306122448980E+00)) { // 14.0428817217\n" + " return 1.81250000000000E+01 * x - 9.33750000000000E+00;\n" + " } else if (x <= 64.0) {\n" + " return -5.18306122448980E+00 * x + 3.27037346938775E+02;\n" + " } else {\n" + " return x;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < (8.01533134203946E+02 + 1.96917113893858E+00) / (1.99964221824687E+00 + 4.25020839121978E+00)) { // 128.063441841\n" + " return 1.99964221824687E+00 * x - 1.96917113893858E+00;\n" + " } else if (x < (8.01533134203946E+02 + 7.17997825045893E+02) / (3.80632931598691E+00 + 4.25020839121978E+00)) {\n" + " return -4.25020839121978E+00 * x + 8.01533134203946E+02;\n" + " } else {\n" + " return 3.80632931598691E+00 * x - 7.17997825045893E+02;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float t = x * 255.0;\n" + " float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0);\n" + " return vec4(r, x, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Volcano.h b/colormap-shaders/include/colormap/private/IDL/Volcano.h new file mode 100644 index 0000000..e2db0ef --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Volcano.h @@ -0,0 +1,139 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Volcano : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Volcano.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Volcano"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_r1(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 216.6901575438631;\n" + " const float b = 1.073972444219095;\n" + " const float c = 0.6275803332110022;\n" + " const float d = 221.6241814852619;\n" + " float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + " if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_r2(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 202.3454274460618;\n" + " const float b = 1.058678309228987;\n" + " const float c = 0.4891299991060677;\n" + " const float d = -72.38173481234448;\n" + " return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.4264009656413063) {\n" + " return colormap_r1(x);\n" + " } else if (x < 0.6024851624202665) {\n" + " const float a = (0.0 - 255.0) / (0.6024851624202665 - 0.4264009656413063);\n" + " const float b = -0.6024851624202665 * a;\n" + " return a * x + b;\n" + " } else {\n" + " return colormap_r2(x);\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 126.3856859482602;\n" + " const float b = 0.6744554815524477;\n" + " const float c = 0.01070628027163306;\n" + " const float d = 26.95058522613648;\n" + " float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + " if (v < 0.0) {\n" + " return -v;\n" + " } else {\n" + " return v;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 126.9540413031656;\n" + " const float b = 0.2891013907955124;\n" + " const float c = 0.5136633102640619;\n" + " const float d = 126.5159759632338;\n" + " return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + "}\n" + "\n" + "// R1 - 255 = 0\n" + "// => 0.4264009656413063\n" + "\n" + "// R2 = 0\n" + "// => 0.6024851624202665\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/IDL/Waves.h b/colormap-shaders/include/colormap/private/IDL/Waves.h new file mode 100644 index 0000000..32e9a98 --- /dev/null +++ b/colormap-shaders/include/colormap/private/IDL/Waves.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace IDL +{ + +class Waves : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/IDL_Waves.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("Waves"); + } + + std::string getCategory() const override + { + return std::string("IDL"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f(float x, float phase) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 126.9634465941118;\n" + " const float b = 1.011727672706345;\n" + " const float c = 0.0038512319231245;\n" + " const float d = 127.5277540583575;\n" + " return a * sin(2.0 * pi / b * x + 2.0 * pi * (c + phase)) + d;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " return colormap_f(x, 0.5);\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " const float pi = 3.141592653589793238462643383279502884197169399;\n" + " const float a = 63.19460736097507;\n" + " const float b = 0.06323746667143024;\n" + " const float c = 0.06208443629833329;\n" + " const float d = 96.56305326777574;\n" + " return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return colormap_f(x, 0.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n" + " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/autumn.h b/colormap-shaders/include/colormap/private/MATLAB/autumn.h new file mode 100644 index 0000000..b5e6ca8 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/autumn.h @@ -0,0 +1,73 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Autumn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_autumn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("autumn"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float g = clamp(x, 0.0, 1.0);\n" + " return vec4(1.0, g, 0.0, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/bone.h b/colormap-shaders/include/colormap/private/MATLAB/bone.h new file mode 100644 index 0000000..ed85b26 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/bone.h @@ -0,0 +1,101 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Bone : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_bone.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("bone"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.75) {\n" + " return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0;\n" + " } else {\n" + " return (13.0 + 8.0 / 9.0) / 10.0 * x - (3.0 + 8.0 / 9.0) / 10.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x <= 0.375) {\n" + " return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0;\n" + " } else if (x <= 0.75) {\n" + " return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 100.0;\n" + " } else {\n" + " return 8.0 / 9.0 * x + 1.0 / 9.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x <= 0.375) {\n" + " return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 1000.0;\n" + " } else {\n" + " return 8.0 / 9.0 * x + 1.0 / 9.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x), 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/cool.h b/colormap-shaders/include/colormap/private/MATLAB/cool.h new file mode 100644 index 0000000..a0c04a8 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/cool.h @@ -0,0 +1,83 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Cool : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_cool.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("cool"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return (1.0 + 1.0 / 63.0) * x - 1.0 / 63.0;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return -(1.0 + 1.0 / 63.0) * x + (1.0 + 1.0 / 63.0);\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = 1.0;\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/copper.h b/colormap-shaders/include/colormap/private/MATLAB/copper.h new file mode 100644 index 0000000..5bf1633 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/copper.h @@ -0,0 +1,87 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Copper : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_copper.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("copper"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " return 80.0 / 63.0 * x + 5.0 / 252.0;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " return 0.7936 * x - 0.0124;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " return 796.0 / 1575.0 * x + 199.0 / 25200.0;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x), 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/hot.h b/colormap-shaders/include/colormap/private/MATLAB/hot.h new file mode 100644 index 0000000..47f67f5 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/hot.h @@ -0,0 +1,75 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Hot : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_hot.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("hot"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float r = clamp(8.0 / 3.0 * x, 0.0, 1.0);\n" + " float g = clamp(8.0 / 3.0 * x - 1.0, 0.0, 1.0);\n" + " float b = clamp(4.0 * x - 3.0, 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/hsv.h b/colormap-shaders/include/colormap/private/MATLAB/hsv.h new file mode 100644 index 0000000..b97589d --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/hsv.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Hsv : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_hsv.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("hsv"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.5) {\n" + " return -6.0 * x + 67.0 / 32.0;\n" + " } else {\n" + " return 6.0 * x - 79.0 / 16.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.4) {\n" + " return 6.0 * x - 3.0 / 32.0;\n" + " } else {\n" + " return -6.0 * x + 79.0 / 16.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.7) {\n" + " return 6.0 * x - 67.0 / 32.0;\n" + " } else {\n" + " return -6.0 * x + 195.0 / 32.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x), 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/jet.h b/colormap-shaders/include/colormap/private/MATLAB/jet.h new file mode 100644 index 0000000..a849844 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/jet.h @@ -0,0 +1,99 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Jet : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_jet.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("jet"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.7) {\n" + " return 4.0 * x - 1.5;\n" + " } else {\n" + " return -4.0 * x + 4.5;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.5) {\n" + " return 4.0 * x - 0.5;\n" + " } else {\n" + " return -4.0 * x + 3.5;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.3) {\n" + " return 4.0 * x + 0.5;\n" + " } else {\n" + " return -4.0 * x + 2.5;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = clamp(colormap_red(x), 0.0, 1.0);\n" + " float g = clamp(colormap_green(x), 0.0, 1.0);\n" + " float b = clamp(colormap_blue(x), 0.0, 1.0);\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/parula.h b/colormap-shaders/include/colormap/private/MATLAB/parula.h new file mode 100644 index 0000000..9fc873a --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/parula.h @@ -0,0 +1,461 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Parula : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_parula.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("parula"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " if (x < 0.0) {\n" + " return vec4(0.0, 0.0, 0.0, 0.0);\n" + " } else if (1.0 < x) {\n" + " return vec4(0.0, 0.0, 0.0, 0.0);\n" + " }\n" + " if (x < 3.1250000000000000e-02) {\n" + " float dx = x - 1.5625000000000000e-02;\n" + " return ((vec4(-1.4151576683620706e+02, 2.4271369358056621e+01, 4.5510373586485706e+01, 1.0) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 2.6007355728658488e-01, 1.4968553250962457e+00, 3.0913652594248364e+00, 1.0)) * dx\n" + " + vec4( 2.0810000000000001e-01, 1.6630000000000000e-01, 5.2920000000000000e-01, 1.0);\n" + " } else if (x < 4.6875000000000000e-02) {\n" + " float dx = x - 3.1250000000000000e-02;\n" + " return ((vec4(-5.1390461057291191e+01, 1.2211762733842230e+01, -1.2843448884986955e+01, 1.0) * dx\n" + " + vec4(-6.6335515704472066e+00, 1.1377204386589042e+00, 2.1332987618665173e+00, 1.0)) * dx\n" + " + vec4( 1.5642431399834725e-01, 1.5146322069502911e+00, 3.1246980525790007e+00, 1.0)) * dx\n" + " + vec4( 2.1162380952380999e-01, 1.8978095238095199e-01, 5.7767619047619101e-01, 1.0);\n" + " } else if (x < 6.2500000000000000e-02) {\n" + " float dx = x - 4.6875000000000000e-02;\n" + " return ((vec4(-1.4725107464858192e+02, 1.3014608277362621e+01, 5.8634219534912217e+00, 1.0) * dx\n" + " + vec4(-9.0424794325077311e+00, 1.7101468168077587e+00, 1.5312620953827538e+00, 1.0)) * dx\n" + " + vec4(-8.8513670422823654e-02, 1.5591301328169576e+00, 3.1819568159735203e+00, 1.0)) * dx\n" + " + vec4( 2.1225238095238100e-01, 2.1377142857142900e-01, 6.2697142857142896e-01, 1.0);\n" + " } else if (x < 7.8125000000000000e-02) {\n" + " float dx = x - 6.2500000000000000e-02;\n" + " return ((vec4(-2.1469400225321081e+02, -1.4338005366630648e+01, -4.1817857976177763e+01, 1.0) * dx\n" + " + vec4(-1.5944873556660008e+01, 2.3202065798091316e+00, 1.8061099994526548e+00, 1.0)) * dx\n" + " + vec4(-4.7894106087856969e-01, 1.6221044046390967e+00, 3.2341032549553237e+00, 1.0)) * dx\n" + " + vec4( 2.0810000000000001e-01, 2.3860000000000001e-01, 6.7708571428571396e-01, 1.0);\n" + " } else if (x < 9.3750000000000000e-02) {\n" + " float dx = x - 7.8125000000000000e-02;\n" + " return ((vec4(-2.8846495443400278e+02, 2.0037550842697090e+02, 1.1771734328417965e+02, 1.0) * dx\n" + " + vec4(-2.6008654912279265e+01, 1.6481125782483199e+00, -1.5410209318067788e-01, 1.0)) * dx\n" + " + vec4(-1.1344649432057459e+00, 1.6841093914837442e+00, 3.2599158784908235e+00, 1.0)) * dx\n" + " + vec4( 1.9590476190476200e-01, 2.6445714285714300e-01, 7.2789999999999999e-01, 1.0);\n" + " } else if (x < 1.0937500000000000e-01) {\n" + " float dx = x - 9.3750000000000000e-02;\n" + " return ((vec4(-5.4509738001026233e+02, 5.1696771659011155e+01, -6.5374637230314454e+02, 1.0) * dx\n" + " + vec4(-3.9530449651373146e+01, 1.1040714535762580e+01, 5.3638983732652425e+00, 1.0)) * dx\n" + " + vec4(-2.1585134520128149e+00, 1.8823723151401646e+00, 3.3413189453671448e+00, 1.0)) * dx\n" + " + vec4( 1.7072857142857101e-01, 2.9193809523809500e-01, 7.7924761904761897e-01, 1.0);\n" + " } else if (x < 1.2500000000000000e-01) {\n" + " float dx = x - 1.0937500000000000e-01;\n" + " return ((vec4( 2.3639968744743715e+03, -8.1036503315845437e+02, -8.1573269216733058e+02, 1.0) * dx\n" + " + vec4(-6.5081889339354191e+01, 1.3464000707278728e+01, -2.5280462828444659e+01, 1.0)) * dx\n" + " + vec4(-3.7930812487429293e+00, 2.2652584908126849e+00, 3.0301226257549660e+00, 1.0)) * dx\n" + " + vec4( 1.2527142857142901e-01, 3.2424285714285700e-01, 8.3027142857142899e-01, 1.0);\n" + " } else if (x < 1.4062500000000000e-01) {\n" + " float dx = x - 1.2500000000000000e-01;\n" + " return ((vec4( 1.4125902630655582e+03, 2.5375056097507152e+02, 9.0826266478267496e+02, 1.0) * dx\n" + " + vec4( 4.5730464151631985e+01, -2.4521860222023822e+01, -6.3517932773788282e+01, 1.0)) * dx\n" + " + vec4(-4.0954472673010889e+00, 2.0924794358947931e+00, 1.6426476944700765e+00, 1.0)) * dx\n" + " + vec4( 5.9133333333333399e-02, 3.5983333333333301e-01, 8.6833333333333296e-01, 1.0);\n" + " } else if (x < 1.5625000000000000e-01) {\n" + " float dx = x - 1.4062500000000000e-01;\n" + " return ((vec4(-1.9850459267366693e+03, 1.4738473211499172e+02, 2.4976683303608979e+02, 1.0) * dx\n" + " + vec4( 1.1194563273283002e+02, -1.2627302676317344e+01, -2.0943120362100398e+01, 1.0)) * dx\n" + " + vec4(-1.6317582534813697e+00, 1.5120237656082123e+00, 3.2294373922181602e-01, 1.0)) * dx\n" + " + vec4( 1.1695238095238101e-02, 3.8750952380952403e-01, 8.8195714285714299e-01, 1.0);\n" + " } else if (x < 1.7187500000000000e-01) {\n" + " float dx = x - 1.5625000000000000e-01;\n" + " return ((vec4(-1.3211246088080517e+02, 6.1731462945951478e+01, 9.6199145930320853e+01, 1.0) * dx\n" + " + vec4( 1.8896604917048652e+01, -5.7186433584271068e+00, -9.2353000635336890e+00, 1.0)) * dx\n" + " + vec4( 4.1265170979798449e-01, 1.2253683588153301e+00, -1.4859407992871662e-01, 1.0)) * dx\n" + " + vec4( 5.9571428571428596e-03, 4.0861428571428599e-01, 8.8284285714285704e-01, 1.0);\n" + " } else if (x < 1.8750000000000000e-01) {\n" + " float dx = x - 1.7187500000000000e-01;\n" + " return ((vec4(-2.4276114402580023e+02, 1.8878292291818184e+01, 5.4500811814199913e+01, 1.0) * dx\n" + " + vec4( 1.2703833313260910e+01, -2.8249810328356313e+00, -4.7259650980498993e+00, 1.0)) * dx\n" + " + vec4( 9.0640855714657143e-01, 1.0918742277018498e+00, -3.6673884807846019e-01, 1.0)) * dx\n" + " + vec4( 1.6514285714285700e-02, 4.2659999999999998e-01, 8.7863333333333304e-01, 1.0);\n" + " } else if (x < 2.0312500000000000e-01) {\n" + " float dx = x - 1.8750000000000000e-01;\n" + " return ((vec4(-2.4875702015890445e+02, 2.7531596458333780e+01, 1.1605149669749400e+01, 1.0) * dx\n" + " + vec4( 1.3244046870515243e+00, -1.9400610816566539e+00, -2.1712395442592785e+00, 1.0)) * dx\n" + " + vec4( 1.1255997759014531e+00, 1.0174204446629080e+00, -4.7450767061454108e-01, 1.0)) * dx\n" + " + vec4( 3.2852380952381001e-02, 4.4304285714285702e-01, 8.7195714285714299e-01, 1.0);\n" + " } else if (x < 2.1875000000000000e-01) {\n" + " float dx = x - 2.0312500000000000e-01;\n" + " return ((vec4( 6.6879357994795782e+01, 3.3156266362545779e+00, 3.1398894268734253e+01, 1.0) * dx\n" + " + vec4(-1.0336080632897122e+01, -6.4951749767225808e-01, -1.6272481534897754e+00, 1.0)) * dx\n" + " + vec4( 9.8479233924761567e-01, 9.7695827936089374e-01, -5.3385904089187008e-01, 1.0)) * dx\n" + " + vec4( 4.9814285714285700e-02, 4.5857142857142902e-01, 8.6405714285714297e-01, 1.0);\n" + " } else if (x < 2.3437500000000000e-01) {\n" + " float dx = x - 2.1875000000000000e-01;\n" + " return ((vec4(-3.7807546774099214e+00, 2.9110963663947160e+01, 2.0085673255558202e+01, 1.0) * dx\n" + " + vec4(-7.2011107268910699e+00, -4.9409749909782474e-01, -1.5542498464285720e-01, 1.0)) * dx\n" + " + vec4( 7.1077372425092522e-01, 9.5908929503636120e-01, -5.6171330867519242e-01, 1.0)) * dx\n" + " + vec4( 6.2933333333333299e-02, 4.7369047619047600e-01, 8.5543809523809500e-01, 1.0);\n" + " } else if (x < 2.5000000000000000e-01) {\n" + " float dx = x - 2.3437500000000000e-01;\n" + " return ((vec4(-1.8052110713761824e+01, 7.5676044216235097e+00, 2.6820241280346455e+01, 1.0) * dx\n" + " + vec4(-7.3783336023946600e+00, 8.7047892264969851e-01, 7.8609094921143352e-01, 1.0)) * dx\n" + " + vec4( 4.8296990660583561e-01, 9.6497025477935916e-01, -5.5185915297880839e-01, 1.0)) * dx\n" + " + vec4( 7.2266666666666701e-02, 4.8866666666666703e-01, 8.4670000000000001e-01, 1.0);\n" + " } else if (x < 2.6562500000000000e-01) {\n" + " float dx = x - 2.5000000000000000e-01;\n" + " return ((vec4(-8.5042116753280467e+01, 3.9234694840689350e+01, 6.3623990194130904e+01, 1.0) * dx\n" + " + vec4(-8.2245262921022455e+00, 1.2252103799133005e+00, 2.0432897592276738e+00, 1.0)) * dx\n" + " + vec4( 2.3917522075432149e-01, 9.9771540013190607e-01, -5.0765007940944740e-01, 1.0)) * dx\n" + " + vec4( 7.7942857142857203e-02, 5.0398571428571404e-01, 8.3837142857142899e-01, 1.0);\n" + " } else if (x < 2.8125000000000000e-01) {\n" + " float dx = x - 2.6562500000000000e-01;\n" + " return ((vec4(-4.4981860368289709e+01, 3.5222378119677195e+01, 1.8276940800992332e+01, 1.0) * dx\n" + " + vec4(-1.2210875514912267e+01, 3.0643367005706139e+00, 5.0256642995775600e+00, 1.0)) * dx\n" + " + vec4(-8.0127932480280273e-02, 1.0647395732644671e+00, -3.9719767224061564e-01, 1.0)) * dx\n" + " + vec4( 7.9347619047619000e-02, 5.2002380952381000e-01, 8.3118095238095202e-01, 1.0);\n" + " } else if (x < 2.9687500000000000e-01) {\n" + " float dx = x - 2.8125000000000000e-01;\n" + " return ((vec4( 8.8958586797831074e+01, -6.4031864461777545e+01, -5.4343639113056135e+01, 1.0) * dx\n" + " + vec4(-1.4319400219675847e+01, 4.7153856749304826e+00, 5.8823958996240755e+00, 1.0)) * dx\n" + " + vec4(-4.9466349083321959e-01, 1.1862977353816719e+00, -2.2675923162809006e-01, 1.0)) * dx\n" + " + vec4( 7.4942857142857103e-02, 5.3754285714285699e-01, 8.2627142857142899e-01, 1.0);\n" + " } else if (x < 3.1250000000000000e-01) {\n" + " float dx = x - 2.9687500000000000e-01;\n" + " return ((vec4( 2.3465669412937996e+02, -7.4943148843863256e+01, -1.7040059387215410e+02, 1.0) * dx\n" + " + vec4(-1.0149466463527515e+01, 1.7138920282846606e+00, 3.3350378161995691e+00, 1.0)) * dx\n" + " + vec4(-8.7698953275827207e-01, 1.2867551994944084e+00, -8.2736829818345611e-02, 1.0)) * dx\n" + " + vec4( 6.4057142857142799e-02, 5.5698571428571397e-01, 8.2395714285714305e-01, 1.0);\n" + " } else if (x < 3.2812500000000000e-01) {\n" + " float dx = x - 3.1250000000000000e-01;\n" + " return ((vec4( 3.5054309382746595e+02, -7.5598816353949772e+01, -5.9224118732067950e+01, 1.0) * dx\n" + " + vec4( 8.5006607378717081e-01, -1.7990680737714295e+00, -4.6524900215576546e+00, 1.0)) * dx\n" + " + vec4(-1.0222926638479650e+00, 1.2854243237836778e+00, -1.0332202052706571e-01, 1.0)) * dx\n" + " + vec4( 4.8771428571428597e-02, 5.7722380952381003e-01, 8.2282857142857202e-01, 1.0);\n" + " } else if (x < 3.4375000000000000e-01) {\n" + " float dx = x - 3.2812500000000000e-01;\n" + " return ((vec4(-1.3511844086782639e+02, 2.1571557117596814e+01, 6.5912402293741552e+00, 1.0) * dx\n" + " + vec4( 1.7281773596949638e+01, -5.3427625903628249e+00, -7.4286205871233397e+00, 1.0)) * dx\n" + " + vec4(-7.3898266899270237e-01, 1.1738332196565799e+00, -2.9208937378770627e-01, 1.0)) * dx\n" + " + vec4( 3.4342857142857203e-02, 5.9658095238095199e-01, 8.1985238095238100e-01, 1.0);\n" + " } else if (x < 3.5937500000000000e-01) {\n" + " float dx = x - 3.4375000000000000e-01;\n" + " return ((vec4(-1.6458788273706924e+02, 1.0533768835542057e+01, 3.0362548290707878e+01, 1.0) * dx\n" + " + vec4( 1.0948096681270275e+01, -4.3315958504754741e+00, -7.1196562013714262e+00, 1.0)) * dx\n" + " + vec4(-2.9789094589551629e-01, 1.0226713690184817e+00, -5.1940619860793691e-01, 1.0)) * dx\n" + " + vec4( 2.6499999999999999e-02, 6.1370000000000002e-01, 8.1350000000000000e-01, 1.0);\n" + " } else if (x < 3.7500000000000000e-01) {\n" + " float dx = x - 3.5937500000000000e-01;\n" + " return ((vec4(-1.0406115199344315e+02, 1.9929786587720105e+01, 3.6734795179105028e+01, 1.0) * dx\n" + " + vec4( 3.2330396779701545e+00, -3.8378254363094402e+00, -5.6964117502444944e+00, 1.0)) * dx\n" + " + vec4(-7.6310690282384588e-02, 8.9502416141246732e-01, -7.1965726035193567e-01, 1.0)) * dx\n" + " + vec4( 2.3890476190476202e-02, 6.2866190476190498e-01, 8.0376190476190501e-01, 1.0);\n" + " } else if (x < 3.9062500000000000e-01) {\n" + " float dx = x - 3.7500000000000000e-01;\n" + " return ((vec4( 2.3255546213942225e+02, 1.8349599099637384e+01, 1.7433813849989207e+01, 1.0) * dx\n" + " + vec4(-1.6448268217224928e+00, -2.9036166900100602e+00, -3.9744682262239461e+00, 1.0)) * dx\n" + " + vec4(-5.1494864403514876e-02, 7.8968912818872505e-01, -8.7076475998425507e-01, 1.0)) * dx\n" + " + vec4( 2.3090476190476199e-02, 6.4178571428571396e-01, 7.9126666666666701e-01, 1.0);\n" + " } else if (x < 4.0625000000000000e-01) {\n" + " float dx = x - 3.9062500000000000e-01;\n" + " return ((vec4( 1.5126193200717549e+02, 2.0267550346934740e+01, 2.0857035135376179e+01, 1.0) * dx\n" + " + vec4( 9.2562104660629245e+00, -2.0434792322145579e+00, -3.1572582020057021e+00, 1.0)) * dx\n" + " + vec4( 6.7433005039304356e-02, 7.1239075440396538e-01, -9.8219798542534331e-01, 1.0)) * dx\n" + " + vec4( 2.2771428571428599e-02, 6.5348571428571400e-01, 7.7675714285714303e-01, 1.0);\n" + " } else if (x < 4.2187500000000000e-01) {\n" + " float dx = x - 4.0625000000000000e-01;\n" + " return ((vec4( 1.0861181935568159e+02, -5.7969433444380156e+00, 3.9956456082908054e+00, 1.0) * dx\n" + " + vec4( 1.6346613528899276e+01, -1.0934378097019919e+00, -2.1795846800349437e+00, 1.0)) * dx\n" + " + vec4( 4.6747712996058871e-01, 6.6337642562401933e-01, -1.0655861554572283e+00, 1.0)) * dx\n" + " + vec4( 2.6661904761904800e-02, 6.6419523809523795e-01, 7.6071904761904796e-01, 1.0);\n" + " } else if (x < 4.3750000000000000e-01) {\n" + " float dx = x - 4.2187500000000000e-01;\n" + " return ((vec4(-3.0484063800132168e+02, 1.4154965887634640e+01, -3.1353889969814710e+00, 1.0) * dx\n" + " + vec4( 2.1437792561196851e+01, -1.3651695289725239e+00, -1.9922887921463122e+00, 1.0)) * dx\n" + " + vec4( 1.0578584751183406e+00, 6.2496068595722998e-01, -1.1307716784600605e+00, 1.0)) * dx\n" + " + vec4( 3.8371428571428598e-02, 6.7427142857142897e-01, 7.4355238095238096e-01, 1.0);\n" + " } else if (x < 4.5312500000000000e-01) {\n" + " float dx = x - 4.3750000000000000e-01;\n" + " return ((vec4( 1.9732370744832981e+01, -3.3873392535419122e+00, -5.1854420010455629e+00, 1.0) * dx\n" + " + vec4( 7.1483876548848961e+00, -7.0165550298965007e-01, -2.1392601513798186e+00, 1.0)) * dx\n" + " + vec4( 1.5045175409946179e+00, 5.9266654483282100e-01, -1.1953271307026563e+00, 1.0)) * dx\n" + " + vec4( 5.8971428571428598e-02, 6.8375714285714295e-01, 7.2538571428571397e-01, 1.0);\n" + " } else if (x < 4.6875000000000000e-01) {\n" + " float dx = x - 4.5312500000000000e-01;\n" + " return ((vec4(-5.2460806882781675e+01, -6.0560887320505685e-01, 1.3890718905419471e+01, 1.0) * dx\n" + " + vec4( 8.0733425335489422e+00, -8.6043703049942721e-01, -2.3823277451788294e+00, 1.0)) * dx\n" + " + vec4( 1.7423570751888966e+00, 5.6825884899705426e-01, -1.2659769415863851e+00, 1.0)) * dx\n" + " + vec4( 8.4300000000000000e-02, 6.9283333333333297e-01, 7.0616666666666705e-01, 1.0);\n" + " } else if (x < 4.8437500000000000e-01) {\n" + " float dx = x - 4.6875000000000000e-01;\n" + " return ((vec4( 1.0354971072183483e+01, 5.8097747460711062e+00, -5.4384621916749820e+00, 1.0) * dx\n" + " + vec4( 5.6142422109185510e+00, -8.8882494643091425e-01, -1.7312002964872917e+00, 1.0)) * dx\n" + " + vec4( 1.9562255868212013e+00, 5.4092663060751767e-01, -1.3302508172374183e+00, 1.0)) * dx\n" + " + vec4( 1.1329523809523800e-01, 7.0150000000000001e-01, 6.8585714285714305e-01, 1.0);\n" + " } else if (x < 5.0000000000000000e-01) {\n" + " float dx = x - 4.8437500000000000e-01;\n" + " return ((vec4(-1.3925172644537971e+01, -8.9021377300786071e+00, -4.6199177582688593e+00, 1.0) * dx\n" + " + vec4( 6.0996314799271518e+00, -6.1649175520883115e-01, -1.9861282117220564e+00, 1.0)) * dx\n" + " + vec4( 2.1392548632406654e+00, 5.1740605714439658e-01, -1.3883340751781894e+00, 1.0)) * dx\n" + " + vec4( 1.4527142857142900e-01, 7.0975714285714298e-01, 6.6462857142857201e-01, 1.0);\n" + " } else if (x < 5.1562500000000000e-01) {\n" + " float dx = x - 5.0000000000000000e-01;\n" + " return ((vec4( 3.1614367125520630e+01, -1.1395280968671647e+01, 2.1421523701702025e+01, 1.0) * dx\n" + " + vec4( 5.4468890122144344e+00, -1.0337794613062659e+00, -2.2026868566409092e+00, 1.0)) * dx\n" + " + vec4( 2.3196692459303776e+00, 4.9162056938634824e-01, -1.4537843106213608e+00, 1.0)) * dx\n" + " + vec4( 1.8013333333333301e-01, 7.1765714285714299e-01, 6.4243333333333297e-01, 1.0);\n" + " } else if (x < 5.3125000000000000e-01) {\n" + " float dx = x - 5.1562500000000000e-01;\n" + " return ((vec4(-3.7634010143333590e+01, 2.0544616050328934e+00, 1.3219372364175872e+00, 1.0) * dx\n" + " + vec4( 6.9288124712232140e+00, -1.5679332567127493e+00, -1.1985529331236269e+00, 1.0)) * dx\n" + " + vec4( 2.5130395816090907e+00, 4.5096880816730112e-01, -1.5069286823364316e+00, 1.0)) * dx\n" + " + vec4( 2.1782857142857101e-01, 7.2504285714285699e-01, 6.1926190476190501e-01, 1.0);\n" + " } else if (x < 5.4687500000000000e-01) {\n" + " float dx = x - 5.3125000000000000e-01;\n" + " return ((vec4( 1.2815768685879013e+01, -1.4298832118473902e+01, 3.9450879734146490e+01, 1.0) * dx\n" + " + vec4( 5.1647182457544520e+00, -1.4716303689768324e+00, -1.1365871251665525e+00, 1.0)) * dx\n" + " + vec4( 2.7020009990618670e+00, 4.0347562651590141e-01, -1.5434152457472157e+00, 1.0)) * dx\n" + " + vec4( 2.5864285714285701e-01, 7.3171428571428598e-01, 5.9542857142857097e-01, 1.0);\n" + " } else if (x < 5.6250000000000000e-01) {\n" + " float dx = x - 5.4687500000000000e-01;\n" + " return ((vec4(-7.8540912219456771e+01, -1.8509114083431125e+01, 3.3113477160250433e+01, 1.0) * dx\n" + " + vec4( 5.7654574029050307e+00, -2.1418881245302965e+00, 7.1267286237156402e-01, 1.0)) * dx\n" + " + vec4( 2.8727849935721714e+00, 3.4701440005485251e-01, -1.5500389061033872e+00, 1.0)) * dx\n" + " + vec4( 3.0217142857142898e-01, 7.3760476190476199e-01, 5.7118571428571396e-01, 1.0);\n" + " } else if (x < 5.7812500000000000e-01) {\n" + " float dx = x - 5.6250000000000000e-01;\n" + " return ((vec4(-5.8163891236508938e+01, 9.6920884524980497e+00, 3.0320583052976861e+01, 1.0) * dx\n" + " + vec4( 2.0838521426179946e+00, -3.0095028471911305e+00, 2.2648671042583031e+00, 1.0)) * dx\n" + " + vec4( 2.9954304552209687e+00, 2.6652391612170523e-01, -1.5035148441247956e+00, 1.0)) * dx\n" + " + vec4( 3.4816666666666701e-01, 7.4243333333333295e-01, 5.4726666666666701e-01, 1.0);\n" + " } else if (x < 5.9375000000000000e-01) {\n" + " float dx = x - 5.7812500000000000e-01;\n" + " return ((vec4(-6.4543256167712116e+01, -2.8636353652780144e-01, 2.8905906284068501e+00, 1.0) * dx\n" + " + vec4(-6.4258025909336181e-01, -2.5551862009802844e+00, 3.6861444348665935e+00, 1.0)) * dx\n" + " + vec4( 3.0179503284010409e+00, 1.7957564974402687e-01, -1.4105302888259692e+00, 1.0)) * dx\n" + " + vec4( 3.9525714285714297e-01, 7.4590000000000001e-01, 5.2444285714285699e-01, 1.0);\n" + " } else if (x < 6.0937500000000000e-01) {\n" + " float dx = x - 5.9375000000000000e-01;\n" + " return ((vec4(-2.4450284092939786e+01, 1.3922851408411924e+01, -1.6916850328844372e+01, 1.0) * dx\n" + " + vec4(-3.6680453919548675e+00, -2.5686094917550251e+00, 3.8216408705731646e+00, 1.0)) * dx\n" + " + vec4( 2.9505968026034126e+00, 9.9516342045037676e-02, -1.2932211434284731e+00, 1.0)) * dx\n" + " + vec4( 4.4200952380952402e-01, 7.4808095238095196e-01, 5.0331428571428605e-01, 1.0);\n" + " } else if (x < 6.2500000000000000e-01) {\n" + " float dx = x - 6.0937500000000000e-01;\n" + " return ((vec4( 1.2547821111311350e+01, 1.5748329330961459e+01, -1.7611303598786566e+01, 1.0) * dx\n" + " + vec4(-4.8141524588114200e+00, -1.9159758319857161e+00, 3.0286635114085847e+00, 1.0)) * dx\n" + " + vec4( 2.8180624611851890e+00, 2.9444696361588602e-02, -1.1861851374600081e+00, 1.0)) * dx\n" + " + vec4( 4.8712380952380901e-01, 7.4906190476190504e-01, 4.8397619047619100e-01, 1.0);\n" + " } else if (x < 6.4062500000000000e-01) {\n" + " float dx = x - 6.2500000000000000e-01;\n" + " return ((vec4( 9.2115329809656430e+00, -3.2661877796437579e+00, -1.2675733711774058e+00, 1.0) * dx\n" + " + vec4(-4.2259733442187004e+00, -1.1777728945968977e+00, 2.2031336552154643e+00, 1.0)) * dx\n" + " + vec4( 2.6768104955128438e+00, -1.8895127491264742e-02, -1.1044383067315073e+00, 1.0)) * dx\n" + " + vec4( 5.3002857142857096e-01, 7.4911428571428595e-01, 4.6611428571428598e-01, 1.0);\n" + " } else if (x < 6.5625000000000000e-01) {\n" + " float dx = x - 6.4062500000000000e-01;\n" + " return ((vec4( 1.4269589821681299e+01, 7.3028598827757278e+00, -8.5260219639800940e+00, 1.0) * dx\n" + " + vec4(-3.7941827357359359e+00, -1.3308754467676989e+00, 2.1437161534415234e+00, 1.0)) * dx\n" + " + vec4( 2.5514955567635522e+00, -5.8092757825086563e-02, -1.0365187784712420e+00, 1.0)) * dx\n" + " + vec4( 5.7085714285714295e-01, 7.4851904761904797e-01, 4.4939047619047601e-01, 1.0);\n" + " } else if (x < 6.7187500000000000e-01) {\n" + " float dx = x - 6.5625000000000000e-01;\n" + " return ((vec4( 8.6083934467238432e+00, 2.6914824850885094e-01, -1.7057138772896455e+01, 1.0) * dx\n" + " + vec4(-3.1252957128446250e+00, -9.8855388976258662e-01, 1.7440588738799565e+00, 1.0)) * dx\n" + " + vec4( 2.4433787060044811e+00, -9.4333841208372265e-02, -9.7577229366934382e-01, 1.0)) * dx\n" + " + vec4( 6.0985238095238103e-01, 7.4731428571428604e-01, 4.3368571428571401e-01, 1.0);\n" + " } else if (x < 6.8750000000000000e-01) {\n" + " float dx = x - 6.7187500000000000e-01;\n" + " return ((vec4( 8.7188554392023345e+00, 1.7834947123447904e+01, -1.8886229447019101e+00, 1.0) * dx\n" + " + vec4(-2.7217772700294449e+00, -9.7593756561373424e-01, 9.4450549390043514e-01, 1.0)) * dx\n" + " + vec4( 2.3520181906470738e+00, -1.2502902019862727e-01, -9.3376347542277516e-01, 1.0)) * dx\n" + " + vec4( 6.4729999999999999e-01, 7.4560000000000004e-01, 4.1880000000000001e-01, 1.0);\n" + " } else if (x < 7.0312500000000000e-01) {\n" + " float dx = x - 6.8750000000000000e-01;\n" + " return ((vec4( 8.9449847961700044e+00, -2.1676746266635202e+01, -4.0993789718798466e+00, 1.0) * dx\n" + " + vec4(-2.3130809213168355e+00, -1.3992441920211368e-01, 8.5597629336753311e-01, 1.0)) * dx\n" + " + vec4( 2.2733485314072883e+00, -1.4246436371137491e-01, -9.0563094749671313e-01, 1.0)) * dx\n" + " + vec4( 6.8341904761904804e-01, 7.4347619047619096e-01, 4.0443333333333298e-01, 1.0);\n" + " } else if (x < 7.1875000000000000e-01) {\n" + " float dx = x - 7.0312500000000000e-01;\n" + " return ((vec4( 1.1674919661892304e+01, 2.3933066515154213e+01, -1.1673175453308831e+01, 1.0) * dx\n" + " + vec4(-1.8937847589963666e+00, -1.1560219004506387e+00, 6.6381790406066532e-01, 1.0)) * dx\n" + " + vec4( 2.2076162551523946e+00, -1.6271352495594915e-01, -8.8188416316189755e-01, 1.0)) * dx\n" + " + vec4( 7.1840952380952405e-01, 7.4113333333333298e-01, 3.9047619047618998e-01, 1.0);\n" + " } else if (x < 7.3437500000000000e-01) {\n" + " float dx = x - 7.1875000000000000e-01;\n" + " return ((vec4(-4.4641682053710623e+00, 2.0910706819426692e+00, 4.6048045942407727e+00, 1.0) * dx\n" + " + vec4(-1.3465228998451648e+00, -3.4159407552784897e-02, 1.1663780468681384e-01, 1.0)) * dx\n" + " + vec4( 2.1569864479829954e+00, -1.8131010789350266e-01, -8.6968954271271826e-01, 1.0)) * dx\n" + " + vec4( 7.5248571428571398e-01, 7.3839999999999995e-01, 3.7681428571428599e-01, 1.0);\n" + " } else if (x < 7.5000000000000000e-01) {\n" + " float dx = x - 7.3437500000000000e-01;\n" + " return ((vec4( 1.2423276968973711e+01, -6.0829492432479162e+00, -2.1725700066572116e+01, 1.0) * dx\n" + " + vec4(-1.5557807844719334e+00, 6.3859530663277708e-02, 3.3248802004185007e-01, 1.0)) * dx\n" + " + vec4( 2.1116379529155407e+00, -1.8084604346990121e-01, -8.6267195170133282e-01, 1.0)) * dx\n" + " + vec4( 7.8584285714285695e-01, 7.3556666666666704e-01, 3.6327142857142902e-01, 1.0);\n" + " } else if (x < 7.6562500000000000e-01) {\n" + " float dx = x - 7.5000000000000000e-01;\n" + " return ((vec4( 3.4549460436900552e+00, 2.2240726291601970e+01, -7.5799471847609725e+00, 1.0) * dx\n" + " + vec4(-9.7343967655129060e-01, -2.2127871511396835e-01, -6.8590417057871789e-01, 1.0)) * dx\n" + " + vec4( 2.0721188832120530e+00, -1.8330571822694325e-01, -8.6819407905347146e-01, 1.0)) * dx\n" + " + vec4( 8.1850476190476196e-01, 7.3273333333333301e-01, 3.4979047619047599e-01, 1.0);\n" + " } else if (x < 7.8125000000000000e-01) {\n" + " float dx = x - 7.6562500000000000e-01;\n" + " return ((vec4( 8.7094721894791203e+00, 1.3239510743088688e+01, -2.2852796908624047e+01, 1.0) * dx\n" + " + vec4(-8.1148908075331927e-01, 8.2125532980487381e-01, -1.0412141948643885e+00, 1.0)) * dx\n" + " + vec4( 2.0442293713791684e+00, -1.7393108362239784e-01, -8.9518030351351996e-01, 1.0)) * dx\n" + " + vec4( 8.5065714285714300e-01, 7.2989999999999999e-01, 3.3602857142857101e-01, 1.0);\n" + " } else if (x < 7.9687500000000000e-01) {\n" + " float dx = x - 7.8125000000000000e-01;\n" + " return ((vec4(-1.2078434801289291e+01, 4.3390183117236198e+01, -3.9570693752303733e+01, 1.0) * dx\n" + " + vec4(-4.0323257187148548e-01, 1.4418573958871561e+00, -2.1124390499561407e+00, 1.0)) * dx\n" + " + vec4( 2.0252493455569058e+00, -1.3856994728345987e-01, -9.4445613546384066e-01, 1.0)) * dx\n" + " + vec4( 8.8243333333333296e-01, 7.2743333333333304e-01, 3.2169999999999999e-01, 1.0);\n" + " } else if (x < 8.1250000000000000e-01) {\n" + " float dx = x - 7.9687500000000000e-01;\n" + " return ((vec4(-1.2824532984374384e+01, 1.1653781393088177e+02, -1.1096774236821523e+02, 1.0) * dx\n" + " + vec4(-9.6940920318192092e-01, 3.4757722295076028e+00, -3.9673153195953783e+00, 1.0)) * dx\n" + " + vec4( 2.0038018178216963e+00, -6.1731984386666772e-02, -1.0394522974880831e+00, 1.0)) * dx\n" + " + vec4( 9.1393333333333304e-01, 7.2578571428571403e-01, 3.0627619047619098e-01, 1.0);\n" + " } else if (x < 8.2812500000000000e-01) {\n" + " float dx = x - 8.1250000000000000e-01;\n" + " return ((vec4(-3.5855044278532131e+02, 2.7064903734930277e+02, -8.0792089155266083e+01, 1.0) * dx\n" + " + vec4(-1.5705591868244702e+00, 8.9384822575176859e+00, -9.1689282431054675e+00, 1.0)) * dx\n" + " + vec4( 1.9641148117278464e+00, 1.3224074197310332e-01, -1.2447061031552840e+00, 1.0)) * dx\n" + " + vec4( 9.4495714285714305e-01, 7.2611428571428605e-01, 2.8864285714285698e-01, 1.0);\n" + " } else if (x < 8.4375000000000000e-01) {\n" + " float dx = x - 8.2812500000000000e-01;\n" + " return ((vec4(-3.8174017206443654e+02, -1.9549693475620506e+02, 4.4911575613188438e+02, 1.0) * dx\n" + " + vec4(-1.8377611192386407e+01, 2.1625155883266252e+01, -1.2956057422258565e+01, 1.0)) * dx\n" + " + vec4( 1.6524246495526764e+00, 6.0979758792285232e-01, -1.5904090041765968e+00, 1.0)) * dx\n" + " + vec4( 9.7389523809523804e-01, 7.3139523809523799e-01, 2.6664761904761902e-01, 1.0);\n" + " } else if (x < 8.5937500000000000e-01) {\n" + " float dx = x - 8.4375000000000000e-01;\n" + " return ((vec4( 4.3248438818547703e+02, -2.7134838403902307e+02, 3.3204036056432756e+01, 1.0) * dx\n" + " + vec4(-3.6271681757906869e+01, 1.2461237066569140e+01, 8.0962436464235150e+00, 1.0)) * dx\n" + " + vec4( 7.9852944720434427e-01, 1.1423974777640304e+00, -1.6663435944240195e+00, 1.0)) * dx\n" + " + vec4( 9.9377142857142897e-01, 7.4545714285714304e-01, 2.4034761904761900e-01, 1.0);\n" + " } else if (x < 8.7500000000000000e-01) {\n" + " float dx = x - 8.5937500000000000e-01;\n" + " return ((vec4( 1.7847934313241271e+02, -6.1117386114828536e+00, -1.0882439559595376e+02, 1.0) * dx\n" + " + vec4(-1.5998976061712632e+01, -2.5821843526006538e-01, 9.6526828365688004e+00, 1.0)) * dx\n" + " + vec4(-1.8199581227210410e-02, 1.3330696438782346e+00, -1.3890166181272647e+00, 1.0)) * dx\n" + " + vec4( 9.9904285714285701e-01, 7.6531428571428595e-01, 2.1641428571428600e-01, 1.0);\n" + " } else if (x < 8.9062500000000000e-01) {\n" + " float dx = x - 8.7500000000000000e-01;\n" + " return ((vec4( 1.0065469642774150e+02, 1.1181852770679304e+01, -4.2302948910418884e+01, 1.0) * dx\n" + " + vec4(-7.6327568523807861e+00, -5.4470618267332416e-01, 4.5515392930084682e+00, 1.0)) * dx\n" + " + vec4(-3.8744540800992006e-01, 1.3205239467230254e+00, -1.1670756473526198e+00, 1.0)) * dx\n" + " + vec4( 9.9553333333333305e-01, 7.8605714285714301e-01, 1.9665238095238100e-01, 1.0);\n" + " } else if (x < 9.0625000000000000e-01) {\n" + " float dx = x - 8.9062500000000000e-01;\n" + " return ((vec4( 5.1792385442186948e+01, 1.3813127528788970e+01, -4.7771351619749993e+01, 1.0) * dx\n" + " + vec4(-2.9145679573304033e+00, -2.0556834047731776e-02, 2.5685885628325829e+00, 1.0)) * dx\n" + " + vec4(-5.5224735816165738e-01, 1.3116917120867588e+00, -1.0558236496051034e+00, 1.0)) * dx\n" + " + vec4( 9.8799999999999999e-01, 8.0659999999999998e-01, 1.7936666666666701e-01, 1.0);\n" + " } else if (x < 9.2187500000000000e-01) {\n" + " float dx = x - 9.0625000000000000e-01;\n" + " return ((vec4( 1.1035785704157649e+02, 5.2154589495154021e+01, -3.9990387467675163e+01, 1.0) * dx\n" + " + vec4(-4.8679988972789023e-01, 6.2693351886425119e-01, 3.2930645565680206e-01, 1.0)) * dx\n" + " + vec4(-6.0539373077194325e-01, 1.3211663477870170e+00, -1.0105440399412067e+00, 1.0)) * dx\n" + " + vec4( 9.7885714285714298e-01, 8.2714285714285696e-01, 1.6331428571428599e-01, 1.0);\n" + " } else if (x < 9.3750000000000000e-01) {\n" + " float dx = x - 9.2187500000000000e-01;\n" + " return ((vec4( 4.6043843534396274e+01, 2.0987943062129727e+01, -2.3203479461840441e+01, 1.0) * dx\n" + " + vec4( 4.6862246590960082e+00, 3.0716799014495959e+00, -1.5452429568904713e+00, 1.0)) * dx\n" + " + vec4(-5.3977771875056635e-01, 1.3789571824794209e+00, -1.0295430477729828e+00, 1.0)) * dx\n" + " + vec4( 9.6970000000000001e-01, 8.4813809523809502e-01, 1.4745238095238100e-01, 1.0);\n" + " } else if (x < 9.5312500000000000e-01) {\n" + " float dx = x - 9.3750000000000000e-01;\n" + " return ((vec4( 6.1233625963980650e+01, 2.8669866827404956e+01, 2.4201791029260814e+01, 1.0) * dx\n" + " + vec4( 6.8445298247708335e+00, 4.0554897324869268e+00, -2.6329060566642419e+00, 1.0)) * dx\n" + " + vec4(-3.5960967994014698e-01, 1.4903192080096790e+00, -1.0948266261097752e+00, 1.0)) * dx\n" + " + vec4( 9.6258571428571404e-01, 8.7051428571428602e-01, 1.3089999999999999e-01, 1.0);\n" + " } else if (x < 9.6875000000000000e-01) {\n" + " float dx = x - 9.5312500000000000e-01;\n" + " return ((vec4( 4.1070719275903762e+01, 5.3910277236601019e+00, 2.0019172487757277e+01, 1.0) * dx\n" + " + vec4( 9.7148560418324266e+00, 5.3993897400215340e+00, -1.4984471021676413e+00, 1.0)) * dx\n" + " + vec4(-1.0086927577447102e-01, 1.6380516997676238e+00, -1.1593790192165234e+00, 1.0)) * dx\n" + " + vec4( 9.5887142857142904e-01, 8.9490000000000003e-01, 1.1324285714285701e-01, 1.0);\n" + " } else if (x < 9.8437500000000000e-01) {\n" + " float dx = x - 9.6875000000000000e-01;\n" + " return ((vec4(-5.3250445924665847e+01, -1.6529749150400146e+01, -1.4422423336140781e+02, 1.0) * dx\n" + " + vec4( 1.1640046007890415e+01, 5.6520941645681013e+00, -5.6004839180401900e-01, 1.0)) * dx\n" + " + vec4( 2.3280106875244833e-01, 1.8107311357768368e+00, -1.1915430113098306e+00, 1.0)) * dx\n" + " + vec4( 9.5982380952380997e-01, 9.2183333333333295e-01, 9.4838095238095305e-02, 1.0);\n" + " } else if (x < 1.0000000000000000e+00) {\n" + " float dx = x - 9.8437500000000000e-01;\n" + " return ((vec4(-1.9507053557699635e+02, -1.0404825969371934e+02, 1.5617193238656020e+02, 1.0) * dx\n" + " + vec4( 9.1439313551717039e+00, 4.8772621731430945e+00, -7.3205593306200099e+00, 1.0)) * dx\n" + " + vec4( 5.5755071505029385e-01, 1.9752523285535741e+00, -1.3146775069727061e+00, 1.0)) * dx\n" + " + vec4( 9.6609999999999996e-01, 9.5144285714285703e-01, 7.5533333333333300e-02, 1.0);\n" + " } else {\n" + " float dx = x - 1.0000000000000000e+00;\n" + " return ((vec4( 0.0000000000000000e+00, 3.4202936336155174e+00, 3.0625241907655076e+00, 1.0) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 9.7629999999999995e-01, 9.8309999999999997e-01, 5.3800000000000001e-02, 1.0);\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/pink.h b/colormap-shaders/include/colormap/private/MATLAB/pink.h new file mode 100644 index 0000000..69c1f01 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/pink.h @@ -0,0 +1,461 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Pink : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_pink.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("pink"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " if (x < 0.0) {\n" + " return vec4(0.0, 0.0, 0.0, 0.0);\n" + " } else if (1.0 < x) {\n" + " return vec4(0.0, 0.0, 0.0, 0.0);\n" + " }\n" + " if (x < 3.1250000000000000e-02) {\n" + " float dx = x - 1.5625000000000000e-02;\n" + " return ((vec4(-1.4669881459549135e+03, -4.0682398921086065e+03, -4.0682398921088602e+03, 1.0) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 5.3504982998818882e+00, 7.5768322282919200e+00, 7.5768322282919822e+00, 1.0)) * dx\n" + " + vec4( 1.1785113019775800e-01, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0);\n" + " } else if (x < 4.6875000000000000e-02) {\n" + " float dx = x - 3.1250000000000000e-02;\n" + " return ((vec4( 1.2528152076829322e+03, 4.5446100426089361e+03, 4.5446100426102021e+03, 1.0) * dx\n" + " + vec4(-6.8765069341636575e+01, -1.9069874494259093e+02, -1.9069874494260281e+02, 1.0)) * dx\n" + " + vec4( 4.2760440914188163e+00, 4.5971643385639362e+00, 4.5971643385638128e+00, 1.0)) * dx\n" + " + vec4( 1.9585655046433401e-01, 1.0286889997472801e-01, 1.0286889997472801e-01, 1.0);\n" + " } else if (x < 6.2500000000000000e-02) {\n" + " float dx = x - 4.6875000000000000e-02;\n" + " return ((vec4(-8.2547934274917452e+01, -9.1253943618964820e+02, -9.1253943619445545e+02, 1.0) * dx\n" + " + vec4(-1.0039356481499135e+01, 2.2329850804702957e+01, 2.2329850804750397e+01, 1.0)) * dx\n" + " + vec4( 3.0447249379323211e+00, 1.9664003676594368e+00, 1.9664003676598694e+00, 1.0)) * dx\n" + " + vec4( 2.5066050313259902e-01, 1.4547859349066200e-01, 1.4547859349066200e-01, 1.0);\n" + " } else if (x < 7.8125000000000000e-02) {\n" + " float dx = x - 6.2500000000000000e-02;\n" + " return ((vec4( 1.3738814812365237e+02, 3.5917185339157112e+02, 3.5917185340953500e+02, 1.0) * dx\n" + " + vec4(-1.3908790900635891e+01, -2.0445435266686804e+01, -2.0445435266864703e+01, 1.0)) * dx\n" + " + vec4( 2.6705351350864612e+00, 1.9958443604409393e+00, 1.9958443604393332e+00, 1.0)) * dx\n" + " + vec4( 2.9546842014263902e-01, 1.7817416127495000e-01, 1.7817416127495000e-01, 1.0);\n" + " } else if (x < 9.3750000000000000e-02) {\n" + " float dx = x - 7.8125000000000000e-02;\n" + " return ((vec4( 2.7031959945674146e+01, -3.8567216714497711e+01, -3.8567216781546392e+01, 1.0) * dx\n" + " + vec4(-7.4687214573396865e+00, -3.6092546389569100e+00, -3.6092546382927484e+00, 1.0)) * dx\n" + " + vec4( 2.3365115044930929e+00, 1.6199898306652563e+00, 1.6199898306712481e+00, 1.0)) * dx\n" + " + vec4( 3.3432392491786600e-01, 2.0573779994945601e-01, 2.0573779994945601e-01, 1.0);\n" + " } else if (x < 1.0937500000000000e-01) {\n" + " float dx = x - 9.3750000000000000e-02;\n" + " return ((vec4( 3.2452254818731888e+01, 4.4132390168433041e+01, 4.4132390418663725e+01, 1.0) * dx\n" + " + vec4(-6.2015983348862109e+00, -5.4170929224489903e+00, -5.4170929249277355e+00, 1.0)) * dx\n" + " + vec4( 2.1229127577395634e+00, 1.4789531500182891e+00, 1.4789531499959279e+00, 1.0)) * dx\n" + " + vec4( 3.6911161759471400e-01, 2.3002185311411799e-01, 2.3002185311411799e-01, 1.0);\n" + " } else if (x < 1.2500000000000000e-01) {\n" + " float dx = x - 1.0937500000000000e-01;\n" + " return ((vec4( 1.7962452314829033e+01, 9.9760928434314167e+00, 9.9760919095573772e+00, 1.0) * dx\n" + " + vec4(-4.6803988902581537e+00, -3.3483871333036914e+00, -3.3483871240528735e+00, 1.0)) * dx\n" + " + vec4( 1.9528815510966826e+00, 1.3419925241471533e+00, 1.3419925242306059e+00, 1.0)) * dx\n" + " + vec4( 4.0089186286863698e-01, 2.5197631533948500e-01, 2.5197631533948500e-01, 1.0);\n" + " } else if (x < 1.4062500000000000e-01) {\n" + " float dx = x - 1.2500000000000000e-01;\n" + " return ((vec4( 1.4107229469108253e+01, 1.2353314086225026e+01, 1.2353317571490493e+01, 1.0) * dx\n" + " + vec4(-3.8384089380005428e+00, -2.8807577812678438e+00, -2.8807578157923714e+00, 1.0)) * dx\n" + " + vec4( 1.8197751787801404e+00, 1.2446621348569731e+00, 1.2446621345455240e+00, 1.0)) * dx\n" + " + vec4( 4.3033148291193501e-01, 2.7216552697590901e-01, 2.7216552697590901e-01, 1.0);\n" + " } else if (x < 1.5625000000000000e-01) {\n" + " float dx = x - 1.4062500000000000e-01;\n" + " return ((vec4( 1.0219970967189909e+01, 7.5634260052650815e+00, 7.5634129980772871e+00, 1.0) * dx\n" + " + vec4(-3.1771325566360935e+00, -2.3016961834760457e+00, -2.3016960546287546e+00, 1.0)) * dx\n" + " + vec4( 1.7101573429264429e+00, 1.1636862916578499e+00, 1.1636862928201939e+00, 1.0)) * dx\n" + " + vec4( 4.5788217333292702e-01, 2.9095718698132300e-01, 2.9095718698132300e-01, 1.0);\n" + " } else if (x < 1.7187500000000000e-01) {\n" + " float dx = x - 1.5625000000000000e-01;\n" + " return ((vec4( 7.9639431579939997e+00, 6.1408899801328447e+00, 6.1409385236185399e+00, 1.0) * dx\n" + " + vec4(-2.6980714175490665e+00, -1.9471605894792450e+00, -1.9471610703438818e+00, 1.0)) * dx\n" + " + vec4( 1.6183572808297999e+00, 1.0972979045804234e+00, 1.0972979002424965e+00, 1.0)) * dx\n" + " + vec4( 4.8386670078337102e-01, 3.0860669992418399e-01, 3.0860669992418399e-01, 1.0);\n" + " } else if (x < 1.8750000000000000e-01) {\n" + " float dx = x - 1.7187500000000000e-01;\n" + " return ((vec4( 6.2644603100084071e+00, 4.6737470532015237e+00, 4.6735658864465535e+00, 1.0) * dx\n" + " + vec4(-2.3247615820180978e+00, -1.6593063716605179e+00, -1.6593045770492627e+00, 1.0)) * dx\n" + " + vec4( 1.5398755152115629e+00, 1.0409468583126147e+00, 1.0409468745019785e+00, 1.0)) * dx\n" + " + vec4( 5.0852520448634997e-01, 3.2530002431617799e-01, 3.2530002431617799e-01, 1.0);\n" + " } else if (x < 2.0312500000000000e-01) {\n" + " float dx = x - 1.8750000000000000e-01;\n" + " return ((vec4( 5.0557657194808643e+00, 3.7546306563046934e+00, 3.7553067798388895e+00, 1.0) * dx\n" + " + vec4(-2.0311150049864537e+00, -1.4402244785416964e+00, -1.4402311761220805e+00, 1.0)) * dx\n" + " + vec4( 1.4718149435396168e+00, 9.9251668877820509e-01, 9.9251662835867638e-01, 1.0)) * dx\n" + " + vec4( 5.3204208768553596e-01, 3.4117754381277299e-01, 3.4117754381277299e-01, 1.0);\n" + " } else if (x < 2.1875000000000000e-01) {\n" + " float dx = x - 2.0312500000000000e-01;\n" + " return ((vec4( 4.1410369504978677e+00, 3.0442611292784201e+00, 3.0417378018965926e+00, 1.0) * dx\n" + " + vec4(-1.7941259868857882e+00, -1.2642261665274139e+00, -1.2642011708171326e+00, 1.0)) * dx\n" + " + vec4( 1.4120455530416129e+00, 9.5025964744900027e-01, 9.5025987293775116e-01, 1.0)) * dx\n" + " + vec4( 5.5456260470724394e-01, 3.5634832254989901e-01, 3.5634832254989901e-01, 1.0);\n" + " } else if (x < 2.3437500000000000e-01) {\n" + " float dx = x - 2.1875000000000000e-01;\n" + " return ((vec4( 3.4529542936776019e+00, 2.5030166001054397e+00, 2.5124337860985739e+00, 1.0) * dx\n" + " + vec4(-1.6000148798312006e+00, -1.1215264260924880e+00, -1.1216197113532298e+00, 1.0)) * dx\n" + " + vec4( 1.3590121019991601e+00, 9.1298226318931430e-01, 9.1298142165383922e-01, 1.0)) * dx\n" + " + vec4( 5.7620359423608403e-01, 3.7089909350945799e-01, 3.7089909350945799e-01, 1.0);\n" + " } else if (x < 2.5000000000000000e-01) {\n" + " float dx = x - 2.3437500000000000e-01;\n" + " return ((vec4( 2.8804720304898979e+00, 2.1365016738443594e+00, 2.1013562572536415e+00, 1.0) * dx\n" + " + vec4(-1.4381576473150630e+00, -1.0041975229625455e+00, -1.0038493776298592e+00, 1.0)) * dx\n" + " + vec4( 1.3115406562624998e+00, 8.7976782648532936e-01, 8.7977096713847847e-01, 1.0)) * dx\n" + " + vec4( 5.9706070167235203e-01, 3.8490017945975102e-01, 3.8490017945975102e-01, 1.0);\n" + " } else if (x < 2.6562500000000000e-01) {\n" + " float dx = x - 2.5000000000000000e-01;\n" + " return ((vec4( 2.5594362349562849e+00, 1.6480351971046261e+00, 1.7791996774743761e+00, 1.0) * dx\n" + " + vec4(-1.3031355208858491e+00, -9.0404900700109114e-01, -9.0534830307109471e-01, 1.0)) * dx\n" + " + vec4( 1.2687079505093606e+00, 8.4995147445464758e-01, 8.4993975337752603e-01, 1.0)) * dx\n" + " + vec4( 6.1721339984836798e-01, 3.9840953644479798e-01, 3.9840953644479798e-01, 1.0);\n" + " } else if (x < 2.8125000000000000e-01) {\n" + " float dx = x - 2.6562500000000000e-01;\n" + " return ((vec4( 1.8051368703401163e+00, 2.0114928499339442e+00, 1.5219803450456506e+00, 1.0) * dx\n" + " + vec4(-1.1831619473722732e+00, -8.2679735713681179e-01, -8.2194831818948333e-01, 1.0)) * dx\n" + " + vec4( 1.2298595525678273e+00, 8.2290700001499284e-01, 8.2295074367032950e-01, 1.0)) * dx\n" + " + vec4( 6.3672857672895500e-01, 4.1147559989891203e-01, 4.1147559989891203e-01, 1.0);\n" + " } else if (x < 2.9687500000000000e-01) {\n" + " float dx = x - 2.8125000000000000e-01;\n" + " return ((vec4( 3.0463396572174992e+00, -5.1289449769253304e-01, 1.3139910414908893e+00, 1.0) * dx\n" + " + vec4(-1.0985461565750803e+00, -7.3250862979615816e-01, -7.5060548951546846e-01, 1.0)) * dx\n" + " + vec4( 1.1942078634436499e+00, 7.9854284396916519e-01, 7.9837959042493967e-01, 1.0)) * dx\n" + " + vec4( 6.5566316039120298e-01, 4.2413934018690103e-01, 4.2413934018690103e-01, 1.0);\n" + " } else if (x < 3.1250000000000000e-01) {\n" + " float dx = x - 2.9687500000000000e-01;\n" + " return ((vec4(-2.8704741000704268e+00, 7.9617278728423395e+00, 1.1436982209969482e+00, 1.0) * dx\n" + " + vec4(-9.5574898514300999e-01, -7.5655055937549565e-01, -6.8901215944558303e-01, 1.0)) * dx\n" + " + vec4( 1.1621095018543048e+00, 7.7527629413835808e-01, 7.7588556465992320e-01, 1.0)) * dx\n" + " + vec4( 6.7406607937581298e-01, 4.3643578047198500e-01, 4.3643578047198500e-01, 1.0);\n" + " } else if (x < 3.2812500000000000e-01) {\n" + " float dx = x - 3.1250000000000000e-01;\n" + " return ((vec4( 1.8151104486259406e+01, -2.4442464044541747e+01, 1.0027690236563866e+00, 1.0) * dx\n" + " + vec4(-1.0903024585838113e+00, -3.8334456533601097e-01, -6.3540130533635109e-01, 1.0)) * dx\n" + " + vec4( 1.1301399480460732e+00, 7.5746543281474077e-01, 7.5519160427270549e-01, 1.0)) * dx\n" + " + vec4( 6.9197975319800997e-01, 4.4839513942303300e-01, 4.4839513942303300e-01, 1.0);\n" + " } else if (x < 3.4375000000000000e-01) {\n" + " float dx = x - 3.2812500000000000e-01;\n" + " return ((vec4(-6.1186402817835244e+01, 9.5847900752188593e+01, 8.8499813124143623e-01, 1.0) * dx\n" + " + vec4(-2.3946943579040159e-01, -1.5290850674239054e+00, -5.8839650735245796e-01, 1.0)) * dx\n" + " + vec4( 1.1093622621964760e+00, 7.2758371980286707e-01, 7.3606976344944286e-01, 1.0)) * dx\n" + " + vec4( 7.0944124373120399e-01, 4.6004370622823598e-01, 4.6004370622823598e-01, 1.0);\n" + " } else if (x < 3.5937500000000000e-01) {\n" + " float dx = x - 3.4375000000000000e-01;\n" + " return ((vec4( 2.3416165617778907e+02, -3.5362066219986355e+02, 7.8571521572691694e-01, 1.0) * dx\n" + " + vec4(-3.1075820678764288e+00, 2.9637852803349345e+00, -5.4691221995051564e-01, 1.0)) * dx\n" + " + vec4( 1.0570645824516820e+00, 7.5000091062960195e-01, 7.1833056458533395e-01, 1.0)) * dx\n" + " + vec4( 7.2648315725677903e-01, 4.7140452079103201e-01, 4.7140452079103201e-01, 1.0);\n" + " } else if (x < 3.7500000000000000e-01) {\n" + " float dx = x - 3.5937500000000000e-01;\n" + " return ((vec4(-8.6872290443392524e+02, 1.3233639570551793e+03, 7.0135001376448258e-01, 1.0) * dx\n" + " + vec4( 7.8687455654574343e+00, -1.3612183260283668e+01, -5.1008181921331641e-01, 1.0)) * dx\n" + " + vec4( 1.1314577621013850e+00, 5.8361969219290288e-01, 7.0181503272339907e-01, 1.0)) * dx\n" + " + vec4( 7.4313436015883205e-01, 4.8249790963716399e-01, 4.8249790963716399e-01, 1.0);\n" + " } else if (x < 3.9062500000000000e-01) {\n" + " float dx = x - 3.7500000000000000e-01;\n" + " return ((vec4( 8.8518476063177650e+02, -1.3713638359409479e+03, 6.2914033536808966e-01, 1.0) * dx\n" + " + vec4(-3.2852640579882809e+01, 4.8420502226677854e+01, -4.7720603731810629e-01, 1.0)) * dx\n" + " + vec4( 7.4108440250098861e-01, 1.1274996760428120e+00, 6.8638865996509557e-01, 1.0)) * dx\n" + " + vec4( 7.5942055326385305e-01, 4.9334191326730298e-01, 4.9334191326730298e-01, 1.0);\n" + " } else if (x < 4.0625000000000000e-01) {\n" + " float dx = x - 3.9062500000000000e-01;\n" + " return ((vec4(-2.3709260415260931e+02, 3.7516300791309146e+02, 5.6692410339443688e-01, 1.0) * dx\n" + " + vec4( 8.6403950747317122e+00, -1.5862177583054082e+01, -4.4771508409772709e-01, 1.0)) * dx\n" + " + vec4( 3.6276806648300275e-01, 1.6362234985994335e+00, 6.7193676744297315e-01, 1.0)) * dx\n" + " + vec4( 7.6635604473481300e-01, 5.1754916950676599e-01, 5.0395263067897000e-01, 1.0);\n" + " } else if (x < 4.2187500000000000e-01) {\n" + " float dx = x - 4.0625000000000000e-01;\n" + " return ((vec4( 6.3616714987678073e+01, -9.4300538300030098e+01, 5.1299127761488117e-01, 1.0) * dx\n" + " + vec4(-2.4733207449218502e+00, 1.7235884128720800e+00, -4.2114051675111286e-01, 1.0)) * dx\n" + " + vec4( 4.5912860288628182e-01, 1.4153080428153397e+00, 6.5836089867971004e-01, 1.0)) * dx\n" + " + vec4( 7.7322933071864097e-01, 5.4067369302384405e-01, 5.1434449987363995e-01, 1.0);\n" + " } else if (x < 4.3750000000000000e-01) {\n" + " float dx = x - 4.2187500000000000e-01;\n" + " return ((vec4(-1.6961859855932584e+01, 3.0379726001371605e+01, 4.6597626654549629e-01, 1.0) * dx\n" + " + vec4( 5.0871277012555960e-01, -2.6967493199418304e+00, -3.9709405061291531e-01, 1.0)) * dx\n" + " + vec4( 4.2843160328008978e-01, 1.4001024036423748e+00, 6.4557598356464707e-01, 1.0)) * dx\n" + " + vec4( 7.8004205557495998e-01, 5.6284895113959499e-01, 5.2453052831296199e-01, 1.0);\n" + " } else if (x < 4.5312500000000000e-01) {\n" + " float dx = x - 4.3750000000000000e-01;\n" + " return ((vec4( 4.6255693417292765e+00, -3.8807368791610912e+00, 4.2477880151371511e-01, 1.0) * dx\n" + " + vec4(-2.8637441062128022e-01, -1.2726996636275365e+00, -3.7525141311859517e-01, 1.0)) * dx\n" + " + vec4( 4.3190564014734417e-01, 1.3380797632741035e+00, 6.3350808569384220e-01, 1.0)) * dx\n" + " + vec4( 7.8679579246944298e-01, 5.8418305458977604e-01, 5.3452248382484902e-01, 1.0);\n" + " } else if (x < 4.6875000000000000e-01) {\n" + " float dx = x - 4.5312500000000000e-01;\n" + " return ((vec4(-1.1620953817302908e+00, 4.6334128006838897e+00, 3.8850531365210134e-01, 1.0) * dx\n" + " + vec4(-6.9550847727720383e-02, -1.4546092048382127e+00, -3.5533990679763977e-01, 1.0)) * dx\n" + " + vec4( 4.2634430798564099e-01, 1.2954655622043261e+00, 6.2209259632015113e-01, 1.0)) * dx\n" + " + vec4( 7.9349204761587200e-01, 6.0476502936325705e-01, 5.4433105395181702e-01, 1.0);\n" + " } else if (x < 4.8437500000000000e-01) {\n" + " float dx = x - 4.6875000000000000e-01;\n" + " return ((vec4( 3.8556361698416303e-01, 1.8233043610892945e+00, 3.5642377965443828e-01, 1.0) * dx\n" + " + vec4(-1.2402406874632776e-01, -1.2374179798061553e+00, -3.3712872022019752e-01, 1.0)) * dx\n" + " + vec4( 4.2331969991573404e-01, 1.2534026374442579e+00, 6.1127277402299740e-01, 1.0)) * dx\n" + " + vec4( 8.0013226419863903e-01, 6.2466922463944097e-01, 5.5396597989254404e-01, 1.0);\n" + " } else if (x < 5.0000000000000000e-01) {\n" + " float dx = x - 4.8437500000000000e-01;\n" + " return ((vec4(-3.2095667390052242e-02, 2.1503801318034825e+00, 3.2793327560925789e-01, 1.0) * dx\n" + " + vec4(-1.0595077420019512e-01, -1.1519505878800946e+00, -3.2042135554889573e-01, 1.0)) * dx\n" + " + vec4( 4.1972634299469458e-01, 1.2160687535741603e+00, 6.0099855408910530e-01, 1.0)) * dx\n" + " + vec4( 8.0671782600463904e-01, 6.4395849220469203e-01, 5.6343616981901101e-01, 1.0);\n" + " } else if (x < 5.1562500000000000e-01) {\n" + " float dx = x - 5.0000000000000000e-01;\n" + " return ((vec4( 7.7013830342289147e-02, 1.7153408159410617e+00, 3.0252602235293108e-01, 1.0) * dx\n" + " + vec4(-1.0745525860910382e-01, -1.0511515192018064e+00, -3.0504948325471176e-01, 1.0)) * dx\n" + " + vec4( 4.1639187373204928e-01, 1.1816452831510056e+00, 5.9122557223279892e-01, 1.0)) * dx\n" + " + vec4( 8.1325006079044404e-01, 6.6268653159200297e-01, 5.7274979532281600e-01, 1.0);\n" + " } else if (x < 5.3125000000000000e-01) {\n" + " float dx = x - 5.1562500000000000e-01;\n" + " return ((vec4( 4.5128006172428847e-02, 1.5453203541034857e+00, 2.7981246555779532e-01, 1.0) * dx\n" + " + vec4(-1.0384523531180902e-01, -9.7074491845456912e-01, -2.9086857595691812e-01, 1.0)) * dx\n" + " + vec4( 4.1309030351453502e-01, 1.1500531513126246e+00, 5.8191435255761725e-01, 1.0)) * dx\n" + " + vec4( 8.1973024340795897e-01, 6.8089965385828999e-01, 5.8191437396264600e-01, 1.0);\n" + " } else if (x < 5.4687500000000000e-01) {\n" + " float dx = x - 5.3125000000000000e-01;\n" + " return ((vec4( 5.1163279076130053e-02, 1.3521114454007919e+00, 2.5933722356445560e-01, 1.0) * dx\n" + " + vec4(-1.0172986002247641e-01, -8.9830802685596822e-01, -2.7775236663389646e-01, 1.0)) * dx\n" + " + vec4( 4.0987819264993680e-01, 1.1208491990421476e+00, 5.7302965032963571e-01, 1.0)) * dx\n" + " + vec4( 8.2615959870940303e-01, 6.9863813100577199e-01, 5.9093684028527904e-01, 1.0);\n" + " } else if (x < 5.6250000000000000e-01) {\n" + " float dx = x - 5.4687500000000000e-01;\n" + " return ((vec4( 4.7169570095915013e-02, 1.2029732434271569e+00, 2.4119519806979875e-01, 1.0) * dx\n" + " + vec4(-9.9331581315782819e-02, -8.3492780285280610e-01, -2.6559593427931261e-01, 1.0)) * dx\n" + " + vec4( 4.0673660762902653e-01, 1.0937673892029480e+00, 5.6453983312786682e-01, 1.0)) * dx\n" + " + vec4( 8.3253930425037204e-01, 7.1593724415352000e-01, 5.9982360722829198e-01, 1.0);\n" + " } else if (x < 5.7812500000000000e-01) {\n" + " float dx = x - 5.6250000000000000e-01;\n" + " return ((vec4( 4.5986272021792729e-02, 1.0731479391457011e+00, 2.2367640273462128e-01, 1.0) * dx\n" + " + vec4(-9.7120507717536803e-02, -7.7853843206715811e-01, -2.5428990936979079e-01, 1.0)) * dx\n" + " + vec4( 4.0366704373788093e-01, 1.0685569792823235e+00, 5.5641661682084964e-01, 1.0)) * dx\n" + " + vec4( 8.3887049280786097e-01, 7.3282810879294003e-01, 6.0858061945018505e-01, 1.0);\n" + " } else if (x < 5.9375000000000000e-01) {\n" + " float dx = x - 5.7812500000000000e-01;\n" + " return ((vec4( 4.4164995395678787e-02, 9.6091304374043085e-01, 2.1201124590809547e-01, 1.0) * dx\n" + " + vec4(-9.4964901216515268e-02, -7.2823462241970338e-01, -2.4380507799160542e-01, 1.0)) * dx\n" + " + vec4( 4.0066570922328631e-01, 1.0450136503059664e+00, 5.4863388264332780e-01, 1.0)) * dx\n" + " + vec4( 8.4515425472851702e-01, 7.4933833246934400e-01, 6.1721339984836798e-01, 1.0);\n" + " } else if (x < 6.0937500000000000e-01) {\n" + " float dx = x - 5.9375000000000000e-01;\n" + " return ((vec4( 4.2622287162048224e-02, 8.7204745369720627e-01, 1.8569722378857575e-01, 1.0) * dx\n" + " + vec4(-9.2894667057342825e-02, -6.8319182349437069e-01, -2.3386705083966344e-01, 1.0)) * dx\n" + " + vec4( 3.9773040346900729e-01, 1.0229601120885590e+00, 5.4117025563033927e-01, 1.0)) * dx\n" + " + vec4( 8.5139164012088198e-01, 7.6549254469187100e-01, 6.2572709029927098e-01, 1.0);\n" + " } else if (x < 6.2500000000000000e-01) {\n" + " float dx = x - 6.0937500000000000e-01;\n" + " return ((vec4( 4.1105693265725961e-02, 7.6494427361798978e-01, 2.2040881261248599e-01, 1.0) * dx\n" + " + vec4(-9.0896747346621815e-02, -6.4231459910231414e-01, -2.2516249347457395e-01, 1.0)) * dx\n" + " + vec4( 3.9485866261894537e-01, 1.0022490742354857e+00, 5.3399791900042926e-01, 1.0)) * dx\n" + " + vec4( 8.5758366090413296e-01, 7.8131282816150904e-01, 6.3412648747422795e-01, 1.0);\n" + " } else if (x < 6.4062500000000000e-01) {\n" + " float dx = x - 6.2500000000000000e-01;\n" + " return ((vec4( 3.9676521680195975e-02, 7.8428805986266303e-01, 3.3000425741025317e-02, 1.0) * dx\n" + " + vec4(-8.8969917974790910e-02, -6.0645783627647087e-01, -2.1483083038336367e-01, 1.0)) * dx\n" + " + vec4( 3.9204824597329829e-01, 9.8273700493269212e-01, 5.2712302331514893e-01, 1.0)) * dx\n" + " + vec4( 8.6373129272462201e-01, 7.9681907288959597e-01, 6.4241607443962101e-01, 1.0);\n" + " } else if (x < 6.5625000000000000e-01) {\n" + " float dx = x - 6.4062500000000000e-01;\n" + " return ((vec4( 3.8312487764607418e-02, 3.8021584708698697e-01, 6.7955965978490873e-01, 1.0) * dx\n" + " + vec4(-8.7110081021031724e-02, -5.6969433347040854e-01, -2.1328393542675311e-01, 1.0)) * dx\n" + " + vec4( 3.8929699598898854e-01, 9.6435962728039715e-01, 5.2043373009936589e-01, 1.0)) * dx\n" + " + vec4( 8.6983547675049300e-01, 8.1202926941800202e-01, 6.5060004863235499e-01, 1.0);\n" + " } else if (x < 6.7187500000000000e-01) {\n" + " float dx = x - 6.5625000000000000e-01;\n" + " return ((vec4( 3.7014142710244315e-02, 1.5972496107531242e+00, -1.7818291365727916e+00, 1.0) * dx\n" + " + vec4(-8.5314183157065751e-02, -5.5187171563820603e-01, -1.8142957637433552e-01, 1.0)) * dx\n" + " + vec4( 3.8660286686120576e-01, 9.4683515776307503e-01, 5.1426633147747391e-01, 1.0)) * dx\n" + " + vec4( 8.7589712135373898e-01, 8.2695975347197803e-01, 6.5868234670623604e-01, 1.0);\n" + " } else if (x < 6.8750000000000000e-01) {\n" + " float dx = x - 6.7187500000000000e-01;\n" + " return ((vec4( 3.5776320711640310e-02, -3.2011488281931193e+00, 7.3597907806637606e+00, 1.0) * dx\n" + " + vec4(-8.3579145217523049e-02, -4.7700064013415333e-01, -2.6495281715118513e-01, 1.0)) * dx\n" + " + vec4( 3.8396390860535284e-01, 9.3075902720413195e-01, 5.0729160657863759e-01, 1.0)) * dx\n" + " + vec4( 8.8191710368819698e-01, 8.4162541153017301e-01, 6.6666666666666696e-01, 1.0);\n" + " } else if (x < 7.0312500000000000e-01) {\n" + " float dx = x - 6.8750000000000000e-01;\n" + " return ((vec4( 3.4595751258128971e-02, 1.4479853717875505e+01, -2.6798031522024559e+01, 1.0) * dx\n" + " + vec4(-8.1902130184164909e-02, -6.2705449145570580e-01, 8.0037375692428664e-02, 1.0)) * dx\n" + " + vec4( 3.8137826367720146e-01, 9.1350816577304039e-01, 5.0440230280584453e-01, 1.0)) * dx\n" + " + vec4( 8.8789627117123804e-01, 8.5603985468214805e-01, 6.7455648764684994e-01, 1.0);\n" + " } else if (x < 7.1875000000000000e-01) {\n" + " float dx = x - 7.0312500000000000e-01;\n" + " return ((vec4( 3.3468991753281919e-02, -5.1708135322659281e+01, 1.0064307843765410e+02, 1.0) * dx\n" + " + vec4(-8.0280454343940114e-02, 5.1688651569708526e-02, -1.1761203519024725e+00, 1.0)) * dx\n" + " + vec4( 3.7884416079394984e-01, 9.0451807452482169e-01, 4.8727600630256263e-01, 1.0)) * dx\n" + " + vec4( 8.9383544287626004e-01, 8.7021556655528298e-01, 6.8235508762554498e-01, 1.0);\n" + " } else if (x < 7.3437500000000000e-01) {\n" + " float dx = x - 7.1875000000000000e-01;\n" + " return ((vec4( 3.2392951100837251e-02, 1.9512898026633002e+02, -3.7500834138704249e+02, 1.0) * dx\n" + " + vec4(-7.8711595355505024e-02, -2.3721301916799455e+00, 3.5415239498625635e+00, 1.0)) * dx\n" + " + vec4( 3.7635991001739599e-01, 8.6826117546059922e-01, 5.2423543752068902e-01, 1.0)) * dx\n" + " + vec4( 8.9973541084243802e-01, 8.8416402988700704e-01, 6.9006555934235403e-01, 1.0);\n" + " } else if (x < 7.5000000000000000e-01) {\n" + " float dx = x - 7.3437500000000000e-01;\n" + " return ((vec4( 3.1364727379629663e-02, -7.2624066315039011e+02, 1.4001148170350855e+03, 1.0) * dx\n" + " + vec4(-7.7193175772653277e-02, 6.7745407583042745e+00, -1.4036992052655055e+01, 1.0)) * dx\n" + " + vec4( 3.7392389796851849e-01, 9.3704884056410442e-01, 3.6024374841455642e-01, 1.0)) * dx\n" + " + vec4( 9.0559694130767698e-01, 8.9789583539346696e-01, 6.9769082462971099e-01, 1.0);\n" + " } else if (x < 7.6562500000000000e-01) {\n" + " float dx = x - 7.5000000000000000e-01;\n" + " return ((vec4( 3.0381616356811136e-02, 7.3556986866868601e+02, -1.4318093578633127e+03, 1.0) * dx\n" + " + vec4(-7.5722954176733137e-02, -2.7267990326870265e+01, 5.1593389995864584e+01, 1.0)) * dx\n" + " + vec4( 3.7153458343805934e-01, 6.1683869105526079e-01, 9.4706246627720525e-01, 1.0)) * dx\n" + " + vec4( 9.1142077587019599e-01, 9.1142077587019599e-01, 7.0523364734993799e-01, 1.0);\n" + " } else if (x < 7.8125000000000000e-01) {\n" + " float dx = x - 7.6562500000000000e-01;\n" + " return ((vec4( 2.9441135219075026e-02, -1.9705777042165474e+02, 3.8669242628155297e+02, 1.0) * dx\n" + " + vec4(-7.4298815910007615e-02, 7.2118472669743907e+00, -1.5522673653978197e+01, 1.0)) * dx\n" + " + vec4( 3.6919049328045406e-01, 3.0346145574438771e-01, 1.5106674091191798e+00, 1.0)) * dx\n" + " + vec4( 9.1720763258372495e-01, 9.1720763258372495e-01, 7.2716562162264098e-01, 1.0);\n" + " } else if (x < 7.9687500000000000e-01) {\n" + " float dx = x - 7.8125000000000000e-01;\n" + " return ((vec4( 2.8540822829984158e-02, 5.2837899997996146e+01, -1.0097631834123302e+02, 1.0) * dx\n" + " + vec4(-7.2918762696613473e-02, -2.0252357215406760e+00, 2.6035338279695983e+00, 1.0)) * dx\n" + " + vec4( 3.6689021861472559e-01, 3.8450226114178948e-01, 1.3088058493377956e+00, 1.0)) * dx\n" + " + vec4( 9.2295820699089703e-01, 9.2295820699089703e-01, 7.4845519918374903e-01, 1.0);\n" + " } else if (x < 8.1250000000000000e-01) {\n" + " float dx = x - 7.9687500000000000e-01;\n" + " return ((vec4( 2.7678922768475427e-02, -1.4122546221022333e+01, 2.9362371786331625e+01, 1.0) * dx\n" + " + vec4(-7.1580911626457966e-02, 4.5154084086539337e-01, -2.1297310942756997e+00, 1.0)) * dx\n" + " + vec4( 3.6463241120342760e-01, 3.5991327863123823e-01, 1.3162090170517629e+00, 1.0)) * dx\n" + " + vec4( 9.2867317309905195e-01, 9.2867317309905195e-01, 7.6915572487015205e-01, 1.0);\n" + " } else if (x < 8.2812500000000000e-01) {\n" + " float dx = x - 8.1250000000000000e-01;\n" + " return ((vec4( 2.6851775131151001e-02, 3.8183931751282176e+00, -5.8379224589604535e+00, 1.0) * dx\n" + " + vec4(-7.0283462121685680e-02, -2.1045351324502842e-01, -7.5336991679140475e-01, 1.0)) * dx\n" + " + vec4( 3.6241578036361283e-01, 3.6368026812530641e-01, 1.2711605637538392e+00, 1.0)) * dx\n" + " + vec4( 9.3435318430231395e-01, 9.3435318430231395e-01, 7.8931354544051302e-01, 1.0);\n" + " } else if (x < 8.4375000000000000e-01) {\n" + " float dx = x - 8.2812500000000000e-01;\n" + " return ((vec4( 2.6063496580937279e-02, -9.8987695961652500e-01, 3.3620382019700017e+00, 1.0) * dx\n" + " + vec4(-6.9024785162412977e-02, -3.1466333160893228e-02, -1.0270225320551760e+00, 1.0)) * dx\n" + " + vec4( 3.6023908899979878e-01, 3.5990027052521389e-01, 1.2433419317406114e+00, 1.0)) * dx\n" + " + vec4( 9.3999887425351902e-01, 9.3999887425351902e-01, 8.0896923113998398e-01, 1.0);\n" + " } else if (x < 8.5937500000000000e-01) {\n" + " float dx = x - 8.4375000000000000e-01;\n" + " return ((vec4( 2.5289790701126986e-02, 2.9751021549391093e-01, 7.0033007973428829e-01, 1.0) * dx\n" + " + vec4(-6.7803058760181542e-02, -7.7866815642917836e-02, -8.6942699133783219e-01, 1.0)) * dx\n" + " + vec4( 3.5810115393850828e-01, 3.5819194007515431e-01, 1.2137099079375957e+00, 1.0)) * dx\n" + " + vec4( 9.4561085768929998e-01, 9.4561085768929998e-01, 8.2815853605850198e-01, 1.0);\n" + " } else if (x < 8.7500000000000000e-01) {\n" + " float dx = x - 8.5937500000000000e-01;\n" + " return ((vec4( 2.4612980139061474e-02, -4.8328262834613035e-02, 1.2462888208522547e+00, 1.0) * dx\n" + " + vec4(-6.6617599821066215e-02, -6.3921024291640760e-02, -8.3659901885028742e-01, 1.0)) * dx\n" + " + vec4( 3.5600083114817627e-01, 3.5597650507617684e-01, 1.1870532515284062e+00, 1.0)) * dx\n" + " + vec4( 9.5118973121134198e-01, 9.5118973121134198e-01, 8.4691316246821002e-01, 1.0);\n" + " } else if (x < 8.9062500000000000e-01) {\n" + " float dx = x - 8.7500000000000000e-01;\n" + " return ((vec4( 2.3718003357877809e-02, 4.3262550459793069e-02, 9.5432454482368223e-01, 1.0) * dx\n" + " + vec4(-6.5463866377047708e-02, -6.6186411612013246e-02, -7.7817923037283798e-01, 1.0)) * dx\n" + " + vec4( 3.5393705823883076e-01, 3.5394357639018226e-01, 1.1618223413842950e+00, 1.0)) * dx\n" + " + vec4( 9.5673607402664396e-01, 9.5673607402664396e-01, 8.6526137593056196e-01, 1.0);\n" + " } else if (x < 9.0625000000000000e-01) {\n" + " float dx = x - 8.9062500000000000e-01;\n" + " return ((vec4( 2.3773347988404581e-02, 1.8536402554417759e-02, 9.1391585031942668e-01, 1.0) * dx\n" + " + vec4(-6.4352084969647186e-02, -6.4158479559210446e-02, -7.3344526733422788e-01, 1.0)) * dx\n" + " + vec4( 3.5190868399903863e-01, 3.5190693746563190e-01, 1.1382032086076221e+00, 1.0)) * dx\n" + " + vec4( 9.6225044864937603e-01, 9.6225044864937603e-01, 8.8322850531025798e-01, 1.0);\n" + " } else if (x < 9.2187500000000000e-01) {\n" + " float dx = x - 9.0625000000000000e-01;\n" + " return ((vec4( 2.0411271658957286e-02, 2.1814506292989311e-02, 7.9416477361003268e-01, 1.0) * dx\n" + " + vec4(-6.3237709282690721e-02, -6.3289585689472114e-02, -6.9060546185050475e-01, 1.0)) * dx\n" + " + vec4( 3.4991509346384586e-01, 3.4991556144612124e-01, 1.1159524159641105e+00, 1.0)) * dx\n" + " + vec4( 9.6773340156674204e-01, 9.6773340156674204e-01, 9.0083735297107703e-01, 1.0);\n" + " } else if (x < 9.3750000000000000e-01) {\n" + " float dx = x - 9.2187500000000000e-01;\n" + " return ((vec4( 2.9925950574317017e-02, 2.9549957472174999e-02, 8.1438789217981622e-01, 1.0) * dx\n" + " + vec4(-6.2280930923677098e-02, -6.2267030706988240e-02, -6.5337898808753447e-01, 1.0)) * dx\n" + " + vec4( 3.4795386471062134e-01, 3.4795373931492651e-01, 1.0949526589338288e+00, 1.0)) * dx\n" + " + vec4( 9.7318546387106897e-01, 9.7318546387106897e-01, 9.1810853411962201e-01, 1.0);\n" + " } else if (x < 9.5312500000000000e-01) {\n" + " float dx = x - 9.3750000000000000e-01;\n" + " return ((vec4(-8.4993852229346221e-03, -8.3986474483984299e-03, 4.1632155771993951e-01, 1.0) * dx\n" + " + vec4(-6.0878151990505988e-02, -6.0881876450480037e-02, -6.1520455564160559e-01, 1.0)) * dx\n" + " + vec4( 3.4602950404008725e-01, 3.4602953764059108e-01, 1.0751310410630610e+00, 1.0)) * dx\n" + " + vec4( 9.7860715186021296e-01, 9.7860715186021296e-01, 9.3506075970421498e-01, 1.0);\n" + " } else if (x < 9.6875000000000000e-01) {\n" + " float dx = x - 9.5312500000000000e-01;\n" + " return ((vec4( 1.3210083171865797e-01, 1.3207387372265536e-01, 1.6040605599926014e+00, 1.0) * dx\n" + " + vec4(-6.1276560672831049e-02, -6.1275563049623713e-02, -5.9568948262348342e-01, 1.0)) * dx\n" + " + vec4( 3.4412083665472259e-01, 3.4412082764840196e-01, 1.0562108217151689e+00, 1.0)) * dx\n" + " + vec4( 9.8399896760818195e-01, 9.8399896760818195e-01, 9.5171107393681598e-01, 1.0);\n" + " } else if (x < 9.8437500000000000e-01) {\n" + " float dx = x - 9.6875000000000000e-01;\n" + " return ((vec4(-3.9532580170327219e-01, -3.9531870749379783e-01, -3.0883889522318717e+00, 1.0) * dx\n" + " + vec4(-5.5084334186018956e-02, -5.5084600218874243e-02, -5.2049914387383023e-01, 1.0)) * dx\n" + " + vec4( 3.4230269767255306e-01, 3.4230270009733171e-01, 1.0387703744261485e+00, 1.0)) * dx\n" + " + vec4( 9.8936139950777302e-01, 9.8936139950777302e-01, 9.6807505502895397e-01, 1.0);\n" + " } else if (x < 1.0000000000000000e+00) {\n" + " float dx = x - 9.8437500000000000e-01;\n" + " return ((vec4( 1.5704582643383433e+00, 1.5704568454964483e+00, 1.4192370688206916e+01, 1.0) * dx\n" + " + vec4(-7.3615231140859841e-02, -7.3615164632646016e-02, -6.6526737600969921e-01, 1.0)) * dx\n" + " + vec4( 3.4029176696432056e-01, 3.4029176627152669e-01, 1.0202427725529684e+00, 1.0)) * dx\n" + " + vec4( 9.9469492278687599e-01, 9.9469492278687599e-01, 9.8416698587417395e-01, 1.0);\n" + " } else {\n" + " float dx = x - 1.0000000000000000e+00;\n" + " return ((vec4(-2.0078712962998271e+01, 4.4659701609405914e+01, 4.4659701609500793e+01, 1.0) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx\n" + " + vec4( 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0);\n" + " }\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/spring.h b/colormap-shaders/include/colormap/private/MATLAB/spring.h new file mode 100644 index 0000000..e676612 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/spring.h @@ -0,0 +1,72 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Spring : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_spring.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("spring"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " return vec4(1.0, clamp(x, 0.0, 1.0), clamp(1.0 - x, 0.0, 1.0), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/summer.h b/colormap-shaders/include/colormap/private/MATLAB/summer.h new file mode 100644 index 0000000..7992fb6 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/summer.h @@ -0,0 +1,72 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Summer : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_summer.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("summer"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " return vec4(clamp(x, 0.0, 1.0), clamp(0.5 * x + 0.5, 0.0, 1.0), 0.4, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/MATLAB/winter.h b/colormap-shaders/include/colormap/private/MATLAB/winter.h new file mode 100644 index 0000000..0cb91b5 --- /dev/null +++ b/colormap-shaders/include/colormap/private/MATLAB/winter.h @@ -0,0 +1,72 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace MATLAB +{ + +class Winter : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/MATLAB_winter.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("winter"); + } + + std::string getCategory() const override + { + return std::string("MATLAB"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " return vec4(0.0, clamp(x, 0.0, 1.0), clamp(-0.5 * x + 1.0, 0.0, 1.0), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/all_colormaps.h b/colormap-shaders/include/colormap/private/all_colormaps.h new file mode 100644 index 0000000..a7b6e7e --- /dev/null +++ b/colormap-shaders/include/colormap/private/all_colormaps.h @@ -0,0 +1,108 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#include "./IDL/16_Level.h" +#include "./IDL/Beach.h" +#include "./IDL/Black-White_Linear.h" +#include "./IDL/Blue-Green-Red-Yellow.h" +#include "./IDL/Blue-Pastel-Red.h" +#include "./IDL/Blue-Red.h" +#include "./IDL/Blue-Red_2.h" +#include "./IDL/Blue-White_Linear.h" +#include "./IDL/Blue_Waves.h" +#include "./IDL/CB-Accent.h" +#include "./IDL/CB-Blues.h" +#include "./IDL/CB-BrBG.h" +#include "./IDL/CB-BuGn.h" +#include "./IDL/CB-BuPu.h" +#include "./IDL/CB-Dark2.h" +#include "./IDL/CB-GnBu.h" +#include "./IDL/CB-Greens.h" +#include "./IDL/CB-Greys.h" +#include "./IDL/CB-OrRd.h" +#include "./IDL/CB-Oranges.h" +#include "./IDL/CB-PRGn.h" +#include "./IDL/CB-Paired.h" +#include "./IDL/CB-Pastel1.h" +#include "./IDL/CB-Pastel2.h" +#include "./IDL/CB-PiYG.h" +#include "./IDL/CB-PuBu.h" +#include "./IDL/CB-PuBuGn.h" +#include "./IDL/CB-PuOr.h" +#include "./IDL/CB-PuRd.h" +#include "./IDL/CB-Purples.h" +#include "./IDL/CB-RdBu.h" +#include "./IDL/CB-RdGy.h" +#include "./IDL/CB-RdPu.h" +#include "./IDL/CB-RdYiBu.h" +#include "./IDL/CB-RdYiGn.h" +#include "./IDL/CB-Reds.h" +#include "./IDL/CB-Set1.h" +#include "./IDL/CB-Set2.h" +#include "./IDL/CB-Set3.h" +#include "./IDL/CB-Spectral.h" +#include "./IDL/CB-YIGn.h" +#include "./IDL/CB-YIGnBu.h" +#include "./IDL/CB-YIOrBr.h" +#include "./IDL/Eos_A.h" +#include "./IDL/Eos_B.h" +#include "./IDL/Green-Pink.h" +#include "./IDL/Green-Red-Blue-White.h" +#include "./IDL/Green-White_Exponential.h" +#include "./IDL/Green-White_Linear.h" +#include "./IDL/Hardcandy.h" +#include "./IDL/Haze.h" +#include "./IDL/Hue_Sat_Lightness_1.h" +#include "./IDL/Hue_Sat_Lightness_2.h" +#include "./IDL/Hue_Sat_Value_1.h" +#include "./IDL/Hue_Sat_Value_2.h" +#include "./IDL/Mac_Style.h" +#include "./IDL/Nature.h" +#include "./IDL/Ocean.h" +#include "./IDL/Pastels.h" +#include "./IDL/Peppermint.h" +#include "./IDL/Plasma.h" +#include "./IDL/Prism.h" +#include "./IDL/Purple-Red+Stripes.h" +#include "./IDL/Rainbow+Black.h" +#include "./IDL/Rainbow+White.h" +#include "./IDL/Rainbow.h" +#include "./IDL/Rainbow_18.h" +#include "./IDL/Rainbow_2.h" +#include "./IDL/Red-Purple.h" +#include "./IDL/Red_Temperature.h" +#include "./IDL/Standard_Gamma-II.h" +#include "./IDL/Steps.h" +#include "./IDL/Stern_Special.h" +#include "./IDL/Volcano.h" +#include "./IDL/Waves.h" +#include "./MATLAB/autumn.h" +#include "./MATLAB/bone.h" +#include "./MATLAB/cool.h" +#include "./MATLAB/copper.h" +#include "./MATLAB/hot.h" +#include "./MATLAB/hsv.h" +#include "./MATLAB/jet.h" +#include "./MATLAB/parula.h" +#include "./MATLAB/pink.h" +#include "./MATLAB/spring.h" +#include "./MATLAB/summer.h" +#include "./MATLAB/winter.h" +#include "./kbinani/altitude.h" +#include "./transform/apricot.h" +#include "./transform/carnation.h" +#include "./transform/ether.h" +#include "./transform/grayscale_banded.h" +#include "./transform/hot_metal.h" +#include "./transform/lava_waves.h" +#include "./transform/malachite.h" +#include "./transform/morning_glory.h" +#include "./transform/peanut_butter_and_jerry.h" +#include "./transform/purple_haze.h" +#include "./transform/rainbow.h" +#include "./transform/rose.h" +#include "./transform/saturn.h" +#include "./transform/seismic.h" +#include "./transform/space.h" +#include "./transform/supernova.h" diff --git a/colormap-shaders/include/colormap/private/init_colormap_list.inc b/colormap-shaders/include/colormap/private/init_colormap_list.inc new file mode 100644 index 0000000..42e4602 --- /dev/null +++ b/colormap-shaders/include/colormap/private/init_colormap_list.inc @@ -0,0 +1,108 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), +std::make_shared(), diff --git a/colormap-shaders/include/colormap/private/kbinani/altitude.h b/colormap-shaders/include/colormap/private/kbinani/altitude.h new file mode 100644 index 0000000..20dee5b --- /dev/null +++ b/colormap-shaders/include/colormap/private/kbinani/altitude.h @@ -0,0 +1,80 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace kbinani +{ + +class Altitude : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/kbinani_altitude.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("altitude"); + } + + std::string getCategory() const override + { + return std::string("kbinani"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_func(float x, float a, float c, float d, float e, float f, float g) {\n" + " x = 193.0 * clamp(x, 0.0, 1.0);\n" + " return a * exp(-x * x / (2.0 * c * c)) + ((d * x + e) * x + f) * x + g;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " float r = colormap_func(x, 48.6399, 13.3443, 0.00000732641, -0.00154886, -0.211758, 83.3109);\n" + " float g = colormap_func(x, 92.7934, 9.66818, 0.00000334955, -0.000491041, -0.189276, 56.8844);\n" + " float b = colormap_func(x, 43.4277, 8.92338, 0.00000387675, -0.00112176, 0.0373863, 15.9435);\n" + " return vec4(r / 255.0, g / 255.0, b / 255.0, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace kbinani +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/apricot.h b/colormap-shaders/include/colormap/private/transform/apricot.h new file mode 100644 index 0000000..61391ac --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/apricot.h @@ -0,0 +1,137 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Apricot : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_apricot.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("apricot"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_pi = 3.141592653589793;\n" + "\n" + "float colormap_f(float x, float c) {\n" + " return abs((((-5.563e-5 * x + 3.331e-16) * x + 3.045e-1) * x + 4.396e-12) * x + c);\n" + "}\n" + "\n" + "float colormap_f2(float x) {\n" + " return 262.0 * x + 12.0 * x * sin(((x - 8.0) * x + 66.0 * colormap_pi) * x);\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 1.0) {\n" + " float r = colormap_f2(x);\n" + " if (r > 255.0) {\n" + " r = 510.0 - r;\n" + " }\n" + " return r / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 1.0) {\n" + " return (109.0 * x + 25.0 * sin(9.92 * colormap_pi * x) * x) / 255.0;\n" + " } else {\n" + " return 102.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " float b = 0.0;\n" + " x = x * 256.0;\n" + "\n" + " if (x < 0.0) {\n" + " b = 241.0 / 255.0;\n" + " } else if (x < 66.82) {\n" + " b = colormap_f(x - 32.0, -27.0);\n" + " if (x > 32.0 && b > 225.0) {\n" + " b = b - 10.0;\n" + " }\n" + " } else if (x < 126.67) {\n" + " b = colormap_f(x - 97.0, 30.0);\n" + " } else if (x < 195.83) {\n" + " b = colormap_f(x - 161.0, -27.0);\n" + " if (x > 161.0 && b > 225.0) {\n" + " b -= 10.0;\n" + " }\n" + " } else if (x < 256.0) {\n" + " b = colormap_f(x - 226.0, 30.0);\n" + " } else {\n" + " b = 251.0;\n" + " }\n" + " if (b > 255.0) {\n" + " b = 255.0;\n" + " }\n" + "\n" + " return b / 255.0;\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/carnation.h b/colormap-shaders/include/colormap/private/transform/carnation.h new file mode 100644 index 0000000..e864b4e --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/carnation.h @@ -0,0 +1,122 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Carnation : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_carnation.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("carnation"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f(float x) {\n" + " return ((-9.93427e0 * x + 1.56301e1) * x + 2.44663e2 * x) / 255.0;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 11.0 / 255.0;\n" + " } else if (x < 0.16531216481302) {\n" + " return (((-1635.0 * x) + 1789.0) * x + 3.938) / 255.0;\n" + " } else if (x < 0.50663669203696) {\n" + " return 1.0;\n" + " } else if (x < 0.67502056695956) {\n" + " return ((((1.28932e3 * x) - 7.74147e2) * x - 9.47634e2) * x + 7.65071e2) / 255.0;\n" + " } else if (x < 1.0) {\n" + " return colormap_f(x);\n" + " } else {\n" + " return 251.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 0.33807590140751) {\n" + " return colormap_f(x);\n" + " } else if (x < 0.50663669203696) {\n" + " return (((-5.83014e2 * x - 8.38523e2) * x + 2.03823e3) * x - 4.86592e2) / 255.0;\n" + " } else if (x < 0.84702285244773) {\n" + " return 1.0;\n" + " } else if (x < 1.0) {\n" + " return (((-5.03306e2 * x + 2.95545e3) * x - 4.19210e3) * x + 1.99128e3) / 255.0;\n" + " } else {\n" + " return 251.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.16531216481302) {\n" + " return 1.0;\n" + " } else if (x < 0.33807590140751) {\n" + " return (((-5.15164e3 * x + 5.30564e3) * x - 2.65098e3) * x + 5.70771e2) / 255.0;\n" + " } else if (x < 0.67502056695956) {\n" + " return colormap_f(x);\n" + " } else if (x < 0.84702285244773) {\n" + " return (((3.34136e3 * x - 9.01976e3) * x + 8.39740e3) * x - 2.41682e3) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/ether.h b/colormap-shaders/include/colormap/private/transform/ether.h new file mode 100644 index 0000000..353ff5d --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/ether.h @@ -0,0 +1,134 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Ether : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_ether.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("ether"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f(float x, float b) {\n" + " float x2 = x * x;\n" + " return ((-1.89814e5 * x2 + 1.50967e4) * x2 + b) / 255.0;\n" + "}\n" + "\n" + "float colormap_f2(float x, float b) {\n" + " float x2 = x * x;\n" + " return ((1.88330e5 * x2 - 1.50839e4) * x2 + b) / 255.0;\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0e0) {\n" + " return 246.0 / 255.0;\n" + " } else if (x < 0.25) {\n" + " return colormap_f(x - 32.0 / 256.0, 65.0);\n" + " } else if (x < 130.0 / 256.0) {\n" + " return colormap_f2(x - 97.0 / 256.0, 190.0);\n" + " } else if (x < 193.0 / 256.0) {\n" + " return colormap_f(x - 161.0 / 256.0, 65.0);\n" + " } else if (x < 1.0) {\n" + " return colormap_f2(x - 226.0 / 256.0, 190.0);\n" + " } else {\n" + " return 18.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 0.20615790927912) {\n" + " return ((((-3.81619e4 * x - 2.94574e3) * x + 2.61347e3) * x - 7.92183e1) * x) / 255.0;\n" + " } else if (x < 0.54757171958025) {\n" + " return (((((2.65271e5 * x - 4.14808e5) * x + 2.26118e5) * x - 5.16491e4) * x + 5.06893e3) * x - 1.80630e2) / 255.0;\n" + " } else if (x < 0.71235558668792) {\n" + " return ((((1.77058e5 * x - 4.62571e5) * x + 4.39628e5) * x - 1.80143e5) * x + 2.68555e4) / 255.0;\n" + " } else if (x < 1.0) {\n" + " float xx = ((((1.70556e5 * x - 6.20429e5) * x + 8.28331e5) * x - 4.80913e5) * x + 1.02608e5);\n" + " if (xx > 255.0) {\n" + " return (510.0 - xx) / 255.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else {\n" + " return 154.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 2.0 / 255.0;\n" + " } else if (x < 1.0) {\n" + " float xx = 2.83088e2 * x + 8.17847e-1;\n" + " if (xx > 255.0) {\n" + " return (510.0 - xx) / 255.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else {\n" + " return 226.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/grayscale_banded.h b/colormap-shaders/include/colormap/private/transform/grayscale_banded.h new file mode 100644 index 0000000..65fa2ab --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/grayscale_banded.h @@ -0,0 +1,77 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class GrayscaleBanded : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_grayscale_banded.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("grayscale_banded"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float v = cos(133.0 * x) * 28.0 + 230.0 * x + 27.0;\n" + " if (v > 255.0) {\n" + " v = 510.0 - v;\n" + " }\n" + " v = v / 255.0;\n" + " return vec4(v, v, v, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/hot_metal.h b/colormap-shaders/include/colormap/private/transform/hot_metal.h new file mode 100644 index 0000000..b62c5eb --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/hot_metal.h @@ -0,0 +1,96 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class HotMetal : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_hot_metal.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("hot_metal"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_blue(float x) {\n" + " return 0.0;\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.6) {\n" + " return 0.0;\n" + " } else if (x <= 0.95) {\n" + " return ((x - 0.6) * 728.57) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x <= 0.57147) {\n" + " return 446.22 * x / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/lava_waves.h b/colormap-shaders/include/colormap/private/transform/lava_waves.h new file mode 100644 index 0000000..18b729f --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/lava_waves.h @@ -0,0 +1,103 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class LavaWaves : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_lava_waves.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("lava_waves"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 124.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (128.0 * sin(6.25 * (x + 0.5)) + 128.0) / 255.0;\n" + " } else {\n" + " return 134.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 121.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (63.0 * sin(x * 99.72) + 97.0) / 255.0;\n" + " } else {\n" + " return 52.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 131.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (128.0 * sin(6.23 * x) + 128.0) / 255.0;\n" + " } else {\n" + " return 121.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/malachite.h b/colormap-shaders/include/colormap/private/transform/malachite.h new file mode 100644 index 0000000..60a65e4 --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/malachite.h @@ -0,0 +1,122 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Malachite : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_malachite.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("malachite"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_blue(float x) {\n" + " if (x < 248.25 / 1066.8) {\n" + " return 0.0;\n" + " } else if (x < 384.25 / 1066.8) {\n" + " return (1066.8 * x - 248.25) / 255.0;\n" + " } else if (x < 0.5) {\n" + " return 136.0 / 255.0;\n" + " } else if (x < 595.14 / 1037.9) {\n" + " return (-1037.9 * x + 595.14) / 255.0;\n" + " } else if (x < 666.68 / 913.22) {\n" + " return 0.0;\n" + " } else if (x <= 1.0) {\n" + " return (913.22 * x - 666.68) / 255.0;\n" + " } else {\n" + " return 246.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 253.0 / 255.0;\n" + " } else if (x < 248.25 / 1066.8) {\n" + " return (-545.75 * x + 253.36) / 255.0;\n" + " } else if (x < 384.25 / 1066.8) {\n" + " return (426.18 * x + 19335217.0 / 711200.0) / 255.0;\n" + " } else if (x < 0.5) {\n" + " return (-385524981.0 / 298300.0 * x + 385524981.0 / 596600.0) / 255.0;\n" + " } else if (x < 666.68 / 913.22) {\n" + " return (3065810.0 / 3001.0 * x - 1532906.0 / 3001.0) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 384.25 / 1066.8) {\n" + " return 0.0;\n" + " } else if (x < 0.5) {\n" + " return (1092.0 * x - 99905.0 / 254.0) / 255.0;\n" + " } else if (x < 259.3 / 454.5) {\n" + " return (1091.9 * x - 478.18) / 255.0;\n" + " } else if (x < 34188.3 / 51989.0) {\n" + " return (819.2 * x - 322.6) / 255.0;\n" + " } else if (x < 666.68 / 913.22) {\n" + " return (299.31 * x + 19.283) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/morning_glory.h b/colormap-shaders/include/colormap/private/transform/morning_glory.h new file mode 100644 index 0000000..0e16c3d --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/morning_glory.h @@ -0,0 +1,114 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class MorningGlory : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_morning_glory.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("morning_glory"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x <= 1.0) {\n" + " float xx = 270.9 * x + 0.7703;\n" + " if (xx > 255.0) {\n" + " return (510.0 - xx) / 266.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else {\n" + " return 239.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 124.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " float xx = 180.0 * sin(x * 3.97 + 9.46) + 131.0;\n" + " if (xx < 0.0) {\n" + " return abs(xx) / 255.0;\n" + " } else if (xx > 255.0) {\n" + " return (510.0 - xx) / 255.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else {\n" + " return 242.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 78.0 / 255.0;\n" + " } else if (x <= 1.0e0) {\n" + " return (95.0 * sin((x - 0.041) * 7.46) + 106.9) / 255.0;\n" + " } else {\n" + " return 179.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/peanut_butter_and_jerry.h b/colormap-shaders/include/colormap/private/transform/peanut_butter_and_jerry.h new file mode 100644 index 0000000..0eef80c --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/peanut_butter_and_jerry.h @@ -0,0 +1,107 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class PeanutButterAndJerry : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_peanut_butter_and_jerry.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("peanut_butter_and_jerry"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 1.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " float xx = 407.92 * x + 1.3181;\n" + " if (xx > 255.0) {\n" + " return (510.0 - xx) / 255.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else {\n" + " return 100.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x <= 1.0) {\n" + " return (128.7 * x + 0.2089) / 255.0;\n" + " } else {\n" + " return 128.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 73.0 / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (63.0 * sin(x * 6.21 - 0.3) + 92.0) / 255.0;\n" + " } else {\n" + " return 69.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/purple_haze.h b/colormap-shaders/include/colormap/private/transform/purple_haze.h new file mode 100644 index 0000000..a6ed463 --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/purple_haze.h @@ -0,0 +1,122 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class PurpleHaze : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_purple_haze.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("purple_haze"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_e = exp(1.0);\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 13.0 / 255.0;\n" + " } else if (x < colormap_e * 0.1) {\n" + " return (706.48 * x + 13.06) / 255.0;\n" + " } else if (x < colormap_e * 0.1 + 149.0 / 510.0) {\n" + " return (166.35 * x + 28.3) / 255.0;\n" + " } else if (x < colormap_e * 0.1 + 298.0 / 510.0) {\n" + " return (313.65 * x - 47.179) / 255.0;\n" + " } else if (x < colormap_e * 0.05 + 202.0 / 255.0) {\n" + " return (557.93 * x - 310.05) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (319.64 * x + 439093.0 / 34000.0 * colormap_e - 1030939.0 / 8500.0) / 255.0;\n" + " } else {\n" + " return 249.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < colormap_e * 0.1) {\n" + " return 0.0;\n" + " } else if (x < colormap_e * 0.1 + 149.0 / 510.0) {\n" + " return ((3166.59 / 14.9 * colormap_e + 2098.7 / 74.5) * x - (316.659 / 14.9 * colormap_e + 209.87 / 74.5) * colormap_e) / 255.0;\n" + " } else if (x < colormap_e * 0.1 + 298.0 / 510.0) {\n" + " return (725.0 * x - 394.35) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (-716.23 * x + 721.38) / 255.0;\n" + " } else {\n" + " return 5.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 16.0 / 255.0;\n" + " } else if (x < colormap_e * 0.1) {\n" + " return (878.72 * x + 16.389) / 255.0;\n" + " } else if (x < colormap_e * 0.1 + 149.0 / 510.0) {\n" + " return (-166.35 * x + 227.7) / 255.0;\n" + " } else if (x < colormap_e * 0.1 + 298.0 / 510.0) {\n" + " return (-317.2 * x + 305.21) / 255.0;\n" + " } else if (x < 1.0) {\n" + " return ((1530.0 / (212.0 -51.0 * colormap_e)) * x + (153.0 * colormap_e + 894.0) / (51.0 * colormap_e - 212.0)) / 255.0;\n" + " } else {\n" + " return 2.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/rainbow.h b/colormap-shaders/include/colormap/private/transform/rainbow.h new file mode 100644 index 0000000..763d11c --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/rainbow.h @@ -0,0 +1,106 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Rainbow : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_rainbow.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("rainbow"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "vec4 colormap(float x) {\n" + " float r = 0.0, g = 0.0, b = 0.0;\n" + "\n" + " if (x < 0.0) {\n" + " r = 127.0 / 255.0;\n" + " } else if (x <= 1.0 / 9.0) {\n" + " r = 1147.5 * (1.0 / 9.0 - x) / 255.0;\n" + " } else if (x <= 5.0 / 9.0) {\n" + " r = 0.0;\n" + " } else if (x <= 7.0 / 9.0) {\n" + " r = 1147.5 * (x - 5.0 / 9.0) / 255.0;\n" + " } else {\n" + " r = 1.0;\n" + " }\n" + "\n" + " if (x <= 1.0 / 9.0) {\n" + " g = 0.0;\n" + " } else if (x <= 3.0 / 9.0) {\n" + " g = 1147.5 * (x - 1.0 / 9.0) / 255.0;\n" + " } else if (x <= 7.0 / 9.0) {\n" + " g = 1.0;\n" + " } else if (x <= 1.0) {\n" + " g = 1.0 - 1147.5 * (x - 7.0 / 9.0) / 255.0;\n" + " } else {\n" + " g = 0.0;\n" + " }\n" + "\n" + " if (x <= 3.0 / 9.0) {\n" + " b = 1.0;\n" + " } else if (x <= 5.0 / 9.0) {\n" + " b = 1.0 - 1147.5 * (x - 3.0 / 9.0) / 255.0;\n" + " } else {\n" + " b = 0.0;\n" + " }\n" + "\n" + " return vec4(r, g, b, 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/rose.h b/colormap-shaders/include/colormap/private/transform/rose.h new file mode 100644 index 0000000..3c3fd90 --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/rose.h @@ -0,0 +1,108 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Rose : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_rose.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("rose"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 54.0 / 255.0;\n" + " } else if (x < 20049.0 / 82979.0) {\n" + " return (829.79 * x + 54.51) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 20049.0 / 82979.0) {\n" + " return 0.0;\n" + " } else if (x < 327013.0 / 810990.0) {\n" + " return (8546482679670.0 / 10875673217.0 * x - 2064961390770.0 / 10875673217.0) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (103806720.0 / 483977.0 * x + 19607415.0 / 483977.0) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 54.0 / 255.0;\n" + " } else if (x < 7249.0 / 82979.0) {\n" + " return (829.79 * x + 54.51) / 255.0;\n" + " } else if (x < 20049.0 / 82979.0) {\n" + " return 127.0 / 255.0;\n" + " } else if (x < 327013.0 / 810990.0) {\n" + " return (792.02249341361393720147485376583 * x - 64.364790735602331034989206222672) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/saturn.h b/colormap-shaders/include/colormap/private/transform/saturn.h new file mode 100644 index 0000000..f523b5e --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/saturn.h @@ -0,0 +1,144 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Saturn : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_saturn.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("saturn"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f1(float x) {\n" + " return -510.0 * x + 255.0;\n" + "}\n" + "\n" + "float colormap_f2(float x) {\n" + " return (-1891.7 * x + 217.46) * x + 255.0;\n" + "}\n" + "\n" + "float colormap_f3(float x) {\n" + " return 9.26643676359015e1 * sin((x - 4.83450094847127e-1) * 9.93) + 1.35940451627965e2;\n" + "}\n" + "\n" + "float colormap_f4(float x) {\n" + " return -510.0 * x + 510.0;\n" + "}\n" + "\n" + "float colormap_f5(float x) {\n" + " float xx = x - 197169.0 / 251000.0;\n" + " return (2510.0 * xx - 538.31) * xx;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 1.0;\n" + " } else if (x < 10873.0 / 94585.0) {\n" + " float xx = colormap_f2(x);\n" + " if (xx > 255.0) {\n" + " return (510.0 - xx) / 255.0;\n" + " } else {\n" + " return xx / 255.0;\n" + " }\n" + " } else if (x < 0.5) {\n" + " return 1.0;\n" + " } else if (x < 146169.0 / 251000.0) {\n" + " return colormap_f4(x) / 255.0;\n" + " } else if (x < 197169.0 / 251000.0) {\n" + " return colormap_f5(x) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 10873.0 / 94585.0) {\n" + " return 1.0;\n" + " } else if (x < 36373.0 / 94585.0) {\n" + " return colormap_f2(x) / 255.0;\n" + " } else if (x < 0.5) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else if (x < 197169.0 / 251000.0) {\n" + " return 0.0;\n" + " } else if (x <= 1.0) {\n" + " return abs(colormap_f5(x)) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 36373.0 / 94585.0) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else if (x < 146169.0 / 251000.0) {\n" + " return colormap_f3(x) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return colormap_f4(x) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/seismic.h b/colormap-shaders/include/colormap/private/transform/seismic.h new file mode 100644 index 0000000..627cc56 --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/seismic.h @@ -0,0 +1,126 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Seismic : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_seismic.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("seismic"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f(float x) {\n" + " return ((-2010.0 * x + 2502.5950459) * x - 481.763180924) / 255.0;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 3.0 / 255.0;\n" + " } else if (x < 0.238) {\n" + " return ((-1810.0 * x + 414.49) * x + 3.87702) / 255.0;\n" + " } else if (x < 51611.0 / 108060.0) {\n" + " return (344441250.0 / 323659.0 * x - 23422005.0 / 92474.0) / 255.0;\n" + " } else if (x < 25851.0 / 34402.0) {\n" + " return 1.0;\n" + " } else if (x <= 1.0) {\n" + " return (-688.04 * x + 772.02) / 255.0;\n" + " } else {\n" + " return 83.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 0.238) {\n" + " return 0.0;\n" + " } else if (x < 51611.0 / 108060.0) {\n" + " return colormap_f(x);\n" + " } else if (x < 0.739376978894039) {\n" + " float xx = x - 51611.0 / 108060.0;\n" + " return ((-914.74 * xx - 734.72) * xx + 255.) / 255.0;\n" + " } else {\n" + " return 0.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 19.0 / 255.0;\n" + " } else if (x < 0.238) {\n" + " float xx = x - 0.238;\n" + " return (((1624.6 * xx + 1191.4) * xx + 1180.2) * xx + 255.0) / 255.0;\n" + " } else if (x < 51611.0 / 108060.0) {\n" + " return 1.0;\n" + " } else if (x < 174.5 / 256.0) {\n" + " return (-951.67322673866 * x + 709.532730938451) / 255.0;\n" + " } else if (x < 0.745745353439206) {\n" + " return (-705.250074130877 * x + 559.620050530617) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return ((-399.29 * x + 655.71) * x - 233.25) / 255.0;\n" + " } else {\n" + " return 23.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/space.h b/colormap-shaders/include/colormap/private/transform/space.h new file mode 100644 index 0000000..fcfa59c --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/space.h @@ -0,0 +1,137 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Space : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_space.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("space"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_red(float x) {\n" + " if (x < 37067.0 / 158860.0) {\n" + " return 0.0;\n" + " } else if (x < 85181.0 / 230350.0) {\n" + " float xx = x - 37067.0 / 158860.0;\n" + " return (780.25 * xx + 319.71) * xx / 255.0;\n" + " } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) {\n" + " return ((1035.33580904442 * x - 82.5380748768798) * x - 52.8985266363332) / 255.0;\n" + " } else if (x < 231408.0 / 362695.0) {\n" + " return (339.41 * x - 33.194) / 255.0;\n" + " } else if (x < 152073.0 / 222340.0) {\n" + " return (1064.8 * x - 496.01) / 255.0;\n" + " } else if (x < 294791.0 / 397780.0) {\n" + " return (397.78 * x - 39.791) / 255.0;\n" + " } else if (x < 491189.0 / 550980.0) {\n" + " return 1.0;\n" + " } else if (x < 1.0) {\n" + " return (5509.8 * x + 597.91) * x / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " float xx;\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < (-sqrt(166317494.0) + 39104.0) / 183830.0) {\n" + " return (-1838.3 * x + 464.36) * x / 255.0;\n" + " } else if (x < 37067.0 / 158860.0) {\n" + " return (-317.72 * x + 74.134) / 255.0;\n" + " } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) {\n" + " return 0.0;\n" + " } else if (x < 294791.0 / 397780.0) {\n" + " xx = x - (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0;\n" + " return (-1945.0 * xx + 1430.2) * xx / 255.0;\n" + " } else if (x < 491189.0 / 550980.0) {\n" + " return ((-1770.0 * x + 3.92813840044638e3) * x - 1.84017494792245e3) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 51987.0 / 349730.0) {\n" + " return (458.79 * x) / 255.0;\n" + " } else if (x < 85181.0 / 230350.0) {\n" + " return (109.06 * x + 51.987) / 255.0;\n" + " } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) {\n" + " return (339.41 * x - 33.194) / 255.0;\n" + " } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) {\n" + " return ((-1552.4 * x + 1170.7) * x - 92.996) / 255.0;\n" + " } else if (x < 27568.0 / 38629.0) {\n" + " return 0.0;\n" + " } else if (x < 81692.0 / 96241.0) {\n" + " return (386.29 * x - 275.68) / 255.0;\n" + " } else if (x <= 1.0) {\n" + " return (1348.7 * x - 1092.6) / 255.0;\n" + " } else {\n" + " return 1.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/include/colormap/private/transform/supernova.h b/colormap-shaders/include/colormap/private/transform/supernova.h new file mode 100644 index 0000000..eea9662 --- /dev/null +++ b/colormap-shaders/include/colormap/private/transform/supernova.h @@ -0,0 +1,134 @@ +/** + * This file was automatically created with "create_c++_header.sh". + * Do not edit manually. + */ +#pragma once +#include "../../colormap.h" + +namespace colormap +{ +namespace transform +{ + +class Supernova : public Colormap +{ +private: + class Wrapper : public WrapperBase + { + public: + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wkeyword-macro" + #elif defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wkeyword-macro" + #endif + + #define float local_real_t + #include "../../../../shaders/glsl/transform_supernova.frag" + #undef float + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + }; + +public: + Color getColor(double x) const override + { + Wrapper w; + vec4 c = w.colormap(x); + Color result; + result.r = std::max(0.0, std::min(1.0, c.r)); + result.g = std::max(0.0, std::min(1.0, c.g)); + result.b = std::max(0.0, std::min(1.0, c.b)); + result.a = std::max(0.0, std::min(1.0, c.a)); + return result; + } + + std::string getTitle() const override + { + return std::string("supernova"); + } + + std::string getCategory() const override + { + return std::string("transform"); + } + + std::string getSource() const override + { + return std::string( + "float colormap_f1(float x) {\n" + " return (0.3647 * x + 164.02) * x + 154.21;\n" + "}\n" + "\n" + "float colormap_f2(float x) {\n" + " return (126.68 * x + 114.35) * x + 0.1551;\n" + "}\n" + "\n" + "float colormap_red(float x) {\n" + " if (x < 0.0) {\n" + " return 0.0;\n" + " } else if (x < 0.136721748106749) {\n" + " return colormap_f2(x) / 255.0;\n" + " } else if (x < 0.23422409711017) {\n" + " return (1789.6 * x - 226.52) / 255.0;\n" + " } else if (x < 0.498842730309711) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else if (x < 0.549121259378134) {\n" + " return (-654.951781800243 * x + 562.838873112072) / 255.0;\n" + " } else if (x < 1.0) {\n" + " return ((3.6897 * x + 11.125) * x + 223.15) / 255.0;\n" + " } else {\n" + " return 237.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_green(float x) {\n" + " if (x < 0.0) {\n" + " return 154.0 / 255.0;\n" + " } else if (x < 3.888853260731947e-2) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else if (x < 0.136721748106749e0) {\n" + " return (-1455.86353067466 * x + 217.205447330541) / 255.0;\n" + " } else if (x < 0.330799131955394) {\n" + " return colormap_f2(x) / 255.0;\n" + " } else if (x < 0.498842730309711) {\n" + " return (1096.6 * x - 310.91) / 255.0;\n" + " } else if (x < 0.549121259378134) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else {\n" + " return 244.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "float colormap_blue(float x) {\n" + " if (x < 0.0) {\n" + " return 93.0 / 255.0;\n" + " } else if (x < 3.888853260731947e-2) {\n" + " return (1734.6 * x + 93.133) / 255.0;\n" + " } else if (x < 0.234224097110170) {\n" + " return colormap_f1(x) / 255.0;\n" + " } else if (x < 0.330799131955394) {\n" + " return (-1457.96598791534 * x + 534.138211325166) / 255.0;\n" + " } else if (x < 0.549121259378134) {\n" + " return colormap_f2(x) / 255.0;\n" + " } else if (x < 1.0) {\n" + " return ((3.8931 * x + 176.32) * x + 3.1505) / 255.0;\n" + " } else {\n" + " return 183.0 / 255.0;\n" + " }\n" + "}\n" + "\n" + "vec4 colormap(float x) {\n" + " return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0);\n" + "}\n" + ); + } +}; + +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/sample/IDL_16_Level.png b/colormap-shaders/sample/IDL_16_Level.png new file mode 100644 index 0000000..9928ac0 Binary files /dev/null and b/colormap-shaders/sample/IDL_16_Level.png differ diff --git a/colormap-shaders/sample/IDL_Beach.png b/colormap-shaders/sample/IDL_Beach.png new file mode 100644 index 0000000..c6a4ade Binary files /dev/null and b/colormap-shaders/sample/IDL_Beach.png differ diff --git a/colormap-shaders/sample/IDL_Black-White_Linear.png b/colormap-shaders/sample/IDL_Black-White_Linear.png new file mode 100644 index 0000000..43938c2 Binary files /dev/null and b/colormap-shaders/sample/IDL_Black-White_Linear.png differ diff --git a/colormap-shaders/sample/IDL_Blue-Green-Red-Yellow.png b/colormap-shaders/sample/IDL_Blue-Green-Red-Yellow.png new file mode 100644 index 0000000..1665f64 Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue-Green-Red-Yellow.png differ diff --git a/colormap-shaders/sample/IDL_Blue-Pastel-Red.png b/colormap-shaders/sample/IDL_Blue-Pastel-Red.png new file mode 100644 index 0000000..e7e4c54 Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue-Pastel-Red.png differ diff --git a/colormap-shaders/sample/IDL_Blue-Red.png b/colormap-shaders/sample/IDL_Blue-Red.png new file mode 100644 index 0000000..70f646d Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue-Red.png differ diff --git a/colormap-shaders/sample/IDL_Blue-Red_2.png b/colormap-shaders/sample/IDL_Blue-Red_2.png new file mode 100644 index 0000000..7313a57 Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue-Red_2.png differ diff --git a/colormap-shaders/sample/IDL_Blue-White_Linear.png b/colormap-shaders/sample/IDL_Blue-White_Linear.png new file mode 100644 index 0000000..1587189 Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue-White_Linear.png differ diff --git a/colormap-shaders/sample/IDL_Blue_Waves.png b/colormap-shaders/sample/IDL_Blue_Waves.png new file mode 100644 index 0000000..d6f0826 Binary files /dev/null and b/colormap-shaders/sample/IDL_Blue_Waves.png differ diff --git a/colormap-shaders/sample/IDL_CB-Accent.png b/colormap-shaders/sample/IDL_CB-Accent.png new file mode 100644 index 0000000..813d8b2 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Accent.png differ diff --git a/colormap-shaders/sample/IDL_CB-Blues.png b/colormap-shaders/sample/IDL_CB-Blues.png new file mode 100644 index 0000000..337f61d Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Blues.png differ diff --git a/colormap-shaders/sample/IDL_CB-BrBG.png b/colormap-shaders/sample/IDL_CB-BrBG.png new file mode 100644 index 0000000..5e1403c Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-BrBG.png differ diff --git a/colormap-shaders/sample/IDL_CB-BuGn.png b/colormap-shaders/sample/IDL_CB-BuGn.png new file mode 100644 index 0000000..e00e4de Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-BuGn.png differ diff --git a/colormap-shaders/sample/IDL_CB-BuPu.png b/colormap-shaders/sample/IDL_CB-BuPu.png new file mode 100644 index 0000000..9cc72f1 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-BuPu.png differ diff --git a/colormap-shaders/sample/IDL_CB-Dark2.png b/colormap-shaders/sample/IDL_CB-Dark2.png new file mode 100644 index 0000000..ce7b7f4 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Dark2.png differ diff --git a/colormap-shaders/sample/IDL_CB-GnBu.png b/colormap-shaders/sample/IDL_CB-GnBu.png new file mode 100644 index 0000000..01bb036 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-GnBu.png differ diff --git a/colormap-shaders/sample/IDL_CB-Greens.png b/colormap-shaders/sample/IDL_CB-Greens.png new file mode 100644 index 0000000..c4cba82 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Greens.png differ diff --git a/colormap-shaders/sample/IDL_CB-Greys.png b/colormap-shaders/sample/IDL_CB-Greys.png new file mode 100644 index 0000000..a6d8fe1 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Greys.png differ diff --git a/colormap-shaders/sample/IDL_CB-OrRd.png b/colormap-shaders/sample/IDL_CB-OrRd.png new file mode 100644 index 0000000..74c3636 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-OrRd.png differ diff --git a/colormap-shaders/sample/IDL_CB-Oranges.png b/colormap-shaders/sample/IDL_CB-Oranges.png new file mode 100644 index 0000000..f3bd02a Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Oranges.png differ diff --git a/colormap-shaders/sample/IDL_CB-PRGn.png b/colormap-shaders/sample/IDL_CB-PRGn.png new file mode 100644 index 0000000..fef21a2 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PRGn.png differ diff --git a/colormap-shaders/sample/IDL_CB-Paired.png b/colormap-shaders/sample/IDL_CB-Paired.png new file mode 100644 index 0000000..5068511 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Paired.png differ diff --git a/colormap-shaders/sample/IDL_CB-Pastel1.png b/colormap-shaders/sample/IDL_CB-Pastel1.png new file mode 100644 index 0000000..a05742b Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Pastel1.png differ diff --git a/colormap-shaders/sample/IDL_CB-Pastel2.png b/colormap-shaders/sample/IDL_CB-Pastel2.png new file mode 100644 index 0000000..84eede1 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Pastel2.png differ diff --git a/colormap-shaders/sample/IDL_CB-PiYG.png b/colormap-shaders/sample/IDL_CB-PiYG.png new file mode 100644 index 0000000..ac72ff5 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PiYG.png differ diff --git a/colormap-shaders/sample/IDL_CB-PuBu.png b/colormap-shaders/sample/IDL_CB-PuBu.png new file mode 100644 index 0000000..749ac50 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PuBu.png differ diff --git a/colormap-shaders/sample/IDL_CB-PuBuGn.png b/colormap-shaders/sample/IDL_CB-PuBuGn.png new file mode 100644 index 0000000..0d1a38c Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PuBuGn.png differ diff --git a/colormap-shaders/sample/IDL_CB-PuOr.png b/colormap-shaders/sample/IDL_CB-PuOr.png new file mode 100644 index 0000000..b1a2ff8 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PuOr.png differ diff --git a/colormap-shaders/sample/IDL_CB-PuRd.png b/colormap-shaders/sample/IDL_CB-PuRd.png new file mode 100644 index 0000000..3f425af Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-PuRd.png differ diff --git a/colormap-shaders/sample/IDL_CB-Purples.png b/colormap-shaders/sample/IDL_CB-Purples.png new file mode 100644 index 0000000..0b200ff Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Purples.png differ diff --git a/colormap-shaders/sample/IDL_CB-RdBu.png b/colormap-shaders/sample/IDL_CB-RdBu.png new file mode 100644 index 0000000..0f14e53 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-RdBu.png differ diff --git a/colormap-shaders/sample/IDL_CB-RdGy.png b/colormap-shaders/sample/IDL_CB-RdGy.png new file mode 100644 index 0000000..53b3079 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-RdGy.png differ diff --git a/colormap-shaders/sample/IDL_CB-RdPu.png b/colormap-shaders/sample/IDL_CB-RdPu.png new file mode 100644 index 0000000..4906156 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-RdPu.png differ diff --git a/colormap-shaders/sample/IDL_CB-RdYiBu.png b/colormap-shaders/sample/IDL_CB-RdYiBu.png new file mode 100644 index 0000000..725e398 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-RdYiBu.png differ diff --git a/colormap-shaders/sample/IDL_CB-RdYiGn.png b/colormap-shaders/sample/IDL_CB-RdYiGn.png new file mode 100644 index 0000000..935675b Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-RdYiGn.png differ diff --git a/colormap-shaders/sample/IDL_CB-Reds.png b/colormap-shaders/sample/IDL_CB-Reds.png new file mode 100644 index 0000000..4a7d5b0 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Reds.png differ diff --git a/colormap-shaders/sample/IDL_CB-Set1.png b/colormap-shaders/sample/IDL_CB-Set1.png new file mode 100644 index 0000000..ad4ef32 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Set1.png differ diff --git a/colormap-shaders/sample/IDL_CB-Set2.png b/colormap-shaders/sample/IDL_CB-Set2.png new file mode 100644 index 0000000..1384961 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Set2.png differ diff --git a/colormap-shaders/sample/IDL_CB-Set3.png b/colormap-shaders/sample/IDL_CB-Set3.png new file mode 100644 index 0000000..8c2bddf Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Set3.png differ diff --git a/colormap-shaders/sample/IDL_CB-Spectral.png b/colormap-shaders/sample/IDL_CB-Spectral.png new file mode 100644 index 0000000..f5241eb Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-Spectral.png differ diff --git a/colormap-shaders/sample/IDL_CB-YIGn.png b/colormap-shaders/sample/IDL_CB-YIGn.png new file mode 100644 index 0000000..1b88879 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-YIGn.png differ diff --git a/colormap-shaders/sample/IDL_CB-YIGnBu.png b/colormap-shaders/sample/IDL_CB-YIGnBu.png new file mode 100644 index 0000000..76dbf1b Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-YIGnBu.png differ diff --git a/colormap-shaders/sample/IDL_CB-YIOrBr.png b/colormap-shaders/sample/IDL_CB-YIOrBr.png new file mode 100644 index 0000000..87ba063 Binary files /dev/null and b/colormap-shaders/sample/IDL_CB-YIOrBr.png differ diff --git a/colormap-shaders/sample/IDL_Eos_A.png b/colormap-shaders/sample/IDL_Eos_A.png new file mode 100644 index 0000000..78e1dbd Binary files /dev/null and b/colormap-shaders/sample/IDL_Eos_A.png differ diff --git a/colormap-shaders/sample/IDL_Eos_B.png b/colormap-shaders/sample/IDL_Eos_B.png new file mode 100644 index 0000000..9d7513b Binary files /dev/null and b/colormap-shaders/sample/IDL_Eos_B.png differ diff --git a/colormap-shaders/sample/IDL_Green-Pink.png b/colormap-shaders/sample/IDL_Green-Pink.png new file mode 100644 index 0000000..3bf2e44 Binary files /dev/null and b/colormap-shaders/sample/IDL_Green-Pink.png differ diff --git a/colormap-shaders/sample/IDL_Green-Red-Blue-White.png b/colormap-shaders/sample/IDL_Green-Red-Blue-White.png new file mode 100644 index 0000000..0dfbec6 Binary files /dev/null and b/colormap-shaders/sample/IDL_Green-Red-Blue-White.png differ diff --git a/colormap-shaders/sample/IDL_Green-White_Exponential.png b/colormap-shaders/sample/IDL_Green-White_Exponential.png new file mode 100644 index 0000000..d0178b8 Binary files /dev/null and b/colormap-shaders/sample/IDL_Green-White_Exponential.png differ diff --git a/colormap-shaders/sample/IDL_Green-White_Linear.png b/colormap-shaders/sample/IDL_Green-White_Linear.png new file mode 100644 index 0000000..3ab0f24 Binary files /dev/null and b/colormap-shaders/sample/IDL_Green-White_Linear.png differ diff --git a/colormap-shaders/sample/IDL_Hardcandy.png b/colormap-shaders/sample/IDL_Hardcandy.png new file mode 100644 index 0000000..71a2e6d Binary files /dev/null and b/colormap-shaders/sample/IDL_Hardcandy.png differ diff --git a/colormap-shaders/sample/IDL_Haze.png b/colormap-shaders/sample/IDL_Haze.png new file mode 100644 index 0000000..218a708 Binary files /dev/null and b/colormap-shaders/sample/IDL_Haze.png differ diff --git a/colormap-shaders/sample/IDL_Hue_Sat_Lightness_1.png b/colormap-shaders/sample/IDL_Hue_Sat_Lightness_1.png new file mode 100644 index 0000000..7f1813c Binary files /dev/null and b/colormap-shaders/sample/IDL_Hue_Sat_Lightness_1.png differ diff --git a/colormap-shaders/sample/IDL_Hue_Sat_Lightness_2.png b/colormap-shaders/sample/IDL_Hue_Sat_Lightness_2.png new file mode 100644 index 0000000..000af55 Binary files /dev/null and b/colormap-shaders/sample/IDL_Hue_Sat_Lightness_2.png differ diff --git a/colormap-shaders/sample/IDL_Hue_Sat_Value_1.png b/colormap-shaders/sample/IDL_Hue_Sat_Value_1.png new file mode 100644 index 0000000..bc48856 Binary files /dev/null and b/colormap-shaders/sample/IDL_Hue_Sat_Value_1.png differ diff --git a/colormap-shaders/sample/IDL_Hue_Sat_Value_2.png b/colormap-shaders/sample/IDL_Hue_Sat_Value_2.png new file mode 100644 index 0000000..7b133f2 Binary files /dev/null and b/colormap-shaders/sample/IDL_Hue_Sat_Value_2.png differ diff --git a/colormap-shaders/sample/IDL_Mac_Style.png b/colormap-shaders/sample/IDL_Mac_Style.png new file mode 100644 index 0000000..68791e9 Binary files /dev/null and b/colormap-shaders/sample/IDL_Mac_Style.png differ diff --git a/colormap-shaders/sample/IDL_Nature.png b/colormap-shaders/sample/IDL_Nature.png new file mode 100644 index 0000000..f7d812e Binary files /dev/null and b/colormap-shaders/sample/IDL_Nature.png differ diff --git a/colormap-shaders/sample/IDL_Ocean.png b/colormap-shaders/sample/IDL_Ocean.png new file mode 100644 index 0000000..598281a Binary files /dev/null and b/colormap-shaders/sample/IDL_Ocean.png differ diff --git a/colormap-shaders/sample/IDL_Pastels.png b/colormap-shaders/sample/IDL_Pastels.png new file mode 100644 index 0000000..6ee091a Binary files /dev/null and b/colormap-shaders/sample/IDL_Pastels.png differ diff --git a/colormap-shaders/sample/IDL_Peppermint.png b/colormap-shaders/sample/IDL_Peppermint.png new file mode 100644 index 0000000..bfb5a77 Binary files /dev/null and b/colormap-shaders/sample/IDL_Peppermint.png differ diff --git a/colormap-shaders/sample/IDL_Plasma.png b/colormap-shaders/sample/IDL_Plasma.png new file mode 100644 index 0000000..29b85f8 Binary files /dev/null and b/colormap-shaders/sample/IDL_Plasma.png differ diff --git a/colormap-shaders/sample/IDL_Prism.png b/colormap-shaders/sample/IDL_Prism.png new file mode 100644 index 0000000..4f208f5 Binary files /dev/null and b/colormap-shaders/sample/IDL_Prism.png differ diff --git a/colormap-shaders/sample/IDL_Purple-Red+Stripes.png b/colormap-shaders/sample/IDL_Purple-Red+Stripes.png new file mode 100644 index 0000000..5a0f2a9 Binary files /dev/null and b/colormap-shaders/sample/IDL_Purple-Red+Stripes.png differ diff --git a/colormap-shaders/sample/IDL_Rainbow+Black.png b/colormap-shaders/sample/IDL_Rainbow+Black.png new file mode 100644 index 0000000..0ebbdf1 Binary files /dev/null and b/colormap-shaders/sample/IDL_Rainbow+Black.png differ diff --git a/colormap-shaders/sample/IDL_Rainbow+White.png b/colormap-shaders/sample/IDL_Rainbow+White.png new file mode 100644 index 0000000..0ebbdf1 Binary files /dev/null and b/colormap-shaders/sample/IDL_Rainbow+White.png differ diff --git a/colormap-shaders/sample/IDL_Rainbow.png b/colormap-shaders/sample/IDL_Rainbow.png new file mode 100644 index 0000000..b9fbcd9 Binary files /dev/null and b/colormap-shaders/sample/IDL_Rainbow.png differ diff --git a/colormap-shaders/sample/IDL_Rainbow_18.png b/colormap-shaders/sample/IDL_Rainbow_18.png new file mode 100644 index 0000000..90758c6 Binary files /dev/null and b/colormap-shaders/sample/IDL_Rainbow_18.png differ diff --git a/colormap-shaders/sample/IDL_Rainbow_2.png b/colormap-shaders/sample/IDL_Rainbow_2.png new file mode 100644 index 0000000..d027dfb Binary files /dev/null and b/colormap-shaders/sample/IDL_Rainbow_2.png differ diff --git a/colormap-shaders/sample/IDL_Red-Purple.png b/colormap-shaders/sample/IDL_Red-Purple.png new file mode 100644 index 0000000..b992d66 Binary files /dev/null and b/colormap-shaders/sample/IDL_Red-Purple.png differ diff --git a/colormap-shaders/sample/IDL_Red_Temperature.png b/colormap-shaders/sample/IDL_Red_Temperature.png new file mode 100644 index 0000000..b7aa426 Binary files /dev/null and b/colormap-shaders/sample/IDL_Red_Temperature.png differ diff --git a/colormap-shaders/sample/IDL_Standard_Gamma-II.png b/colormap-shaders/sample/IDL_Standard_Gamma-II.png new file mode 100644 index 0000000..9604f5d Binary files /dev/null and b/colormap-shaders/sample/IDL_Standard_Gamma-II.png differ diff --git a/colormap-shaders/sample/IDL_Steps.png b/colormap-shaders/sample/IDL_Steps.png new file mode 100644 index 0000000..ee7925c Binary files /dev/null and b/colormap-shaders/sample/IDL_Steps.png differ diff --git a/colormap-shaders/sample/IDL_Stern_Special.png b/colormap-shaders/sample/IDL_Stern_Special.png new file mode 100644 index 0000000..e551b3f Binary files /dev/null and b/colormap-shaders/sample/IDL_Stern_Special.png differ diff --git a/colormap-shaders/sample/IDL_Volcano.png b/colormap-shaders/sample/IDL_Volcano.png new file mode 100644 index 0000000..2665382 Binary files /dev/null and b/colormap-shaders/sample/IDL_Volcano.png differ diff --git a/colormap-shaders/sample/IDL_Waves.png b/colormap-shaders/sample/IDL_Waves.png new file mode 100644 index 0000000..671b17c Binary files /dev/null and b/colormap-shaders/sample/IDL_Waves.png differ diff --git a/colormap-shaders/sample/MATLAB_autumn.png b/colormap-shaders/sample/MATLAB_autumn.png new file mode 100644 index 0000000..b692fbc Binary files /dev/null and b/colormap-shaders/sample/MATLAB_autumn.png differ diff --git a/colormap-shaders/sample/MATLAB_bone.png b/colormap-shaders/sample/MATLAB_bone.png new file mode 100644 index 0000000..3bf25d2 Binary files /dev/null and b/colormap-shaders/sample/MATLAB_bone.png differ diff --git a/colormap-shaders/sample/MATLAB_cool.png b/colormap-shaders/sample/MATLAB_cool.png new file mode 100644 index 0000000..8e3b36d Binary files /dev/null and b/colormap-shaders/sample/MATLAB_cool.png differ diff --git a/colormap-shaders/sample/MATLAB_copper.png b/colormap-shaders/sample/MATLAB_copper.png new file mode 100644 index 0000000..1159cbf Binary files /dev/null and b/colormap-shaders/sample/MATLAB_copper.png differ diff --git a/colormap-shaders/sample/MATLAB_hot.png b/colormap-shaders/sample/MATLAB_hot.png new file mode 100644 index 0000000..9e04a0a Binary files /dev/null and b/colormap-shaders/sample/MATLAB_hot.png differ diff --git a/colormap-shaders/sample/MATLAB_hsv.png b/colormap-shaders/sample/MATLAB_hsv.png new file mode 100644 index 0000000..e50cd1c Binary files /dev/null and b/colormap-shaders/sample/MATLAB_hsv.png differ diff --git a/colormap-shaders/sample/MATLAB_jet.png b/colormap-shaders/sample/MATLAB_jet.png new file mode 100644 index 0000000..8f888fa Binary files /dev/null and b/colormap-shaders/sample/MATLAB_jet.png differ diff --git a/colormap-shaders/sample/MATLAB_parula.png b/colormap-shaders/sample/MATLAB_parula.png new file mode 100644 index 0000000..45b0994 Binary files /dev/null and b/colormap-shaders/sample/MATLAB_parula.png differ diff --git a/colormap-shaders/sample/MATLAB_pink.png b/colormap-shaders/sample/MATLAB_pink.png new file mode 100644 index 0000000..890d491 Binary files /dev/null and b/colormap-shaders/sample/MATLAB_pink.png differ diff --git a/colormap-shaders/sample/MATLAB_spring.png b/colormap-shaders/sample/MATLAB_spring.png new file mode 100644 index 0000000..173e69b Binary files /dev/null and b/colormap-shaders/sample/MATLAB_spring.png differ diff --git a/colormap-shaders/sample/MATLAB_summer.png b/colormap-shaders/sample/MATLAB_summer.png new file mode 100644 index 0000000..214a266 Binary files /dev/null and b/colormap-shaders/sample/MATLAB_summer.png differ diff --git a/colormap-shaders/sample/MATLAB_winter.png b/colormap-shaders/sample/MATLAB_winter.png new file mode 100644 index 0000000..f344194 Binary files /dev/null and b/colormap-shaders/sample/MATLAB_winter.png differ diff --git a/colormap-shaders/sample/gnuplot_21_22_23.png b/colormap-shaders/sample/gnuplot_21_22_23.png new file mode 100644 index 0000000..a70a71c Binary files /dev/null and b/colormap-shaders/sample/gnuplot_21_22_23.png differ diff --git a/colormap-shaders/sample/gnuplot_23_28_3.png b/colormap-shaders/sample/gnuplot_23_28_3.png new file mode 100644 index 0000000..6bd889d Binary files /dev/null and b/colormap-shaders/sample/gnuplot_23_28_3.png differ diff --git a/colormap-shaders/sample/gnuplot_30_31_32.png b/colormap-shaders/sample/gnuplot_30_31_32.png new file mode 100644 index 0000000..dfb7e4d Binary files /dev/null and b/colormap-shaders/sample/gnuplot_30_31_32.png differ diff --git a/colormap-shaders/sample/gnuplot_33_13_10.png b/colormap-shaders/sample/gnuplot_33_13_10.png new file mode 100644 index 0000000..4f1a96e Binary files /dev/null and b/colormap-shaders/sample/gnuplot_33_13_10.png differ diff --git a/colormap-shaders/sample/gnuplot_34_35_36.png b/colormap-shaders/sample/gnuplot_34_35_36.png new file mode 100644 index 0000000..442834f Binary files /dev/null and b/colormap-shaders/sample/gnuplot_34_35_36.png differ diff --git a/colormap-shaders/sample/gnuplot_3_11_6.png b/colormap-shaders/sample/gnuplot_3_11_6.png new file mode 100644 index 0000000..a5bc2b3 Binary files /dev/null and b/colormap-shaders/sample/gnuplot_3_11_6.png differ diff --git a/colormap-shaders/sample/gnuplot_7_5_15.png b/colormap-shaders/sample/gnuplot_7_5_15.png new file mode 100644 index 0000000..2181fee Binary files /dev/null and b/colormap-shaders/sample/gnuplot_7_5_15.png differ diff --git a/colormap-shaders/sample/kbinani_altitude.png b/colormap-shaders/sample/kbinani_altitude.png new file mode 100644 index 0000000..680cffb Binary files /dev/null and b/colormap-shaders/sample/kbinani_altitude.png differ diff --git a/colormap-shaders/sample/transform_apricot.png b/colormap-shaders/sample/transform_apricot.png new file mode 100644 index 0000000..91b2271 Binary files /dev/null and b/colormap-shaders/sample/transform_apricot.png differ diff --git a/colormap-shaders/sample/transform_carnation.png b/colormap-shaders/sample/transform_carnation.png new file mode 100644 index 0000000..f1c0a89 Binary files /dev/null and b/colormap-shaders/sample/transform_carnation.png differ diff --git a/colormap-shaders/sample/transform_ether.png b/colormap-shaders/sample/transform_ether.png new file mode 100644 index 0000000..3c32129 Binary files /dev/null and b/colormap-shaders/sample/transform_ether.png differ diff --git a/colormap-shaders/sample/transform_grayscale_banded.png b/colormap-shaders/sample/transform_grayscale_banded.png new file mode 100644 index 0000000..7ef95d8 Binary files /dev/null and b/colormap-shaders/sample/transform_grayscale_banded.png differ diff --git a/colormap-shaders/sample/transform_hot_metal.png b/colormap-shaders/sample/transform_hot_metal.png new file mode 100644 index 0000000..e1adeeb Binary files /dev/null and b/colormap-shaders/sample/transform_hot_metal.png differ diff --git a/colormap-shaders/sample/transform_lava_waves.png b/colormap-shaders/sample/transform_lava_waves.png new file mode 100644 index 0000000..365d881 Binary files /dev/null and b/colormap-shaders/sample/transform_lava_waves.png differ diff --git a/colormap-shaders/sample/transform_malachite.png b/colormap-shaders/sample/transform_malachite.png new file mode 100644 index 0000000..72cc783 Binary files /dev/null and b/colormap-shaders/sample/transform_malachite.png differ diff --git a/colormap-shaders/sample/transform_morning_glory.png b/colormap-shaders/sample/transform_morning_glory.png new file mode 100644 index 0000000..0f0524c Binary files /dev/null and b/colormap-shaders/sample/transform_morning_glory.png differ diff --git a/colormap-shaders/sample/transform_peanut_butter_and_jerry.png b/colormap-shaders/sample/transform_peanut_butter_and_jerry.png new file mode 100644 index 0000000..2925f39 Binary files /dev/null and b/colormap-shaders/sample/transform_peanut_butter_and_jerry.png differ diff --git a/colormap-shaders/sample/transform_purple_haze.png b/colormap-shaders/sample/transform_purple_haze.png new file mode 100644 index 0000000..bc0ce78 Binary files /dev/null and b/colormap-shaders/sample/transform_purple_haze.png differ diff --git a/colormap-shaders/sample/transform_rainbow.png b/colormap-shaders/sample/transform_rainbow.png new file mode 100644 index 0000000..3429e8f Binary files /dev/null and b/colormap-shaders/sample/transform_rainbow.png differ diff --git a/colormap-shaders/sample/transform_rose.png b/colormap-shaders/sample/transform_rose.png new file mode 100644 index 0000000..52fe161 Binary files /dev/null and b/colormap-shaders/sample/transform_rose.png differ diff --git a/colormap-shaders/sample/transform_saturn.png b/colormap-shaders/sample/transform_saturn.png new file mode 100644 index 0000000..a7e7bde Binary files /dev/null and b/colormap-shaders/sample/transform_saturn.png differ diff --git a/colormap-shaders/sample/transform_seismic.png b/colormap-shaders/sample/transform_seismic.png new file mode 100644 index 0000000..68d3252 Binary files /dev/null and b/colormap-shaders/sample/transform_seismic.png differ diff --git a/colormap-shaders/sample/transform_space.png b/colormap-shaders/sample/transform_space.png new file mode 100644 index 0000000..e7c91e2 Binary files /dev/null and b/colormap-shaders/sample/transform_space.png differ diff --git a/colormap-shaders/sample/transform_supernova.png b/colormap-shaders/sample/transform_supernova.png new file mode 100644 index 0000000..d33d3a2 Binary files /dev/null and b/colormap-shaders/sample/transform_supernova.png differ diff --git a/colormap-shaders/shaders/glsl/IDL_16_Level.frag b/colormap-shaders/shaders/glsl/IDL_16_Level.frag new file mode 100644 index 0000000..8fd24a9 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_16_Level.frag @@ -0,0 +1,39 @@ +vec4 colormap(float x) { + if (x < 0.0) { + return vec4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return vec4(1.0, 1.0, 1.0, 1.0); + } else if (x < 1.0 / 16.0) { + return vec4(0.0, 84.0 / 255.0, 0.0, 1.0); + } else if (x < 2.0 / 16.0) { + return vec4(0.0, 168.0 / 255.0, 0.0, 1.0); + } else if (x < 3.0 / 16.0) { + return vec4(0.0, 1.0, 0.0, 1.0); + } else if (x < 4.0 / 16.0) { + return vec4(0.0, 1.0, 84.0 / 255.0, 1.0); + } else if (x < 5.0 / 16.0) { + return vec4(0.0, 1.0, 168.0 / 255.0, 1.0); + } else if (x < 6.0 / 16.0) { + return vec4(0.0, 1.0, 1.0, 1.0); + } else if (x < 7.0 / 16.0) { + return vec4(0.0, 0.0, 1.0, 1.0); + } else if (x < 8.0 / 16.0) { + return vec4(128.0 / 255.0, 0.0, 1.0, 1.0); + } else if (x < 9.0 / 16.0) { + return vec4(1.0, 0.0, 220.0 / 255.0, 1.0); + } else if (x < 10.0 / 16.0) { + return vec4(1.0, 0.0, 180.0 / 255.0, 1.0); + } else if (x < 11.0 / 16.0) { + return vec4(1.0, 0.0, 128.0 / 255.0, 1.0); + } else if (x < 12.0 / 16.0) { + return vec4(1.0, 0.0, 64.0 / 255.0, 1.0); + } else if (x < 13.0 / 16.0) { + return vec4(1.0, 0.0, 0.0, 1.0); + } else if (x < 14.0 / 16.0) { + return vec4(220.0 / 255.0, 190.0 / 255.0, 190.0 / 255.0, 1.0); + } else if (x < 15.0 / 16.0) { + return vec4(220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0, 1.0); + } else { + return vec4(1.0, 1.0, 1.0, 1.0); + } +} diff --git a/colormap-shaders/shaders/glsl/IDL_Beach.frag b/colormap-shaders/shaders/glsl/IDL_Beach.frag new file mode 100644 index 0000000..d2ae78c --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Beach.frag @@ -0,0 +1,55 @@ +float colormap_red(float x) { + if (x <= 0.5) { + return 1.07069284759359E+03 * x - 3.92901626559718E+02; // R1 + } else if (x < (4.62452380952399E+02 - 3.16199999999948E+02) / (1.05778571428574E+03 - 8.03199999999881E+02)) { // 0.57447206479 + return 1.05778571428574E+03 * x - 4.62452380952399E+02; // R2 + } else if (x < (2.16218045113087E+01 + 3.16199999999948E+02) / (8.03199999999881E+02 - 2.93462406015021E+02)) { // 0.66273668746 + return 8.03199999999881E+02 * x - 3.16199999999948E+02; // R3 + } else if (x < 0.7332708626326772) { + return 2.93462406015021E+02 * x + 2.16218045113087E+01; // R4 + } else { + return 0.0; + } +} + +float colormap_green(float x) { + if (x < (2.51230508474576E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 5.35095032144939E+02)) { // 0.23285616817 + return -5.35095032144939E+02 * x + 2.51230508474576E+02; // G1 + } else if (x < (6.91824598930488E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 1.39121879297175E+03)) { // 0.36550493804 + return 4.27421457219241E+02 * x + 2.71026069518750E+01; // G2 + } else if (x < (6.91824598930488E+02 + 5.16725562656262E+02) / (1.02304642956372E+03 + 1.39121879297175E+03)) { // 0.500587156 + return -1.39121879297175E+03 * x + 6.91824598930488E+02; // G3 + } else if (x < 0.7332708626326772) { + return 1.02304642956372E+03 * x - 5.16725562656262E+02; // G4 + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.3584754040051419) { + return 1.07130443548384E+03 * x - 2.48036290322570E+02; // B1 + } else if (x < 123.0 / 251.0) { + return 136.0; + } else if (x < 0.7332708626326772) { + return -1.01758796992489E+03 * x + 5.87035338345905E+02; // B2 + } else { + return 8.98509790209691E+02 * x - 6.58851048950966E+02; // B3 + } +} + +// R2 - R3 = 0 +// => [x=0.5744720647924222] + +// B1 - 136 = 0 +// => [x=0.3584754040051419] + +// B3 = 0 +// => [x=0.7332708626326772] + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Black-White_Linear.frag b/colormap-shaders/shaders/glsl/IDL_Black-White_Linear.frag new file mode 100644 index 0000000..919c40b --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Black-White_Linear.frag @@ -0,0 +1,4 @@ +vec4 colormap(float x) { + float d = clamp(x, 0.0, 1.0); + return vec4(d, d, d, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue-Green-Red-Yellow.frag b/colormap-shaders/shaders/glsl/IDL_Blue-Green-Red-Yellow.frag new file mode 100644 index 0000000..31a1bff --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue-Green-Red-Yellow.frag @@ -0,0 +1,43 @@ +float colormap_red(float x) { + if (x < (8.40958823529412E+02 - 5.2E+02) / (7.50588235294118 - 5.0)) { + return 7.50588235294118 * x - 8.40958823529412E+02; + } else if (x < (5.2E+02 + 1.27747747747748E+02) / (5.0 - 5.0e-1)) { + return 5.0 * x - 5.2E+02; + } else { + return 5.0e-1 * x + 1.27747747747748E+02; + } +} + +float colormap_green(float x) { + if (x < (150.0 + 1.00373100303951E+02) / 3.12386018237082) { // 80.1486256385 + return 3.12386018237082 * x - 1.00373100303951E+02; + } else if (x < (2.08794117647059E+02 - 150.0) / 6.17647058823529E-01) { // 95.1904761905 + return 150.0; + } else if (x < (4.19041176470588E+02 - 2.08794117647059E+02) / (-6.17647058823529E-01 + 2.49411764705882E+00)) { // 112.043887147 + return -6.17647058823529E-01 * x + 2.08794117647059E+02; + } else if (x < (8.97617647058824E+02 - 4.19041176470588E+02) / (-2.49411764705882E+00 - -6.23529411764706E+00)) { // 127.921383648 + return -2.49411764705882E+00 * x + 4.19041176470588E+02; + } else if (x < (8.97617647058824E+02 - - 3.32600912600913E+02) / (2.30624780624781E+00 - -6.23529411764706E+00)) { // 144.027690857 + return -6.23529411764706E+00 * x + 8.97617647058824E+02; + } else { + return 2.30624780624781E+00 * x - 3.32600912600913E+02; + } +} + +float colormap_blue(float x) { + if (x < (100.0 - - 3.36734693877551E-01) / 2.07815892314373E+00) { + return 2.07815892314373E+00 * x - 3.36734693877551E-01; + } else if (x < (3.49317448680352E+02 - 100.0) / 3.12243401759531E+00) { + return 100.0; + } else { + return -3.12243401759531E+00 * x + 3.49317448680352E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue-Pastel-Red.frag b/colormap-shaders/shaders/glsl/IDL_Blue-Pastel-Red.frag new file mode 100644 index 0000000..2d55d80 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue-Pastel-Red.frag @@ -0,0 +1,52 @@ +float colormap_red(float x) { + if (x < 0.1131206452846527) { + return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + 3.28713709677420E+01; + } else if (x < 0.5116005837917328) { + return 0.0; + } else if (x < 0.5705677568912506) { + return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - 8.29909138655453E+02; + } else if (x < 0.622047244) { + return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - 7.12389120879120E+03; + } else if (x < 0.7922459542751312) { + return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + 6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) * x - 2.35682532934682E+05; + } else { + return 3.34889230769210E+02 * x - 1.41006123680226E+02; + } +} + +float colormap_green(float x) { + if (x < 0.114394336938858) { + return 0.0; + } else if (x < 0.4417250454425812) { + return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - 3.37113020096108E+01; + } else if (x < 0.4964917968308496) { + return 3.11150000000070E+02 * x + 9.54249999999731E+01; + } else if (x < 0.6259051214039278) { + return -1.03272635599706E+03 * x + 7.62648586707481E+02; + } else if (x < 0.8049814403057098) { + return -2.92799028677160E+02 * x + 2.99524283071235E+02; + } else { + return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + 1.40880802982723E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.4424893036638088) { + return 3.09636968527514E+02 * x + 9.62203074056821E+01; + } else if (x < 0.5) { + return -4.59921428571535E+02 * x + 4.36741666666678E+02; + } else if (x < 0.5691165986930345) { + return -1.81364912280674E+03 * x + 1.05392982456125E+03; + } else if (x < 0.6279306709766388) { + return 1.83776470588197E+02 * x - 8.28382352940910E+01; + } else { + return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - 1.80428756181930E+04) * x + 4.44421976986281E+03; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue-Red.frag b/colormap-shaders/shaders/glsl/IDL_Blue-Red.frag new file mode 100644 index 0000000..37efe82 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue-Red.frag @@ -0,0 +1,31 @@ +float colormap_red(float x) { + return 4.04377880184332E+00 * x - 5.17956989247312E+02; +} + +float colormap_green(float x) { + if (x < (5.14022177419355E+02 + 1.13519230769231E+01) / (4.20313644688645E+00 + 4.04233870967742E+00)) { + return 4.20313644688645E+00 * x - 1.13519230769231E+01; + } else { + return -4.04233870967742E+00 * x + 5.14022177419355E+02; + } +} + +float colormap_blue(float x) { + if (x < 1.34071303331385E+01 / (4.25125657510228E+00 - 1.0)) { // 4.12367649967 + return x; + } else if (x < (255.0 + 1.34071303331385E+01) / 4.25125657510228E+00) { // 63.1359518278 + return 4.25125657510228E+00 * x - 1.34071303331385E+01; + } else if (x < (1.04455240613432E+03 - 255.0) / 4.11010047593866E+00) { // 192.100512082 + return 255.0; + } else { + return -4.11010047593866E+00 * x + 1.04455240613432E+03; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue-Red_2.frag b/colormap-shaders/shaders/glsl/IDL_Blue-Red_2.frag new file mode 100644 index 0000000..b5ff85a --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue-Red_2.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.75) { + return 1012.0 * x - 389.0; + } else { + return -1.11322769567548E+03 * x + 1.24461193212872E+03; + } +} + +float colormap_green(float x) { + if (x < 0.5) { + return 1012.0 * x - 129.0; + } else { + return -1012.0 * x + 899.0; + } +} + +float colormap_blue(float x) { + if (x < 0.25) { + return 1012.0 * x + 131.0; + } else { + return -1012.0 * x + 643.0; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue-White_Linear.frag b/colormap-shaders/shaders/glsl/IDL_Blue-White_Linear.frag new file mode 100644 index 0000000..d5f7671 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue-White_Linear.frag @@ -0,0 +1,26 @@ +float colormap_red(float x) { + if (x < 1.0 / 3.0) { + return 4.0 * x - 2.992156863; + } else if (x < 2.0 / 3.0) { + return 4.0 * x - 2.9882352941; + } else if (x < 2.9843137255 / 3.0) { + return 4.0 * x - 2.9843137255; + } else { + return x; + } +} + +float colormap_green(float x) { + return 1.602642681354730 * x - 5.948580022657070e-1; +} + +float colormap_blue(float x) { + return 1.356416928785610 * x + 3.345982835050930e-3; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Blue_Waves.frag b/colormap-shaders/shaders/glsl/IDL_Blue_Waves.frag new file mode 100644 index 0000000..c703794 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Blue_Waves.frag @@ -0,0 +1,52 @@ +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 94.58052830612496; + const float b = 0.5059881077994055; + const float c = 0.5079410623689743; + const float d = 86.68342149719986; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 99.19361086687104; + const float b = 1.095358975873744; + const float c = 0.3679001899352902; + const float d = 0.7603616684267874; + const float e = 219.7852186508229; + const float f = 1.161240703555854; + float v = (a * x + b) * sin(2.0 * pi * (x / c + d)) + e * x + f; + if (v > 255.0) { + return 510.0 - v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 253.8552881642787; + const float b = 0.5059881077994055; + const float c = 0.5079410623689743; + const float d = 226.7149651787587; + float v = a * sin(2.0 * pi * (x / b + c)) + d; + if (v > 255.0) { + return 510.0 - v; + } else if (v < 0.0) { + return -v; + } else { + return v; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Accent.frag b/colormap-shaders/shaders/glsl/IDL_CB-Accent.frag new file mode 100644 index 0000000..2c07450 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Accent.frag @@ -0,0 +1,56 @@ +float colormap_red(float x) { + if (x < 0.3953623640294495) { + return 4.43904418116747E+02 * x + 1.27235098111810E+02; // R1 + } else if (x < 0.5707952559161218) { + return -1.40693770913775E+03 * x + 8.58988416988442E+02; // R2 + } else if (x < 0.7167119613307117) { + return 1.26199099099112E+03 * x - 6.64423423423499E+02; // R3 + } else if (x < 0.8579249381242428) { + return -3.45591749644313E+02 * x + 4.87750355618723E+02; // R4 + } else { + return -6.12161344537705E+02 * x + 7.16447058823441E+02; // R5 + } +} + +float colormap_green(float x) { + if (x < 0.1411385125927322) { + return -1.90229018492177E+02 * x + 2.01102418207681E+02; // G1 + } else if (x < 0.2839213365162221) { + return 1.26397818871505E+02 * x + 1.56414177335230E+02; // G2 + } else if (x < 0.4292115788900552) { + return 4.30655855855847E+02 * x + 7.00288288288335E+01; // G3 + } else if (x < 0.5716859888719092) { + return -1.03353736732686E+03 * x + 6.98477513951204E+02; // G4 + } else if (x < 0.7167535225418249) { + return -7.29556302521079E+02 * x + 5.24695798319375E+02; // G5 + } else if (x < 0.8577494771113141) { + return 6.31469498069341E+02 * x - 4.50824238524115E+02; // G6 + } else { + return 7.78344916345091E+01 * x + 2.40558987558802E+01; // G7 + } +} + +float colormap_blue(float x) { + if (x < 0.1418174223507038) { + return 5.96339971550497E+02 * x + 1.27334281650071E+02; // B1 + } else if (x < 0.2832901246500529) { + return -5.48535392535404E+02 * x + 2.89697554697557E+02; // B2 + } else if (x < 0.4021748491445084) { + return 1.22844950213372E+02 * x + 9.95021337126610E+01; // B3 + } else if (x < 0.5699636786725797) { + return 1.60703217503224E+02 * x + 8.42764907764923E+01; // B4 + } else if (x < 0.7149788470960766) { + return -3.30626890756314E+02 * x + 3.64316806722696E+02; // B5 + } else if (x < 0.8584529189762473) { + return -7.30288215340717E+02 * x + 6.50066199802944E+02; // B6 + } else { + return 5.42814671814679E+02 * x - 4.42832689832695E+02; // B7 + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Blues.frag b/colormap-shaders/shaders/glsl/IDL_CB-Blues.frag new file mode 100644 index 0000000..30aa958 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Blues.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.8724578971287745) { + return ((((-2.98580898761749E+03 * x + 6.75014845489710E+03) * x - 4.96941610635258E+03) * x + 1.20190439358912E+03) * x - 2.94374708396149E+02) * x + 2.48449410219242E+02; + } else { + return 8.0; + } +} + +float colormap_green(float x) { + if (x < 0.3725897611307026) { + return -1.30453729372935E+02 * x + 2.51073069306930E+02; + } else { + return (-4.97095598364922E+01 * x - 1.77638812495581E+02) * x + 2.75554584848896E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.8782350698420436) { + return (((-1.66242968759033E+02 * x + 2.50865766027010E+02) * x - 1.82046165445353E+02) * x - 3.29698266187334E+01) * x + 2.53927912915449E+02; + } else { + return -3.85153281423831E+02 * x + 4.93849833147981E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-BrBG.frag b/colormap-shaders/shaders/glsl/IDL_CB-BrBG.frag new file mode 100644 index 0000000..d477d75 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-BrBG.frag @@ -0,0 +1,44 @@ +float colormap_red(float x) { + if (x < 0.4128910005092621) { + return (-6.30796693758704E+02 * x + 6.59139629181867E+02) * x + 8.16592339699109E+01; + } else if (x < 0.5004365747118258) { + return -1.99292307692284E+01 * x + 2.54503076923075E+02; + } else if (x < 0.6000321805477142) { + return -4.46903540903651E+02 * x + 4.68176638176691E+02; + } else { + return ((2.43537534073204E+03 * x - 5.03831150657605E+03) * x + 2.73595321475367E+03) * x - 1.53778856560153E+02; + } +} + +float colormap_green(float x) { + if (x < 0.3067105114459991) { + return (((((-1.43558931121826E+06 * x + 1.21789289489746E+06) * x - 3.88754308517456E+05) * x + 5.87745165729522E+04) * x - 3.61237992835044E+03) * x + 4.00139210969209E+02) * x + 4.80612502318691E+01; + } else if (x < 0.4045854562297116) { + return 3.64978461538455E+02 * x + 8.50984615384636E+01; + } else if (x < 0.5035906732082367) { + return 1.25827692307720E+02 * x + 1.81855384615367E+02; + } else { + return ((((-2.83948052403926E+04 * x + 1.08768529946603E+05) * x - 1.62569302478295E+05) * x + 1.17919256227845E+05) * x - 4.16776268978779E+04) * x + 6.01529271177582E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.1012683545126085) { + return 5.85993431855501E+01 * x + 4.56403940886700E+00; + } else if (x < 0.2050940692424774) { + return 3.51072173913048E+02 * x - 2.50542028985514E+01; + } else if (x < 0.5022056996822357) { + return (-7.65121475963620E+02 * x + 1.20827362856208E+03) * x - 1.68677387505814E+02; + } else if (x < 0.5970333516597748) { + return -1.62299487179500E+02 * x + 3.26660512820525E+02; + } else { + return ((1.27993125066091E+03 * x - 3.19799978871341E+03) * x + 2.16242391471484E+03) * x - 1.93738146367890E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-BuGn.frag b/colormap-shaders/shaders/glsl/IDL_CB-BuGn.frag new file mode 100644 index 0000000..a5c6a11 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-BuGn.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.2494658606560582) { + return (-1.98833893257484E+02 * x - 1.24389159093545E+02) * x + 2.46504720279718E+02; + } else { + return (((-1.85732147540803E+03 * x + 3.95435649372523E+03) * x - 2.78121710759105E+03) * x + 3.94042660425286E+02) * x + 2.23685415320351E+02; + } +} + +float colormap_green(float x) { + if (x < 0.2248314628132282) { + return -6.43489926739916E+01 * x + 2.52449038461538E+02; + } else { + return ((-5.64618971208984E+01 * x - 2.68370957359183E+01) * x - 1.13001580194466E+02) * x + 2.65385956392887E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.8) { + return ((((1.59308890502154E+03 * x - 2.88662249445915E+03) * x + 2.00432779052853E+03) * x - 9.47781545884907E+02) * x + 5.68068034974858E+01) * x + 2.51926935643853E+02; + } else { + return ((-4.08819825327256E+03 * x + 1.13496840066923E+04) * x - 1.06254795336147E+04) * x + 3.39092424595566E+03; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-BuPu.frag b/colormap-shaders/shaders/glsl/IDL_CB-BuPu.frag new file mode 100644 index 0000000..df8b798 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-BuPu.frag @@ -0,0 +1,28 @@ +float colormap_red(float x) { + if (x < 0.5) { + return ((9.36778020337806E+02 * x - 6.50118321723071E+02) * x - 1.17443717298418E+02) * x + 2.45640353186226E+02; + } else if (x < 0.8774830563107102) { + return (-1.07698286837105E+02 * x + 1.18941048271099E+02) * x + 1.07226580391914E+02; + } else { + return (-9.74524977247347E+01 * x - 2.28433367883516E+02) * x + 4.04152727778340E+02; + } +} + +float colormap_green(float x) { + if (x < 0.8733318961770479) { + return ((5.48640317293175E+01 * x - 2.50041384768192E+02) * x - 9.10862643329019E+01) * x + 2.50330566129102E+02; + } else { + return (1.99199516170089E+02 * x - 4.99460567863480E+02) * x + 3.00881779984708E+02; + } +} + +float colormap_blue(float x) { + return ((((-5.85479883993044E+02 * x + 1.17558327595144E+03) * x - 8.53086782991886E+02) * x + 1.82921150609850E+02) * x - 9.97610091178212E+01) * x + 2.53898307388663E+02; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Dark2.frag b/colormap-shaders/shaders/glsl/IDL_CB-Dark2.frag new file mode 100644 index 0000000..3e45e6d --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Dark2.frag @@ -0,0 +1,58 @@ +float colormap_red(float x) { + if (x < 0.1420141309011431) { + return 1.34039497392129E+03 * x + 2.69843527738265E+01; // R1 + } else if (x < 0.2832372296870317) { + return -7.10676962676977E+02 * x + 3.18265551265554E+02; // R2 + } else if (x < 0.4289458478001075) { + return 7.81992413466075E+02 * x - 1.04513987671874E+02; // R3 + } else if (x < 0.5708308530153928) { + return -9.08417760617793E+02 * x + 6.20580437580458E+02; // R4 + } else if (x < 0.7161145088911144) { + return 8.78642484589930E+02 * x - 3.99528686581363E+02; // R5 + } else { + return -4.46088623062543E+02 * x + 5.49130479987969E+02; // R6 + } +} + +float colormap_green(float x) { + if (x < 0.1423373623518399) { + return -4.42075062917170E+02 * x + 1.57882591093117E+02; + } else if (x < 0.2834256193936661) { + return 1.20312044817928E+02 * x + 7.78338935574229E+01; + } else if (x < 0.4289129211292926) { + return -4.87706495969635E+02 * x + 2.50161925082971E+02; + } else if (x < 0.5707509745277107) { + return 8.81285199485221E+02 * x - 3.37016302016313E+02; + } else if (x < 0.7167318372796874) { + return 3.38425794215443E+01 * x + 1.46662399241347E+02; + } else if (x < 0.8574321486576632) { + return -3.74788931788816E+02 * x + 4.39541613041524E+02; + } else { + return -1.11864607464601E+02 * x + 2.14101844701848E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1416506418642016) { + return -8.25590327169275E+02 * x + 1.19073968705548E+02; + } else if (x < 0.283798849411819) { + return 1.24433848133849E+03 * x - 1.74132775632779E+02; + } else if (x < 0.4285299211147395) { + return -2.82844476054998E+02 * x + 2.59279990516832E+02; + } else if (x < 0.5700066234111405) { + return -7.58992535392565E+02 * x + 4.63323680823696E+02; + } else if (x < 0.7144281197454347) { + return -1.96085154061629E+02 * x + 1.42462745098042E+02; + } else if (x < 0.8576876140758521) { + return 1.84489769121314E+02 * x - 1.29430681693811E+02; + } else { + return 4.99467953667967E+02 * x - 3.99583569283573E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-GnBu.frag b/colormap-shaders/shaders/glsl/IDL_CB-GnBu.frag new file mode 100644 index 0000000..c5440c0 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-GnBu.frag @@ -0,0 +1,31 @@ +float colormap_red(float x) { + float v = ((((-2.83671754639782E+03 * x + 6.51753994553536E+03) * x - 5.00110948171466E+03) * x + 1.30359712298773E+03) * x - 2.89958300810074E+02) * x + 2.48458039402758E+02; + if (v < 8.0) { + return 8.0; + } else { + return v; + } +} + +float colormap_green(float x) { + return (((((-1.36304822155833E+03 * x + 4.37691418182849E+03) * x - 5.01802019417285E+03) * x + 2.39971481269598E+03) * x - 5.65401491984724E+02) * x - 1.48189675724133E+01) * x + 2.50507618187374E+02; +} + +float colormap_blue(float x) { + if (x < 0.3756393599187693) { + return (9.62948273917718E+01 * x - 1.96136874142438E+02) * x + 2.41033490809633E+02; + } else if (x < 0.6215448666633865) { + return 1.21184043778803E+02 * x + 1.35422939068100E+02; + } else if (x < 0.8830064316178203) { + return -1.53052165744713E+02 * x + 3.05873047350666E+02; + } else { + return -3.49468965517114E+02 * x + 4.79310344827486E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Greens.frag b/colormap-shaders/shaders/glsl/IDL_CB-Greens.frag new file mode 100644 index 0000000..41beec0 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Greens.frag @@ -0,0 +1,26 @@ +float colormap_red(float x) { + if (x < 0.6193682068820651) { + return ((1.41021531432983E+02 * x - 3.78122271460656E+02) * x - 1.08403692154170E+02) * x + 2.45743977533647E+02; + } else { + return ((-8.63146749682724E+02 * x + 1.76195389457266E+03) * x - 1.43807716183136E+03) * x + 4.86922446232568E+02; + } +} + +float colormap_green(float x) { + return (-1.37013460576160E+02 * x - 4.54698187198101E+01) * x + 2.52098684286706E+02; +} + +float colormap_blue(float x) { + if (x < 0.5062477983469252) { + return ((3.95067226937040E+02 * x - 4.52381961582927E+02) * x - 1.25304923569201E+02) * x + 2.43770002412197E+02; + } else { + return ((2.98249378459208E+02 * x - 6.14859580726999E+02) * x + 2.22299590241459E+02) * x + 1.21998454489668E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Greys.frag b/colormap-shaders/shaders/glsl/IDL_CB-Greys.frag new file mode 100644 index 0000000..0c98257 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Greys.frag @@ -0,0 +1,14 @@ +float colormap_f1(float x) { + if (x < 0.3849871446504941) { + return (-1.97035589869658E+02 * x - 1.04694505989261E+02) * x + 2.54887830314633E+02; + } else if (x < 0.7524552013985151) { + return (8.71964614639801E+01 * x - 3.79941007690502E+02) * x + 3.18726712728548E+02; + } else { + return (2.28085532626505E+02 * x - 7.25770100421835E+02) * x + 4.99177793972139E+02; + } +} + +vec4 colormap(float x) { + float v = clamp(colormap_f1(x) / 255.0, 0.0, 1.0); + return vec4(v, v, v, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-OrRd.frag b/colormap-shaders/shaders/glsl/IDL_CB-OrRd.frag new file mode 100644 index 0000000..60e1ead --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-OrRd.frag @@ -0,0 +1,42 @@ +float colormap_erf(float x) { + // erf approximation formula + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0)); + float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x)); + return sign(x) * sqrt(v); +} + +float colormap_red(float x) { + return 127.0548665301906 * (1.0 - colormap_erf(2.926357498911938 * (x - 1.0))); +} + +float colormap_green(float x) { + if (x < 0.3619403852314316) { + return (-1.54198428391755E+02 * x - 1.02444772146395E+02) * x + 2.46537152765234E+02; + } else { + return (-9.36243338922068E+01 * x - 2.52981049073614E+02) * x + 2.93087053416795E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.257177186368595) { + return -3.12872659968267E+02 * x + 2.36904283447911E+02; + } else if (x < 0.3782584246092673) { + return -2.10348217636022E+02 * x + 2.10537335834895E+02; + } else if (x < 0.4977365973504272) { + return -3.49969458128060E+02 * x + 2.63350246305405E+02; + } else if (x < 0.6243924786616242) { + return -1.32763025210105E+02 * x + 1.55238655462198E+02; + } else if (x < 0.7554357868699768) { + return -3.23593609804140E+02 * x + 2.74391837181314E+02; + } else { + return -2.41701581027554E+02 * x + 2.12527667984095E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Oranges.frag b/colormap-shaders/shaders/glsl/IDL_CB-Oranges.frag new file mode 100644 index 0000000..c3541d5 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Oranges.frag @@ -0,0 +1,32 @@ +float colormap_red(float x) { + if (x < 0.4798405468463898) { + return 255.0; + } else if (x < 0.7629524491886985) { + return (-3.67617638383468E+02 * x + 3.17332748024787E+02) * x + 1.85373720793787E+02; + } else { + return (3.68357233392831E+02 * x - 1.00617951362078E+03) * x + 7.66695019519326E+02; + } +} + +float colormap_green(float x) { + if (x < 0.748539247687408) { + return (((-8.92644295264035E+01 * x + 3.93421870424412E+02) * x - 4.73834129104390E+02) * x - 5.60962544745416E+01) * x + 2.43354168263028E+02; + } else { + return (1.06683260838348E+02 * x - 3.18020138166420E+02) * x + 2.51126712492908E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.76) { + return ((7.32034492098544E+02 * x - 7.55283914444663E+02) * x - 1.53168890861198E+02) * x + 2.33567667053916E+02; + } else { + return 1.23702752385982E+01 * x - 8.09423081765692E+00; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PRGn.frag b/colormap-shaders/shaders/glsl/IDL_CB-PRGn.frag new file mode 100644 index 0000000..1f5135b --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PRGn.frag @@ -0,0 +1,40 @@ +float colormap_red(float x) { + if (x < 0.09963276982307434) { + return 5.56064615384614E+02 * x + 6.34200000000000E+01; + } else if (x < 0.4070911109447479) { + return ((-1.64134573262743E+03 * x + 1.26126075878571E+03) * x + 8.30228593437549E+01) * x + 9.96536529647110E+01; + } else if (x < 0.5013306438922882) { + return 1.64123076923114E+02 * x + 1.64926153846145E+02; + } else if (x < 0.9049346148967743) { + return ((((-4.17783076764345E+04 * x + 1.55735420068591E+05) * x - 2.27018068370619E+05) * x + 1.61149115838926E+05) * x - 5.60588504546212E+04) * x + 7.93919652573346E+03; + } else { + return -2.67676923076906E+02 * x + 2.68590769230752E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1011035144329071) { + return 4.30627692307691E+02 * x - 1.56923076923038E-01; + } else if (x < 0.5013851821422577) { + return ((2.21240993583109E+02 * x - 7.23499016773187E+02) * x + 8.74292145995924E+02) * x - 3.78460594811949E+01; + } else { + return ((((-8.82260255008935E+03 * x + 3.69735516719018E+04) * x - 5.94940784200438E+04) * x + 4.54236515662453E+04) * x - 1.66043372157228E+04) * x + 2.59449114260420E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.50031378865242) { + return ((((1.32543265346288E+04 * x - 1.82876583834065E+04) * x + 9.17087085537958E+03) * x - 2.45909850441496E+03) * x + 7.42893247681885E+02) * x + 7.26668497072812E+01; + } else if (x < 0.609173446893692) { + return -3.50141636141726E+02 * x + 4.22147741147797E+02; + } else { + return ((1.79776073728688E+03 * x - 3.80142452792079E+03) * x + 2.10214624189039E+03) * x - 6.74426111651015E+01; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Paired.frag b/colormap-shaders/shaders/glsl/IDL_CB-Paired.frag new file mode 100644 index 0000000..62281b6 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Paired.frag @@ -0,0 +1,80 @@ +float colormap_red(float x) { + if (x < 0.0906416957946237) { + return -1.48766695652174E+03 * x + 1.65896666666667E+02; + } else if (x < 0.181137969063194) { + return 1.62263833992095E+03 * x - 1.16026679841898E+02; + } else if (x < 0.2716806139960391) { + return -1.40227075098820E+03 * x + 4.31899209486178E+02; + } else if (x < 0.3621693275308975) { + return 2.21145652173927E+03 * x - 5.49880434782653E+02; + } else if (x < 0.4514347780510689) { + return -2.73075098814252E+02 * x + 3.49940711462467E+02; + } else if (x < 0.5478389816716595) { + return 2.75424347826088E+02 * x + 1.02328985507251E+02; + } else if (x < 0.6384253260915684) { + return 1.95770750987722E+01 * x + 2.42492094861655E+02; + } else if (x < 0.7280391465804739) { + return -5.92081027667844E+02 * x + 6.32990118576982E+02; + } else if (x < 0.8191050219893012) { + return -1.05189130434770E+03 * x + 9.67749999999916E+02; + } else if (x < 0.9092300295745469) { + return 1.64974505928811E+03 * x - 1.24517391304309E+03; + } else { + return -8.20731225296366E+02 * x + 1.00105731225287E+03; + } +} + +float colormap_green(float x) { + if (x < 0.09069203671589791) { + return -9.49076521739127E+02 * x + 2.05970000000000E+02; + } else if (x < 0.1811205395903491) { + return 1.14400395256917E+03 * x + 1.61442687747026E+01; + } else if (x < 0.271076794014141) { + return -7.04272727272755E+02 * x + 3.50905138339931E+02; + } else if (x < 0.3618506954718166) { + return -6.35000000000221E+01 * x + 1.77206521739141E+02; + } else if (x < 0.4527247821743651) { + return -1.40603557312254E+03 * x + 6.63003952569178E+02; + } else if (x < 0.5472660653935183) { + return 1.73713913043494E+03 * x - 7.59989130434857E+02; + } else if (x < 0.6379975539161487) { + return -7.00507905138483E+02 * x + 5.74052371541584E+02; + } else if (x < 0.7283304980067641) { + return 5.64723320158019E+02 * x - 2.33162055335916E+02; } else if (x < 0.8189077039268755) { + return -1.29283992094844E+03 * x + 1.11975790513821E+03; } else if (x < 0.9094178747563795) { + return 2.14293675889271E+03 * x - 1.69382608695601E+03; + } else { + return -1.75290118577070E+03 * x + 1.84911857707505E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.1835817221386023) { + return -4.93278367346940E+02 * x + 2.25853877551021E+02; + } else if (x < 0.2718482976477959) { + return -1.04124223602495E+03 * x + 3.26450028232661E+02; + } else if (x < 0.3623519200472859) { + return 1.21151976284592E+03 * x - 2.85959486166031E+02; + } else if (x < 0.4526344257525674) { + return -1.38645849802374E+03 * x + 6.55422924901199E+02; + } else if (x < 0.5474992417588231) { + return 8.80275652173975E+02 * x - 3.70578985507278E+02; + } else if (x < 0.6375259518892261) { + return -1.24038339920972E+03 * x + 7.90480237154278E+02; + } else if (x < 0.7280438873117513) { + return 2.36255138339872E+03 * x - 1.50648418972297E+03; + } else if (x < 0.8192397843702398) { + return -6.51816205533491E+02 * x + 6.88107707509788E+02; + } else if (x < 0.9092328860678134) { + return -1.35533596837590E+01 * x + 1.65217391304318E+02; + } else { + return -1.19420158102770E+03 * x + 1.23870158102770E+03; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Pastel1.frag b/colormap-shaders/shaders/glsl/IDL_CB-Pastel1.frag new file mode 100644 index 0000000..8e665fe --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Pastel1.frag @@ -0,0 +1,64 @@ +float colormap_red(float x) { + if (x < 0.122867923365625) { + return -5.81788489736069E+02 * x + 2.50471590909091E+02; + } else if (x < 0.2449046174927113) { + return 1.99984352773830E+02 * x + 1.54416785206258E+02; + } else if (x < 0.3729729104526915) { + return 1.43786086956516E+02 * x + 1.68180000000001E+02; + } else if (x < 0.5011116081610979) { + return 2.52012802275928E+02 * x + 1.27814366998585E+02; + } else if (x < 0.6239282365941264) { + return 7.85450500555661E+00 * x + 2.50164923989616E+02; + } else if (x < 0.7520403577351265) { + return -2.00555718475049E+02 * x + 3.80197947214058E+02; + } else if (x < 0.8796535309192707) { + return 1.86622408963526E+02 * x + 8.90243697479360E+01; + } else { + return -9.30674082313196E+01 * x + 3.35054505005547E+02; + } +} + +float colormap_green(float x) { + if (x < 0.2498801528138394) { + return 2.21725710445469E+02 * x + 1.79002480158730E+02; + } else if (x < 0.3735167574956272) { + return -2.52975806451616E+02 * x + 2.97620967741935E+02; + } else if (x < 0.5007872003710714) { + return 1.09439266615749E+02 * x + 1.62252864782272E+02; + } else if (x < 0.6262274652716027) { + return 3.02956451612894E+02 * x + 6.53419354838611E+01; + } else if (x < 0.752848702686641) { + return -3.10470307917895E+02 * x + 4.49486620234600E+02; + } else if (x < 0.8827503622135592) { + return 2.27675070027963E+01 * x + 1.98608963585427E+02; + } else { + return 1.95678708265011E+02 * x + 4.59715380404256E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1232989588096424) { + return 4.29695747800585E+02 * x + 1.74153409090909E+02; + } else if (x < 0.2476314320040304) { + return -2.40499266862156E+02 * x + 2.56787756598238E+02; + } else if (x < 0.3742360961829455) { + return 2.41095161290329E+02 * x + 1.37529838709676E+02; + } else if (x < 0.4998594481260504) { + return -4.90936497326148E+02 * x + 4.11482508912633E+02; + } else if (x < 0.6256351261233096) { + return 2.96955882352941E+02 * x + 1.76470588235230E+01; + } else if (x < 0.7525509527474964) { + return -1.11771301446066E+02 * x + 2.73361142009640E+02; + } else if (x < 0.8785969154660433) { + return 3.73063712757765E+02 * x - 9.15019098547990E+01; + } else { + return 4.55448275862047E+01 * x + 1.96255172413811E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Pastel2.frag b/colormap-shaders/shaders/glsl/IDL_CB-Pastel2.frag new file mode 100644 index 0000000..fd3b677 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Pastel2.frag @@ -0,0 +1,58 @@ +float colormap_red(float x) { + if (x < 0.1414470427532423) { + return 5.23716927453769E+02 * x + 1.79102418207681E+02; + } else if (x < 0.2832126252873305) { + return -3.55011583011593E+02 * x + 3.03395967395968E+02; + } else if (x < 0.4293789173286286) { + return 2.81737389211071E+02 * x + 1.23060619323778E+02; + } else if (x < 0.5703484841123749) { + return -9.85406162465110E+01 * x + 2.86343977591045E+02; + } else if (x < 0.7170614267751989) { + return 1.69092460881909E+02 * x + 1.33699857752520E+02; + } else if (x < 0.859829619768543) { + return -9.94710581026121E+01 * x + 3.26276397855329E+02; + } else { + return -2.57056149732620E+02 * x + 4.61772727272750E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1411063922737659) { + return -1.49220483641537E+02 * x + 2.26007112375533E+02; + } else if (x < 0.2816283290590322) { + return 5.77629343629288E+01 * x + 1.96800429000430E+02; + } else if (x < 0.4291887492428612) { + return -7.38876244665610E+01 * x + 2.33876955903267E+02; + } else if (x < 0.571830104540257) { + return 3.01873399715509E+02 * x + 7.26045519203479E+01; + } else if (x < 0.7190262682310248) { + return -2.25206477732972E+01 * x + 2.58102834008109E+02; + } else if (x < 0.8491803538380496) { + return -1.16468292682893E+02 * x + 3.25653658536549E+02; + } else { + return -1.44447728516695E+02 * x + 3.49413245758086E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1425168965591466) { + return -2.26903238866400E+02 * x + 2.04742307692308E+02; + } else if (x < 0.2851292529683606) { + return 4.18120091673021E+02 * x + 1.12815584415585E+02; + } else if (x < 0.4319360871262316) { + return -3.09335813546247E+01 * x + 2.40853922748656E+02; + } else if (x < 0.7146533590447866) { + return -1.88956299440485E+02 * x + 3.09109637275714E+02; + } else if (x < 0.8619542566532371) { + return 2.06196082722327E+02 * x + 2.67126600285119E+01; + } else { + return -6.48097784562050E+00 * x + 2.10030557677552E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PiYG.frag b/colormap-shaders/shaders/glsl/IDL_CB-PiYG.frag new file mode 100644 index 0000000..38f8c35 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PiYG.frag @@ -0,0 +1,44 @@ +float colormap_red(float x) { + if (x < 0.09843078255653381) { + return 5.57627692307694E+02 * x + 1.42135384615385E+02; + } else if (x < 0.4093809425830841) { + return ((-4.21748915649019E+02 * x + 1.28054196831998E+01) * x + 2.64504106766935E+02) * x + 1.71265909327078E+02; + } else if (x < 0.5037343473981705) { + return -6.54538461538185E+01 * x + 2.79554615384612E+02; + } else if (x < 0.5982368290424347) { + return -1.66852258852308E+02 * x + 3.30632478632496E+02; + } else { + return ((1.82001891024969E+03 * x - 4.20447326861499E+03) * x + 2.68838861198902E+03) * x - 2.62418693972160E+02; + } +} + +float colormap_green(float x) { + if (x < 0.101902037858963) { + return 2.72322735042735E+02 * x + 5.21367521367536E-01; + } else if (x < 0.5059849917888641) { + return ((6.81035433115437E+02 * x - 1.71408042362240E+03) * x + 1.36671536460816E+03) * x - 9.39210546594673E+01; + } else if (x < 0.5954320132732391) { + return -2.72768472906136E+01 * x + 2.60800985221660E+02; + } else { + return ((1.09164194296742E+03 * x - 3.01508808799416E+03) * x + 2.33004497173996E+03) * x - 3.04306745740377E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.5011215507984161) { + return (((((-3.44764954376220E+04 * x + 6.98813026428223E+04) * x - 4.87748659515380E+04) * x + 1.31832279253005E+04) * x - 1.26691288614273E+03) * x + 4.73465709444135E+02) * x + 8.21916531938477E+01; + } else if (x < 0.5958432303492089) { + return -3.80379731379794E+02 * x + 4.37472934472961E+02; + } else if (x < 0.790071576833725) { + return -7.13383710407293E+02 * x + 6.35891101055846E+02; + } else { + return (1.19760697610430E+03 * x - 2.36001183205723E+03) * x + 1.18928322234544E+03; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PuBu.frag b/colormap-shaders/shaders/glsl/IDL_CB-PuBu.frag new file mode 100644 index 0000000..6d58621 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PuBu.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.7520372909206926) { + return (((9.68615208861418E+02 * x - 1.16097242960380E+03) * x + 1.06173672031378E+02) * x - 1.68616613530379E+02) * x + 2.56073136099945E+02; + } else { + return -1.20830453148990E+01 * x + 1.44337397593436E+01; + } +} + +float colormap_green(float x) { + if (x < 0.7485333535031721) { + return (((-4.58537247030064E+02 * x + 5.67323181593790E+02) * x - 2.56714665792882E+02) * x - 1.14205365680507E+02) * x + 2.47073841488433E+02; + } else { + return ((-2.99774273328017E+02 * x + 4.12147041403012E+02) * x - 2.49880079288168E+02) * x + 1.93578601034431E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.7628468501376879) { + return ((-5.44257972228224E+01 * x + 2.70890554876532E+01) * x - 9.12766750739247E+01) * x + 2.52166182860177E+02; + } else { + return (((4.55621137729287E+04 * x - 1.59960900638524E+05) * x + 2.09530452721547E+05) * x - 1.21704642900945E+05) * x + 2.66644674068694E+04; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PuBuGn.frag b/colormap-shaders/shaders/glsl/IDL_CB-PuBuGn.frag new file mode 100644 index 0000000..611eb94 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PuBuGn.frag @@ -0,0 +1,32 @@ +float colormap_red(float x) { + if (x < 0.4874515235424042) { + return ((-4.67299169932026E+02 * x - 9.61558801325737E+01) * x - 1.42239969624745E+02) * x + 2.55174176214321E+02; + } else if (x < 0.7547346238979944) { + return -4.01060227272736E+02 * x + 3.04365078671334E+02; + } else { + return -4.15773809523774E+00 * x + 4.80902777777746E+0; + } +} + +float colormap_green(float x) { + if (x < 0.6119840443134308) { + return ((-1.86575654193875E+02 * x + 1.34788465541787E+02) * x - 1.76719831637092E+02) * x + 2.46604381236178E+02; + } else { + return ((-8.15961797068245E+02 * x + 1.63871690240040E+03) * x - 1.21797539379991E+03) * x + 4.64835362086844E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.626910001039505) { + return (((1.51117885576561E+02 * x - 3.02884959951043E+02) * x + 1.53322134227491E+02) * x - 1.09362189530744E+02) * x + 2.51508758745276E+02; + } else { + return ((6.51665430892026E+02 * x - 1.29049314879284E+03) * x + 4.20233542130992E+02) * x + 2.75096926634035E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PuOr.frag b/colormap-shaders/shaders/glsl/IDL_CB-PuOr.frag new file mode 100644 index 0000000..478b968 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PuOr.frag @@ -0,0 +1,42 @@ +float colormap_red(float x) { + if (x < 0.3021800816059113) { + return ((-8.74206463186070E+02 * x - 1.85426300850231E+02) * x + 5.51285275571572E+02) * x + 1.26643739338646E+02; + } else if (x < 0.5021429359912872) { + return (-3.88346609612054E+02 * x + 2.84470703793855E+02) * x + 2.01677105728121E+02; + } else { + return ((((-1.46535873909592E+04 * x + 5.53022453680932E+04) * x - 8.13970779339075E+04) * x + 5.81771336215697E+04) * x - 2.05245461242988E+04) * x + 3.14144977294882E+03; + } +} + +float colormap_green(float x) { + if (x < 0.05763718485832214) { + return 2.95595213675214E+02 * x + 5.90683760683760E+01; + } else if (x < 0.5007581412792206) { + return ((((2.62405984206199E+04 * x - 3.27451861162955E+04) * x + 1.22107381531950E+04) * x - 1.00838782028235E+03) * x + 2.70642765981150E+02) * x + 6.36961934872237E+01; + } else if (x < 0.8994744718074799) { + return ((-2.60499440597370E+02 * x - 1.69367458674853E+02) * x + 1.12913289561831E+02) * x + 2.65534872970494E+02; + } else { + return -3.86892551892486E+02 * x + 3.88498371998310E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09708546522206818) { + return -2.18830769230769E+01 * x + 8.03384615384615E+00; + } else if (x < 0.2041181623935699) { + return 1.36731800766284E+02 * x - 7.36535303776692E+00; + } else if (x < 0.4982341825962067) { + return (-3.57661007879491E+02 * x + 1.02135850891279E+03) * x - 1.73032069862183E+02; + } else if (x < 0.6063862144947052) { + return -1.17230769230812E+02 * x + 3.05467236467253E+02; + } else { + return (((((6.76307238761902E+05 * x - 3.23892241330779E+06) * x + 6.41842651908440E+06) * x - 6.73646783203943E+06) * x + 3.94913439210334E+06) * x - 1.22625641797298E+06) * x + 1.57856249228480E+05; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-PuRd.frag b/colormap-shaders/shaders/glsl/IDL_CB-PuRd.frag new file mode 100644 index 0000000..1f9e6d5 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-PuRd.frag @@ -0,0 +1,38 @@ +float colormap_red(float x) { + if (x < 25.0 / 254.0) { + return -1.41567647058826E+02 * x + 2.46492647058824E+02; + } else if (x < 0.3715468440779919) { + return (1.64817020395145E+02 * x - 2.01032852327719E+02) * x + 2.52820173539371E+02; + } else if (x < 0.6232413065898157) { + return (((2.61012828741073E+04 * x - 5.18905872811356E+04) * x + 3.78968358931486E+04) * x - 1.19124127524292E+04) * x + 1.55945779375675E+03; + } else if (x < 0.7481208809057023) { + return -2.02469919786095E+02 * x + 3.57739416221033E+02; + } else { + return -4.08324020737294E+02 * x + 5.11743167562695E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1303350956955242) { + return -1.59734759358287E+02 * x + 2.44376470588235E+02; + } else if (x < 0.6227215280200861) { + return (((1.21347373400442E+03 * x - 2.42854832541048E+03) * x + 1.42039752537243E+03) * x - 6.27806679597789E+02) * x + 2.86280758506240E+02; + } else { + return (1.61877993987291E+02 * x - 4.06294499392671E+02) * x + 2.32401278080262E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.7508644163608551) { + return ((((2.96852143551409E+03 * x - 6.12155011029541E+03) * x + 4.21719423212110E+03) * x - 1.29520280960574E+03) * x + 2.78723913454450E+01) * x + 2.47133504519275E+02; + } else { + return ((-6.55064010825706E+02 * x + 1.23635622822904E+03) * x - 8.68481725874416E+02) * x + 3.18158180572088E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Purples.frag b/colormap-shaders/shaders/glsl/IDL_CB-Purples.frag new file mode 100644 index 0000000..29efe92 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Purples.frag @@ -0,0 +1,22 @@ +float colormap_red(float x) { + return (((-3.03160346735036E+02 * x + 7.95537661771755E+02) * x - 6.68077287777559E+02) * x - 9.83523581613554E+00) * x + 2.49241870138829E+02; +} + +float colormap_green(float x) { + if (x < 0.6238275468349457) { + return ((((-1.64962450015544E+03 * x + 3.91401450219750E+03) * x - 2.81559997409582E+03) * x + 5.71903768479824E+02) * x - 1.63510103061329E+02) * x + 2.52440721674553E+02; + } else { + return (8.00008172182588E+01 * x - 4.62535128626795E+02) * x + 3.83781070034667E+02; + } +} + +float colormap_blue(float x) { + return (((((1.42855146044492E+03 * x - 4.10835541903972E+03) * x + 4.43536620247364E+03) * x - 2.15825854188203E+03) * x + 3.66481133684515E+02) * x - 9.02285603303462E+01) * x + 2.53802694290353E+02; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-RdBu.frag b/colormap-shaders/shaders/glsl/IDL_CB-RdBu.frag new file mode 100644 index 0000000..8f1316f --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-RdBu.frag @@ -0,0 +1,58 @@ +float colormap_red(float x) { + if (x < 0.09771832105856419) { + return 7.60263247863246E+02 * x + 1.02931623931624E+02; + } else if (x < 0.3017162107441106) { + return (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + 1.37642085716717E+02; + } else if (x < 0.4014205790737471) { + return 8.67103448276151E+01 * x + 2.18034482758611E+02; + } else if (x < 0.5019932233215039) { + return -6.15461538461498E+01 * x + 2.77547692307680E+02; + } else if (x < 0.5969483882550937) { + return -3.77588522588624E+02 * x + 4.36198819698878E+02; + } else if (x < 0.8046060096654594) { + return (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + 3.17674951640855E+02; + } else { + return -3.08431855203590E+02 * x + 3.12956742081421E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09881640500975222) { + return 2.41408547008547E+02 * x + 3.50427350427364E-01; + } else if (x < 0.5000816285610199) { + return ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + 1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) * x - 4.82944517518776E+01; + } else if (x < 0.8922355473041534) { + return (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + 1.45172137257997E+04) * x - 5.80944127411621E+03) * x + 1.12477959061948E+03; + } else { + return -5.28313797313699E+02 * x + 5.78459299959206E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1033699568661857) { + return 1.30256410256410E+02 * x + 3.08518518518519E+01; + } else if (x < 0.2037526071071625) { + return 3.38458128078815E+02 * x + 9.33004926108412E+00; + } else if (x < 0.2973267734050751) { + return (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - 3.81852747252658E+01; + } else if (x < 0.4029109179973602) { + return 6.68959706959723E+02 * x - 7.00740740740798E+01; + } else if (x < 0.5006715489526758) { + return 4.87348695652202E+02 * x + 3.09898550724286E+00; + } else if (x < 0.6004396902588283) { + return -6.85799999999829E+01 * x + 2.81436666666663E+02; + } else if (x < 0.702576607465744) { + return -1.81331701891043E+02 * x + 3.49137263626287E+02; + } else if (x < 0.9010407030582428) { + return (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + 5.26198653917172E+02; + } else { + return -7.36990769230737E+02 * x + 8.36652307692262E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-RdGy.frag b/colormap-shaders/shaders/glsl/IDL_CB-RdGy.frag new file mode 100644 index 0000000..ab8a2a4 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-RdGy.frag @@ -0,0 +1,58 @@ +float colormap_f(float x) { + if (x < 0.8110263645648956) { + return (((4.41347880412638E+03 * x - 1.18250308887283E+04) * x + 1.13092070303101E+04) * x - 4.94879610401395E+03) * x + 1.10376673162241E+03; + } else { + return (4.44045986053970E+02 * x - 1.34196160353499E+03) * x + 9.26518306556645E+02; + } +} + +float colormap_red(float x) { + if (x < 0.09384074807167053) { + return 7.56664615384615E+02 * x + 1.05870769230769E+02; + } else if (x < 0.3011957705020905) { + return (-2.97052932130813E+02 * x + 4.43575866219751E+02) * x + 1.37867123966178E+02; + } else if (x < 0.3963058760920129) { + return 8.61868131868288E+01 * x + 2.18562881562874E+02; + } else if (x < 0.5) { + return 2.19915384615048E+01 * x + 2.44003846153861E+02; + } else { + return colormap_f(x); + } +} + +float colormap_green(float x) { + if (x < 0.09568486400411116) { + return 2.40631111111111E+02 * x + 1.26495726495727E+00; + } else if (x < 0.2945883673263987) { + return 7.00971783488427E+02 * x - 4.27826773670273E+01; + } else if (x < 0.3971604611945229) { + return 5.31775726495706E+02 * x + 7.06051282052287E+00; + } else if (x < 0.5) { + return 3.64925470085438E+02 * x + 7.33268376068493E+01; + } else { + return colormap_f(x); + } +} + +float colormap_blue(float x) { + if (x < 0.09892375498249567) { + return 1.30670329670329E+02 * x + 3.12116402116402E+01; + } else if (x < 0.1985468629735229) { + return 3.33268034188035E+02 * x + 1.11699145299146E+01; + } else if (x < 0.2928770209555256) { + return 5.36891330891336E+02 * x - 2.92588522588527E+01; + } else if (x < 0.4061551302245808) { + return 6.60915763546766E+02 * x - 6.55827586206742E+01; + } else if (x < 0.5) { + return 5.64285714285700E+02 * x - 2.63359683794383E+01; + } else { + return colormap_f(x); + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-RdPu.frag b/colormap-shaders/shaders/glsl/IDL_CB-RdPu.frag new file mode 100644 index 0000000..4aadebc --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-RdPu.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.4668049514293671) { + return -1.36007661451525E+01 * x + 2.54876081825334E+02; + } else { + return ((9.11043267377652E+02 * x - 2.27422817830303E+03) * x + 1.47691217772832E+03) * x - 3.80041369120933E+01; + } +} + +float colormap_green(float x) { + return ((((-2.12978937384858E+03 * x + 5.05211767883971E+03) * x - 3.95843947196006E+03) * x + 9.49632208843715E+02) * x - 2.70366761763812E+02) * x + 2.48595803511253E+02; +} + +float colormap_blue(float x) { + if (x < 0.2484821379184723) { + return ((1.12923860577866E+02 * x - 2.02431339810602E+02) * x - 1.60306874714734E+02) * x + 2.42581612831587E+02; + } else if (x < 0.5019654333591461) { + return (-2.24073120483401E+02 * x + 4.46032892337713E+01) * x + 1.94733826112356E+02; + } else if (x < 0.7505462467670441) { + return (-4.08932859712077E+02 * x + 3.70448937862306E+02) * x + 7.77495522761299E+01; + } else { + return (-1.99803137524475E+02 * x + 2.71497008797383E+02) * x + 3.42106616941255E+01; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-RdYiBu.frag b/colormap-shaders/shaders/glsl/IDL_CB-RdYiBu.frag new file mode 100644 index 0000000..4e22039 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-RdYiBu.frag @@ -0,0 +1,56 @@ +float colormap_red(float x) { + if (x < 0.09790863520700754) { + return 5.14512820512820E+02 * x + 1.64641025641026E+02; + } else if (x < 0.2001887081633112) { + return 2.83195402298854E+02 * x + 1.87288998357964E+02; + } else if (x < 0.3190117539655621) { + return 9.27301587301214E+01 * x + 2.25417989417999E+02; + } else if (x < 0.500517389125164) { + return 255.0; + } else if (x < 0.6068377196788788) { + return -3.04674876847379E+02 * x + 4.07495073891681E+02; + } else if (x < 0.9017468988895416) { + return (1.55336390191951E+02 * x - 7.56394659038288E+02) * x + 6.24412733169483E+02; + } else { + return -1.88350769230735E+02 * x + 2.38492307692292E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09638568758964539) { + return 4.81427692307692E+02 * x + 4.61538461538488E-01; + } else if (x < 0.4987066686153412) { + return ((((3.25545903568267E+04 * x - 4.24067109461319E+04) * x + 1.83751375886345E+04) * x - 3.19145329617892E+03) * x + 8.08315127034676E+02) * x - 1.44611527812961E+01; + } else if (x < 0.6047312345537269) { + return -1.18449917898218E+02 * x + 3.14234811165860E+02; + } else if (x < 0.7067635953426361) { + return -2.70822112753102E+02 * x + 4.06379036672115E+02; + } else { + return (-4.62308723214883E+02 * x + 2.42936159122279E+02) * x + 2.74203431802418E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09982818011951204) { + return 1.64123076923076E+01 * x + 3.72646153846154E+01; + } else if (x < 0.2958717460833126) { + return 2.87014675052409E+02 * x + 1.02508735150248E+01; + } else if (x < 0.4900527540014758) { + return 4.65475113122167E+02 * x - 4.25505279034673E+01; + } else if (x < 0.6017014681258838) { + return 5.61032967032998E+02 * x - 8.93789173789407E+01; + } else if (x < 0.7015737100463595) { + return -1.51655677655728E+02 * x + 3.39446886446912E+02; + } else if (x < 0.8237156500567735) { + return -2.43405347593559E+02 * x + 4.03816042780725E+02; + } else { + return -3.00296889157305E+02 * x + 4.50678495922638E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-RdYiGn.frag b/colormap-shaders/shaders/glsl/IDL_CB-RdYiGn.frag new file mode 100644 index 0000000..f59d1bd --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-RdYiGn.frag @@ -0,0 +1,58 @@ +float colormap_red(float x) { + if (x < 0.09825118520770205) { + return 5.07556923076926E+02 * x + 1.64923076923077E+02; + } else if (x < 0.2009111350471108) { + return 2.86362637362647E+02 * x + 1.86655677655676E+02; + } else if (x < 0.2994418666360456) { + return 8.90415982485030E+01 * x + 2.26299671592774E+02; + } else if (x < 0.5001300871372223) { + return 9.81627851140242E+00 * x + 2.50023049219689E+02; + } else if (x < 0.9039205014705658) { + return ((-3.30848798119696E+01 * x - 5.65722561191396E+02) * x + 2.78046782759626E+02) * x + 2.61515979057614E+02; + } else { + return -2.53583846153761E+02 * x + 2.55396153846073E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1105575469849737) { + return 4.79433455433456E+02 * x + 3.65079365079361E-01; + } else if (x < 0.3151890079472769) { + return 6.25896582484846E+02 * x - 1.58275246854709E+01; + } else if (x < 0.4023888287265409) { + return 4.80700000000005E+02 * x + 2.99368421052611E+01; + } else if (x < 0.5007980763912201) { + return 3.22042124542111E+02 * x + 9.37789987790044E+01; + } else if (x < 0.9266376793384552) { + return ((-2.91150627193739E+02 * x + 2.73891595228739E+02) * x - 1.97954551648389E+02) * x + 3.22069054828072E+02; + } else { + return -4.70385384615211E+02 * x + 5.78034615384465E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1007720845701718) { + return 1.66813186813184E+01 * x + 3.72910052910053E+01; + } else if (x < 0.2891807195246389) { + return 2.86155895159223E+02 * x + 1.01354904806627E+01; + } else if (x < 0.4061884871072265) { + return 4.02182758620675E+02 * x - 2.34172413793071E+01; + } else if (x < 0.5018816861329155) { + return 5.35500000000025E+02 * x - 7.75691699604942E+01; + } else if (x < 0.604070194492165) { + return -5.10170329670400E+02 * x + 4.47233618233660E+02; + } else if (x < 0.7060918916718424) { + return -3.26878215654109E+02 * x + 3.36512315270959E+02; + } else if (x < 0.812819402403008) { + return -6.62557264957455E+01 * x + 1.52488888888906E+02; + } else { + return -2.16444081632622E+02 * x + 2.74564897959153E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Reds.frag b/colormap-shaders/shaders/glsl/IDL_CB-Reds.frag new file mode 100644 index 0000000..c6b18da --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Reds.frag @@ -0,0 +1,26 @@ +float colormap_red(float x) { + if (x < 0.7109796106815338) { + return (((-9.58108609441667E+02 * x + 8.89060620527714E+02) * x - 2.42747192807495E+02) * x + 9.97906310565304E+00) * x + 2.54641252219400E+02; + } else { + return ((-9.93985373158007E+02 * x + 1.96524174972026E+03) * x - 1.54068189744713E+03) * x + 6.72947219603874E+02; + } +} + +float colormap_green(float x) { + if (x < 0.7679868638515472) { + return ((((2.66433610509335E+03 * x - 5.05488641558587E+03) * x + 3.69542277742922E+03) * x - 1.36931912848446E+03) * x - 5.12669839132577E+01) * x + 2.41929417192750E+02; + } else { + return (-2.11738816337853E+02 * x + 2.78333107855597E+02) * x - 6.66958752910143E+01; + } +} + +float colormap_blue(float x) { + return (((-6.83475279000297E+02 * x + 1.55250107598171E+03) * x - 9.25799053039285E+02) * x - 1.67380812671938E+02) * x + 2.37145226675143E+02; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Set1.frag b/colormap-shaders/shaders/glsl/IDL_CB-Set1.frag new file mode 100644 index 0000000..2e510b3 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Set1.frag @@ -0,0 +1,64 @@ +float colormap_red(float x) { + if (x < 0.1218978105733187) { + return -1.41278189149560E+03 * x + 2.27681818181818E+02; + } else if (x < 0.2479420725675653) { + return 1.71483957219249E+02 * x + 3.45632798573976E+01; + } else if (x < 0.3737958863310976) { + return 5.93826871657766E+02 * x - 7.01532976827142E+01; + } else if (x < 0.5581935583402973) { + return 8.16999193548379E+02 * x - 1.53574193548385E+02; + } else if (x < 0.7521306441106583) { + return -7.03338903743339E+02 * x + 6.95068738859197E+02; + } else if (x < 0.8778625049273406) { + return 6.43286656891390E+02 * x - 3.17769611436878E+02; + } else { + return -7.44200222469495E+02 * x + 9.00253096032687E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1210132014777112) { + return 8.22324999999999E+02 * x + 2.59536290322581E+01; + } else if (x < 0.2482778857828818) { + return 3.90762700534761E+02 * x + 7.81783645276292E+01; + } else if (x < 0.3736981279637023) { + return -7.75174853372465E+02 * x + 3.67654875366580E+02; + } else if (x < 0.5000834495110191) { + return 3.88169354838696E+02 * x - 6.70846774193464E+01; + } else if (x < 0.6259565510341616) { + return 1.01632587976547E+03 * x - 3.81215359237582E+02; + } else if (x < 0.7519260802219788) { + return -1.34046122994658E+03 * x + 1.09403097147954E+03; + } else if (x < 0.8802211108953331) { + return 3.40231932773057E+02 * x - 1.69726050420116E+02; + } else { + return 1.89186206896551E+02 * x - 3.67724137931057E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1216936022984158) { + return 1.28638709677419E+03 * x + 2.74375000000001E+01; + } else if (x < 0.2481802512682617) { + return -8.68609237536630E+02 * x + 2.89686766862165E+02; + } else if (x < 0.3738953463082063) { + return 7.06041788856318E+02 * x - 1.01110520527863E+02; + } else if (x < 0.499829701274646) { + return -1.29118218475062E+03 * x + 6.45642228738955E+02; + } else if (x < 0.6262008893543518) { + return 3.99252005347605E+02 * x - 1.99286987522289E+02; + } else if (x < 0.752318389825417) { + return -8.38814516128947E+01 * x + 1.03251612903218E+02; + } else if (x < 0.8779851862270176) { + return 1.20109970674463E+03 * x - 8.63463343108315E+02; + } else { + return -3.03613348164648E+02 * x + 4.57652428624434E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Set2.frag b/colormap-shaders/shaders/glsl/IDL_CB-Set2.frag new file mode 100644 index 0000000..84bf904 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Set2.frag @@ -0,0 +1,60 @@ +float colormap_red(float x) { + if (x < 0.1417230259672803) { + return 1.05935704125178E+03 * x + 1.01981507823613E+02; + } else if (x < 0.2832918395614404) { + return -7.84521574205797E+02 * x + 3.63301564722620E+02; + } else if (x < 0.4297095252306736) { + return 6.13507692307669E+02 * x - 3.27487179487109E+01; + } else if (x < 0.5711437760817145) { + return -4.56971171171184E+02 * x + 4.27246246246258E+02; + } else if (x < 0.7170125543394245) { + return 6.08443812233345E+02 * x - 1.81258890469442E+02; + } else if (x < 0.8601498726198596) { + return -1.86129554655803E+02 * x + 3.88460188933823E+02; + } else { + return -3.44927731092377E+02 * x + 5.25050420168008E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1415748781045371) { + return -3.73352299668090E+02 * x + 1.93944523470839E+02; + } else if (x < 0.2833646736626308) { + return 1.32720720720722E+02 * x + 1.22297297297298E+02; + } else if (x < 0.4289465541806786) { + return -1.49887515045407E+02 * x + 2.02378487799539E+02; + } else if (x < 0.5702226800496928) { + return 5.49972024656235E+02 * x - 9.78238501659562E+01; + } else if (x < 0.7146023128494844) { + return 8.99797570850851E+00 * x + 2.10651821862350E+02; + } else if (x < 0.8745816247778255) { + return -1.44022832980902E+02 * x + 3.20000845665901E+02; + } else { + return -1.15363546797967E+02 * x + 2.94935960591057E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1415014758409641) { + return -4.74217638691322E+02 * x + 1.65038406827880E+02; + } else if (x < 0.2835702564175819) { + return 7.39899952584171E+02 * x - 6.76102418207873E+00; + } else if (x < 0.4295821637397355) { + return -5.64243717401478E+01 * x + 2.19052868658126E+02; + } else if (x < 0.5693521153970126) { + return -7.86119327731098E+02 * x + 5.32516806722689E+02; + } else if (x < 0.7156505014449713) { + return -2.61647700331917E+02 * x + 2.33907776197252E+02; + } else if (x < 0.858726752429748) { + return 7.09638034795805E+02 * x - 4.61193347193250E+02; + } else { + return 2.09176470588245E+02 * x - 3.14336134453805E+01; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Set3.frag b/colormap-shaders/shaders/glsl/IDL_CB-Set3.frag new file mode 100644 index 0000000..097f761 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Set3.frag @@ -0,0 +1,80 @@ +float colormap_red(float x) { + if (x < 0.09082479229584027) { + return 1.24879652173913E+03 * x + 1.41460000000000E+02; + } else if (x < 0.1809653122266933) { + return -7.21339920948626E+02 * x + 3.20397233201581E+02; + } else if (x < 0.2715720097177793) { + return 6.77416996047422E+02 * x + 6.72707509881444E+01; + } else if (x < 0.3619607687891861) { + return -1.36850782608711E+03 * x + 6.22886666666710E+02; + } else if (x < 0.4527609316115322) { + return 1.38118774703557E+03 * x - 3.72395256916997E+02; + } else if (x < 0.5472860687991931) { + return -7.81436521739194E+02 * x + 6.06756521739174E+02; + } else if (x < 0.6360981817705944) { + return 8.06836521739242E+02 * x - 2.62483188405869E+02; + } else if (x < 0.8158623444475089) { + return -3.49616157878512E+02 * x + 4.73134258402717E+02; + } else if (x < 0.9098023786863947) { + return 1.72428853754953E+02 * x + 4.72173913043111E+01; + } else { + return 5.44142292490101E+02 * x - 2.90968379446626E+02; + } +} + +float colormap_green(float x) { + if (x < 0.08778161310534617) { + return 4.88563478260870E+02 * x + 2.10796666666667E+02; + } else if (x < 0.2697669137324175) { + return -6.96835646006769E+02 * x + 3.14852913968545E+02; + } else if (x < 0.3622079895714037) { + return 5.40799130434797E+02 * x - 1.90200000000068E+01; + } else if (x < 0.4519795462045253) { + return 3.23774703557373E+01 * x + 1.65134387351785E+02; + } else if (x < 0.5466820192751115) { + return 4.43064347826088E+02 * x - 2.04876811594176E+01; + } else if (x < 0.6368889369442862) { + return -1.83472332015826E+02 * x + 3.22028656126484E+02; + } else if (x < 0.728402572416003) { + return 1.27250988142231E+02 * x + 1.24132411067220E+02; + } else if (x < 0.8187333479165154) { + return -9.82116600790428E+02 * x + 9.32198616600708E+02; + } else if (x < 0.9094607880855196) { + return 1.17713438735149E+03 * x - 8.35652173912769E+02; + } else { + return 2.13339920948864E+01 * x + 2.15502964426857E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09081516507716858) { + return -2.27937391304345E+02 * x + 1.99486666666666E+02; + } else if (x < 0.1809300436999751) { + return 4.33958498023703E+02 * x + 1.39376482213440E+02; + } else if (x < 0.2720053156712806) { + return -1.14300000000004E+03 * x + 4.24695652173923E+02; + } else if (x < 0.3616296568054424) { + return 1.08175889328072E+03 * x - 1.80450592885399E+02; + } else if (x < 0.4537067088757783) { + return -1.22681999999994E+03 * x + 6.54399999999974E+02; + } else if (x < 0.5472726179445029) { + return 8.30770750988243E+01 * x + 6.00909090909056E+01; + } else if (x < 0.6374811920489858) { + return 1.36487351778676E+03 * x - 6.41401185770872E+02; + } else if (x < 0.7237636846906381) { + return -1.27390769230737E+02 * x + 3.09889230769173E+02; + } else if (x < 0.8178226469606309) { + return -3.01831168831021E+02 * x + 4.36142857142782E+02; + } else if (x < 0.9094505664375214) { + return 8.47622811970801E+01 * x + 1.19977978543158E+02; + } else { + return -9.06117391304296E+02 * x + 1.02113405797096E+03; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-Spectral.frag b/colormap-shaders/shaders/glsl/IDL_CB-Spectral.frag new file mode 100644 index 0000000..e38db0a --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-Spectral.frag @@ -0,0 +1,64 @@ +float colormap_red(float x) { + if (x < 0.09752005946586478) { + return 5.63203907203907E+02 * x + 1.57952380952381E+02; + } else if (x < 0.2005235116443438) { + return 3.02650769230760E+02 * x + 1.83361538461540E+02; + } else if (x < 0.2974133397506856) { + return 9.21045429665647E+01 * x + 2.25581007115501E+02; + } else if (x < 0.5003919130598823) { + return 9.84288115246108E+00 * x + 2.50046722689075E+02; + } else if (x < 0.5989021956920624) { + return -2.48619704433547E+02 * x + 3.79379310344861E+02; + } else if (x < 0.902860552072525) { + return ((2.76764884219295E+03 * x - 6.08393126459837E+03) * x + 3.80008072407485E+03) * x - 4.57725185424742E+02; + } else { + return 4.27603478260530E+02 * x - 3.35293188405479E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09785836420571035) { + return 6.23754529914529E+02 * x + 7.26495726495790E-01; + } else if (x < 0.2034012006283468) { + return 4.60453201970444E+02 * x + 1.67068965517242E+01; + } else if (x < 0.302409765476316) { + return 6.61789401709441E+02 * x - 2.42451282051364E+01; + } else if (x < 0.4005965758690823) { + return 4.82379130434784E+02 * x + 3.00102898550747E+01; + } else if (x < 0.4981907026473237) { + return 3.24710622710631E+02 * x + 9.31717541717582E+01; + } else if (x < 0.6064345916502067) { + return -9.64699507389807E+01 * x + 3.03000000000023E+02; + } else if (x < 0.7987472620841592) { + return -2.54022986425337E+02 * x + 3.98545610859729E+02; + } else { + return -5.71281628959223E+02 * x + 6.51955082956207E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.0997359608740309) { + return 1.26522393162393E+02 * x + 6.65042735042735E+01; + } else if (x < 0.1983790695667267) { + return -1.22037851037851E+02 * x + 9.12946682946686E+01; + } else if (x < 0.4997643530368805) { + return (5.39336225400169E+02 * x + 3.55461986381562E+01) * x + 3.88081126069087E+01; + } else if (x < 0.6025972254407099) { + return -3.79294261294313E+02 * x + 3.80837606837633E+02; + } else if (x < 0.6990141388105746) { + return 1.15990231990252E+02 * x + 8.23805453805459E+01; + } else if (x < 0.8032653181119567) { + return 1.68464957265204E+01 * x + 1.51683418803401E+02; + } else if (x < 0.9035796343050095) { + return 2.40199023199020E+02 * x - 2.77279202279061E+01; + } else { + return -2.78813846153774E+02 * x + 4.41241538461485E+02; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-YIGn.frag b/colormap-shaders/shaders/glsl/IDL_CB-YIGn.frag new file mode 100644 index 0000000..39fde8d --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-YIGn.frag @@ -0,0 +1,32 @@ +float colormap_red(float x) { + if (x < 0.6289940178394318) { + return ((5.11696133375750E+02 * x - 8.41303218634799E+02) * x + 2.59644604131609E+01) * x + 2.53419788769069E+02; + } else { + return (-1.59266359984140E+02 * x - 2.05336652594121E+01) * x + 1.40166356828632E+02; + } +} + +float colormap_green(float x) { + if (x < 0.7657577693462372) { + return ((1.07839212106774E+00 * x - 1.91222692546201E+02) * x - 1.99072424271726E+01) * x + 2.55781815734834E+02; + } else { + return (-2.23913463560442E+02 * x + 1.41364491447333E+02) * x + 1.51940340657207E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1102530658245087) { + return (-1.06015269490890E+01 * x - 3.53323657599336E+02) * x + 2.28818914956011E+02; + } else if (x < 0.7528357207775116) { + return (((6.02578715483658E+02 * x - 1.15715802822919E+03) * x + 7.15916939803876E+02) * x - 3.43088208134950E+02) * x + 2.19476164232866E+02; + } else { + return (-6.54502605847083E+01 * x + 1.22002989630042E+01) * x + 9.46764726107154E+01; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-YIGnBu.frag b/colormap-shaders/shaders/glsl/IDL_CB-YIGnBu.frag new file mode 100644 index 0000000..6117eeb --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-YIGnBu.frag @@ -0,0 +1,36 @@ +float colormap_red(float x) { + if (x < 0.2523055374622345) { + return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + 2.53829637096771E+02; + } else if (x < 0.6267540156841278) { + return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - 5.30725139102868E+03) * x + 8.58474724851723E+02) * x + 2.03329669375107E+02; + } else if (x < 0.8763731146612115) { + return 3.28717357910916E+01 * x + 8.82117255504255E+00; + } else { + return -2.29186583577707E+02 * x + 2.38482038123159E+02; + } +} + +float colormap_green(float x) { + if (x < 0.4578040540218353) { + return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + 2.09812296466262E+01) * x + 2.52987561849833E+02; + } else { + return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + 1.52699334501816E+03) * x - 6.48190622715140E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1239372193813324) { + return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + 2.17553885630496E+02; + } else if (x < 0.7535201013088226) { + return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + 6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) * x + 1.56774650431396E+02; + } else { + return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x - 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - 6.55080846112976E+07) * x + 2.27664953009389E+07) * x - 3.28811994253461E+06; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_CB-YIOrBr.frag b/colormap-shaders/shaders/glsl/IDL_CB-YIOrBr.frag new file mode 100644 index 0000000..d826b27 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_CB-YIOrBr.frag @@ -0,0 +1,24 @@ +float colormap_red(float x) { + return ((((1.30858855846896E+03 * x - 2.84649723684787E+03) * x + 1.76048857883363E+03) * x - 3.99775093706324E+02) * x + 2.69759225316811E+01) * x + 2.54587325383574E+02; +} + +float colormap_green(float x) { + return ((((-8.85605750526301E+02 * x + 2.20590941129997E+03) * x - 1.50123293069936E+03) * x + 2.38490009587258E+01) * x - 6.03460495073813E+01) * x + 2.54768707485247E+02; +} + +float colormap_blue(float x) { + if (x < 0.2363454401493073) { + return (-3.68734834041388E+01 * x - 3.28163398692792E+02) * x + 2.27342862588147E+02; + } else if (x < 0.7571054399013519) { + return ((((1.60988309475108E+04 * x - 4.18782706486673E+04) * x + 4.14508040221340E+04) * x - 1.88926043556059E+04) * x + 3.50108270140290E+03) * x - 5.28541997751406E+01; + } else { + return 1.68513761929930E+01 * x - 1.06424668227935E+01; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Eos_A.frag b/colormap-shaders/shaders/glsl/IDL_Eos_A.frag new file mode 100644 index 0000000..c029a41 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Eos_A.frag @@ -0,0 +1,76 @@ +float colormap_h(float x) { + if (x < 0.1151580585723306) { + return (2.25507158009032E+00 * x - 1.17973110308697E+00) * x + 7.72551618145170E-01; // H1 + } else if (x < (9.89643667779019E-01 - 6.61604251019618E-01) / (2.80520737708568E+00 - 1.40111938331467E+00)) { + return -2.80520737708568E+00 * x + 9.89643667779019E-01; // H2 + } else if (x < (6.61604251019618E-01 - 4.13849520734156E-01) / (1.40111938331467E+00 - 7.00489176507247E-01)) { + return -1.40111938331467E+00 * x + 6.61604251019618E-01; // H3 + } else if (x < (4.13849520734156E-01 - 2.48319927251200E-01) / (7.00489176507247E-01 - 3.49965224045823E-01)) { + return -7.00489176507247E-01 * x + 4.13849520734156E-01; // H4 + } else { + return -3.49965224045823E-01 * x + 2.48319927251200E-01; // H5 + } +} + +float colormap_v(float x) { + float v = 1.0; + if (x < 0.5) { + v = clamp(2.10566088679245E+00 * x + 7.56360684411500E-01, 0.0, 1.0); + } else { + v = clamp(-1.70132918347782E+00 * x + 2.20637371757606E+00, 0.0, 1.0); + } + float period = 4.0 / 105.0; + float len = 3.0 / 252.0; + float t = mod(x + 7.0 / 252.0, period); + if (0.0 <= t && t < len) { + if (x < 0.12) { + v = (1.87862631683169E+00 * x + 6.81498517051705E-01); + } else if (x < 0.73) { + v -= 26.0 / 252.0; + } else { + v = -1.53215278202992E+00 * x + 1.98649818445446E+00; + } + } + return v; +} + +// H1 - H2 = 0 +// => [x=-0.8359672286003642,x=0.1151580585723306] + +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = 1.0; + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Eos_B.frag b/colormap-shaders/shaders/glsl/IDL_Eos_B.frag new file mode 100644 index 0000000..14ee4e9 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Eos_B.frag @@ -0,0 +1,101 @@ +float colormap_h(float x) { + if (x < 0.1167535483837128) { + return 2.0 / 3.0; // H1 + } else if (x < 0.1767823398113251) { + return ((-3.19659402385354E+02 * x + 1.14469539590179E+02) * x - 1.52210982227697E+01) * x + 1.39214703883044E+00; // H2 + } else if (x < 0.2266354262828827) { + return ((-3.55166097640991E+02 * x + 2.51218596935272E+02) * x - 6.08853752315044E+01) * x + 5.38727123476564E+00; // H3 + } else if (x < (6.95053970124612E-01 - 4.13725796136428E-01) / (1.48914458632691E+00 - 6.97458630656247E-01)) { + return -1.48914458632691E+00 * x + 6.95053970124612E-01; // H4 + } else if (x < (4.13725796136428E-01 - 2.48329223043123E-01) / (6.97458630656247E-01 - 3.48617475202321E-01)) { + return -6.97458630656247E-01 * x + 4.13725796136428E-01; // H5 + } else { + return -3.48617475202321E-01 * x + 2.48329223043123E-01; // H6 + } +} + +float colormap_v(float x) { + float v = 1.0; + if (x < 0.115834504365921) { + v = 4.18575376272140E+00 * x + 5.15145240089963E-01; // V1-Hi + } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) { + v = -7.87450803534638E+00 * x + 1.90980360972022E+00; // V2-Hi + } else if (x < 0.5) { + v = 7.87450639585523E+00 * x - 9.13724751363001E-01; // V3-Hi + } else { + v = -1.87540494049556E+00 * x + 2.33603077812338E+00; // V4-Hi + } + v = clamp(v, 0.0, 1.0); + + float period = 4.0 / 105.0; + float len = 3.0 / 252.0; + float t = mod(x + 7.0 / 252.0, period); + if (0.0 <= t && t < len) { + if (x < 0.115834504365921) { + v = 3.74113124408467E+00 * x + 4.64654322955584E-01; // V1-Lo + } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) { + v = -3.97326878048783E+00 * x + 1.25308500609757E+00; // V2-Lo + } else if (x < 0.25) { + v = 6.99297032967038E+00 * x - 8.03946549450558E-01; // V3-Lo + } else if (x < 0.72) { + v -= 26.0 / 255.0; + } else { + v = -1.67870020621040E+00 * x + 2.09414636280895E+00; // V4-Lo + } + } + + return v; +} + +// H1 - H2 = 0 +// => [x=0.1167535483837128] + +// H2 - H3 = 0 +// => [x=0.1767823398113251,x=0.1822494566440582,x=3.492328017950058] + +// H3 - H4 = 0 +// => [x=0.2266354262828827] + +// V1-Hi - 1 = 0 +// => [x=0.115834504365921] + +// V2-Hi - V3-Hi = 0 +// => + +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = 1.0; + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Green-Pink.frag b/colormap-shaders/shaders/glsl/IDL_Green-Pink.frag new file mode 100644 index 0000000..d6c8874 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Green-Pink.frag @@ -0,0 +1,47 @@ +float colormap_red(float x) { + if (x < (6.20000000000000E+02 - 6.05717647058824E+02) / (5.00000000000000E+00 - 4.87941176470588E+00)) { // 118.43902439 + return 5.00000000000000E+00 * x - 6.20000000000000E+02; + } else if (x < (6.05717647058824E+02 - 3.12000000000000E+02) / (4.87941176470588E+00 - 3.00000000000000E+00)) { // 156.281690141 + return 4.87941176470588E+00 * x - 6.05717647058824E+02; + } else if (x < (252.0 + 3.12000000000000E+02) / 3.00000000000000E+00) { // 188 + return 3.00000000000000E+00 * x - 3.12000000000000E+02; + } else { + return 252.0; + } +} + +float colormap_green(float x) { + if (x < (2.04536133198612E+02 + 1.47941176470588E+01) / (9.95833333333333E+00 + 1.14822299345429E+00)) { + return 9.95833333333333E+00 * x - 1.47941176470588E+01; + } else if (x < (2.72705547652916E+02 - 2.04536133198612E+02) / (1.69701280227596E+00 - 1.14822299345429E+00)) { + return -1.14822299345429E+00 * x + 2.04536133198612E+02; + } else if (x < 2.72705547652916E+02 / 1.69701280227596E+00) { + return -1.69701280227596E+00 * x + 2.72705547652916E+02; + } else if (x < 7.52000000000000E+02 / 4.00000000000000E+00) { + return 0.0; + } else if (x < (7.52000000000000E+02 - 7.45733990147783E+02) / (4.00000000000000E+00 - 3.95785440613027E+00)) { + return 4.00000000000000E+00 * x - 7.52000000000000E+02; + } else { + return 3.95785440613027E+00 * x - 7.45733990147783E+02; + } +} + +float colormap_blue(float x) { + if (x < (2.50785650623886E+02 + 4.04215299263843E+01) / (1.92690173903766E+00 + 4.23796791443850E-01)) { + return 1.92690173903766E+00 * x - 4.04215299263843E+01; + } else if (x < (2.50785650623886E+02 - 1.58221357063404E+02) / (1.75528364849833E-01 + 4.23796791443850E-01)) { + return -4.23796791443850E-01 * x + 2.50785650623886E+02; + } else if (x < (1.58221357063404E+02 - 1.27826659541169E+01) / (9.48066572508303E-01 - 1.75528364849833E-01)) { + return 1.75528364849833E-01 * x + 1.58221357063404E+02; + } else { + return 9.48066572508303E-01 * x + 1.27826659541169E+01; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Green-Red-Blue-White.frag b/colormap-shaders/shaders/glsl/IDL_Green-Red-Blue-White.frag new file mode 100644 index 0000000..528d0bb --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Green-Red-Blue-White.frag @@ -0,0 +1,84 @@ +float colormap_red(float x) { + if (x < 0.2648221343873518) { + return 1518.00 * x - 162.00; + } else if (x < 0.2806324110671937) { + return 759.00 * x + 39.00; + } else if (x < 0.2964426877470356) { + return 252.0; + } else if (x < 0.3122529644268774) { + return -253.00 * x + 327.00; + } else if (x < 0.3280632411067194) { + return 248.0; + } else if (x < 0.3596837944664031) { + return -253.00 * x + 331.00; + } else if (x < 0.3636363636363636) { + return 240.0; + } else if (x < 0.3794466403162055) { + return -253.00 * x + 332.00; + } else if (x < 0.391304347826087) { + return 236.0; + } else if (x < 0.4229249011857708) { + return -253.00 * x + 335.00; + } else if (x < 0.4387351778656127) { + return 228.0; + } else if (x < 0.4861660079051384) { + return -253.00 * x + 339.00; + } else if (x < 0.5019762845849802) { + return 216.0; + } else if (x < 0.549407114624506) { + return -253.00 * x + 343.00; + } else if (x < 0.5652173913043478) { + return 204.0; + } else if (x < 0.5968379446640316) { + return -253.00 * x + 347.00; + } else if (x < 0.6126482213438735) { + return 196.0; + } else if (x < 0.6600790513833992) { + return -253.00 * x + 351.00; + } else if (x < 0.6758893280632411) { + return 184.0; + } else if (x < 0.7075098814229249) { + return -253.00 * x + 355.00; + } else if (x < 0.7233201581027668) { + return 176.0; + } else if (x < 0.7707509881422925) { + return -253.00 * x + 359.00; + } else if (x < 0.7865612648221344) { + return 164.0; + } else if (x < 0.83399209486166) { + return -253.00 * x + 363.00; + } else if (x < 0.849802371541502) { + return 152.0; + } else if (x < 0.8662737248407505) { + return -253.00 * x + 367.00; + } else { + return 8.24946218487293E+02 * x - 5.66796485866989E+02; + } +} + +float colormap_green(float x) { + if (x < 0.04321209459549381) { + return 9.10799999999998E+02 * x + 6.80363636363637E+01; + } else if (x < 0.1067193675889328) { + return 2277.00 * x + 9.00; + } else if (x < 0.1225296442687747) { + return -759.00 * x + 333.00; + } else if (x < 0.6113554850777934) { + return -1518.00 * x + 426.00; + } else if (x < 0.9924501603814814) { + return 1.97884558823513E+03 * x - 1.71181573083763E+03; + } else { + return 253.00 * x + 1.00; + } +} + +float colormap_blue(float x) { + return 5.23682489688790E+02 * x - 1.55016347956506E+02; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Green-White_Exponential.frag b/colormap-shaders/shaders/glsl/IDL_Green-White_Exponential.frag new file mode 100644 index 0000000..adbb8d2 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Green-White_Exponential.frag @@ -0,0 +1,33 @@ +float colormap_red(float x) { + if (x < (5.33164074896858E-01 + 3.69558823529412E+01) / (6.61764705882353E-01 - 3.80845483226613E-01)) { // 133.451339048 + return 3.80845483226613E-01 * x + 5.33164074896858E-01; + } else if(x < (2.21853643274093E+02 - 3.69558823529412E+01) / (1.86816585713397E+00 - 6.61764705882353E-01)) { // 153.263912861 + return 6.61764705882353E-01 * x - 3.69558823529412E+01; + } else { + return 1.86816585713397E+00 * x - 2.21853643274093E+02; + } +} + +float colormap_green(float x) { + if (x < (8.74223522059742E+01 - 3.33294186729301E-01) / (1.34076340457443E+00 - 6.66705813270699E-01)) { // 129.201212393 + return 6.66705813270699E-01 * x - 3.33294186729301E-01; + } else { + return 1.34076340457443E+00 * x - 8.74223522059742E+01; + } +} + +float colormap_blue(float x) { + if (x < (4.92898927047827E+02 - 4.63219741480611E-01) / (2.93126567624928E+00 - 2.63081042553601E-01)) { + return 2.63081042553601E-01 * x - 4.63219741480611E-01; + } else { + return 2.93126567624928E+00 * x - 4.92898927047827E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Green-White_Linear.frag b/colormap-shaders/shaders/glsl/IDL_Green-White_Linear.frag new file mode 100644 index 0000000..6b09393 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Green-White_Linear.frag @@ -0,0 +1,19 @@ +float colormap_red(float x) { + return 1.61361058036781E+00 * x - 1.55391688559828E+02; +} + +float colormap_green(float x) { + return 9.99817607003891E-01 * x + 1.01544260700389E+00; +} + +float colormap_blue(float x) { + return 3.44167852062589E+00 * x - 6.19885917496444E+02; +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Hardcandy.frag b/colormap-shaders/shaders/glsl/IDL_Hardcandy.frag new file mode 100644 index 0000000..44dbaf4 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Hardcandy.frag @@ -0,0 +1,32 @@ +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi * (1.0 / (2.0 * 0.143365330321852)) * x + 1.55) * (322.0 * x) + 191.0 * x; + if (v < 0.0) { + v = -v; + } else if (v > 255.0) { + v = 255.0 - (v - 255.0); + } + return v; +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi / 0.675 * (x + 0.015)) * 190.0 + 25.0; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + return sin(2.0 * pi * (x * -3.45 - 0.02)) * 127.5 + 127.5; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Haze.frag b/colormap-shaders/shaders/glsl/IDL_Haze.frag new file mode 100644 index 0000000..8639d42 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Haze.frag @@ -0,0 +1,41 @@ +float colormap_red(float x) { + if (x < 0.0) { + return 167.0; + } else if (x < (2.54491177159840E+02 + 2.49117061281287E+02) / (1.94999353031535E+00 + 1.94987400471999E+00)) { + return -1.94987400471999E+00 * x + 2.54491177159840E+02; + } else if (x <= 255.0) { + return 1.94999353031535E+00 * x - 2.49117061281287E+02; + } else { + return 251.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 112.0; + } else if (x < (2.13852573128775E+02 + 1.42633630462899E+02) / (1.31530121382008E+00 + 1.39181683887691E+00)) { + return -1.39181683887691E+00 * x + 2.13852573128775E+02; + } else if (x <= 255.0) { + return 1.31530121382008E+00 * x - 1.42633630462899E+02; + } else { + return 195.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 255.0; + } else if (x <= 255.0) { + return -9.84241021836929E-01 * x + 2.52502692064968E+02; + } else { + return 0.0; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = colormap_red(t) / 255.0; + float g = colormap_green(t) / 255.0; + float b = colormap_blue(t) / 255.0; + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_1.frag b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_1.frag new file mode 100644 index 0000000..f50245d --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_1.frag @@ -0,0 +1,49 @@ +float colormap_low(float x) { + return (-1.91005335917480E-03 * x + 1.49751468348116E+00) * x - 6.97037614414503E+00; // lower +} + +float colormap_up(float x) { + return (1.88420526249161E-03 * x - 5.03556849093925E-01) * x + 2.55777688663313E+02; // upper +} + +float colormap_red(float x) { + if (x < 43.76015739302458) { // first root of `lower = B1` + return colormap_up(x); + } else if (x < 86.85552651930304) { // first root of `lower = R1` + return (3.42882679808412E-02 * x - 7.47424573913507E+00) * x + 4.99200716753466E+02; // R1 + } else if (x < 174.6136813850324) { // first root of `low = B2` + return colormap_low(x); + } else { + return ((1.12237347384081E-04 * x - 7.83534162528667E-02) * x + 1.86033275155350E+01) * x - 1.25879271751642E+03; + } +} + +float colormap_green(float x) { + if (x < 86.85552651930304) { + return colormap_low(x); + } else if (x < 130.6514942376722) { + return (-2.86318899478317E-02 * x + 8.83599571161434E+00) * x - 4.43544771805581E+02; // G1 + } else { + return colormap_up(x); + } +} + +float colormap_blue(float x) { + if (x < 43.76015739302458) { + return (-3.50205069618621E-02 * x + 7.15746326474339E+00) * x - 8.79902788903102E+00; // B1 + } else if (x < 130.6514942376722) { // first root of `upper = G1` + return colormap_up(x); + } else if (x < 174.6136813850324) { // first root of `low = B2` + return (1.99506804131033E-02 * x - 6.64847464240324E+00) * x + 7.48898397192062E+02; // B2 + } else { + return colormap_low(x); + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_2.frag b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_2.frag new file mode 100644 index 0000000..2dd2994 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Lightness_2.frag @@ -0,0 +1,88 @@ +float colormap_up(float x) { + return (1.88200166286601E-03 * x - 4.65545143706978E-01) * x + 2.51008231568770E+02; +} + +float colormap_low(float x) { + return (-1.90879354636631E-03 * x - 5.05775136749144E-01) * x + 2.51839633472648E+02; +} + +float colormap_r1(float x) { + float t = x - 84.41170691108532; + return ((-1.30664056487685E-04 * t - 2.23609578814399E-02) * t - 1.63427831229829E+00) * t + colormap_low(84.41170691108532); +} + +float colormap_r2(float x) { + float t = (x - 172.4679464259528); + return (3.39051205856669E-02 * t + 1.53777364753859E+00) * t + colormap_low(172.4679464259528); +} + +float colormap_g1(float x) { + return (2.06966753567031E-02 * x - 3.81765550976615E+00) * x + 3.70329541512642E+02; +} + +float colormap_g2(float x) { + float t = x - 215.8140719563986; + return (-2.93369381849802E-02 * t - 4.45609461245051E+00) * t + colormap_up(215.8140719563986); +} + +float colormap_b1(float x) { + float t = (x - 129.0039558892991); + return (-2.69029805601284E-02 * t - 1.46365429919324E+00) * t + colormap_up(129.0039558892991); +} + +float colormap_red(float x) { + if (x < 84.41170691108532) { + return colormap_r1(x); + } else if (x < 172.4679464259528) { + return colormap_low(x); + } else if (x < 215.8140719563986) { + return colormap_r2(x); + } else { + return colormap_up(x); + } +} + +float colormap_green(float x) { + if (x < 84.41170691108532) { + return colormap_low(x); + } else if (x < 129.0039558892991) { + return colormap_g1(x); + } else if (x < 215.8140719563986) { + return colormap_up(x); + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 129.0039558892991) { + return colormap_up(x); + } else if (x < 172.4679464259528) { + return colormap_b1(x); + } else { + return colormap_low(x); + } +} + +// G1 = low +// => [x=62.09621943267293,x=84.41170691108532] + +// G1 = up +// => [x=49.16072666680554,x=129.0039558892991] + +// B1 = low +// => [x=66.91982278615977,x=172.4679464259528] + +// R2 = up +// => [x=86.8352194379599,x=215.8140719563986] + +// low(172.4679464259528) = 107.83220272 +// up(215.8140719563986) = 238.192608973 + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_1.frag b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_1.frag new file mode 100644 index 0000000..674b7a0 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_1.frag @@ -0,0 +1,87 @@ +float colormap_low(float x) { + return (3.31549320112257E-06 * x + 9.90093135228017E-01) * x - 2.85569629002368E-01; +} + +float colormap_r2(float x) { + float t = x - 172.2021990097892; + return (-2.39029325463818E-02 * t + 2.98715296752437E+00) * t + 170.308961782; +} + +float colormap_g1(float x) { + float t = x - 86.01791713538523; + return (-2.29102048531908E-02 * t + 4.93089581616270E+00) * t + 84.9047112396; +} + +float colormap_g2(float x) { + float t = x - 215.6804047700857; + return ((-2.84214232291614E-04 * t + 3.97502254733824E-02) * t - 1.21659773743153E+00) * t + 255.0; +} + +float colormap_b2(float x) { + float t = x - 129.1625547389263; + return (2.47358957372179E-02 * t - 3.03236899995258E+00) * t + 255.0; +} + +float colormap_red(float x) { + if (x < 43.15291462916737) { + return 255.0; + } else if (x < 86.01791713538523) { + return (2.31649880284905E-02 * x - 6.92920742890475E+00) * x + 5.09541054138852E+02; // R1 + } else if (x < 172.2021990097892) { + return colormap_low(x); + } else if (x < 215.6804047700857) { + return colormap_r2(x); + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < 86.01791713538523) { + return colormap_low(x); + } else if (x < 129.1625547389263) { + return colormap_g1(x); + } else if (x < 215.6804047700857) { + return 255.0; + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 43.15291462916737) { + return (-2.29056417125175E-02 * x + 6.89833449327894E+00) * x - 2.89480825884616E-02; // B1 + } else if (x < 129.1625547389263) { + return 255.0; + } else if (x < 172.2021990097892) { + return colormap_b2(x); + } else { + return colormap_low(x); + } +} + +// B1 - 255 = 0 +// => [x=43.15291462916737,x=258.0102040408121] + +// R1 - low = 0 +// => [x=86.01791713538523,x=255.8961027639475] + +// G1 - 255 = 0 +// => [x=129.1625547389263,x=258.1003299995292] + +// B2 - low = 0 +// => [x=172.2021990097892,x=248.7957319298701] + +// R2 - 255 = 0 +// => [x=215.6804047700857,x=253.6941391396688] + +// low(86.01791713538523) = 84.9047112396 +// low(172.2021990097892) = 170.308961782 + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_2.frag b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_2.frag new file mode 100644 index 0000000..d7a7a8b --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Hue_Sat_Value_2.frag @@ -0,0 +1,92 @@ +float colormap_low(float x) { + return -9.89123311722871E-01 * x + 2.54113856910082E+02; +} + +float colormap_r1(float x) { + float t = x - 44.52807774916808; + return (-2.10743035084859E-02 * t - 1.14339819510944E+00) * t + 255.0; +} + +float colormap_r2(float x) { + float t = x - 173.2142990353825; + return (2.10464655909683E-02 * t + 3.09770350177039E+00) * t + 82.7835558104; +} + +float colormap_g1(float x) { + float t = x - 87.18599073927922; + return (2.18814766236433E-02 * t + 1.07683877405025E+00) * t + 167.876161014; +} + +float colormap_g2(float x) { + float t = x - 216.2347301863598; + return (-1.75617661106684E-02 * t - 5.19390917463437E+00) * t + 255.0; +} + +float colormap_b2(float x) { + float t = x - 130.3078696041572; + return (-1.97675474706200E-02 * t - 3.16561290370380E+00) * t + 255.0; +} + +float colormap_red(float x) { + if (x < 44.52807774916808) { + return 255.0; + } else if (x < 87.18599073927922) { + return colormap_r1(x); + } else if (x < 173.2142990353825) { + return colormap_low(x); + } else if (x < 216.2347301863598) { + return colormap_r2(x); + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < 87.18599073927922) { + return colormap_low(x); + } else if (x < 130.3078696041572) { + return colormap_g1(x); + } else if (x < 216.2347301863598) { + return 255.0; + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 44.52807774916808) { + return (2.31958376441286E-02 * x - 1.01298265446011E+00) * x + 2.54114630079813E+02; // B1 + } else if (x < 130.3078696041572) { + return 255.0; + } else if (x < 173.2142990353825) { + return colormap_b2(x); + } else { + return colormap_low(x); + } +} + +// B1 - 255 = 0 +// => [x=-0.8571972230440585,x=44.52807774916808] + +// R1 - low = 0 +// => [x=-5.450356335481052,x=87.18599073927922] + +// G1 - 255 = 0 +// => [x=-5.148233003947013,x=130.3078696041572] + +// B2 - low = 0 +// => [x=-22.70273917535556,x=173.2142990353825] + +// R2 - 255 = 0 +// => [x=-16.99015635858727,x=216.2347301863598] + +// low(87.18599073927922) = 167.876161014 +// low(173.2142990353825) = 82.7835558104 + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Mac_Style.frag b/colormap-shaders/shaders/glsl/IDL_Mac_Style.frag new file mode 100644 index 0000000..1319817 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Mac_Style.frag @@ -0,0 +1,54 @@ +float colormap_h(float x) { + return -7.44992704834645E-01 * x + 7.47986634976377E-01; +} + +float colormap_s(float x) { + return 1.0; +} + +float colormap_v(float x) { + float i = mod(mod(x * 256.0, 2.0) + 2.0, 2.0); + if (0.0 <= i && i < 1.0) { + return 1.0; + } else { + return 254.0 / 255.0; + } +} + +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = colormap_s(clamp(x, 0.0, 1.0)); + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Nature.frag b/colormap-shaders/shaders/glsl/IDL_Nature.frag new file mode 100644 index 0000000..70a2ace --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Nature.frag @@ -0,0 +1,61 @@ +float colormap_red(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi * (x * 2.440771851872335 + 0.03082889566781979)) * 94.0 + 86.68712190457872; + if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 82.0; + } +} + +float colormap_green(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = - 133.8180196373718; + const float b = 105.5963045788319; + const float c = 1.192621559448461; + const float d = 4.00554233186818; + const float e = 0.04779355732364274; + const float f = 218.2356517672776; + const float g = -269.6049419208264; + float v = (a * x + b) * sin(2.0 * pi / c * (d * x + e)) + f + g * x; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 2.443749115965466; + const float b = 0.02934035424870109; + const float c = 253.745120022022; + const float d = 226.671125688366; + float v = sin(2.0 * pi * (x * a + b))*c + d; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 214.0; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Ocean.frag b/colormap-shaders/shaders/glsl/IDL_Ocean.frag new file mode 100644 index 0000000..f2c4ae9 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Ocean.frag @@ -0,0 +1,65 @@ +float colormap_red(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 92.39421034238549; + const float b = 88.02925388837211; + const float c = 0.5467741159150409; + const float d = 0.03040219113949284; + return a * sin(2.0 * pi / c * (x - d)) + b; + } else { + return 105.0; + } +} + +float colormap_green(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 92.44399971120093; + const float b = 22.7616696017667; + const float c = 0.3971750420482239; + const float d = 0.1428144080827581; + const float e = 203.7220396611977; + const float f = 49.51517183258432; + float v = (a * x + b) * sin(2.0 * pi / c * (x + d)) + (e * x + f); + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } + } else { + return 246.0; + } +} + +float colormap_blue(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 251.0868719483008; + const float b = 0.5472498585835275; + const float c = 0.02985857858149428; + const float d = 225.9495771701237; + float v = a * sin(2.0 * pi / b * (x - c)) + d; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 234.0; + } +} + +// R1 - 105 = 0 +// => 0.8344881408181015 + +// B1 - 234 = 0 +// => 0.847940340889657 + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Pastels.frag b/colormap-shaders/shaders/glsl/IDL_Pastels.frag new file mode 100644 index 0000000..d7a8343 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Pastels.frag @@ -0,0 +1,33 @@ +float colormap_red(float x) { + if (x < 129.0) { + return -1.95881595881596E+00 * x + 4.39831831831832E+02; + } else { + return 5.70897317298797E+00 * x - 1.11405615171138E+03; + } +} + +float colormap_green(float x) { + if (x < 129.0) { + return 0.0; + } else if (x < 200.0) { + return 5.72337662337662E+00 * x - 6.06801082251082E+02; + } else { + return -5.58823529411765E+00 * x + 1.59313235294118E+03; + } +} + +float colormap_blue(float x) { + if (x < 120.0) { + return 1.95784725990233E+00 * x + 6.90962481913547E+01; + } else { + return -5.71881606765328E+00 * x + 1.11517336152220E+03; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Peppermint.frag b/colormap-shaders/shaders/glsl/IDL_Peppermint.frag new file mode 100644 index 0000000..ae653b1 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Peppermint.frag @@ -0,0 +1,18 @@ +float colormap_red(float x) { + return float(int(mod(x * 256.0 / 4.0, 4.0))) * 80.0; +} + +float colormap_green(float x) { + return float(int(x * 256.0 / 16.0)) * 16.0; +} + +float colormap_blue(float x) { + return float(int(mod(x * 256.0, 4.0))) * 80.0; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Plasma.frag b/colormap-shaders/shaders/glsl/IDL_Plasma.frag new file mode 100644 index 0000000..641d2da --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Plasma.frag @@ -0,0 +1,47 @@ +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 12.16378802377247; + const float b = 0.05245257017955226; + const float c = 0.2532139106569052; + const float d = 0.02076964056039702; + const float e = 270.124167081014; + const float f = 1.724941960305955; + float v = (a * x + b) * sin(2.0 * pi / c * (x - d)) + e * x + f; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 88.08537391182792; + const float b = 0.25280516046667; + const float c = 0.05956080245692388; + const float d = 106.5684078925541; + return a * sin(2.0 * pi / b * (x - c)) + d; +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 63.89922420106684; + const float b = 0.4259605778503662; + const float c = 0.2529247343450655; + const float d = 0.5150868195804643; + const float e = 938.1798072557968; + const float f = 503.0883490697431; + float v = (a * x + b) * sin(2.0 * pi / c * x + d * 2.0 * pi) - e * x + f; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return mod(v, 255.0); + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Prism.frag b/colormap-shaders/shaders/glsl/IDL_Prism.frag new file mode 100644 index 0000000..c2db70f --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Prism.frag @@ -0,0 +1,31 @@ +float colormap_red(float x) { + if (x < (5.35651507139080E+02 + 4.75703324808184E-01) / (3.80568385693018E+00 + 4.18112109994712E+00)) { + return 3.80568385693018E+00 * x - 4.75703324808184E-01; + } else { + return -4.18112109994712E+00 * x + 5.35651507139080E+02; + } +} + +float colormap_green(float x) { + if (x < (7.72815970386039E+02 + 2.57000000000000E+02) / (4.00000000000000E+00 + 4.04283447911158E+00)) { + return 4.00000000000000E+00 * x - 2.57000000000000E+02; + } else { + return -4.04283447911158E+00 * x + 7.72815970386039E+02; + } +} + +float colormap_blue(float x) { + if (x < (1.03175883256528E+03 + 4.87540173259576E+02) / (3.86517065024528E+00 + 4.04377880184332E+00)) { + return 3.86517065024528E+00 * x - 4.87540173259576E+02; + } else { + return -4.04377880184332E+00 * x + 1.03175883256528E+03; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Purple-Red+Stripes.frag b/colormap-shaders/shaders/glsl/IDL_Purple-Red+Stripes.frag new file mode 100644 index 0000000..91d97a7 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Purple-Red+Stripes.frag @@ -0,0 +1,77 @@ +float colormap_h(float x) { + if (x < 0.3310005332481092) { + return (4.38091557495284E-01 * x - 6.45518032448820E-01) * x + 8.32595065985926E-01; // H1 + } else if (x < 0.836653386) { + return -9.95987681712782E-01 * x + 9.96092924041492E-01; // H2 + } else if (x < 0.9144920256360881) { + return (-3.25656183098909E+00 * x + 4.39104086393490E+00) * x - 1.23205476222211E+00; // H3 + } else { + return (1.68724608409684E+00 * x - 3.93349028637749E+00) * x + 2.24617746415606E+00; // H4 + } +} + +float colormap_s(float x) { + if (x < 0.9124516770628384) { + return -2.49531958245657E+00 * x + 3.07915192631601E+00; // S1 + } else { + return 2.28056601637550E+00 * x - 1.27861289779857E+00; // S2 + } +} + +float colormap_v(float x) { + float v = clamp(7.55217853407034E-01 * x + 7.48186662435193E-01, 0.0, 1.0); + float period = 0.039840637; + float t = x - 0.027888446; + float tt = t - float(int(t / period)) * period; + if (0.0 <= tt && tt < 0.007968127) { + v -= 0.2; + } + return v; +} + +// H1 - H2 = 0 +// => [x=-1.186402343934078,x=0.3310005332481092] + +// H3 - H4 = 0 +// => [x=0.7693377859773962,x=0.9144920256360881] + +// S1 - 1 = 0 +// => [x=0.9124516770628384] + +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = colormap_s(clamp(x, 0.0, 1.0)); + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Rainbow+Black.frag b/colormap-shaders/shaders/glsl/IDL_Rainbow+Black.frag new file mode 100644 index 0000000..81cfe74 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Rainbow+Black.frag @@ -0,0 +1,43 @@ +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + if (x < 0.0) { + return vec4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return vec4(0.0, 0.0, 0.0, 1.0); + } else { + float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0); + float s = 1.0; + float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0); + return colormap_hsv2rgb(h, s, v); + } +} diff --git a/colormap-shaders/shaders/glsl/IDL_Rainbow+White.frag b/colormap-shaders/shaders/glsl/IDL_Rainbow+White.frag new file mode 100644 index 0000000..4f71364 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Rainbow+White.frag @@ -0,0 +1,43 @@ +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + if (x < 0.0) { + return vec4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return vec4(1.0, 1.0, 1.0, 1.0); + } else { + float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0); + float s = 1.0; + float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0); + return colormap_hsv2rgb(h, s, v); + } +} diff --git a/colormap-shaders/shaders/glsl/IDL_Rainbow.frag b/colormap-shaders/shaders/glsl/IDL_Rainbow.frag new file mode 100644 index 0000000..4bc7f72 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Rainbow.frag @@ -0,0 +1,31 @@ +float colormap_red(float x) { + if (x < 100.0) { + return (-9.55123422981038E-02 * x + 5.86981763554179E+00) * x - 3.13964093701986E+00; + } else { + return 5.25591836734694E+00 * x - 8.32322857142857E+02; + } +} + +float colormap_green(float x) { + if (x < 150.0) { + return 5.24448979591837E+00 * x - 3.20842448979592E+02; + } else { + return -5.25673469387755E+00 * x + 1.34195877551020E+03; + } +} + +float colormap_blue(float x) { + if (x < 80.0) { + return 4.59774436090226E+00 * x - 2.26315789473684E+00; + } else { + return -5.25112244897959E+00 * x + 8.30385102040816E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Rainbow_18.frag b/colormap-shaders/shaders/glsl/IDL_Rainbow_18.frag new file mode 100644 index 0000000..3814f80 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Rainbow_18.frag @@ -0,0 +1,38 @@ +vec4 colormap(float x) { + float x16 = x * 16.0; + const float a = 255.0; + const float s = 1.0 / 255.0; + if (x16 < 1.0) { + return vec4(150.0, 0.0, 150.0, a) * s; + } else if (x16 < 2.0) { + return vec4(200.0, 0.0, 200.0, a) * s; + } else if (x16 < 3.0) { + return vec4(100.0, 100.0, 150.0, a) * s; + } else if (x16 < 4.0) { + return vec4(100.0, 100.0, 200.0, a) * s; + } else if (x16 < 5.0) { + return vec4(100.0, 100.0, 255.0, a) * s; + } else if (x16 < 6.0) { + return vec4(0.0, 140.0, 0.0, a) * s; + } else if (x16 < 7.0) { + return vec4(150.0, 170.0, 0.0, a) *s; + } else if (x16 < 8.0) { + return vec4(200.0, 200.0, 0.0, a) * s; + } else if (x16 < 9.0) { + return vec4(150.0, 200.0, 0.0, a) * s; + } else if (x16 < 10.0) { + return vec4(200.0, 255.0, 120.0, a) * s; + } else if (x16 < 11.0) { + return vec4(255.0, 255.0, 0.0, a) * s; + } else if (x16 < 12.0) { + return vec4(255.0, 200.0, 0.0, a) * s; + } else if (x16 < 13.0) { + return vec4(255.0, 160.0, 0.0, a) * s; + } else if (x16 < 14.0) { + return vec4(255.0, 125.0, 0.0, a) * s; + } else if (x16 < 15.0) { + return vec4(200.0, 50.0, 100.0, a) * s; + } else { + return vec4(175.0, 50.0, 75.0, a) * s; + } +} diff --git a/colormap-shaders/shaders/glsl/IDL_Rainbow_2.frag b/colormap-shaders/shaders/glsl/IDL_Rainbow_2.frag new file mode 100644 index 0000000..b9ab41e --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Rainbow_2.frag @@ -0,0 +1,37 @@ +vec4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return vec4(r, g, b, 1.0); +} + +vec4 colormap(float x) { + float h = clamp(-7.44981265666511E-01 * x + 7.47965390904122E-01, 0.0, 1.0); + float s = 1.0; + float v = 1.0; + return colormap_hsv2rgb(h, s, v); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Red-Purple.frag b/colormap-shaders/shaders/glsl/IDL_Red-Purple.frag new file mode 100644 index 0000000..78a3887 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Red-Purple.frag @@ -0,0 +1,31 @@ +float colormap_red(float x) { + if (x < 25.97288868211422) { + return 3.07931034482759E+00 * x - 1.62758620689655E+00; + } else if(x < 154.7883608200706) { + return (-0.002335409922053 * x + 1.770196213987500) * x + 33.949335775363600; + } else { + return 252.0; + } +} + +float colormap_green(float x) { + return ((7.125813968310300E-05 * x - 2.223039020276470E-02) * x + 2.367815929630070E+00) * x - 7.739188304766140E+01; +} + +float colormap_blue(float x) { + if (x < (2.51577880184332E+01 - 5.67741935483871E-01) / (9.88497695852535E-01 - 1.70189098998888E-01)) { // 30.0498444933 + return 1.70189098998888E-01 * x - 5.67741935483871E-01; + } else if(x < 150.2124460352976) { + return 9.88497695852535E-01 * x - 2.51577880184332E+01; + } else { + return (-3.85393764961783E-03 * x + 2.82261880442729E+00) * x - 2.13706208872841E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Red_Temperature.frag b/colormap-shaders/shaders/glsl/IDL_Red_Temperature.frag new file mode 100644 index 0000000..e45df28 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Red_Temperature.frag @@ -0,0 +1,19 @@ +float colormap_red(float x) { + return 1.448953446096850 * x - 5.02253539008443e-1; +} + +float colormap_green(float x) { + return 1.889376646180860 * x - 2.272028094820020e2; +} + +float colormap_blue(float x) { + return 3.92613636363636 * x - 7.46528409090909e+2; +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Standard_Gamma-II.frag b/colormap-shaders/shaders/glsl/IDL_Standard_Gamma-II.frag new file mode 100644 index 0000000..98edd69 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Standard_Gamma-II.frag @@ -0,0 +1,55 @@ +float colormap_red(float x) { + if (x < (8.75333333333333E+01 + 2.19676470588235E+02) / (4.76470588235294E+00 + 1.00000000000000E-01)) { // 63.1507456671 + return 4.76470588235294E+00 * x - 2.19676470588235E+02; + } else if (x < (8.75333333333333E+01 + 3.11000000000000E+02) / (5.00000000000000E+00 + 1.00000000000000E-01)) { // 78.1437908497 + return -1.00000000000000E-01 * x + 8.75333333333333E+01; + } else if (x < (-3.11000000000000E+02 + 3.42345454545455E+02) / (5.32727272727273E+00 - 5.00000000000000E+00)) { // 95.7777777778 + return 5.00000000000000E+00 * x - 3.11000000000000E+02; + } else if (x < (255.0 + 3.42345454545455E+02) / 5.32727272727273E+00) { // 112.129692833 + return 5.32727272727273E+00 * x - 3.42345454545455E+02; + } else if (x < (1.49279020979021E+03 - 255.0) / 7.68531468531468E+00) { // 161.059144677 + return 255.0; + } else if (x < (1.49279020979021E+03 + 7.19657722738218E+02) / (5.10010319917441E+00 + 7.68531468531468E+00)) { // 173.04463198 + return -7.68531468531468E+00 * x + 1.49279020979021E+03; + } else if (x < (255.0 + 7.19657722738218E+02) / 5.10010319917441E+00) { // 191.105490355 + return 5.10010319917441E+00 * x - 7.19657722738218E+02; + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < (163.0 + 5.65896810850440E+02) / 5.07239736070381E+00) { // 143.69868112 + return 5.07239736070381E+00 * x - 5.65896810850440E+02; + } else if (x < (163.0 + 9.06153846153846E+02) / 6.10769230769231E+00) { // 175.050377834 + return 163.0; + } else { + return 6.10769230769231E+00 * x - 9.06153846153846E+02; + } +} + +float colormap_blue(float x) { + if (x < (5.16164662349676E+02 - 4.77795918367347E+00) / (5.20142857142857E+00 + 5.42900092506938E+00)) { // 48.1059305585 + return 5.20142857142857E+00 * x + 4.77795918367347E+00; + } else if (x < 5.16164662349676E+02 / 5.42900092506938E+00) { // 95.0754419595 + return -5.42900092506938E+00 * x + 5.16164662349676E+02; + } else if (x < 6.16058823529412E+02 / 4.84558823529412E+00) { // 127.138088012 + return 0.0; + } else if (x < (9.31184615384615E+02 + 6.16058823529412E+02) / (4.84558823529412E+00 + 5.89230769230769E+00)) { // 144.091863932 + return 4.84558823529412E+00 * x - 6.16058823529412E+02; + } else if (x < 9.31184615384615E+02 / 5.89230769230769E+00) { // 158.033942559 + return -5.89230769230769E+00 * x + 9.31184615384615E+02; + } else if (x < 5.64142909048289E+02 / 3.22177684013127E+00) { // 175.103036939 + return 0.0; + } else { + return 3.22177684013127E+00 * x - 5.64142909048289E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Steps.frag b/colormap-shaders/shaders/glsl/IDL_Steps.frag new file mode 100644 index 0000000..1d5fcbe --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Steps.frag @@ -0,0 +1,43 @@ +float colormap_erf(float x) { + // erf approximation formula + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0)); + float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x)); + return sign(x) * sqrt(v); +} + +float colormap_red(float x) { + if (x <= 95.5) { + return 8.14475806451613E+00 * x - 5.23967741935484E+02; + } else { + return colormap_erf((x - 145.0) * 0.028) * 131.0 + 125.0; + } +} + +float colormap_green(float x) { + if (x < (3.14410256410256E+02 + 2.14285714285714E-01) / (4.25000000000000E+01 + 9.81196581196581E+00)) { + return 4.25000000000000E+01 * x - 2.14285714285714E-01; + } else if (x < 192.0) { // actual root: 193.529143410603 + return -9.81196581196581E+00 * x + 3.14410256410256E+02; + } else { + return ((5.35129859215999E-04 * x - 2.98599683017528E-01) * x + 5.69466901216655E+01) * x - 3.71604038989543E+03; + } +} + +float colormap_blue(float x) { + if (x < 63.0) { + return 8.22620967741936E+00 * x - 2.63729032258065E+02; + } else if (x <= 95.5) { + return 4.97690615835777E+00 * x - 3.16414039589443E+02; + } else { + return (((-7.88871743679920E-05 * x + 7.21525684930384E-02) * x - 2.45956037640571E+01) * x + 3.70824713134765E+03) * x - 2.08852518066406E+05; + } +} + +vec4 colormap(float x) { + float t = x * 255.0 - 0.5; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Stern_Special.frag b/colormap-shaders/shaders/glsl/IDL_Stern_Special.frag new file mode 100644 index 0000000..6eec55c --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Stern_Special.frag @@ -0,0 +1,26 @@ +float colormap_red(float x) { + if (x < (3.27037346938775E+02 + 9.33750000000000E+00) / (1.81250000000000E+01 + 5.18306122448980E+00)) { // 14.0428817217 + return 1.81250000000000E+01 * x - 9.33750000000000E+00; + } else if (x <= 64.0) { + return -5.18306122448980E+00 * x + 3.27037346938775E+02; + } else { + return x; + } +} + +float colormap_blue(float x) { + if (x < (8.01533134203946E+02 + 1.96917113893858E+00) / (1.99964221824687E+00 + 4.25020839121978E+00)) { // 128.063441841 + return 1.99964221824687E+00 * x - 1.96917113893858E+00; + } else if (x < (8.01533134203946E+02 + 7.17997825045893E+02) / (3.80632931598691E+00 + 4.25020839121978E+00)) { + return -4.25020839121978E+00 * x + 8.01533134203946E+02; + } else { + return 3.80632931598691E+00 * x - 7.17997825045893E+02; + } +} + +vec4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return vec4(r, x, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Volcano.frag b/colormap-shaders/shaders/glsl/IDL_Volcano.frag new file mode 100644 index 0000000..40dcfb3 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Volcano.frag @@ -0,0 +1,70 @@ +float colormap_r1(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 216.6901575438631; + const float b = 1.073972444219095; + const float c = 0.6275803332110022; + const float d = 221.6241814852619; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_r2(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 202.3454274460618; + const float b = 1.058678309228987; + const float c = 0.4891299991060677; + const float d = -72.38173481234448; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +float colormap_red(float x) { + if (x < 0.4264009656413063) { + return colormap_r1(x); + } else if (x < 0.6024851624202665) { + const float a = (0.0 - 255.0) / (0.6024851624202665 - 0.4264009656413063); + const float b = -0.6024851624202665 * a; + return a * x + b; + } else { + return colormap_r2(x); + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.3856859482602; + const float b = 0.6744554815524477; + const float c = 0.01070628027163306; + const float d = 26.95058522613648; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.9540413031656; + const float b = 0.2891013907955124; + const float c = 0.5136633102640619; + const float d = 126.5159759632338; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +// R1 - 255 = 0 +// => 0.4264009656413063 + +// R2 = 0 +// => 0.6024851624202665 + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/IDL_Waves.frag b/colormap-shaders/shaders/glsl/IDL_Waves.frag new file mode 100644 index 0000000..593d441 --- /dev/null +++ b/colormap-shaders/shaders/glsl/IDL_Waves.frag @@ -0,0 +1,32 @@ +float colormap_f(float x, float phase) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.9634465941118; + const float b = 1.011727672706345; + const float c = 0.0038512319231245; + const float d = 127.5277540583575; + return a * sin(2.0 * pi / b * x + 2.0 * pi * (c + phase)) + d; +} + +float colormap_red(float x) { + return colormap_f(x, 0.5); +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 63.19460736097507; + const float b = 0.06323746667143024; + const float c = 0.06208443629833329; + const float d = 96.56305326777574; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +float colormap_blue(float x) { + return colormap_f(x, 0.0); +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_autumn.frag b/colormap-shaders/shaders/glsl/MATLAB_autumn.frag new file mode 100644 index 0000000..76a0d84 --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_autumn.frag @@ -0,0 +1,4 @@ +vec4 colormap(float x) { + float g = clamp(x, 0.0, 1.0); + return vec4(1.0, g, 0.0, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_bone.frag b/colormap-shaders/shaders/glsl/MATLAB_bone.frag new file mode 100644 index 0000000..6d4b26a --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_bone.frag @@ -0,0 +1,32 @@ +float colormap_red(float x) { + if (x < 0.75) { + return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else { + return (13.0 + 8.0 / 9.0) / 10.0 * x - (3.0 + 8.0 / 9.0) / 10.0; + } +} + +float colormap_green(float x) { + if (x <= 0.375) { + return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else if (x <= 0.75) { + return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 100.0; + } else { + return 8.0 / 9.0 * x + 1.0 / 9.0; + } +} + +float colormap_blue(float x) { + if (x <= 0.375) { + return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else { + return 8.0 / 9.0 * x + 1.0 / 9.0; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_cool.frag b/colormap-shaders/shaders/glsl/MATLAB_cool.frag new file mode 100644 index 0000000..f441b8a --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_cool.frag @@ -0,0 +1,14 @@ +float colormap_red(float x) { + return (1.0 + 1.0 / 63.0) * x - 1.0 / 63.0; +} + +float colormap_green(float x) { + return -(1.0 + 1.0 / 63.0) * x + (1.0 + 1.0 / 63.0); +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = 1.0; + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_copper.frag b/colormap-shaders/shaders/glsl/MATLAB_copper.frag new file mode 100644 index 0000000..ac39ed8 --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_copper.frag @@ -0,0 +1,18 @@ +float colormap_red(float x) { + return 80.0 / 63.0 * x + 5.0 / 252.0; +} + +float colormap_green(float x) { + return 0.7936 * x - 0.0124; +} + +float colormap_blue(float x) { + return 796.0 / 1575.0 * x + 199.0 / 25200.0; +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_hot.frag b/colormap-shaders/shaders/glsl/MATLAB_hot.frag new file mode 100644 index 0000000..ffeebda --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_hot.frag @@ -0,0 +1,6 @@ +vec4 colormap(float x) { + float r = clamp(8.0 / 3.0 * x, 0.0, 1.0); + float g = clamp(8.0 / 3.0 * x - 1.0, 0.0, 1.0); + float b = clamp(4.0 * x - 3.0, 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_hsv.frag b/colormap-shaders/shaders/glsl/MATLAB_hsv.frag new file mode 100644 index 0000000..05130ae --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_hsv.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.5) { + return -6.0 * x + 67.0 / 32.0; + } else { + return 6.0 * x - 79.0 / 16.0; + } +} + +float colormap_green(float x) { + if (x < 0.4) { + return 6.0 * x - 3.0 / 32.0; + } else { + return -6.0 * x + 79.0 / 16.0; + } +} + +float colormap_blue(float x) { + if (x < 0.7) { + return 6.0 * x - 67.0 / 32.0; + } else { + return -6.0 * x + 195.0 / 32.0; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_jet.frag b/colormap-shaders/shaders/glsl/MATLAB_jet.frag new file mode 100644 index 0000000..5d58f41 --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_jet.frag @@ -0,0 +1,30 @@ +float colormap_red(float x) { + if (x < 0.7) { + return 4.0 * x - 1.5; + } else { + return -4.0 * x + 4.5; + } +} + +float colormap_green(float x) { + if (x < 0.5) { + return 4.0 * x - 0.5; + } else { + return -4.0 * x + 3.5; + } +} + +float colormap_blue(float x) { + if (x < 0.3) { + return 4.0 * x + 0.5; + } else { + return -4.0 * x + 2.5; + } +} + +vec4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_parula.frag b/colormap-shaders/shaders/glsl/MATLAB_parula.frag new file mode 100644 index 0000000..b010cfc --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_parula.frag @@ -0,0 +1,392 @@ +vec4 colormap(float x) { + if (x < 0.0) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if (1.0 < x) { + return vec4(0.0, 0.0, 0.0, 0.0); + } + if (x < 3.1250000000000000e-02) { + float dx = x - 1.5625000000000000e-02; + return ((vec4(-1.4151576683620706e+02, 2.4271369358056621e+01, 4.5510373586485706e+01, 1.0) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 2.6007355728658488e-01, 1.4968553250962457e+00, 3.0913652594248364e+00, 1.0)) * dx + + vec4( 2.0810000000000001e-01, 1.6630000000000000e-01, 5.2920000000000000e-01, 1.0); + } else if (x < 4.6875000000000000e-02) { + float dx = x - 3.1250000000000000e-02; + return ((vec4(-5.1390461057291191e+01, 1.2211762733842230e+01, -1.2843448884986955e+01, 1.0) * dx + + vec4(-6.6335515704472066e+00, 1.1377204386589042e+00, 2.1332987618665173e+00, 1.0)) * dx + + vec4( 1.5642431399834725e-01, 1.5146322069502911e+00, 3.1246980525790007e+00, 1.0)) * dx + + vec4( 2.1162380952380999e-01, 1.8978095238095199e-01, 5.7767619047619101e-01, 1.0); + } else if (x < 6.2500000000000000e-02) { + float dx = x - 4.6875000000000000e-02; + return ((vec4(-1.4725107464858192e+02, 1.3014608277362621e+01, 5.8634219534912217e+00, 1.0) * dx + + vec4(-9.0424794325077311e+00, 1.7101468168077587e+00, 1.5312620953827538e+00, 1.0)) * dx + + vec4(-8.8513670422823654e-02, 1.5591301328169576e+00, 3.1819568159735203e+00, 1.0)) * dx + + vec4( 2.1225238095238100e-01, 2.1377142857142900e-01, 6.2697142857142896e-01, 1.0); + } else if (x < 7.8125000000000000e-02) { + float dx = x - 6.2500000000000000e-02; + return ((vec4(-2.1469400225321081e+02, -1.4338005366630648e+01, -4.1817857976177763e+01, 1.0) * dx + + vec4(-1.5944873556660008e+01, 2.3202065798091316e+00, 1.8061099994526548e+00, 1.0)) * dx + + vec4(-4.7894106087856969e-01, 1.6221044046390967e+00, 3.2341032549553237e+00, 1.0)) * dx + + vec4( 2.0810000000000001e-01, 2.3860000000000001e-01, 6.7708571428571396e-01, 1.0); + } else if (x < 9.3750000000000000e-02) { + float dx = x - 7.8125000000000000e-02; + return ((vec4(-2.8846495443400278e+02, 2.0037550842697090e+02, 1.1771734328417965e+02, 1.0) * dx + + vec4(-2.6008654912279265e+01, 1.6481125782483199e+00, -1.5410209318067788e-01, 1.0)) * dx + + vec4(-1.1344649432057459e+00, 1.6841093914837442e+00, 3.2599158784908235e+00, 1.0)) * dx + + vec4( 1.9590476190476200e-01, 2.6445714285714300e-01, 7.2789999999999999e-01, 1.0); + } else if (x < 1.0937500000000000e-01) { + float dx = x - 9.3750000000000000e-02; + return ((vec4(-5.4509738001026233e+02, 5.1696771659011155e+01, -6.5374637230314454e+02, 1.0) * dx + + vec4(-3.9530449651373146e+01, 1.1040714535762580e+01, 5.3638983732652425e+00, 1.0)) * dx + + vec4(-2.1585134520128149e+00, 1.8823723151401646e+00, 3.3413189453671448e+00, 1.0)) * dx + + vec4( 1.7072857142857101e-01, 2.9193809523809500e-01, 7.7924761904761897e-01, 1.0); + } else if (x < 1.2500000000000000e-01) { + float dx = x - 1.0937500000000000e-01; + return ((vec4( 2.3639968744743715e+03, -8.1036503315845437e+02, -8.1573269216733058e+02, 1.0) * dx + + vec4(-6.5081889339354191e+01, 1.3464000707278728e+01, -2.5280462828444659e+01, 1.0)) * dx + + vec4(-3.7930812487429293e+00, 2.2652584908126849e+00, 3.0301226257549660e+00, 1.0)) * dx + + vec4( 1.2527142857142901e-01, 3.2424285714285700e-01, 8.3027142857142899e-01, 1.0); + } else if (x < 1.4062500000000000e-01) { + float dx = x - 1.2500000000000000e-01; + return ((vec4( 1.4125902630655582e+03, 2.5375056097507152e+02, 9.0826266478267496e+02, 1.0) * dx + + vec4( 4.5730464151631985e+01, -2.4521860222023822e+01, -6.3517932773788282e+01, 1.0)) * dx + + vec4(-4.0954472673010889e+00, 2.0924794358947931e+00, 1.6426476944700765e+00, 1.0)) * dx + + vec4( 5.9133333333333399e-02, 3.5983333333333301e-01, 8.6833333333333296e-01, 1.0); + } else if (x < 1.5625000000000000e-01) { + float dx = x - 1.4062500000000000e-01; + return ((vec4(-1.9850459267366693e+03, 1.4738473211499172e+02, 2.4976683303608979e+02, 1.0) * dx + + vec4( 1.1194563273283002e+02, -1.2627302676317344e+01, -2.0943120362100398e+01, 1.0)) * dx + + vec4(-1.6317582534813697e+00, 1.5120237656082123e+00, 3.2294373922181602e-01, 1.0)) * dx + + vec4( 1.1695238095238101e-02, 3.8750952380952403e-01, 8.8195714285714299e-01, 1.0); + } else if (x < 1.7187500000000000e-01) { + float dx = x - 1.5625000000000000e-01; + return ((vec4(-1.3211246088080517e+02, 6.1731462945951478e+01, 9.6199145930320853e+01, 1.0) * dx + + vec4( 1.8896604917048652e+01, -5.7186433584271068e+00, -9.2353000635336890e+00, 1.0)) * dx + + vec4( 4.1265170979798449e-01, 1.2253683588153301e+00, -1.4859407992871662e-01, 1.0)) * dx + + vec4( 5.9571428571428596e-03, 4.0861428571428599e-01, 8.8284285714285704e-01, 1.0); + } else if (x < 1.8750000000000000e-01) { + float dx = x - 1.7187500000000000e-01; + return ((vec4(-2.4276114402580023e+02, 1.8878292291818184e+01, 5.4500811814199913e+01, 1.0) * dx + + vec4( 1.2703833313260910e+01, -2.8249810328356313e+00, -4.7259650980498993e+00, 1.0)) * dx + + vec4( 9.0640855714657143e-01, 1.0918742277018498e+00, -3.6673884807846019e-01, 1.0)) * dx + + vec4( 1.6514285714285700e-02, 4.2659999999999998e-01, 8.7863333333333304e-01, 1.0); + } else if (x < 2.0312500000000000e-01) { + float dx = x - 1.8750000000000000e-01; + return ((vec4(-2.4875702015890445e+02, 2.7531596458333780e+01, 1.1605149669749400e+01, 1.0) * dx + + vec4( 1.3244046870515243e+00, -1.9400610816566539e+00, -2.1712395442592785e+00, 1.0)) * dx + + vec4( 1.1255997759014531e+00, 1.0174204446629080e+00, -4.7450767061454108e-01, 1.0)) * dx + + vec4( 3.2852380952381001e-02, 4.4304285714285702e-01, 8.7195714285714299e-01, 1.0); + } else if (x < 2.1875000000000000e-01) { + float dx = x - 2.0312500000000000e-01; + return ((vec4( 6.6879357994795782e+01, 3.3156266362545779e+00, 3.1398894268734253e+01, 1.0) * dx + + vec4(-1.0336080632897122e+01, -6.4951749767225808e-01, -1.6272481534897754e+00, 1.0)) * dx + + vec4( 9.8479233924761567e-01, 9.7695827936089374e-01, -5.3385904089187008e-01, 1.0)) * dx + + vec4( 4.9814285714285700e-02, 4.5857142857142902e-01, 8.6405714285714297e-01, 1.0); + } else if (x < 2.3437500000000000e-01) { + float dx = x - 2.1875000000000000e-01; + return ((vec4(-3.7807546774099214e+00, 2.9110963663947160e+01, 2.0085673255558202e+01, 1.0) * dx + + vec4(-7.2011107268910699e+00, -4.9409749909782474e-01, -1.5542498464285720e-01, 1.0)) * dx + + vec4( 7.1077372425092522e-01, 9.5908929503636120e-01, -5.6171330867519242e-01, 1.0)) * dx + + vec4( 6.2933333333333299e-02, 4.7369047619047600e-01, 8.5543809523809500e-01, 1.0); + } else if (x < 2.5000000000000000e-01) { + float dx = x - 2.3437500000000000e-01; + return ((vec4(-1.8052110713761824e+01, 7.5676044216235097e+00, 2.6820241280346455e+01, 1.0) * dx + + vec4(-7.3783336023946600e+00, 8.7047892264969851e-01, 7.8609094921143352e-01, 1.0)) * dx + + vec4( 4.8296990660583561e-01, 9.6497025477935916e-01, -5.5185915297880839e-01, 1.0)) * dx + + vec4( 7.2266666666666701e-02, 4.8866666666666703e-01, 8.4670000000000001e-01, 1.0); + } else if (x < 2.6562500000000000e-01) { + float dx = x - 2.5000000000000000e-01; + return ((vec4(-8.5042116753280467e+01, 3.9234694840689350e+01, 6.3623990194130904e+01, 1.0) * dx + + vec4(-8.2245262921022455e+00, 1.2252103799133005e+00, 2.0432897592276738e+00, 1.0)) * dx + + vec4( 2.3917522075432149e-01, 9.9771540013190607e-01, -5.0765007940944740e-01, 1.0)) * dx + + vec4( 7.7942857142857203e-02, 5.0398571428571404e-01, 8.3837142857142899e-01, 1.0); + } else if (x < 2.8125000000000000e-01) { + float dx = x - 2.6562500000000000e-01; + return ((vec4(-4.4981860368289709e+01, 3.5222378119677195e+01, 1.8276940800992332e+01, 1.0) * dx + + vec4(-1.2210875514912267e+01, 3.0643367005706139e+00, 5.0256642995775600e+00, 1.0)) * dx + + vec4(-8.0127932480280273e-02, 1.0647395732644671e+00, -3.9719767224061564e-01, 1.0)) * dx + + vec4( 7.9347619047619000e-02, 5.2002380952381000e-01, 8.3118095238095202e-01, 1.0); + } else if (x < 2.9687500000000000e-01) { + float dx = x - 2.8125000000000000e-01; + return ((vec4( 8.8958586797831074e+01, -6.4031864461777545e+01, -5.4343639113056135e+01, 1.0) * dx + + vec4(-1.4319400219675847e+01, 4.7153856749304826e+00, 5.8823958996240755e+00, 1.0)) * dx + + vec4(-4.9466349083321959e-01, 1.1862977353816719e+00, -2.2675923162809006e-01, 1.0)) * dx + + vec4( 7.4942857142857103e-02, 5.3754285714285699e-01, 8.2627142857142899e-01, 1.0); + } else if (x < 3.1250000000000000e-01) { + float dx = x - 2.9687500000000000e-01; + return ((vec4( 2.3465669412937996e+02, -7.4943148843863256e+01, -1.7040059387215410e+02, 1.0) * dx + + vec4(-1.0149466463527515e+01, 1.7138920282846606e+00, 3.3350378161995691e+00, 1.0)) * dx + + vec4(-8.7698953275827207e-01, 1.2867551994944084e+00, -8.2736829818345611e-02, 1.0)) * dx + + vec4( 6.4057142857142799e-02, 5.5698571428571397e-01, 8.2395714285714305e-01, 1.0); + } else if (x < 3.2812500000000000e-01) { + float dx = x - 3.1250000000000000e-01; + return ((vec4( 3.5054309382746595e+02, -7.5598816353949772e+01, -5.9224118732067950e+01, 1.0) * dx + + vec4( 8.5006607378717081e-01, -1.7990680737714295e+00, -4.6524900215576546e+00, 1.0)) * dx + + vec4(-1.0222926638479650e+00, 1.2854243237836778e+00, -1.0332202052706571e-01, 1.0)) * dx + + vec4( 4.8771428571428597e-02, 5.7722380952381003e-01, 8.2282857142857202e-01, 1.0); + } else if (x < 3.4375000000000000e-01) { + float dx = x - 3.2812500000000000e-01; + return ((vec4(-1.3511844086782639e+02, 2.1571557117596814e+01, 6.5912402293741552e+00, 1.0) * dx + + vec4( 1.7281773596949638e+01, -5.3427625903628249e+00, -7.4286205871233397e+00, 1.0)) * dx + + vec4(-7.3898266899270237e-01, 1.1738332196565799e+00, -2.9208937378770627e-01, 1.0)) * dx + + vec4( 3.4342857142857203e-02, 5.9658095238095199e-01, 8.1985238095238100e-01, 1.0); + } else if (x < 3.5937500000000000e-01) { + float dx = x - 3.4375000000000000e-01; + return ((vec4(-1.6458788273706924e+02, 1.0533768835542057e+01, 3.0362548290707878e+01, 1.0) * dx + + vec4( 1.0948096681270275e+01, -4.3315958504754741e+00, -7.1196562013714262e+00, 1.0)) * dx + + vec4(-2.9789094589551629e-01, 1.0226713690184817e+00, -5.1940619860793691e-01, 1.0)) * dx + + vec4( 2.6499999999999999e-02, 6.1370000000000002e-01, 8.1350000000000000e-01, 1.0); + } else if (x < 3.7500000000000000e-01) { + float dx = x - 3.5937500000000000e-01; + return ((vec4(-1.0406115199344315e+02, 1.9929786587720105e+01, 3.6734795179105028e+01, 1.0) * dx + + vec4( 3.2330396779701545e+00, -3.8378254363094402e+00, -5.6964117502444944e+00, 1.0)) * dx + + vec4(-7.6310690282384588e-02, 8.9502416141246732e-01, -7.1965726035193567e-01, 1.0)) * dx + + vec4( 2.3890476190476202e-02, 6.2866190476190498e-01, 8.0376190476190501e-01, 1.0); + } else if (x < 3.9062500000000000e-01) { + float dx = x - 3.7500000000000000e-01; + return ((vec4( 2.3255546213942225e+02, 1.8349599099637384e+01, 1.7433813849989207e+01, 1.0) * dx + + vec4(-1.6448268217224928e+00, -2.9036166900100602e+00, -3.9744682262239461e+00, 1.0)) * dx + + vec4(-5.1494864403514876e-02, 7.8968912818872505e-01, -8.7076475998425507e-01, 1.0)) * dx + + vec4( 2.3090476190476199e-02, 6.4178571428571396e-01, 7.9126666666666701e-01, 1.0); + } else if (x < 4.0625000000000000e-01) { + float dx = x - 3.9062500000000000e-01; + return ((vec4( 1.5126193200717549e+02, 2.0267550346934740e+01, 2.0857035135376179e+01, 1.0) * dx + + vec4( 9.2562104660629245e+00, -2.0434792322145579e+00, -3.1572582020057021e+00, 1.0)) * dx + + vec4( 6.7433005039304356e-02, 7.1239075440396538e-01, -9.8219798542534331e-01, 1.0)) * dx + + vec4( 2.2771428571428599e-02, 6.5348571428571400e-01, 7.7675714285714303e-01, 1.0); + } else if (x < 4.2187500000000000e-01) { + float dx = x - 4.0625000000000000e-01; + return ((vec4( 1.0861181935568159e+02, -5.7969433444380156e+00, 3.9956456082908054e+00, 1.0) * dx + + vec4( 1.6346613528899276e+01, -1.0934378097019919e+00, -2.1795846800349437e+00, 1.0)) * dx + + vec4( 4.6747712996058871e-01, 6.6337642562401933e-01, -1.0655861554572283e+00, 1.0)) * dx + + vec4( 2.6661904761904800e-02, 6.6419523809523795e-01, 7.6071904761904796e-01, 1.0); + } else if (x < 4.3750000000000000e-01) { + float dx = x - 4.2187500000000000e-01; + return ((vec4(-3.0484063800132168e+02, 1.4154965887634640e+01, -3.1353889969814710e+00, 1.0) * dx + + vec4( 2.1437792561196851e+01, -1.3651695289725239e+00, -1.9922887921463122e+00, 1.0)) * dx + + vec4( 1.0578584751183406e+00, 6.2496068595722998e-01, -1.1307716784600605e+00, 1.0)) * dx + + vec4( 3.8371428571428598e-02, 6.7427142857142897e-01, 7.4355238095238096e-01, 1.0); + } else if (x < 4.5312500000000000e-01) { + float dx = x - 4.3750000000000000e-01; + return ((vec4( 1.9732370744832981e+01, -3.3873392535419122e+00, -5.1854420010455629e+00, 1.0) * dx + + vec4( 7.1483876548848961e+00, -7.0165550298965007e-01, -2.1392601513798186e+00, 1.0)) * dx + + vec4( 1.5045175409946179e+00, 5.9266654483282100e-01, -1.1953271307026563e+00, 1.0)) * dx + + vec4( 5.8971428571428598e-02, 6.8375714285714295e-01, 7.2538571428571397e-01, 1.0); + } else if (x < 4.6875000000000000e-01) { + float dx = x - 4.5312500000000000e-01; + return ((vec4(-5.2460806882781675e+01, -6.0560887320505685e-01, 1.3890718905419471e+01, 1.0) * dx + + vec4( 8.0733425335489422e+00, -8.6043703049942721e-01, -2.3823277451788294e+00, 1.0)) * dx + + vec4( 1.7423570751888966e+00, 5.6825884899705426e-01, -1.2659769415863851e+00, 1.0)) * dx + + vec4( 8.4300000000000000e-02, 6.9283333333333297e-01, 7.0616666666666705e-01, 1.0); + } else if (x < 4.8437500000000000e-01) { + float dx = x - 4.6875000000000000e-01; + return ((vec4( 1.0354971072183483e+01, 5.8097747460711062e+00, -5.4384621916749820e+00, 1.0) * dx + + vec4( 5.6142422109185510e+00, -8.8882494643091425e-01, -1.7312002964872917e+00, 1.0)) * dx + + vec4( 1.9562255868212013e+00, 5.4092663060751767e-01, -1.3302508172374183e+00, 1.0)) * dx + + vec4( 1.1329523809523800e-01, 7.0150000000000001e-01, 6.8585714285714305e-01, 1.0); + } else if (x < 5.0000000000000000e-01) { + float dx = x - 4.8437500000000000e-01; + return ((vec4(-1.3925172644537971e+01, -8.9021377300786071e+00, -4.6199177582688593e+00, 1.0) * dx + + vec4( 6.0996314799271518e+00, -6.1649175520883115e-01, -1.9861282117220564e+00, 1.0)) * dx + + vec4( 2.1392548632406654e+00, 5.1740605714439658e-01, -1.3883340751781894e+00, 1.0)) * dx + + vec4( 1.4527142857142900e-01, 7.0975714285714298e-01, 6.6462857142857201e-01, 1.0); + } else if (x < 5.1562500000000000e-01) { + float dx = x - 5.0000000000000000e-01; + return ((vec4( 3.1614367125520630e+01, -1.1395280968671647e+01, 2.1421523701702025e+01, 1.0) * dx + + vec4( 5.4468890122144344e+00, -1.0337794613062659e+00, -2.2026868566409092e+00, 1.0)) * dx + + vec4( 2.3196692459303776e+00, 4.9162056938634824e-01, -1.4537843106213608e+00, 1.0)) * dx + + vec4( 1.8013333333333301e-01, 7.1765714285714299e-01, 6.4243333333333297e-01, 1.0); + } else if (x < 5.3125000000000000e-01) { + float dx = x - 5.1562500000000000e-01; + return ((vec4(-3.7634010143333590e+01, 2.0544616050328934e+00, 1.3219372364175872e+00, 1.0) * dx + + vec4( 6.9288124712232140e+00, -1.5679332567127493e+00, -1.1985529331236269e+00, 1.0)) * dx + + vec4( 2.5130395816090907e+00, 4.5096880816730112e-01, -1.5069286823364316e+00, 1.0)) * dx + + vec4( 2.1782857142857101e-01, 7.2504285714285699e-01, 6.1926190476190501e-01, 1.0); + } else if (x < 5.4687500000000000e-01) { + float dx = x - 5.3125000000000000e-01; + return ((vec4( 1.2815768685879013e+01, -1.4298832118473902e+01, 3.9450879734146490e+01, 1.0) * dx + + vec4( 5.1647182457544520e+00, -1.4716303689768324e+00, -1.1365871251665525e+00, 1.0)) * dx + + vec4( 2.7020009990618670e+00, 4.0347562651590141e-01, -1.5434152457472157e+00, 1.0)) * dx + + vec4( 2.5864285714285701e-01, 7.3171428571428598e-01, 5.9542857142857097e-01, 1.0); + } else if (x < 5.6250000000000000e-01) { + float dx = x - 5.4687500000000000e-01; + return ((vec4(-7.8540912219456771e+01, -1.8509114083431125e+01, 3.3113477160250433e+01, 1.0) * dx + + vec4( 5.7654574029050307e+00, -2.1418881245302965e+00, 7.1267286237156402e-01, 1.0)) * dx + + vec4( 2.8727849935721714e+00, 3.4701440005485251e-01, -1.5500389061033872e+00, 1.0)) * dx + + vec4( 3.0217142857142898e-01, 7.3760476190476199e-01, 5.7118571428571396e-01, 1.0); + } else if (x < 5.7812500000000000e-01) { + float dx = x - 5.6250000000000000e-01; + return ((vec4(-5.8163891236508938e+01, 9.6920884524980497e+00, 3.0320583052976861e+01, 1.0) * dx + + vec4( 2.0838521426179946e+00, -3.0095028471911305e+00, 2.2648671042583031e+00, 1.0)) * dx + + vec4( 2.9954304552209687e+00, 2.6652391612170523e-01, -1.5035148441247956e+00, 1.0)) * dx + + vec4( 3.4816666666666701e-01, 7.4243333333333295e-01, 5.4726666666666701e-01, 1.0); + } else if (x < 5.9375000000000000e-01) { + float dx = x - 5.7812500000000000e-01; + return ((vec4(-6.4543256167712116e+01, -2.8636353652780144e-01, 2.8905906284068501e+00, 1.0) * dx + + vec4(-6.4258025909336181e-01, -2.5551862009802844e+00, 3.6861444348665935e+00, 1.0)) * dx + + vec4( 3.0179503284010409e+00, 1.7957564974402687e-01, -1.4105302888259692e+00, 1.0)) * dx + + vec4( 3.9525714285714297e-01, 7.4590000000000001e-01, 5.2444285714285699e-01, 1.0); + } else if (x < 6.0937500000000000e-01) { + float dx = x - 5.9375000000000000e-01; + return ((vec4(-2.4450284092939786e+01, 1.3922851408411924e+01, -1.6916850328844372e+01, 1.0) * dx + + vec4(-3.6680453919548675e+00, -2.5686094917550251e+00, 3.8216408705731646e+00, 1.0)) * dx + + vec4( 2.9505968026034126e+00, 9.9516342045037676e-02, -1.2932211434284731e+00, 1.0)) * dx + + vec4( 4.4200952380952402e-01, 7.4808095238095196e-01, 5.0331428571428605e-01, 1.0); + } else if (x < 6.2500000000000000e-01) { + float dx = x - 6.0937500000000000e-01; + return ((vec4( 1.2547821111311350e+01, 1.5748329330961459e+01, -1.7611303598786566e+01, 1.0) * dx + + vec4(-4.8141524588114200e+00, -1.9159758319857161e+00, 3.0286635114085847e+00, 1.0)) * dx + + vec4( 2.8180624611851890e+00, 2.9444696361588602e-02, -1.1861851374600081e+00, 1.0)) * dx + + vec4( 4.8712380952380901e-01, 7.4906190476190504e-01, 4.8397619047619100e-01, 1.0); + } else if (x < 6.4062500000000000e-01) { + float dx = x - 6.2500000000000000e-01; + return ((vec4( 9.2115329809656430e+00, -3.2661877796437579e+00, -1.2675733711774058e+00, 1.0) * dx + + vec4(-4.2259733442187004e+00, -1.1777728945968977e+00, 2.2031336552154643e+00, 1.0)) * dx + + vec4( 2.6768104955128438e+00, -1.8895127491264742e-02, -1.1044383067315073e+00, 1.0)) * dx + + vec4( 5.3002857142857096e-01, 7.4911428571428595e-01, 4.6611428571428598e-01, 1.0); + } else if (x < 6.5625000000000000e-01) { + float dx = x - 6.4062500000000000e-01; + return ((vec4( 1.4269589821681299e+01, 7.3028598827757278e+00, -8.5260219639800940e+00, 1.0) * dx + + vec4(-3.7941827357359359e+00, -1.3308754467676989e+00, 2.1437161534415234e+00, 1.0)) * dx + + vec4( 2.5514955567635522e+00, -5.8092757825086563e-02, -1.0365187784712420e+00, 1.0)) * dx + + vec4( 5.7085714285714295e-01, 7.4851904761904797e-01, 4.4939047619047601e-01, 1.0); + } else if (x < 6.7187500000000000e-01) { + float dx = x - 6.5625000000000000e-01; + return ((vec4( 8.6083934467238432e+00, 2.6914824850885094e-01, -1.7057138772896455e+01, 1.0) * dx + + vec4(-3.1252957128446250e+00, -9.8855388976258662e-01, 1.7440588738799565e+00, 1.0)) * dx + + vec4( 2.4433787060044811e+00, -9.4333841208372265e-02, -9.7577229366934382e-01, 1.0)) * dx + + vec4( 6.0985238095238103e-01, 7.4731428571428604e-01, 4.3368571428571401e-01, 1.0); + } else if (x < 6.8750000000000000e-01) { + float dx = x - 6.7187500000000000e-01; + return ((vec4( 8.7188554392023345e+00, 1.7834947123447904e+01, -1.8886229447019101e+00, 1.0) * dx + + vec4(-2.7217772700294449e+00, -9.7593756561373424e-01, 9.4450549390043514e-01, 1.0)) * dx + + vec4( 2.3520181906470738e+00, -1.2502902019862727e-01, -9.3376347542277516e-01, 1.0)) * dx + + vec4( 6.4729999999999999e-01, 7.4560000000000004e-01, 4.1880000000000001e-01, 1.0); + } else if (x < 7.0312500000000000e-01) { + float dx = x - 6.8750000000000000e-01; + return ((vec4( 8.9449847961700044e+00, -2.1676746266635202e+01, -4.0993789718798466e+00, 1.0) * dx + + vec4(-2.3130809213168355e+00, -1.3992441920211368e-01, 8.5597629336753311e-01, 1.0)) * dx + + vec4( 2.2733485314072883e+00, -1.4246436371137491e-01, -9.0563094749671313e-01, 1.0)) * dx + + vec4( 6.8341904761904804e-01, 7.4347619047619096e-01, 4.0443333333333298e-01, 1.0); + } else if (x < 7.1875000000000000e-01) { + float dx = x - 7.0312500000000000e-01; + return ((vec4( 1.1674919661892304e+01, 2.3933066515154213e+01, -1.1673175453308831e+01, 1.0) * dx + + vec4(-1.8937847589963666e+00, -1.1560219004506387e+00, 6.6381790406066532e-01, 1.0)) * dx + + vec4( 2.2076162551523946e+00, -1.6271352495594915e-01, -8.8188416316189755e-01, 1.0)) * dx + + vec4( 7.1840952380952405e-01, 7.4113333333333298e-01, 3.9047619047618998e-01, 1.0); + } else if (x < 7.3437500000000000e-01) { + float dx = x - 7.1875000000000000e-01; + return ((vec4(-4.4641682053710623e+00, 2.0910706819426692e+00, 4.6048045942407727e+00, 1.0) * dx + + vec4(-1.3465228998451648e+00, -3.4159407552784897e-02, 1.1663780468681384e-01, 1.0)) * dx + + vec4( 2.1569864479829954e+00, -1.8131010789350266e-01, -8.6968954271271826e-01, 1.0)) * dx + + vec4( 7.5248571428571398e-01, 7.3839999999999995e-01, 3.7681428571428599e-01, 1.0); + } else if (x < 7.5000000000000000e-01) { + float dx = x - 7.3437500000000000e-01; + return ((vec4( 1.2423276968973711e+01, -6.0829492432479162e+00, -2.1725700066572116e+01, 1.0) * dx + + vec4(-1.5557807844719334e+00, 6.3859530663277708e-02, 3.3248802004185007e-01, 1.0)) * dx + + vec4( 2.1116379529155407e+00, -1.8084604346990121e-01, -8.6267195170133282e-01, 1.0)) * dx + + vec4( 7.8584285714285695e-01, 7.3556666666666704e-01, 3.6327142857142902e-01, 1.0); + } else if (x < 7.6562500000000000e-01) { + float dx = x - 7.5000000000000000e-01; + return ((vec4( 3.4549460436900552e+00, 2.2240726291601970e+01, -7.5799471847609725e+00, 1.0) * dx + + vec4(-9.7343967655129060e-01, -2.2127871511396835e-01, -6.8590417057871789e-01, 1.0)) * dx + + vec4( 2.0721188832120530e+00, -1.8330571822694325e-01, -8.6819407905347146e-01, 1.0)) * dx + + vec4( 8.1850476190476196e-01, 7.3273333333333301e-01, 3.4979047619047599e-01, 1.0); + } else if (x < 7.8125000000000000e-01) { + float dx = x - 7.6562500000000000e-01; + return ((vec4( 8.7094721894791203e+00, 1.3239510743088688e+01, -2.2852796908624047e+01, 1.0) * dx + + vec4(-8.1148908075331927e-01, 8.2125532980487381e-01, -1.0412141948643885e+00, 1.0)) * dx + + vec4( 2.0442293713791684e+00, -1.7393108362239784e-01, -8.9518030351351996e-01, 1.0)) * dx + + vec4( 8.5065714285714300e-01, 7.2989999999999999e-01, 3.3602857142857101e-01, 1.0); + } else if (x < 7.9687500000000000e-01) { + float dx = x - 7.8125000000000000e-01; + return ((vec4(-1.2078434801289291e+01, 4.3390183117236198e+01, -3.9570693752303733e+01, 1.0) * dx + + vec4(-4.0323257187148548e-01, 1.4418573958871561e+00, -2.1124390499561407e+00, 1.0)) * dx + + vec4( 2.0252493455569058e+00, -1.3856994728345987e-01, -9.4445613546384066e-01, 1.0)) * dx + + vec4( 8.8243333333333296e-01, 7.2743333333333304e-01, 3.2169999999999999e-01, 1.0); + } else if (x < 8.1250000000000000e-01) { + float dx = x - 7.9687500000000000e-01; + return ((vec4(-1.2824532984374384e+01, 1.1653781393088177e+02, -1.1096774236821523e+02, 1.0) * dx + + vec4(-9.6940920318192092e-01, 3.4757722295076028e+00, -3.9673153195953783e+00, 1.0)) * dx + + vec4( 2.0038018178216963e+00, -6.1731984386666772e-02, -1.0394522974880831e+00, 1.0)) * dx + + vec4( 9.1393333333333304e-01, 7.2578571428571403e-01, 3.0627619047619098e-01, 1.0); + } else if (x < 8.2812500000000000e-01) { + float dx = x - 8.1250000000000000e-01; + return ((vec4(-3.5855044278532131e+02, 2.7064903734930277e+02, -8.0792089155266083e+01, 1.0) * dx + + vec4(-1.5705591868244702e+00, 8.9384822575176859e+00, -9.1689282431054675e+00, 1.0)) * dx + + vec4( 1.9641148117278464e+00, 1.3224074197310332e-01, -1.2447061031552840e+00, 1.0)) * dx + + vec4( 9.4495714285714305e-01, 7.2611428571428605e-01, 2.8864285714285698e-01, 1.0); + } else if (x < 8.4375000000000000e-01) { + float dx = x - 8.2812500000000000e-01; + return ((vec4(-3.8174017206443654e+02, -1.9549693475620506e+02, 4.4911575613188438e+02, 1.0) * dx + + vec4(-1.8377611192386407e+01, 2.1625155883266252e+01, -1.2956057422258565e+01, 1.0)) * dx + + vec4( 1.6524246495526764e+00, 6.0979758792285232e-01, -1.5904090041765968e+00, 1.0)) * dx + + vec4( 9.7389523809523804e-01, 7.3139523809523799e-01, 2.6664761904761902e-01, 1.0); + } else if (x < 8.5937500000000000e-01) { + float dx = x - 8.4375000000000000e-01; + return ((vec4( 4.3248438818547703e+02, -2.7134838403902307e+02, 3.3204036056432756e+01, 1.0) * dx + + vec4(-3.6271681757906869e+01, 1.2461237066569140e+01, 8.0962436464235150e+00, 1.0)) * dx + + vec4( 7.9852944720434427e-01, 1.1423974777640304e+00, -1.6663435944240195e+00, 1.0)) * dx + + vec4( 9.9377142857142897e-01, 7.4545714285714304e-01, 2.4034761904761900e-01, 1.0); + } else if (x < 8.7500000000000000e-01) { + float dx = x - 8.5937500000000000e-01; + return ((vec4( 1.7847934313241271e+02, -6.1117386114828536e+00, -1.0882439559595376e+02, 1.0) * dx + + vec4(-1.5998976061712632e+01, -2.5821843526006538e-01, 9.6526828365688004e+00, 1.0)) * dx + + vec4(-1.8199581227210410e-02, 1.3330696438782346e+00, -1.3890166181272647e+00, 1.0)) * dx + + vec4( 9.9904285714285701e-01, 7.6531428571428595e-01, 2.1641428571428600e-01, 1.0); + } else if (x < 8.9062500000000000e-01) { + float dx = x - 8.7500000000000000e-01; + return ((vec4( 1.0065469642774150e+02, 1.1181852770679304e+01, -4.2302948910418884e+01, 1.0) * dx + + vec4(-7.6327568523807861e+00, -5.4470618267332416e-01, 4.5515392930084682e+00, 1.0)) * dx + + vec4(-3.8744540800992006e-01, 1.3205239467230254e+00, -1.1670756473526198e+00, 1.0)) * dx + + vec4( 9.9553333333333305e-01, 7.8605714285714301e-01, 1.9665238095238100e-01, 1.0); + } else if (x < 9.0625000000000000e-01) { + float dx = x - 8.9062500000000000e-01; + return ((vec4( 5.1792385442186948e+01, 1.3813127528788970e+01, -4.7771351619749993e+01, 1.0) * dx + + vec4(-2.9145679573304033e+00, -2.0556834047731776e-02, 2.5685885628325829e+00, 1.0)) * dx + + vec4(-5.5224735816165738e-01, 1.3116917120867588e+00, -1.0558236496051034e+00, 1.0)) * dx + + vec4( 9.8799999999999999e-01, 8.0659999999999998e-01, 1.7936666666666701e-01, 1.0); + } else if (x < 9.2187500000000000e-01) { + float dx = x - 9.0625000000000000e-01; + return ((vec4( 1.1035785704157649e+02, 5.2154589495154021e+01, -3.9990387467675163e+01, 1.0) * dx + + vec4(-4.8679988972789023e-01, 6.2693351886425119e-01, 3.2930645565680206e-01, 1.0)) * dx + + vec4(-6.0539373077194325e-01, 1.3211663477870170e+00, -1.0105440399412067e+00, 1.0)) * dx + + vec4( 9.7885714285714298e-01, 8.2714285714285696e-01, 1.6331428571428599e-01, 1.0); + } else if (x < 9.3750000000000000e-01) { + float dx = x - 9.2187500000000000e-01; + return ((vec4( 4.6043843534396274e+01, 2.0987943062129727e+01, -2.3203479461840441e+01, 1.0) * dx + + vec4( 4.6862246590960082e+00, 3.0716799014495959e+00, -1.5452429568904713e+00, 1.0)) * dx + + vec4(-5.3977771875056635e-01, 1.3789571824794209e+00, -1.0295430477729828e+00, 1.0)) * dx + + vec4( 9.6970000000000001e-01, 8.4813809523809502e-01, 1.4745238095238100e-01, 1.0); + } else if (x < 9.5312500000000000e-01) { + float dx = x - 9.3750000000000000e-01; + return ((vec4( 6.1233625963980650e+01, 2.8669866827404956e+01, 2.4201791029260814e+01, 1.0) * dx + + vec4( 6.8445298247708335e+00, 4.0554897324869268e+00, -2.6329060566642419e+00, 1.0)) * dx + + vec4(-3.5960967994014698e-01, 1.4903192080096790e+00, -1.0948266261097752e+00, 1.0)) * dx + + vec4( 9.6258571428571404e-01, 8.7051428571428602e-01, 1.3089999999999999e-01, 1.0); + } else if (x < 9.6875000000000000e-01) { + float dx = x - 9.5312500000000000e-01; + return ((vec4( 4.1070719275903762e+01, 5.3910277236601019e+00, 2.0019172487757277e+01, 1.0) * dx + + vec4( 9.7148560418324266e+00, 5.3993897400215340e+00, -1.4984471021676413e+00, 1.0)) * dx + + vec4(-1.0086927577447102e-01, 1.6380516997676238e+00, -1.1593790192165234e+00, 1.0)) * dx + + vec4( 9.5887142857142904e-01, 8.9490000000000003e-01, 1.1324285714285701e-01, 1.0); + } else if (x < 9.8437500000000000e-01) { + float dx = x - 9.6875000000000000e-01; + return ((vec4(-5.3250445924665847e+01, -1.6529749150400146e+01, -1.4422423336140781e+02, 1.0) * dx + + vec4( 1.1640046007890415e+01, 5.6520941645681013e+00, -5.6004839180401900e-01, 1.0)) * dx + + vec4( 2.3280106875244833e-01, 1.8107311357768368e+00, -1.1915430113098306e+00, 1.0)) * dx + + vec4( 9.5982380952380997e-01, 9.2183333333333295e-01, 9.4838095238095305e-02, 1.0); + } else if (x < 1.0000000000000000e+00) { + float dx = x - 9.8437500000000000e-01; + return ((vec4(-1.9507053557699635e+02, -1.0404825969371934e+02, 1.5617193238656020e+02, 1.0) * dx + + vec4( 9.1439313551717039e+00, 4.8772621731430945e+00, -7.3205593306200099e+00, 1.0)) * dx + + vec4( 5.5755071505029385e-01, 1.9752523285535741e+00, -1.3146775069727061e+00, 1.0)) * dx + + vec4( 9.6609999999999996e-01, 9.5144285714285703e-01, 7.5533333333333300e-02, 1.0); + } else { + float dx = x - 1.0000000000000000e+00; + return ((vec4( 0.0000000000000000e+00, 3.4202936336155174e+00, 3.0625241907655076e+00, 1.0) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 9.7629999999999995e-01, 9.8309999999999997e-01, 5.3800000000000001e-02, 1.0); + } +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_pink.frag b/colormap-shaders/shaders/glsl/MATLAB_pink.frag new file mode 100644 index 0000000..607e78c --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_pink.frag @@ -0,0 +1,392 @@ +vec4 colormap(float x) { + if (x < 0.0) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if (1.0 < x) { + return vec4(0.0, 0.0, 0.0, 0.0); + } + if (x < 3.1250000000000000e-02) { + float dx = x - 1.5625000000000000e-02; + return ((vec4(-1.4669881459549135e+03, -4.0682398921086065e+03, -4.0682398921088602e+03, 1.0) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 5.3504982998818882e+00, 7.5768322282919200e+00, 7.5768322282919822e+00, 1.0)) * dx + + vec4( 1.1785113019775800e-01, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0); + } else if (x < 4.6875000000000000e-02) { + float dx = x - 3.1250000000000000e-02; + return ((vec4( 1.2528152076829322e+03, 4.5446100426089361e+03, 4.5446100426102021e+03, 1.0) * dx + + vec4(-6.8765069341636575e+01, -1.9069874494259093e+02, -1.9069874494260281e+02, 1.0)) * dx + + vec4( 4.2760440914188163e+00, 4.5971643385639362e+00, 4.5971643385638128e+00, 1.0)) * dx + + vec4( 1.9585655046433401e-01, 1.0286889997472801e-01, 1.0286889997472801e-01, 1.0); + } else if (x < 6.2500000000000000e-02) { + float dx = x - 4.6875000000000000e-02; + return ((vec4(-8.2547934274917452e+01, -9.1253943618964820e+02, -9.1253943619445545e+02, 1.0) * dx + + vec4(-1.0039356481499135e+01, 2.2329850804702957e+01, 2.2329850804750397e+01, 1.0)) * dx + + vec4( 3.0447249379323211e+00, 1.9664003676594368e+00, 1.9664003676598694e+00, 1.0)) * dx + + vec4( 2.5066050313259902e-01, 1.4547859349066200e-01, 1.4547859349066200e-01, 1.0); + } else if (x < 7.8125000000000000e-02) { + float dx = x - 6.2500000000000000e-02; + return ((vec4( 1.3738814812365237e+02, 3.5917185339157112e+02, 3.5917185340953500e+02, 1.0) * dx + + vec4(-1.3908790900635891e+01, -2.0445435266686804e+01, -2.0445435266864703e+01, 1.0)) * dx + + vec4( 2.6705351350864612e+00, 1.9958443604409393e+00, 1.9958443604393332e+00, 1.0)) * dx + + vec4( 2.9546842014263902e-01, 1.7817416127495000e-01, 1.7817416127495000e-01, 1.0); + } else if (x < 9.3750000000000000e-02) { + float dx = x - 7.8125000000000000e-02; + return ((vec4( 2.7031959945674146e+01, -3.8567216714497711e+01, -3.8567216781546392e+01, 1.0) * dx + + vec4(-7.4687214573396865e+00, -3.6092546389569100e+00, -3.6092546382927484e+00, 1.0)) * dx + + vec4( 2.3365115044930929e+00, 1.6199898306652563e+00, 1.6199898306712481e+00, 1.0)) * dx + + vec4( 3.3432392491786600e-01, 2.0573779994945601e-01, 2.0573779994945601e-01, 1.0); + } else if (x < 1.0937500000000000e-01) { + float dx = x - 9.3750000000000000e-02; + return ((vec4( 3.2452254818731888e+01, 4.4132390168433041e+01, 4.4132390418663725e+01, 1.0) * dx + + vec4(-6.2015983348862109e+00, -5.4170929224489903e+00, -5.4170929249277355e+00, 1.0)) * dx + + vec4( 2.1229127577395634e+00, 1.4789531500182891e+00, 1.4789531499959279e+00, 1.0)) * dx + + vec4( 3.6911161759471400e-01, 2.3002185311411799e-01, 2.3002185311411799e-01, 1.0); + } else if (x < 1.2500000000000000e-01) { + float dx = x - 1.0937500000000000e-01; + return ((vec4( 1.7962452314829033e+01, 9.9760928434314167e+00, 9.9760919095573772e+00, 1.0) * dx + + vec4(-4.6803988902581537e+00, -3.3483871333036914e+00, -3.3483871240528735e+00, 1.0)) * dx + + vec4( 1.9528815510966826e+00, 1.3419925241471533e+00, 1.3419925242306059e+00, 1.0)) * dx + + vec4( 4.0089186286863698e-01, 2.5197631533948500e-01, 2.5197631533948500e-01, 1.0); + } else if (x < 1.4062500000000000e-01) { + float dx = x - 1.2500000000000000e-01; + return ((vec4( 1.4107229469108253e+01, 1.2353314086225026e+01, 1.2353317571490493e+01, 1.0) * dx + + vec4(-3.8384089380005428e+00, -2.8807577812678438e+00, -2.8807578157923714e+00, 1.0)) * dx + + vec4( 1.8197751787801404e+00, 1.2446621348569731e+00, 1.2446621345455240e+00, 1.0)) * dx + + vec4( 4.3033148291193501e-01, 2.7216552697590901e-01, 2.7216552697590901e-01, 1.0); + } else if (x < 1.5625000000000000e-01) { + float dx = x - 1.4062500000000000e-01; + return ((vec4( 1.0219970967189909e+01, 7.5634260052650815e+00, 7.5634129980772871e+00, 1.0) * dx + + vec4(-3.1771325566360935e+00, -2.3016961834760457e+00, -2.3016960546287546e+00, 1.0)) * dx + + vec4( 1.7101573429264429e+00, 1.1636862916578499e+00, 1.1636862928201939e+00, 1.0)) * dx + + vec4( 4.5788217333292702e-01, 2.9095718698132300e-01, 2.9095718698132300e-01, 1.0); + } else if (x < 1.7187500000000000e-01) { + float dx = x - 1.5625000000000000e-01; + return ((vec4( 7.9639431579939997e+00, 6.1408899801328447e+00, 6.1409385236185399e+00, 1.0) * dx + + vec4(-2.6980714175490665e+00, -1.9471605894792450e+00, -1.9471610703438818e+00, 1.0)) * dx + + vec4( 1.6183572808297999e+00, 1.0972979045804234e+00, 1.0972979002424965e+00, 1.0)) * dx + + vec4( 4.8386670078337102e-01, 3.0860669992418399e-01, 3.0860669992418399e-01, 1.0); + } else if (x < 1.8750000000000000e-01) { + float dx = x - 1.7187500000000000e-01; + return ((vec4( 6.2644603100084071e+00, 4.6737470532015237e+00, 4.6735658864465535e+00, 1.0) * dx + + vec4(-2.3247615820180978e+00, -1.6593063716605179e+00, -1.6593045770492627e+00, 1.0)) * dx + + vec4( 1.5398755152115629e+00, 1.0409468583126147e+00, 1.0409468745019785e+00, 1.0)) * dx + + vec4( 5.0852520448634997e-01, 3.2530002431617799e-01, 3.2530002431617799e-01, 1.0); + } else if (x < 2.0312500000000000e-01) { + float dx = x - 1.8750000000000000e-01; + return ((vec4( 5.0557657194808643e+00, 3.7546306563046934e+00, 3.7553067798388895e+00, 1.0) * dx + + vec4(-2.0311150049864537e+00, -1.4402244785416964e+00, -1.4402311761220805e+00, 1.0)) * dx + + vec4( 1.4718149435396168e+00, 9.9251668877820509e-01, 9.9251662835867638e-01, 1.0)) * dx + + vec4( 5.3204208768553596e-01, 3.4117754381277299e-01, 3.4117754381277299e-01, 1.0); + } else if (x < 2.1875000000000000e-01) { + float dx = x - 2.0312500000000000e-01; + return ((vec4( 4.1410369504978677e+00, 3.0442611292784201e+00, 3.0417378018965926e+00, 1.0) * dx + + vec4(-1.7941259868857882e+00, -1.2642261665274139e+00, -1.2642011708171326e+00, 1.0)) * dx + + vec4( 1.4120455530416129e+00, 9.5025964744900027e-01, 9.5025987293775116e-01, 1.0)) * dx + + vec4( 5.5456260470724394e-01, 3.5634832254989901e-01, 3.5634832254989901e-01, 1.0); + } else if (x < 2.3437500000000000e-01) { + float dx = x - 2.1875000000000000e-01; + return ((vec4( 3.4529542936776019e+00, 2.5030166001054397e+00, 2.5124337860985739e+00, 1.0) * dx + + vec4(-1.6000148798312006e+00, -1.1215264260924880e+00, -1.1216197113532298e+00, 1.0)) * dx + + vec4( 1.3590121019991601e+00, 9.1298226318931430e-01, 9.1298142165383922e-01, 1.0)) * dx + + vec4( 5.7620359423608403e-01, 3.7089909350945799e-01, 3.7089909350945799e-01, 1.0); + } else if (x < 2.5000000000000000e-01) { + float dx = x - 2.3437500000000000e-01; + return ((vec4( 2.8804720304898979e+00, 2.1365016738443594e+00, 2.1013562572536415e+00, 1.0) * dx + + vec4(-1.4381576473150630e+00, -1.0041975229625455e+00, -1.0038493776298592e+00, 1.0)) * dx + + vec4( 1.3115406562624998e+00, 8.7976782648532936e-01, 8.7977096713847847e-01, 1.0)) * dx + + vec4( 5.9706070167235203e-01, 3.8490017945975102e-01, 3.8490017945975102e-01, 1.0); + } else if (x < 2.6562500000000000e-01) { + float dx = x - 2.5000000000000000e-01; + return ((vec4( 2.5594362349562849e+00, 1.6480351971046261e+00, 1.7791996774743761e+00, 1.0) * dx + + vec4(-1.3031355208858491e+00, -9.0404900700109114e-01, -9.0534830307109471e-01, 1.0)) * dx + + vec4( 1.2687079505093606e+00, 8.4995147445464758e-01, 8.4993975337752603e-01, 1.0)) * dx + + vec4( 6.1721339984836798e-01, 3.9840953644479798e-01, 3.9840953644479798e-01, 1.0); + } else if (x < 2.8125000000000000e-01) { + float dx = x - 2.6562500000000000e-01; + return ((vec4( 1.8051368703401163e+00, 2.0114928499339442e+00, 1.5219803450456506e+00, 1.0) * dx + + vec4(-1.1831619473722732e+00, -8.2679735713681179e-01, -8.2194831818948333e-01, 1.0)) * dx + + vec4( 1.2298595525678273e+00, 8.2290700001499284e-01, 8.2295074367032950e-01, 1.0)) * dx + + vec4( 6.3672857672895500e-01, 4.1147559989891203e-01, 4.1147559989891203e-01, 1.0); + } else if (x < 2.9687500000000000e-01) { + float dx = x - 2.8125000000000000e-01; + return ((vec4( 3.0463396572174992e+00, -5.1289449769253304e-01, 1.3139910414908893e+00, 1.0) * dx + + vec4(-1.0985461565750803e+00, -7.3250862979615816e-01, -7.5060548951546846e-01, 1.0)) * dx + + vec4( 1.1942078634436499e+00, 7.9854284396916519e-01, 7.9837959042493967e-01, 1.0)) * dx + + vec4( 6.5566316039120298e-01, 4.2413934018690103e-01, 4.2413934018690103e-01, 1.0); + } else if (x < 3.1250000000000000e-01) { + float dx = x - 2.9687500000000000e-01; + return ((vec4(-2.8704741000704268e+00, 7.9617278728423395e+00, 1.1436982209969482e+00, 1.0) * dx + + vec4(-9.5574898514300999e-01, -7.5655055937549565e-01, -6.8901215944558303e-01, 1.0)) * dx + + vec4( 1.1621095018543048e+00, 7.7527629413835808e-01, 7.7588556465992320e-01, 1.0)) * dx + + vec4( 6.7406607937581298e-01, 4.3643578047198500e-01, 4.3643578047198500e-01, 1.0); + } else if (x < 3.2812500000000000e-01) { + float dx = x - 3.1250000000000000e-01; + return ((vec4( 1.8151104486259406e+01, -2.4442464044541747e+01, 1.0027690236563866e+00, 1.0) * dx + + vec4(-1.0903024585838113e+00, -3.8334456533601097e-01, -6.3540130533635109e-01, 1.0)) * dx + + vec4( 1.1301399480460732e+00, 7.5746543281474077e-01, 7.5519160427270549e-01, 1.0)) * dx + + vec4( 6.9197975319800997e-01, 4.4839513942303300e-01, 4.4839513942303300e-01, 1.0); + } else if (x < 3.4375000000000000e-01) { + float dx = x - 3.2812500000000000e-01; + return ((vec4(-6.1186402817835244e+01, 9.5847900752188593e+01, 8.8499813124143623e-01, 1.0) * dx + + vec4(-2.3946943579040159e-01, -1.5290850674239054e+00, -5.8839650735245796e-01, 1.0)) * dx + + vec4( 1.1093622621964760e+00, 7.2758371980286707e-01, 7.3606976344944286e-01, 1.0)) * dx + + vec4( 7.0944124373120399e-01, 4.6004370622823598e-01, 4.6004370622823598e-01, 1.0); + } else if (x < 3.5937500000000000e-01) { + float dx = x - 3.4375000000000000e-01; + return ((vec4( 2.3416165617778907e+02, -3.5362066219986355e+02, 7.8571521572691694e-01, 1.0) * dx + + vec4(-3.1075820678764288e+00, 2.9637852803349345e+00, -5.4691221995051564e-01, 1.0)) * dx + + vec4( 1.0570645824516820e+00, 7.5000091062960195e-01, 7.1833056458533395e-01, 1.0)) * dx + + vec4( 7.2648315725677903e-01, 4.7140452079103201e-01, 4.7140452079103201e-01, 1.0); + } else if (x < 3.7500000000000000e-01) { + float dx = x - 3.5937500000000000e-01; + return ((vec4(-8.6872290443392524e+02, 1.3233639570551793e+03, 7.0135001376448258e-01, 1.0) * dx + + vec4( 7.8687455654574343e+00, -1.3612183260283668e+01, -5.1008181921331641e-01, 1.0)) * dx + + vec4( 1.1314577621013850e+00, 5.8361969219290288e-01, 7.0181503272339907e-01, 1.0)) * dx + + vec4( 7.4313436015883205e-01, 4.8249790963716399e-01, 4.8249790963716399e-01, 1.0); + } else if (x < 3.9062500000000000e-01) { + float dx = x - 3.7500000000000000e-01; + return ((vec4( 8.8518476063177650e+02, -1.3713638359409479e+03, 6.2914033536808966e-01, 1.0) * dx + + vec4(-3.2852640579882809e+01, 4.8420502226677854e+01, -4.7720603731810629e-01, 1.0)) * dx + + vec4( 7.4108440250098861e-01, 1.1274996760428120e+00, 6.8638865996509557e-01, 1.0)) * dx + + vec4( 7.5942055326385305e-01, 4.9334191326730298e-01, 4.9334191326730298e-01, 1.0); + } else if (x < 4.0625000000000000e-01) { + float dx = x - 3.9062500000000000e-01; + return ((vec4(-2.3709260415260931e+02, 3.7516300791309146e+02, 5.6692410339443688e-01, 1.0) * dx + + vec4( 8.6403950747317122e+00, -1.5862177583054082e+01, -4.4771508409772709e-01, 1.0)) * dx + + vec4( 3.6276806648300275e-01, 1.6362234985994335e+00, 6.7193676744297315e-01, 1.0)) * dx + + vec4( 7.6635604473481300e-01, 5.1754916950676599e-01, 5.0395263067897000e-01, 1.0); + } else if (x < 4.2187500000000000e-01) { + float dx = x - 4.0625000000000000e-01; + return ((vec4( 6.3616714987678073e+01, -9.4300538300030098e+01, 5.1299127761488117e-01, 1.0) * dx + + vec4(-2.4733207449218502e+00, 1.7235884128720800e+00, -4.2114051675111286e-01, 1.0)) * dx + + vec4( 4.5912860288628182e-01, 1.4153080428153397e+00, 6.5836089867971004e-01, 1.0)) * dx + + vec4( 7.7322933071864097e-01, 5.4067369302384405e-01, 5.1434449987363995e-01, 1.0); + } else if (x < 4.3750000000000000e-01) { + float dx = x - 4.2187500000000000e-01; + return ((vec4(-1.6961859855932584e+01, 3.0379726001371605e+01, 4.6597626654549629e-01, 1.0) * dx + + vec4( 5.0871277012555960e-01, -2.6967493199418304e+00, -3.9709405061291531e-01, 1.0)) * dx + + vec4( 4.2843160328008978e-01, 1.4001024036423748e+00, 6.4557598356464707e-01, 1.0)) * dx + + vec4( 7.8004205557495998e-01, 5.6284895113959499e-01, 5.2453052831296199e-01, 1.0); + } else if (x < 4.5312500000000000e-01) { + float dx = x - 4.3750000000000000e-01; + return ((vec4( 4.6255693417292765e+00, -3.8807368791610912e+00, 4.2477880151371511e-01, 1.0) * dx + + vec4(-2.8637441062128022e-01, -1.2726996636275365e+00, -3.7525141311859517e-01, 1.0)) * dx + + vec4( 4.3190564014734417e-01, 1.3380797632741035e+00, 6.3350808569384220e-01, 1.0)) * dx + + vec4( 7.8679579246944298e-01, 5.8418305458977604e-01, 5.3452248382484902e-01, 1.0); + } else if (x < 4.6875000000000000e-01) { + float dx = x - 4.5312500000000000e-01; + return ((vec4(-1.1620953817302908e+00, 4.6334128006838897e+00, 3.8850531365210134e-01, 1.0) * dx + + vec4(-6.9550847727720383e-02, -1.4546092048382127e+00, -3.5533990679763977e-01, 1.0)) * dx + + vec4( 4.2634430798564099e-01, 1.2954655622043261e+00, 6.2209259632015113e-01, 1.0)) * dx + + vec4( 7.9349204761587200e-01, 6.0476502936325705e-01, 5.4433105395181702e-01, 1.0); + } else if (x < 4.8437500000000000e-01) { + float dx = x - 4.6875000000000000e-01; + return ((vec4( 3.8556361698416303e-01, 1.8233043610892945e+00, 3.5642377965443828e-01, 1.0) * dx + + vec4(-1.2402406874632776e-01, -1.2374179798061553e+00, -3.3712872022019752e-01, 1.0)) * dx + + vec4( 4.2331969991573404e-01, 1.2534026374442579e+00, 6.1127277402299740e-01, 1.0)) * dx + + vec4( 8.0013226419863903e-01, 6.2466922463944097e-01, 5.5396597989254404e-01, 1.0); + } else if (x < 5.0000000000000000e-01) { + float dx = x - 4.8437500000000000e-01; + return ((vec4(-3.2095667390052242e-02, 2.1503801318034825e+00, 3.2793327560925789e-01, 1.0) * dx + + vec4(-1.0595077420019512e-01, -1.1519505878800946e+00, -3.2042135554889573e-01, 1.0)) * dx + + vec4( 4.1972634299469458e-01, 1.2160687535741603e+00, 6.0099855408910530e-01, 1.0)) * dx + + vec4( 8.0671782600463904e-01, 6.4395849220469203e-01, 5.6343616981901101e-01, 1.0); + } else if (x < 5.1562500000000000e-01) { + float dx = x - 5.0000000000000000e-01; + return ((vec4( 7.7013830342289147e-02, 1.7153408159410617e+00, 3.0252602235293108e-01, 1.0) * dx + + vec4(-1.0745525860910382e-01, -1.0511515192018064e+00, -3.0504948325471176e-01, 1.0)) * dx + + vec4( 4.1639187373204928e-01, 1.1816452831510056e+00, 5.9122557223279892e-01, 1.0)) * dx + + vec4( 8.1325006079044404e-01, 6.6268653159200297e-01, 5.7274979532281600e-01, 1.0); + } else if (x < 5.3125000000000000e-01) { + float dx = x - 5.1562500000000000e-01; + return ((vec4( 4.5128006172428847e-02, 1.5453203541034857e+00, 2.7981246555779532e-01, 1.0) * dx + + vec4(-1.0384523531180902e-01, -9.7074491845456912e-01, -2.9086857595691812e-01, 1.0)) * dx + + vec4( 4.1309030351453502e-01, 1.1500531513126246e+00, 5.8191435255761725e-01, 1.0)) * dx + + vec4( 8.1973024340795897e-01, 6.8089965385828999e-01, 5.8191437396264600e-01, 1.0); + } else if (x < 5.4687500000000000e-01) { + float dx = x - 5.3125000000000000e-01; + return ((vec4( 5.1163279076130053e-02, 1.3521114454007919e+00, 2.5933722356445560e-01, 1.0) * dx + + vec4(-1.0172986002247641e-01, -8.9830802685596822e-01, -2.7775236663389646e-01, 1.0)) * dx + + vec4( 4.0987819264993680e-01, 1.1208491990421476e+00, 5.7302965032963571e-01, 1.0)) * dx + + vec4( 8.2615959870940303e-01, 6.9863813100577199e-01, 5.9093684028527904e-01, 1.0); + } else if (x < 5.6250000000000000e-01) { + float dx = x - 5.4687500000000000e-01; + return ((vec4( 4.7169570095915013e-02, 1.2029732434271569e+00, 2.4119519806979875e-01, 1.0) * dx + + vec4(-9.9331581315782819e-02, -8.3492780285280610e-01, -2.6559593427931261e-01, 1.0)) * dx + + vec4( 4.0673660762902653e-01, 1.0937673892029480e+00, 5.6453983312786682e-01, 1.0)) * dx + + vec4( 8.3253930425037204e-01, 7.1593724415352000e-01, 5.9982360722829198e-01, 1.0); + } else if (x < 5.7812500000000000e-01) { + float dx = x - 5.6250000000000000e-01; + return ((vec4( 4.5986272021792729e-02, 1.0731479391457011e+00, 2.2367640273462128e-01, 1.0) * dx + + vec4(-9.7120507717536803e-02, -7.7853843206715811e-01, -2.5428990936979079e-01, 1.0)) * dx + + vec4( 4.0366704373788093e-01, 1.0685569792823235e+00, 5.5641661682084964e-01, 1.0)) * dx + + vec4( 8.3887049280786097e-01, 7.3282810879294003e-01, 6.0858061945018505e-01, 1.0); + } else if (x < 5.9375000000000000e-01) { + float dx = x - 5.7812500000000000e-01; + return ((vec4( 4.4164995395678787e-02, 9.6091304374043085e-01, 2.1201124590809547e-01, 1.0) * dx + + vec4(-9.4964901216515268e-02, -7.2823462241970338e-01, -2.4380507799160542e-01, 1.0)) * dx + + vec4( 4.0066570922328631e-01, 1.0450136503059664e+00, 5.4863388264332780e-01, 1.0)) * dx + + vec4( 8.4515425472851702e-01, 7.4933833246934400e-01, 6.1721339984836798e-01, 1.0); + } else if (x < 6.0937500000000000e-01) { + float dx = x - 5.9375000000000000e-01; + return ((vec4( 4.2622287162048224e-02, 8.7204745369720627e-01, 1.8569722378857575e-01, 1.0) * dx + + vec4(-9.2894667057342825e-02, -6.8319182349437069e-01, -2.3386705083966344e-01, 1.0)) * dx + + vec4( 3.9773040346900729e-01, 1.0229601120885590e+00, 5.4117025563033927e-01, 1.0)) * dx + + vec4( 8.5139164012088198e-01, 7.6549254469187100e-01, 6.2572709029927098e-01, 1.0); + } else if (x < 6.2500000000000000e-01) { + float dx = x - 6.0937500000000000e-01; + return ((vec4( 4.1105693265725961e-02, 7.6494427361798978e-01, 2.2040881261248599e-01, 1.0) * dx + + vec4(-9.0896747346621815e-02, -6.4231459910231414e-01, -2.2516249347457395e-01, 1.0)) * dx + + vec4( 3.9485866261894537e-01, 1.0022490742354857e+00, 5.3399791900042926e-01, 1.0)) * dx + + vec4( 8.5758366090413296e-01, 7.8131282816150904e-01, 6.3412648747422795e-01, 1.0); + } else if (x < 6.4062500000000000e-01) { + float dx = x - 6.2500000000000000e-01; + return ((vec4( 3.9676521680195975e-02, 7.8428805986266303e-01, 3.3000425741025317e-02, 1.0) * dx + + vec4(-8.8969917974790910e-02, -6.0645783627647087e-01, -2.1483083038336367e-01, 1.0)) * dx + + vec4( 3.9204824597329829e-01, 9.8273700493269212e-01, 5.2712302331514893e-01, 1.0)) * dx + + vec4( 8.6373129272462201e-01, 7.9681907288959597e-01, 6.4241607443962101e-01, 1.0); + } else if (x < 6.5625000000000000e-01) { + float dx = x - 6.4062500000000000e-01; + return ((vec4( 3.8312487764607418e-02, 3.8021584708698697e-01, 6.7955965978490873e-01, 1.0) * dx + + vec4(-8.7110081021031724e-02, -5.6969433347040854e-01, -2.1328393542675311e-01, 1.0)) * dx + + vec4( 3.8929699598898854e-01, 9.6435962728039715e-01, 5.2043373009936589e-01, 1.0)) * dx + + vec4( 8.6983547675049300e-01, 8.1202926941800202e-01, 6.5060004863235499e-01, 1.0); + } else if (x < 6.7187500000000000e-01) { + float dx = x - 6.5625000000000000e-01; + return ((vec4( 3.7014142710244315e-02, 1.5972496107531242e+00, -1.7818291365727916e+00, 1.0) * dx + + vec4(-8.5314183157065751e-02, -5.5187171563820603e-01, -1.8142957637433552e-01, 1.0)) * dx + + vec4( 3.8660286686120576e-01, 9.4683515776307503e-01, 5.1426633147747391e-01, 1.0)) * dx + + vec4( 8.7589712135373898e-01, 8.2695975347197803e-01, 6.5868234670623604e-01, 1.0); + } else if (x < 6.8750000000000000e-01) { + float dx = x - 6.7187500000000000e-01; + return ((vec4( 3.5776320711640310e-02, -3.2011488281931193e+00, 7.3597907806637606e+00, 1.0) * dx + + vec4(-8.3579145217523049e-02, -4.7700064013415333e-01, -2.6495281715118513e-01, 1.0)) * dx + + vec4( 3.8396390860535284e-01, 9.3075902720413195e-01, 5.0729160657863759e-01, 1.0)) * dx + + vec4( 8.8191710368819698e-01, 8.4162541153017301e-01, 6.6666666666666696e-01, 1.0); + } else if (x < 7.0312500000000000e-01) { + float dx = x - 6.8750000000000000e-01; + return ((vec4( 3.4595751258128971e-02, 1.4479853717875505e+01, -2.6798031522024559e+01, 1.0) * dx + + vec4(-8.1902130184164909e-02, -6.2705449145570580e-01, 8.0037375692428664e-02, 1.0)) * dx + + vec4( 3.8137826367720146e-01, 9.1350816577304039e-01, 5.0440230280584453e-01, 1.0)) * dx + + vec4( 8.8789627117123804e-01, 8.5603985468214805e-01, 6.7455648764684994e-01, 1.0); + } else if (x < 7.1875000000000000e-01) { + float dx = x - 7.0312500000000000e-01; + return ((vec4( 3.3468991753281919e-02, -5.1708135322659281e+01, 1.0064307843765410e+02, 1.0) * dx + + vec4(-8.0280454343940114e-02, 5.1688651569708526e-02, -1.1761203519024725e+00, 1.0)) * dx + + vec4( 3.7884416079394984e-01, 9.0451807452482169e-01, 4.8727600630256263e-01, 1.0)) * dx + + vec4( 8.9383544287626004e-01, 8.7021556655528298e-01, 6.8235508762554498e-01, 1.0); + } else if (x < 7.3437500000000000e-01) { + float dx = x - 7.1875000000000000e-01; + return ((vec4( 3.2392951100837251e-02, 1.9512898026633002e+02, -3.7500834138704249e+02, 1.0) * dx + + vec4(-7.8711595355505024e-02, -2.3721301916799455e+00, 3.5415239498625635e+00, 1.0)) * dx + + vec4( 3.7635991001739599e-01, 8.6826117546059922e-01, 5.2423543752068902e-01, 1.0)) * dx + + vec4( 8.9973541084243802e-01, 8.8416402988700704e-01, 6.9006555934235403e-01, 1.0); + } else if (x < 7.5000000000000000e-01) { + float dx = x - 7.3437500000000000e-01; + return ((vec4( 3.1364727379629663e-02, -7.2624066315039011e+02, 1.4001148170350855e+03, 1.0) * dx + + vec4(-7.7193175772653277e-02, 6.7745407583042745e+00, -1.4036992052655055e+01, 1.0)) * dx + + vec4( 3.7392389796851849e-01, 9.3704884056410442e-01, 3.6024374841455642e-01, 1.0)) * dx + + vec4( 9.0559694130767698e-01, 8.9789583539346696e-01, 6.9769082462971099e-01, 1.0); + } else if (x < 7.6562500000000000e-01) { + float dx = x - 7.5000000000000000e-01; + return ((vec4( 3.0381616356811136e-02, 7.3556986866868601e+02, -1.4318093578633127e+03, 1.0) * dx + + vec4(-7.5722954176733137e-02, -2.7267990326870265e+01, 5.1593389995864584e+01, 1.0)) * dx + + vec4( 3.7153458343805934e-01, 6.1683869105526079e-01, 9.4706246627720525e-01, 1.0)) * dx + + vec4( 9.1142077587019599e-01, 9.1142077587019599e-01, 7.0523364734993799e-01, 1.0); + } else if (x < 7.8125000000000000e-01) { + float dx = x - 7.6562500000000000e-01; + return ((vec4( 2.9441135219075026e-02, -1.9705777042165474e+02, 3.8669242628155297e+02, 1.0) * dx + + vec4(-7.4298815910007615e-02, 7.2118472669743907e+00, -1.5522673653978197e+01, 1.0)) * dx + + vec4( 3.6919049328045406e-01, 3.0346145574438771e-01, 1.5106674091191798e+00, 1.0)) * dx + + vec4( 9.1720763258372495e-01, 9.1720763258372495e-01, 7.2716562162264098e-01, 1.0); + } else if (x < 7.9687500000000000e-01) { + float dx = x - 7.8125000000000000e-01; + return ((vec4( 2.8540822829984158e-02, 5.2837899997996146e+01, -1.0097631834123302e+02, 1.0) * dx + + vec4(-7.2918762696613473e-02, -2.0252357215406760e+00, 2.6035338279695983e+00, 1.0)) * dx + + vec4( 3.6689021861472559e-01, 3.8450226114178948e-01, 1.3088058493377956e+00, 1.0)) * dx + + vec4( 9.2295820699089703e-01, 9.2295820699089703e-01, 7.4845519918374903e-01, 1.0); + } else if (x < 8.1250000000000000e-01) { + float dx = x - 7.9687500000000000e-01; + return ((vec4( 2.7678922768475427e-02, -1.4122546221022333e+01, 2.9362371786331625e+01, 1.0) * dx + + vec4(-7.1580911626457966e-02, 4.5154084086539337e-01, -2.1297310942756997e+00, 1.0)) * dx + + vec4( 3.6463241120342760e-01, 3.5991327863123823e-01, 1.3162090170517629e+00, 1.0)) * dx + + vec4( 9.2867317309905195e-01, 9.2867317309905195e-01, 7.6915572487015205e-01, 1.0); + } else if (x < 8.2812500000000000e-01) { + float dx = x - 8.1250000000000000e-01; + return ((vec4( 2.6851775131151001e-02, 3.8183931751282176e+00, -5.8379224589604535e+00, 1.0) * dx + + vec4(-7.0283462121685680e-02, -2.1045351324502842e-01, -7.5336991679140475e-01, 1.0)) * dx + + vec4( 3.6241578036361283e-01, 3.6368026812530641e-01, 1.2711605637538392e+00, 1.0)) * dx + + vec4( 9.3435318430231395e-01, 9.3435318430231395e-01, 7.8931354544051302e-01, 1.0); + } else if (x < 8.4375000000000000e-01) { + float dx = x - 8.2812500000000000e-01; + return ((vec4( 2.6063496580937279e-02, -9.8987695961652500e-01, 3.3620382019700017e+00, 1.0) * dx + + vec4(-6.9024785162412977e-02, -3.1466333160893228e-02, -1.0270225320551760e+00, 1.0)) * dx + + vec4( 3.6023908899979878e-01, 3.5990027052521389e-01, 1.2433419317406114e+00, 1.0)) * dx + + vec4( 9.3999887425351902e-01, 9.3999887425351902e-01, 8.0896923113998398e-01, 1.0); + } else if (x < 8.5937500000000000e-01) { + float dx = x - 8.4375000000000000e-01; + return ((vec4( 2.5289790701126986e-02, 2.9751021549391093e-01, 7.0033007973428829e-01, 1.0) * dx + + vec4(-6.7803058760181542e-02, -7.7866815642917836e-02, -8.6942699133783219e-01, 1.0)) * dx + + vec4( 3.5810115393850828e-01, 3.5819194007515431e-01, 1.2137099079375957e+00, 1.0)) * dx + + vec4( 9.4561085768929998e-01, 9.4561085768929998e-01, 8.2815853605850198e-01, 1.0); + } else if (x < 8.7500000000000000e-01) { + float dx = x - 8.5937500000000000e-01; + return ((vec4( 2.4612980139061474e-02, -4.8328262834613035e-02, 1.2462888208522547e+00, 1.0) * dx + + vec4(-6.6617599821066215e-02, -6.3921024291640760e-02, -8.3659901885028742e-01, 1.0)) * dx + + vec4( 3.5600083114817627e-01, 3.5597650507617684e-01, 1.1870532515284062e+00, 1.0)) * dx + + vec4( 9.5118973121134198e-01, 9.5118973121134198e-01, 8.4691316246821002e-01, 1.0); + } else if (x < 8.9062500000000000e-01) { + float dx = x - 8.7500000000000000e-01; + return ((vec4( 2.3718003357877809e-02, 4.3262550459793069e-02, 9.5432454482368223e-01, 1.0) * dx + + vec4(-6.5463866377047708e-02, -6.6186411612013246e-02, -7.7817923037283798e-01, 1.0)) * dx + + vec4( 3.5393705823883076e-01, 3.5394357639018226e-01, 1.1618223413842950e+00, 1.0)) * dx + + vec4( 9.5673607402664396e-01, 9.5673607402664396e-01, 8.6526137593056196e-01, 1.0); + } else if (x < 9.0625000000000000e-01) { + float dx = x - 8.9062500000000000e-01; + return ((vec4( 2.3773347988404581e-02, 1.8536402554417759e-02, 9.1391585031942668e-01, 1.0) * dx + + vec4(-6.4352084969647186e-02, -6.4158479559210446e-02, -7.3344526733422788e-01, 1.0)) * dx + + vec4( 3.5190868399903863e-01, 3.5190693746563190e-01, 1.1382032086076221e+00, 1.0)) * dx + + vec4( 9.6225044864937603e-01, 9.6225044864937603e-01, 8.8322850531025798e-01, 1.0); + } else if (x < 9.2187500000000000e-01) { + float dx = x - 9.0625000000000000e-01; + return ((vec4( 2.0411271658957286e-02, 2.1814506292989311e-02, 7.9416477361003268e-01, 1.0) * dx + + vec4(-6.3237709282690721e-02, -6.3289585689472114e-02, -6.9060546185050475e-01, 1.0)) * dx + + vec4( 3.4991509346384586e-01, 3.4991556144612124e-01, 1.1159524159641105e+00, 1.0)) * dx + + vec4( 9.6773340156674204e-01, 9.6773340156674204e-01, 9.0083735297107703e-01, 1.0); + } else if (x < 9.3750000000000000e-01) { + float dx = x - 9.2187500000000000e-01; + return ((vec4( 2.9925950574317017e-02, 2.9549957472174999e-02, 8.1438789217981622e-01, 1.0) * dx + + vec4(-6.2280930923677098e-02, -6.2267030706988240e-02, -6.5337898808753447e-01, 1.0)) * dx + + vec4( 3.4795386471062134e-01, 3.4795373931492651e-01, 1.0949526589338288e+00, 1.0)) * dx + + vec4( 9.7318546387106897e-01, 9.7318546387106897e-01, 9.1810853411962201e-01, 1.0); + } else if (x < 9.5312500000000000e-01) { + float dx = x - 9.3750000000000000e-01; + return ((vec4(-8.4993852229346221e-03, -8.3986474483984299e-03, 4.1632155771993951e-01, 1.0) * dx + + vec4(-6.0878151990505988e-02, -6.0881876450480037e-02, -6.1520455564160559e-01, 1.0)) * dx + + vec4( 3.4602950404008725e-01, 3.4602953764059108e-01, 1.0751310410630610e+00, 1.0)) * dx + + vec4( 9.7860715186021296e-01, 9.7860715186021296e-01, 9.3506075970421498e-01, 1.0); + } else if (x < 9.6875000000000000e-01) { + float dx = x - 9.5312500000000000e-01; + return ((vec4( 1.3210083171865797e-01, 1.3207387372265536e-01, 1.6040605599926014e+00, 1.0) * dx + + vec4(-6.1276560672831049e-02, -6.1275563049623713e-02, -5.9568948262348342e-01, 1.0)) * dx + + vec4( 3.4412083665472259e-01, 3.4412082764840196e-01, 1.0562108217151689e+00, 1.0)) * dx + + vec4( 9.8399896760818195e-01, 9.8399896760818195e-01, 9.5171107393681598e-01, 1.0); + } else if (x < 9.8437500000000000e-01) { + float dx = x - 9.6875000000000000e-01; + return ((vec4(-3.9532580170327219e-01, -3.9531870749379783e-01, -3.0883889522318717e+00, 1.0) * dx + + vec4(-5.5084334186018956e-02, -5.5084600218874243e-02, -5.2049914387383023e-01, 1.0)) * dx + + vec4( 3.4230269767255306e-01, 3.4230270009733171e-01, 1.0387703744261485e+00, 1.0)) * dx + + vec4( 9.8936139950777302e-01, 9.8936139950777302e-01, 9.6807505502895397e-01, 1.0); + } else if (x < 1.0000000000000000e+00) { + float dx = x - 9.8437500000000000e-01; + return ((vec4( 1.5704582643383433e+00, 1.5704568454964483e+00, 1.4192370688206916e+01, 1.0) * dx + + vec4(-7.3615231140859841e-02, -7.3615164632646016e-02, -6.6526737600969921e-01, 1.0)) * dx + + vec4( 3.4029176696432056e-01, 3.4029176627152669e-01, 1.0202427725529684e+00, 1.0)) * dx + + vec4( 9.9469492278687599e-01, 9.9469492278687599e-01, 9.8416698587417395e-01, 1.0); + } else { + float dx = x - 1.0000000000000000e+00; + return ((vec4(-2.0078712962998271e+01, 4.4659701609405914e+01, 4.4659701609500793e+01, 1.0) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + vec4( 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0); + } +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_spring.frag b/colormap-shaders/shaders/glsl/MATLAB_spring.frag new file mode 100644 index 0000000..8c054f3 --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_spring.frag @@ -0,0 +1,3 @@ +vec4 colormap(float x) { + return vec4(1.0, clamp(x, 0.0, 1.0), clamp(1.0 - x, 0.0, 1.0), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_summer.frag b/colormap-shaders/shaders/glsl/MATLAB_summer.frag new file mode 100644 index 0000000..bebbedc --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_summer.frag @@ -0,0 +1,3 @@ +vec4 colormap(float x) { + return vec4(clamp(x, 0.0, 1.0), clamp(0.5 * x + 0.5, 0.0, 1.0), 0.4, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/MATLAB_winter.frag b/colormap-shaders/shaders/glsl/MATLAB_winter.frag new file mode 100644 index 0000000..e439c49 --- /dev/null +++ b/colormap-shaders/shaders/glsl/MATLAB_winter.frag @@ -0,0 +1,3 @@ +vec4 colormap(float x) { + return vec4(0.0, clamp(x, 0.0, 1.0), clamp(-0.5 * x + 1.0, 0.0, 1.0), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/gnuplot.frag b/colormap-shaders/shaders/glsl/gnuplot.frag new file mode 100644 index 0000000..62c4740 --- /dev/null +++ b/colormap-shaders/shaders/glsl/gnuplot.frag @@ -0,0 +1,114 @@ +float colormap_f1(int formula, float x) { + float DEG2RAD = 3.1415926535897932384 / 180.0; + if (formula < 0) { + x = 1.0 - x; + formula = -formula; + } + float d = 0.0; + if (formula == 0) { + return 0.0; + } else if (formula == 1) { + return 0.5; + } else if (formula == 2) { + return 1.0; + } else if (formula == 3) { + d = x; + } else if (formula == 4) { + d = x * x; + } else if (formula == 5) { + d = x * x * x; + } else if (formula == 6) { + d = x * x * x * x; + } else if (formula == 7) { + d = sqrt(x); + } else if (formula == 8) { + d = sqrt(sqrt(x)); + } else if (formula == 9) { + d = sin(90.0 * x * DEG2RAD); + } else if (formula == 10) { + d = cos(90.0 * x * DEG2RAD); + } else if (formula == 11) { + d = abs(x - 0.5); + } else if (formula == 12) { + d = (2.0 * x - 1.0) * (2.0 * x - 1.0); + } else if (formula == 13) { + d = sin(180.0 * x * DEG2RAD); + } else if (formula == 14) { + d = abs(cos(180.0 * x * DEG2RAD)); + } else if (formula == 15) { + d = sin(360.0 * x * DEG2RAD); + } else if (formula == 16) { + d = cos(360.0 * x * DEG2RAD); + } else if (formula == 17) { + d = abs(sin(360.0 * x * DEG2RAD)); + } else if (formula == 18) { + d = abs(cos(360.0e0 * x * DEG2RAD)); + } else if (formula == 19) { + d = abs(sin(720.0e0 * x * DEG2RAD)); + } else if (formula == 20) { + d = abs(cos(720.0e0 * x * DEG2RAD)); + } else if (formula == 21) { + d = 3.0e0 * x; + } else if (formula == 22) { + d = 3.0e0 * x - 1.0e0; + } else if (formula == 23) { + d = 3.0e0 * x - 2.0e0; + } else if (formula == 24) { + d = abs(3.0e0 * x - 1.0e0); + } else if (formula == 25) { + d = abs(3.0e0 * x - 2.0e0); + } else if (formula == 26) { + d = 1.5e0 * x - 0.5e0; + } else if (formula == 27) { + d = 1.5e0 * x - 1.0e0; + } else if (formula == 28) { + d = abs(1.5e0 * x - 0.5e0); + } else if (formula == 29) { + d = abs(1.5e0 * x - 1.0e0); + } else if (formula == 30) { + if (x <= 0.25e0) { + return 0.0; + } else if (x >= 0.57) { + return 1.0; + } else { + d = x / 0.32 - 0.78125; + } + } else if (formula == 31) { + if (x <= 0.42) { + return 0.0; + } else if (x >= 0.92) { + return d = 1.0; + } else { + d = 2.0 * x - 0.84; + } + } else if (formula == 32) { + if (x <= 0.42) { + d = x * 4.0; + } else { + if (x <= 0.92e0) { + d = -2.0 * x + 1.84; + } else { + d = x / 0.08 - 11.5; + } + } + } else if (formula == 33) { + d = abs(2.0 * x - 0.5); + } else if (formula == 34) { + d = 2.0 * x; + } else if (formula == 35) { + d = 2.0 * x - 0.5; + } else if (formula == 36) { + d = 2.0 * x - 1.0; + } + if (d <= 0.0) { + return 0.0; + } else if (d >= 1.0) { + return 1.0; + } else { + return d; + } +} + +vec4 colormap(float x, int red_type, int green_type, int blue_type) { + return vec4(colormap_f1(red_type, x), colormap_f1(green_type, x), colormap_f1(blue_type, x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/kbinani_altitude.frag b/colormap-shaders/shaders/glsl/kbinani_altitude.frag new file mode 100644 index 0000000..3cdfdda --- /dev/null +++ b/colormap-shaders/shaders/glsl/kbinani_altitude.frag @@ -0,0 +1,11 @@ +float colormap_func(float x, float a, float c, float d, float e, float f, float g) { + x = 193.0 * clamp(x, 0.0, 1.0); + return a * exp(-x * x / (2.0 * c * c)) + ((d * x + e) * x + f) * x + g; +} + +vec4 colormap(float x) { + float r = colormap_func(x, 48.6399, 13.3443, 0.00000732641, -0.00154886, -0.211758, 83.3109); + float g = colormap_func(x, 92.7934, 9.66818, 0.00000334955, -0.000491041, -0.189276, 56.8844); + float b = colormap_func(x, 43.4277, 8.92338, 0.00000387675, -0.00112176, 0.0373863, 15.9435); + return vec4(r / 255.0, g / 255.0, b / 255.0, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_apricot.frag b/colormap-shaders/shaders/glsl/transform_apricot.frag new file mode 100644 index 0000000..6183aec --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_apricot.frag @@ -0,0 +1,68 @@ +float colormap_pi = 3.141592653589793; + +float colormap_f(float x, float c) { + return abs((((-5.563e-5 * x + 3.331e-16) * x + 3.045e-1) * x + 4.396e-12) * x + c); +} + +float colormap_f2(float x) { + return 262.0 * x + 12.0 * x * sin(((x - 8.0) * x + 66.0 * colormap_pi) * x); +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 1.0) { + float r = colormap_f2(x); + if (r > 255.0) { + r = 510.0 - r; + } + return r / 255.0; + } else { + return 1.0; + } +} + + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 1.0) { + return (109.0 * x + 25.0 * sin(9.92 * colormap_pi * x) * x) / 255.0; + } else { + return 102.0 / 255.0; + } +} + +float colormap_blue(float x) { + float b = 0.0; + x = x * 256.0; + + if (x < 0.0) { + b = 241.0 / 255.0; + } else if (x < 66.82) { + b = colormap_f(x - 32.0, -27.0); + if (x > 32.0 && b > 225.0) { + b = b - 10.0; + } + } else if (x < 126.67) { + b = colormap_f(x - 97.0, 30.0); + } else if (x < 195.83) { + b = colormap_f(x - 161.0, -27.0); + if (x > 161.0 && b > 225.0) { + b -= 10.0; + } + } else if (x < 256.0) { + b = colormap_f(x - 226.0, 30.0); + } else { + b = 251.0; + } + if (b > 255.0) { + b = 255.0; + } + + return b / 255.0; +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_carnation.frag b/colormap-shaders/shaders/glsl/transform_carnation.frag new file mode 100644 index 0000000..9f491e5 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_carnation.frag @@ -0,0 +1,53 @@ +float colormap_f(float x) { + return ((-9.93427e0 * x + 1.56301e1) * x + 2.44663e2 * x) / 255.0; +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 11.0 / 255.0; + } else if (x < 0.16531216481302) { + return (((-1635.0 * x) + 1789.0) * x + 3.938) / 255.0; + } else if (x < 0.50663669203696) { + return 1.0; + } else if (x < 0.67502056695956) { + return ((((1.28932e3 * x) - 7.74147e2) * x - 9.47634e2) * x + 7.65071e2) / 255.0; + } else if (x < 1.0) { + return colormap_f(x); + } else { + return 251.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.33807590140751) { + return colormap_f(x); + } else if (x < 0.50663669203696) { + return (((-5.83014e2 * x - 8.38523e2) * x + 2.03823e3) * x - 4.86592e2) / 255.0; + } else if (x < 0.84702285244773) { + return 1.0; + } else if (x < 1.0) { + return (((-5.03306e2 * x + 2.95545e3) * x - 4.19210e3) * x + 1.99128e3) / 255.0; + } else { + return 251.0 / 255.0; + } +} + +float colormap_red(float x) { + if (x < 0.16531216481302) { + return 1.0; + } else if (x < 0.33807590140751) { + return (((-5.15164e3 * x + 5.30564e3) * x - 2.65098e3) * x + 5.70771e2) / 255.0; + } else if (x < 0.67502056695956) { + return colormap_f(x); + } else if (x < 0.84702285244773) { + return (((3.34136e3 * x - 9.01976e3) * x + 8.39740e3) * x - 2.41682e3) / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_ether.frag b/colormap-shaders/shaders/glsl/transform_ether.frag new file mode 100644 index 0000000..6c1aa82 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_ether.frag @@ -0,0 +1,65 @@ +float colormap_f(float x, float b) { + float x2 = x * x; + return ((-1.89814e5 * x2 + 1.50967e4) * x2 + b) / 255.0; +} + +float colormap_f2(float x, float b) { + float x2 = x * x; + return ((1.88330e5 * x2 - 1.50839e4) * x2 + b) / 255.0; +} + +float colormap_blue(float x) { + if (x < 0.0e0) { + return 246.0 / 255.0; + } else if (x < 0.25) { + return colormap_f(x - 32.0 / 256.0, 65.0); + } else if (x < 130.0 / 256.0) { + return colormap_f2(x - 97.0 / 256.0, 190.0); + } else if (x < 193.0 / 256.0) { + return colormap_f(x - 161.0 / 256.0, 65.0); + } else if (x < 1.0) { + return colormap_f2(x - 226.0 / 256.0, 190.0); + } else { + return 18.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.20615790927912) { + return ((((-3.81619e4 * x - 2.94574e3) * x + 2.61347e3) * x - 7.92183e1) * x) / 255.0; + } else if (x < 0.54757171958025) { + return (((((2.65271e5 * x - 4.14808e5) * x + 2.26118e5) * x - 5.16491e4) * x + 5.06893e3) * x - 1.80630e2) / 255.0; + } else if (x < 0.71235558668792) { + return ((((1.77058e5 * x - 4.62571e5) * x + 4.39628e5) * x - 1.80143e5) * x + 2.68555e4) / 255.0; + } else if (x < 1.0) { + float xx = ((((1.70556e5 * x - 6.20429e5) * x + 8.28331e5) * x - 4.80913e5) * x + 1.02608e5); + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 154.0 / 255.0; + } +} + +float colormap_red(float x) { + if (x < 0.0) { + return 2.0 / 255.0; + } else if (x < 1.0) { + float xx = 2.83088e2 * x + 8.17847e-1; + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 226.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_grayscale_banded.frag b/colormap-shaders/shaders/glsl/transform_grayscale_banded.frag new file mode 100644 index 0000000..754dd23 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_grayscale_banded.frag @@ -0,0 +1,8 @@ +vec4 colormap(float x) { + float v = cos(133.0 * x) * 28.0 + 230.0 * x + 27.0; + if (v > 255.0) { + v = 510.0 - v; + } + v = v / 255.0; + return vec4(v, v, v, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_hot_metal.frag b/colormap-shaders/shaders/glsl/transform_hot_metal.frag new file mode 100644 index 0000000..215b669 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_hot_metal.frag @@ -0,0 +1,27 @@ +float colormap_blue(float x) { + return 0.0; +} + +float colormap_green(float x) { + if (x < 0.6) { + return 0.0; + } else if (x <= 0.95) { + return ((x - 0.6) * 728.57) / 255.0; + } else { + return 1.0; + } +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 0.57147) { + return 446.22 * x / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_lava_waves.frag b/colormap-shaders/shaders/glsl/transform_lava_waves.frag new file mode 100644 index 0000000..4bc67d9 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_lava_waves.frag @@ -0,0 +1,34 @@ +float colormap_red(float x) { + if (x < 0.0) { + return 124.0 / 255.0; + } else if (x <= 1.0) { + return (128.0 * sin(6.25 * (x + 0.5)) + 128.0) / 255.0; + } else { + return 134.0 / 255.0; + } +} + + +float colormap_green(float x) { + if (x < 0.0) { + return 121.0 / 255.0; + } else if (x <= 1.0) { + return (63.0 * sin(x * 99.72) + 97.0) / 255.0; + } else { + return 52.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 131.0 / 255.0; + } else if (x <= 1.0) { + return (128.0 * sin(6.23 * x) + 128.0) / 255.0; + } else { + return 121.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_malachite.frag b/colormap-shaders/shaders/glsl/transform_malachite.frag new file mode 100644 index 0000000..5a599c5 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_malachite.frag @@ -0,0 +1,53 @@ +float colormap_blue(float x) { + if (x < 248.25 / 1066.8) { + return 0.0; + } else if (x < 384.25 / 1066.8) { + return (1066.8 * x - 248.25) / 255.0; + } else if (x < 0.5) { + return 136.0 / 255.0; + } else if (x < 595.14 / 1037.9) { + return (-1037.9 * x + 595.14) / 255.0; + } else if (x < 666.68 / 913.22) { + return 0.0; + } else if (x <= 1.0) { + return (913.22 * x - 666.68) / 255.0; + } else { + return 246.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 253.0 / 255.0; + } else if (x < 248.25 / 1066.8) { + return (-545.75 * x + 253.36) / 255.0; + } else if (x < 384.25 / 1066.8) { + return (426.18 * x + 19335217.0 / 711200.0) / 255.0; + } else if (x < 0.5) { + return (-385524981.0 / 298300.0 * x + 385524981.0 / 596600.0) / 255.0; + } else if (x < 666.68 / 913.22) { + return (3065810.0 / 3001.0 * x - 1532906.0 / 3001.0) / 255.0; + } else { + return 0.0; + } +} + +float colormap_red(float x) { + if (x < 384.25 / 1066.8) { + return 0.0; + } else if (x < 0.5) { + return (1092.0 * x - 99905.0 / 254.0) / 255.0; + } else if (x < 259.3 / 454.5) { + return (1091.9 * x - 478.18) / 255.0; + } else if (x < 34188.3 / 51989.0) { + return (819.2 * x - 322.6) / 255.0; + } else if (x < 666.68 / 913.22) { + return (299.31 * x + 19.283) / 255.0; + } else { + return 0.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_morning_glory.frag b/colormap-shaders/shaders/glsl/transform_morning_glory.frag new file mode 100644 index 0000000..faff4ec --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_morning_glory.frag @@ -0,0 +1,45 @@ +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 1.0) { + float xx = 270.9 * x + 0.7703; + if (xx > 255.0) { + return (510.0 - xx) / 266.0; + } else { + return xx / 255.0; + } + } else { + return 239.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 124.0 / 255.0; + } else if (x <= 1.0) { + float xx = 180.0 * sin(x * 3.97 + 9.46) + 131.0; + if (xx < 0.0) { + return abs(xx) / 255.0; + } else if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 242.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 78.0 / 255.0; + } else if (x <= 1.0e0) { + return (95.0 * sin((x - 0.041) * 7.46) + 106.9) / 255.0; + } else { + return 179.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_peanut_butter_and_jerry.frag b/colormap-shaders/shaders/glsl/transform_peanut_butter_and_jerry.frag new file mode 100644 index 0000000..686033b --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_peanut_butter_and_jerry.frag @@ -0,0 +1,38 @@ +float colormap_red(float x) { + if (x < 0.0) { + return 1.0 / 255.0; + } else if (x <= 1.0) { + float xx = 407.92 * x + 1.3181; + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 100.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 1.0) { + return (128.7 * x + 0.2089) / 255.0; + } else { + return 128.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 73.0 / 255.0; + } else if (x <= 1.0) { + return (63.0 * sin(x * 6.21 - 0.3) + 92.0) / 255.0; + } else { + return 69.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_purple_haze.frag b/colormap-shaders/shaders/glsl/transform_purple_haze.frag new file mode 100644 index 0000000..9214781 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_purple_haze.frag @@ -0,0 +1,53 @@ +float colormap_e = exp(1.0); + +float colormap_red(float x) { + if (x < 0.0) { + return 13.0 / 255.0; + } else if (x < colormap_e * 0.1) { + return (706.48 * x + 13.06) / 255.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return (166.35 * x + 28.3) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (313.65 * x - 47.179) / 255.0; + } else if (x < colormap_e * 0.05 + 202.0 / 255.0) { + return (557.93 * x - 310.05) / 255.0; + } else if (x <= 1.0) { + return (319.64 * x + 439093.0 / 34000.0 * colormap_e - 1030939.0 / 8500.0) / 255.0; + } else { + return 249.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < colormap_e * 0.1) { + return 0.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return ((3166.59 / 14.9 * colormap_e + 2098.7 / 74.5) * x - (316.659 / 14.9 * colormap_e + 209.87 / 74.5) * colormap_e) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (725.0 * x - 394.35) / 255.0; + } else if (x <= 1.0) { + return (-716.23 * x + 721.38) / 255.0; + } else { + return 5.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 16.0 / 255.0; + } else if (x < colormap_e * 0.1) { + return (878.72 * x + 16.389) / 255.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return (-166.35 * x + 227.7) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (-317.2 * x + 305.21) / 255.0; + } else if (x < 1.0) { + return ((1530.0 / (212.0 -51.0 * colormap_e)) * x + (153.0 * colormap_e + 894.0) / (51.0 * colormap_e - 212.0)) / 255.0; + } else { + return 2.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_rainbow.frag b/colormap-shaders/shaders/glsl/transform_rainbow.frag new file mode 100644 index 0000000..70d768e --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_rainbow.frag @@ -0,0 +1,37 @@ +vec4 colormap(float x) { + float r = 0.0, g = 0.0, b = 0.0; + + if (x < 0.0) { + r = 127.0 / 255.0; + } else if (x <= 1.0 / 9.0) { + r = 1147.5 * (1.0 / 9.0 - x) / 255.0; + } else if (x <= 5.0 / 9.0) { + r = 0.0; + } else if (x <= 7.0 / 9.0) { + r = 1147.5 * (x - 5.0 / 9.0) / 255.0; + } else { + r = 1.0; + } + + if (x <= 1.0 / 9.0) { + g = 0.0; + } else if (x <= 3.0 / 9.0) { + g = 1147.5 * (x - 1.0 / 9.0) / 255.0; + } else if (x <= 7.0 / 9.0) { + g = 1.0; + } else if (x <= 1.0) { + g = 1.0 - 1147.5 * (x - 7.0 / 9.0) / 255.0; + } else { + g = 0.0; + } + + if (x <= 3.0 / 9.0) { + b = 1.0; + } else if (x <= 5.0 / 9.0) { + b = 1.0 - 1147.5 * (x - 3.0 / 9.0) / 255.0; + } else { + b = 0.0; + } + + return vec4(r, g, b, 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_rose.frag b/colormap-shaders/shaders/glsl/transform_rose.frag new file mode 100644 index 0000000..20d0208 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_rose.frag @@ -0,0 +1,39 @@ +float colormap_red(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 20049.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + if (x < 20049.0 / 82979.0) { + return 0.0; + } else if (x < 327013.0 / 810990.0) { + return (8546482679670.0 / 10875673217.0 * x - 2064961390770.0 / 10875673217.0) / 255.0; + } else if (x <= 1.0) { + return (103806720.0 / 483977.0 * x + 19607415.0 / 483977.0) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 7249.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else if (x < 20049.0 / 82979.0) { + return 127.0 / 255.0; + } else if (x < 327013.0 / 810990.0) { + return (792.02249341361393720147485376583 * x - 64.364790735602331034989206222672) / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_saturn.frag b/colormap-shaders/shaders/glsl/transform_saturn.frag new file mode 100644 index 0000000..61a9ebd --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_saturn.frag @@ -0,0 +1,75 @@ +float colormap_f1(float x) { + return -510.0 * x + 255.0; +} + +float colormap_f2(float x) { + return (-1891.7 * x + 217.46) * x + 255.0; +} + +float colormap_f3(float x) { + return 9.26643676359015e1 * sin((x - 4.83450094847127e-1) * 9.93) + 1.35940451627965e2; +} + +float colormap_f4(float x) { + return -510.0 * x + 510.0; +} + +float colormap_f5(float x) { + float xx = x - 197169.0 / 251000.0; + return (2510.0 * xx - 538.31) * xx; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 1.0; + } else if (x < 10873.0 / 94585.0) { + float xx = colormap_f2(x); + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else if (x < 0.5) { + return 1.0; + } else if (x < 146169.0 / 251000.0) { + return colormap_f4(x) / 255.0; + } else if (x < 197169.0 / 251000.0) { + return colormap_f5(x) / 255.0; + } else { + return 0.0; + } +} + +float colormap_green(float x) { + if (x < 10873.0 / 94585.0) { + return 1.0; + } else if (x < 36373.0 / 94585.0) { + return colormap_f2(x) / 255.0; + } else if (x < 0.5) { + return colormap_f1(x) / 255.0; + } else if (x < 197169.0 / 251000.0) { + return 0.0; + } else if (x <= 1.0) { + return abs(colormap_f5(x)) / 255.0; + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 36373.0 / 94585.0) { + return colormap_f1(x) / 255.0; + } else if (x < 146169.0 / 251000.0) { + return colormap_f3(x) / 255.0; + } else if (x <= 1.0) { + return colormap_f4(x) / 255.0; + } else { + return 0.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_seismic.frag b/colormap-shaders/shaders/glsl/transform_seismic.frag new file mode 100644 index 0000000..eaa7805 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_seismic.frag @@ -0,0 +1,57 @@ +float colormap_f(float x) { + return ((-2010.0 * x + 2502.5950459) * x - 481.763180924) / 255.0; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 3.0 / 255.0; + } else if (x < 0.238) { + return ((-1810.0 * x + 414.49) * x + 3.87702) / 255.0; + } else if (x < 51611.0 / 108060.0) { + return (344441250.0 / 323659.0 * x - 23422005.0 / 92474.0) / 255.0; + } else if (x < 25851.0 / 34402.0) { + return 1.0; + } else if (x <= 1.0) { + return (-688.04 * x + 772.02) / 255.0; + } else { + return 83.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.238) { + return 0.0; + } else if (x < 51611.0 / 108060.0) { + return colormap_f(x); + } else if (x < 0.739376978894039) { + float xx = x - 51611.0 / 108060.0; + return ((-914.74 * xx - 734.72) * xx + 255.) / 255.0; + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 19.0 / 255.0; + } else if (x < 0.238) { + float xx = x - 0.238; + return (((1624.6 * xx + 1191.4) * xx + 1180.2) * xx + 255.0) / 255.0; + } else if (x < 51611.0 / 108060.0) { + return 1.0; + } else if (x < 174.5 / 256.0) { + return (-951.67322673866 * x + 709.532730938451) / 255.0; + } else if (x < 0.745745353439206) { + return (-705.250074130877 * x + 559.620050530617) / 255.0; + } else if (x <= 1.0) { + return ((-399.29 * x + 655.71) * x - 233.25) / 255.0; + } else { + return 23.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_space.frag b/colormap-shaders/shaders/glsl/transform_space.frag new file mode 100644 index 0000000..3ee7e81 --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_space.frag @@ -0,0 +1,68 @@ +float colormap_red(float x) { + if (x < 37067.0 / 158860.0) { + return 0.0; + } else if (x < 85181.0 / 230350.0) { + float xx = x - 37067.0 / 158860.0; + return (780.25 * xx + 319.71) * xx / 255.0; + } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) { + return ((1035.33580904442 * x - 82.5380748768798) * x - 52.8985266363332) / 255.0; + } else if (x < 231408.0 / 362695.0) { + return (339.41 * x - 33.194) / 255.0; + } else if (x < 152073.0 / 222340.0) { + return (1064.8 * x - 496.01) / 255.0; + } else if (x < 294791.0 / 397780.0) { + return (397.78 * x - 39.791) / 255.0; + } else if (x < 491189.0 / 550980.0) { + return 1.0; + } else if (x < 1.0) { + return (5509.8 * x + 597.91) * x / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + float xx; + if (x < 0.0) { + return 0.0; + } else if (x < (-sqrt(166317494.0) + 39104.0) / 183830.0) { + return (-1838.3 * x + 464.36) * x / 255.0; + } else if (x < 37067.0 / 158860.0) { + return (-317.72 * x + 74.134) / 255.0; + } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) { + return 0.0; + } else if (x < 294791.0 / 397780.0) { + xx = x - (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0; + return (-1945.0 * xx + 1430.2) * xx / 255.0; + } else if (x < 491189.0 / 550980.0) { + return ((-1770.0 * x + 3.92813840044638e3) * x - 1.84017494792245e3) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 51987.0 / 349730.0) { + return (458.79 * x) / 255.0; + } else if (x < 85181.0 / 230350.0) { + return (109.06 * x + 51.987) / 255.0; + } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) { + return (339.41 * x - 33.194) / 255.0; + } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) { + return ((-1552.4 * x + 1170.7) * x - 92.996) / 255.0; + } else if (x < 27568.0 / 38629.0) { + return 0.0; + } else if (x < 81692.0 / 96241.0) { + return (386.29 * x - 275.68) / 255.0; + } else if (x <= 1.0) { + return (1348.7 * x - 1092.6) / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/glsl/transform_supernova.frag b/colormap-shaders/shaders/glsl/transform_supernova.frag new file mode 100644 index 0000000..736dc0f --- /dev/null +++ b/colormap-shaders/shaders/glsl/transform_supernova.frag @@ -0,0 +1,65 @@ +float colormap_f1(float x) { + return (0.3647 * x + 164.02) * x + 154.21; +} + +float colormap_f2(float x) { + return (126.68 * x + 114.35) * x + 0.1551; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.136721748106749) { + return colormap_f2(x) / 255.0; + } else if (x < 0.23422409711017) { + return (1789.6 * x - 226.52) / 255.0; + } else if (x < 0.498842730309711) { + return colormap_f1(x) / 255.0; + } else if (x < 0.549121259378134) { + return (-654.951781800243 * x + 562.838873112072) / 255.0; + } else if (x < 1.0) { + return ((3.6897 * x + 11.125) * x + 223.15) / 255.0; + } else { + return 237.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 154.0 / 255.0; + } else if (x < 3.888853260731947e-2) { + return colormap_f1(x) / 255.0; + } else if (x < 0.136721748106749e0) { + return (-1455.86353067466 * x + 217.205447330541) / 255.0; + } else if (x < 0.330799131955394) { + return colormap_f2(x) / 255.0; + } else if (x < 0.498842730309711) { + return (1096.6 * x - 310.91) / 255.0; + } else if (x < 0.549121259378134) { + return colormap_f1(x) / 255.0; + } else { + return 244.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 93.0 / 255.0; + } else if (x < 3.888853260731947e-2) { + return (1734.6 * x + 93.133) / 255.0; + } else if (x < 0.234224097110170) { + return colormap_f1(x) / 255.0; + } else if (x < 0.330799131955394) { + return (-1457.96598791534 * x + 534.138211325166) / 255.0; + } else if (x < 0.549121259378134) { + return colormap_f2(x) / 255.0; + } else if (x < 1.0) { + return ((3.8931 * x + 176.32) * x + 3.1505) / 255.0; + } else { + return 183.0 / 255.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} diff --git a/colormap-shaders/shaders/metal/IDL_16_Level.metal b/colormap-shaders/shaders/metal/IDL_16_Level.metal new file mode 100644 index 0000000..9626328 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_16_Level.metal @@ -0,0 +1,50 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace _16_Level { + +float4 colormap(float x) { + if (x < 0.0) { + return float4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return float4(1.0, 1.0, 1.0, 1.0); + } else if (x < 1.0 / 16.0) { + return float4(0.0, 84.0 / 255.0, 0.0, 1.0); + } else if (x < 2.0 / 16.0) { + return float4(0.0, 168.0 / 255.0, 0.0, 1.0); + } else if (x < 3.0 / 16.0) { + return float4(0.0, 1.0, 0.0, 1.0); + } else if (x < 4.0 / 16.0) { + return float4(0.0, 1.0, 84.0 / 255.0, 1.0); + } else if (x < 5.0 / 16.0) { + return float4(0.0, 1.0, 168.0 / 255.0, 1.0); + } else if (x < 6.0 / 16.0) { + return float4(0.0, 1.0, 1.0, 1.0); + } else if (x < 7.0 / 16.0) { + return float4(0.0, 0.0, 1.0, 1.0); + } else if (x < 8.0 / 16.0) { + return float4(128.0 / 255.0, 0.0, 1.0, 1.0); + } else if (x < 9.0 / 16.0) { + return float4(1.0, 0.0, 220.0 / 255.0, 1.0); + } else if (x < 10.0 / 16.0) { + return float4(1.0, 0.0, 180.0 / 255.0, 1.0); + } else if (x < 11.0 / 16.0) { + return float4(1.0, 0.0, 128.0 / 255.0, 1.0); + } else if (x < 12.0 / 16.0) { + return float4(1.0, 0.0, 64.0 / 255.0, 1.0); + } else if (x < 13.0 / 16.0) { + return float4(1.0, 0.0, 0.0, 1.0); + } else if (x < 14.0 / 16.0) { + return float4(220.0 / 255.0, 190.0 / 255.0, 190.0 / 255.0, 1.0); + } else if (x < 15.0 / 16.0) { + return float4(220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0, 1.0); + } else { + return float4(1.0, 1.0, 1.0, 1.0); + } +} + +} // namespace _16_Level +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Beach.metal b/colormap-shaders/shaders/metal/IDL_Beach.metal new file mode 100644 index 0000000..6aa2bda --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Beach.metal @@ -0,0 +1,66 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Beach { + +float colormap_red(float x) { + if (x <= 0.5) { + return 1.07069284759359E+03 * x - 3.92901626559718E+02; // R1 + } else if (x < (4.62452380952399E+02 - 3.16199999999948E+02) / (1.05778571428574E+03 - 8.03199999999881E+02)) { // 0.57447206479 + return 1.05778571428574E+03 * x - 4.62452380952399E+02; // R2 + } else if (x < (2.16218045113087E+01 + 3.16199999999948E+02) / (8.03199999999881E+02 - 2.93462406015021E+02)) { // 0.66273668746 + return 8.03199999999881E+02 * x - 3.16199999999948E+02; // R3 + } else if (x < 0.7332708626326772) { + return 2.93462406015021E+02 * x + 2.16218045113087E+01; // R4 + } else { + return 0.0; + } +} + +float colormap_green(float x) { + if (x < (2.51230508474576E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 5.35095032144939E+02)) { // 0.23285616817 + return -5.35095032144939E+02 * x + 2.51230508474576E+02; // G1 + } else if (x < (6.91824598930488E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 1.39121879297175E+03)) { // 0.36550493804 + return 4.27421457219241E+02 * x + 2.71026069518750E+01; // G2 + } else if (x < (6.91824598930488E+02 + 5.16725562656262E+02) / (1.02304642956372E+03 + 1.39121879297175E+03)) { // 0.500587156 + return -1.39121879297175E+03 * x + 6.91824598930488E+02; // G3 + } else if (x < 0.7332708626326772) { + return 1.02304642956372E+03 * x - 5.16725562656262E+02; // G4 + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.3584754040051419) { + return 1.07130443548384E+03 * x - 2.48036290322570E+02; // B1 + } else if (x < 123.0 / 251.0) { + return 136.0; + } else if (x < 0.7332708626326772) { + return -1.01758796992489E+03 * x + 5.87035338345905E+02; // B2 + } else { + return 8.98509790209691E+02 * x - 6.58851048950966E+02; // B3 + } +} + +// R2 - R3 = 0 +// => [x=0.5744720647924222] + +// B1 - 136 = 0 +// => [x=0.3584754040051419] + +// B3 = 0 +// => [x=0.7332708626326772] + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Beach +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Black-White_Linear.metal b/colormap-shaders/shaders/metal/IDL_Black-White_Linear.metal new file mode 100644 index 0000000..a77ad05 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Black-White_Linear.metal @@ -0,0 +1,15 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Black_White_Linear { + +float4 colormap(float x) { + float d = clamp(x, 0.0, 1.0); + return float4(d, d, d, 1.0); +} + +} // namespace Black_White_Linear +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue-Green-Red-Yellow.metal b/colormap-shaders/shaders/metal/IDL_Blue-Green-Red-Yellow.metal new file mode 100644 index 0000000..690179f --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue-Green-Red-Yellow.metal @@ -0,0 +1,54 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_Green_Red_Yellow { + +float colormap_red(float x) { + if (x < (8.40958823529412E+02 - 5.2E+02) / (7.50588235294118 - 5.0)) { + return 7.50588235294118 * x - 8.40958823529412E+02; + } else if (x < (5.2E+02 + 1.27747747747748E+02) / (5.0 - 5.0e-1)) { + return 5.0 * x - 5.2E+02; + } else { + return 5.0e-1 * x + 1.27747747747748E+02; + } +} + +float colormap_green(float x) { + if (x < (150.0 + 1.00373100303951E+02) / 3.12386018237082) { // 80.1486256385 + return 3.12386018237082 * x - 1.00373100303951E+02; + } else if (x < (2.08794117647059E+02 - 150.0) / 6.17647058823529E-01) { // 95.1904761905 + return 150.0; + } else if (x < (4.19041176470588E+02 - 2.08794117647059E+02) / (-6.17647058823529E-01 + 2.49411764705882E+00)) { // 112.043887147 + return -6.17647058823529E-01 * x + 2.08794117647059E+02; + } else if (x < (8.97617647058824E+02 - 4.19041176470588E+02) / (-2.49411764705882E+00 - -6.23529411764706E+00)) { // 127.921383648 + return -2.49411764705882E+00 * x + 4.19041176470588E+02; + } else if (x < (8.97617647058824E+02 - - 3.32600912600913E+02) / (2.30624780624781E+00 - -6.23529411764706E+00)) { // 144.027690857 + return -6.23529411764706E+00 * x + 8.97617647058824E+02; + } else { + return 2.30624780624781E+00 * x - 3.32600912600913E+02; + } +} + +float colormap_blue(float x) { + if (x < (100.0 - - 3.36734693877551E-01) / 2.07815892314373E+00) { + return 2.07815892314373E+00 * x - 3.36734693877551E-01; + } else if (x < (3.49317448680352E+02 - 100.0) / 3.12243401759531E+00) { + return 100.0; + } else { + return -3.12243401759531E+00 * x + 3.49317448680352E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_Green_Red_Yellow +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue-Pastel-Red.metal b/colormap-shaders/shaders/metal/IDL_Blue-Pastel-Red.metal new file mode 100644 index 0000000..018732c --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue-Pastel-Red.metal @@ -0,0 +1,63 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_Pastel_Red { + +float colormap_red(float x) { + if (x < 0.1131206452846527) { + return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + 3.28713709677420E+01; + } else if (x < 0.5116005837917328) { + return 0.0; + } else if (x < 0.5705677568912506) { + return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - 8.29909138655453E+02; + } else if (x < 0.622047244) { + return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - 7.12389120879120E+03; + } else if (x < 0.7922459542751312) { + return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + 6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) * x - 2.35682532934682E+05; + } else { + return 3.34889230769210E+02 * x - 1.41006123680226E+02; + } +} + +float colormap_green(float x) { + if (x < 0.114394336938858) { + return 0.0; + } else if (x < 0.4417250454425812) { + return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - 3.37113020096108E+01; + } else if (x < 0.4964917968308496) { + return 3.11150000000070E+02 * x + 9.54249999999731E+01; + } else if (x < 0.6259051214039278) { + return -1.03272635599706E+03 * x + 7.62648586707481E+02; + } else if (x < 0.8049814403057098) { + return -2.92799028677160E+02 * x + 2.99524283071235E+02; + } else { + return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + 1.40880802982723E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.4424893036638088) { + return 3.09636968527514E+02 * x + 9.62203074056821E+01; + } else if (x < 0.5) { + return -4.59921428571535E+02 * x + 4.36741666666678E+02; + } else if (x < 0.5691165986930345) { + return -1.81364912280674E+03 * x + 1.05392982456125E+03; + } else if (x < 0.6279306709766388) { + return 1.83776470588197E+02 * x - 8.28382352940910E+01; + } else { + return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - 1.80428756181930E+04) * x + 4.44421976986281E+03; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_Pastel_Red +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue-Red.metal b/colormap-shaders/shaders/metal/IDL_Blue-Red.metal new file mode 100644 index 0000000..a5f3314 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue-Red.metal @@ -0,0 +1,42 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_Red { + +float colormap_red(float x) { + return 4.04377880184332E+00 * x - 5.17956989247312E+02; +} + +float colormap_green(float x) { + if (x < (5.14022177419355E+02 + 1.13519230769231E+01) / (4.20313644688645E+00 + 4.04233870967742E+00)) { + return 4.20313644688645E+00 * x - 1.13519230769231E+01; + } else { + return -4.04233870967742E+00 * x + 5.14022177419355E+02; + } +} + +float colormap_blue(float x) { + if (x < 1.34071303331385E+01 / (4.25125657510228E+00 - 1.0)) { // 4.12367649967 + return x; + } else if (x < (255.0 + 1.34071303331385E+01) / 4.25125657510228E+00) { // 63.1359518278 + return 4.25125657510228E+00 * x - 1.34071303331385E+01; + } else if (x < (1.04455240613432E+03 - 255.0) / 4.11010047593866E+00) { // 192.100512082 + return 255.0; + } else { + return -4.11010047593866E+00 * x + 1.04455240613432E+03; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_Red +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue-Red_2.metal b/colormap-shaders/shaders/metal/IDL_Blue-Red_2.metal new file mode 100644 index 0000000..5745291 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue-Red_2.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_Red_2 { + +float colormap_red(float x) { + if (x < 0.75) { + return 1012.0 * x - 389.0; + } else { + return -1.11322769567548E+03 * x + 1.24461193212872E+03; + } +} + +float colormap_green(float x) { + if (x < 0.5) { + return 1012.0 * x - 129.0; + } else { + return -1012.0 * x + 899.0; + } +} + +float colormap_blue(float x) { + if (x < 0.25) { + return 1012.0 * x + 131.0; + } else { + return -1012.0 * x + 643.0; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_Red_2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue-White_Linear.metal b/colormap-shaders/shaders/metal/IDL_Blue-White_Linear.metal new file mode 100644 index 0000000..8d5d945 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue-White_Linear.metal @@ -0,0 +1,37 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_White_Linear { + +float colormap_red(float x) { + if (x < 1.0 / 3.0) { + return 4.0 * x - 2.992156863; + } else if (x < 2.0 / 3.0) { + return 4.0 * x - 2.9882352941; + } else if (x < 2.9843137255 / 3.0) { + return 4.0 * x - 2.9843137255; + } else { + return x; + } +} + +float colormap_green(float x) { + return 1.602642681354730 * x - 5.948580022657070e-1; +} + +float colormap_blue(float x) { + return 1.356416928785610 * x + 3.345982835050930e-3; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_White_Linear +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Blue_Waves.metal b/colormap-shaders/shaders/metal/IDL_Blue_Waves.metal new file mode 100644 index 0000000..83e88b5 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Blue_Waves.metal @@ -0,0 +1,63 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Blue_Waves { + +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 94.58052830612496; + const float b = 0.5059881077994055; + const float c = 0.5079410623689743; + const float d = 86.68342149719986; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 99.19361086687104; + const float b = 1.095358975873744; + const float c = 0.3679001899352902; + const float d = 0.7603616684267874; + const float e = 219.7852186508229; + const float f = 1.161240703555854; + float v = (a * x + b) * sin(2.0 * pi * (x / c + d)) + e * x + f; + if (v > 255.0) { + return 510.0 - v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 253.8552881642787; + const float b = 0.5059881077994055; + const float c = 0.5079410623689743; + const float d = 226.7149651787587; + float v = a * sin(2.0 * pi * (x / b + c)) + d; + if (v > 255.0) { + return 510.0 - v; + } else if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Blue_Waves +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Accent.metal b/colormap-shaders/shaders/metal/IDL_CB-Accent.metal new file mode 100644 index 0000000..521e7bd --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Accent.metal @@ -0,0 +1,67 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Accent { + +float colormap_red(float x) { + if (x < 0.3953623640294495) { + return 4.43904418116747E+02 * x + 1.27235098111810E+02; // R1 + } else if (x < 0.5707952559161218) { + return -1.40693770913775E+03 * x + 8.58988416988442E+02; // R2 + } else if (x < 0.7167119613307117) { + return 1.26199099099112E+03 * x - 6.64423423423499E+02; // R3 + } else if (x < 0.8579249381242428) { + return -3.45591749644313E+02 * x + 4.87750355618723E+02; // R4 + } else { + return -6.12161344537705E+02 * x + 7.16447058823441E+02; // R5 + } +} + +float colormap_green(float x) { + if (x < 0.1411385125927322) { + return -1.90229018492177E+02 * x + 2.01102418207681E+02; // G1 + } else if (x < 0.2839213365162221) { + return 1.26397818871505E+02 * x + 1.56414177335230E+02; // G2 + } else if (x < 0.4292115788900552) { + return 4.30655855855847E+02 * x + 7.00288288288335E+01; // G3 + } else if (x < 0.5716859888719092) { + return -1.03353736732686E+03 * x + 6.98477513951204E+02; // G4 + } else if (x < 0.7167535225418249) { + return -7.29556302521079E+02 * x + 5.24695798319375E+02; // G5 + } else if (x < 0.8577494771113141) { + return 6.31469498069341E+02 * x - 4.50824238524115E+02; // G6 + } else { + return 7.78344916345091E+01 * x + 2.40558987558802E+01; // G7 + } +} + +float colormap_blue(float x) { + if (x < 0.1418174223507038) { + return 5.96339971550497E+02 * x + 1.27334281650071E+02; // B1 + } else if (x < 0.2832901246500529) { + return -5.48535392535404E+02 * x + 2.89697554697557E+02; // B2 + } else if (x < 0.4021748491445084) { + return 1.22844950213372E+02 * x + 9.95021337126610E+01; // B3 + } else if (x < 0.5699636786725797) { + return 1.60703217503224E+02 * x + 8.42764907764923E+01; // B4 + } else if (x < 0.7149788470960766) { + return -3.30626890756314E+02 * x + 3.64316806722696E+02; // B5 + } else if (x < 0.8584529189762473) { + return -7.30288215340717E+02 * x + 6.50066199802944E+02; // B6 + } else { + return 5.42814671814679E+02 * x - 4.42832689832695E+02; // B7 + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Accent +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Blues.metal b/colormap-shaders/shaders/metal/IDL_CB-Blues.metal new file mode 100644 index 0000000..640aab5 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Blues.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Blues { + +float colormap_red(float x) { + if (x < 0.8724578971287745) { + return ((((-2.98580898761749E+03 * x + 6.75014845489710E+03) * x - 4.96941610635258E+03) * x + 1.20190439358912E+03) * x - 2.94374708396149E+02) * x + 2.48449410219242E+02; + } else { + return 8.0; + } +} + +float colormap_green(float x) { + if (x < 0.3725897611307026) { + return -1.30453729372935E+02 * x + 2.51073069306930E+02; + } else { + return (-4.97095598364922E+01 * x - 1.77638812495581E+02) * x + 2.75554584848896E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.8782350698420436) { + return (((-1.66242968759033E+02 * x + 2.50865766027010E+02) * x - 1.82046165445353E+02) * x - 3.29698266187334E+01) * x + 2.53927912915449E+02; + } else { + return -3.85153281423831E+02 * x + 4.93849833147981E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Blues +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-BrBG.metal b/colormap-shaders/shaders/metal/IDL_CB-BrBG.metal new file mode 100644 index 0000000..7fd8ccb --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-BrBG.metal @@ -0,0 +1,55 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_BrBG { + +float colormap_red(float x) { + if (x < 0.4128910005092621) { + return (-6.30796693758704E+02 * x + 6.59139629181867E+02) * x + 8.16592339699109E+01; + } else if (x < 0.5004365747118258) { + return -1.99292307692284E+01 * x + 2.54503076923075E+02; + } else if (x < 0.6000321805477142) { + return -4.46903540903651E+02 * x + 4.68176638176691E+02; + } else { + return ((2.43537534073204E+03 * x - 5.03831150657605E+03) * x + 2.73595321475367E+03) * x - 1.53778856560153E+02; + } +} + +float colormap_green(float x) { + if (x < 0.3067105114459991) { + return (((((-1.43558931121826E+06 * x + 1.21789289489746E+06) * x - 3.88754308517456E+05) * x + 5.87745165729522E+04) * x - 3.61237992835044E+03) * x + 4.00139210969209E+02) * x + 4.80612502318691E+01; + } else if (x < 0.4045854562297116) { + return 3.64978461538455E+02 * x + 8.50984615384636E+01; + } else if (x < 0.5035906732082367) { + return 1.25827692307720E+02 * x + 1.81855384615367E+02; + } else { + return ((((-2.83948052403926E+04 * x + 1.08768529946603E+05) * x - 1.62569302478295E+05) * x + 1.17919256227845E+05) * x - 4.16776268978779E+04) * x + 6.01529271177582E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.1012683545126085) { + return 5.85993431855501E+01 * x + 4.56403940886700E+00; + } else if (x < 0.2050940692424774) { + return 3.51072173913048E+02 * x - 2.50542028985514E+01; + } else if (x < 0.5022056996822357) { + return (-7.65121475963620E+02 * x + 1.20827362856208E+03) * x - 1.68677387505814E+02; + } else if (x < 0.5970333516597748) { + return -1.62299487179500E+02 * x + 3.26660512820525E+02; + } else { + return ((1.27993125066091E+03 * x - 3.19799978871341E+03) * x + 2.16242391471484E+03) * x - 1.93738146367890E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_BrBG +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-BuGn.metal b/colormap-shaders/shaders/metal/IDL_CB-BuGn.metal new file mode 100644 index 0000000..f70a9c7 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-BuGn.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_BuGn { + +float colormap_red(float x) { + if (x < 0.2494658606560582) { + return (-1.98833893257484E+02 * x - 1.24389159093545E+02) * x + 2.46504720279718E+02; + } else { + return (((-1.85732147540803E+03 * x + 3.95435649372523E+03) * x - 2.78121710759105E+03) * x + 3.94042660425286E+02) * x + 2.23685415320351E+02; + } +} + +float colormap_green(float x) { + if (x < 0.2248314628132282) { + return -6.43489926739916E+01 * x + 2.52449038461538E+02; + } else { + return ((-5.64618971208984E+01 * x - 2.68370957359183E+01) * x - 1.13001580194466E+02) * x + 2.65385956392887E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.8) { + return ((((1.59308890502154E+03 * x - 2.88662249445915E+03) * x + 2.00432779052853E+03) * x - 9.47781545884907E+02) * x + 5.68068034974858E+01) * x + 2.51926935643853E+02; + } else { + return ((-4.08819825327256E+03 * x + 1.13496840066923E+04) * x - 1.06254795336147E+04) * x + 3.39092424595566E+03; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_BuGn +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-BuPu.metal b/colormap-shaders/shaders/metal/IDL_CB-BuPu.metal new file mode 100644 index 0000000..4ca981a --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-BuPu.metal @@ -0,0 +1,39 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_BuPu { + +float colormap_red(float x) { + if (x < 0.5) { + return ((9.36778020337806E+02 * x - 6.50118321723071E+02) * x - 1.17443717298418E+02) * x + 2.45640353186226E+02; + } else if (x < 0.8774830563107102) { + return (-1.07698286837105E+02 * x + 1.18941048271099E+02) * x + 1.07226580391914E+02; + } else { + return (-9.74524977247347E+01 * x - 2.28433367883516E+02) * x + 4.04152727778340E+02; + } +} + +float colormap_green(float x) { + if (x < 0.8733318961770479) { + return ((5.48640317293175E+01 * x - 2.50041384768192E+02) * x - 9.10862643329019E+01) * x + 2.50330566129102E+02; + } else { + return (1.99199516170089E+02 * x - 4.99460567863480E+02) * x + 3.00881779984708E+02; + } +} + +float colormap_blue(float x) { + return ((((-5.85479883993044E+02 * x + 1.17558327595144E+03) * x - 8.53086782991886E+02) * x + 1.82921150609850E+02) * x - 9.97610091178212E+01) * x + 2.53898307388663E+02; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_BuPu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Dark2.metal b/colormap-shaders/shaders/metal/IDL_CB-Dark2.metal new file mode 100644 index 0000000..41df238 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Dark2.metal @@ -0,0 +1,69 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Dark2 { + +float colormap_red(float x) { + if (x < 0.1420141309011431) { + return 1.34039497392129E+03 * x + 2.69843527738265E+01; // R1 + } else if (x < 0.2832372296870317) { + return -7.10676962676977E+02 * x + 3.18265551265554E+02; // R2 + } else if (x < 0.4289458478001075) { + return 7.81992413466075E+02 * x - 1.04513987671874E+02; // R3 + } else if (x < 0.5708308530153928) { + return -9.08417760617793E+02 * x + 6.20580437580458E+02; // R4 + } else if (x < 0.7161145088911144) { + return 8.78642484589930E+02 * x - 3.99528686581363E+02; // R5 + } else { + return -4.46088623062543E+02 * x + 5.49130479987969E+02; // R6 + } +} + +float colormap_green(float x) { + if (x < 0.1423373623518399) { + return -4.42075062917170E+02 * x + 1.57882591093117E+02; + } else if (x < 0.2834256193936661) { + return 1.20312044817928E+02 * x + 7.78338935574229E+01; + } else if (x < 0.4289129211292926) { + return -4.87706495969635E+02 * x + 2.50161925082971E+02; + } else if (x < 0.5707509745277107) { + return 8.81285199485221E+02 * x - 3.37016302016313E+02; + } else if (x < 0.7167318372796874) { + return 3.38425794215443E+01 * x + 1.46662399241347E+02; + } else if (x < 0.8574321486576632) { + return -3.74788931788816E+02 * x + 4.39541613041524E+02; + } else { + return -1.11864607464601E+02 * x + 2.14101844701848E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1416506418642016) { + return -8.25590327169275E+02 * x + 1.19073968705548E+02; + } else if (x < 0.283798849411819) { + return 1.24433848133849E+03 * x - 1.74132775632779E+02; + } else if (x < 0.4285299211147395) { + return -2.82844476054998E+02 * x + 2.59279990516832E+02; + } else if (x < 0.5700066234111405) { + return -7.58992535392565E+02 * x + 4.63323680823696E+02; + } else if (x < 0.7144281197454347) { + return -1.96085154061629E+02 * x + 1.42462745098042E+02; + } else if (x < 0.8576876140758521) { + return 1.84489769121314E+02 * x - 1.29430681693811E+02; + } else { + return 4.99467953667967E+02 * x - 3.99583569283573E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Dark2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-GnBu.metal b/colormap-shaders/shaders/metal/IDL_CB-GnBu.metal new file mode 100644 index 0000000..e269670 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-GnBu.metal @@ -0,0 +1,42 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_GnBu { + +float colormap_red(float x) { + float v = ((((-2.83671754639782E+03 * x + 6.51753994553536E+03) * x - 5.00110948171466E+03) * x + 1.30359712298773E+03) * x - 2.89958300810074E+02) * x + 2.48458039402758E+02; + if (v < 8.0) { + return 8.0; + } else { + return v; + } +} + +float colormap_green(float x) { + return (((((-1.36304822155833E+03 * x + 4.37691418182849E+03) * x - 5.01802019417285E+03) * x + 2.39971481269598E+03) * x - 5.65401491984724E+02) * x - 1.48189675724133E+01) * x + 2.50507618187374E+02; +} + +float colormap_blue(float x) { + if (x < 0.3756393599187693) { + return (9.62948273917718E+01 * x - 1.96136874142438E+02) * x + 2.41033490809633E+02; + } else if (x < 0.6215448666633865) { + return 1.21184043778803E+02 * x + 1.35422939068100E+02; + } else if (x < 0.8830064316178203) { + return -1.53052165744713E+02 * x + 3.05873047350666E+02; + } else { + return -3.49468965517114E+02 * x + 4.79310344827486E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_GnBu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Greens.metal b/colormap-shaders/shaders/metal/IDL_CB-Greens.metal new file mode 100644 index 0000000..69d3774 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Greens.metal @@ -0,0 +1,37 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Greens { + +float colormap_red(float x) { + if (x < 0.6193682068820651) { + return ((1.41021531432983E+02 * x - 3.78122271460656E+02) * x - 1.08403692154170E+02) * x + 2.45743977533647E+02; + } else { + return ((-8.63146749682724E+02 * x + 1.76195389457266E+03) * x - 1.43807716183136E+03) * x + 4.86922446232568E+02; + } +} + +float colormap_green(float x) { + return (-1.37013460576160E+02 * x - 4.54698187198101E+01) * x + 2.52098684286706E+02; +} + +float colormap_blue(float x) { + if (x < 0.5062477983469252) { + return ((3.95067226937040E+02 * x - 4.52381961582927E+02) * x - 1.25304923569201E+02) * x + 2.43770002412197E+02; + } else { + return ((2.98249378459208E+02 * x - 6.14859580726999E+02) * x + 2.22299590241459E+02) * x + 1.21998454489668E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Greens +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Greys.metal b/colormap-shaders/shaders/metal/IDL_CB-Greys.metal new file mode 100644 index 0000000..0067e3c --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Greys.metal @@ -0,0 +1,25 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Greys { + +float colormap_f1(float x) { + if (x < 0.3849871446504941) { + return (-1.97035589869658E+02 * x - 1.04694505989261E+02) * x + 2.54887830314633E+02; + } else if (x < 0.7524552013985151) { + return (8.71964614639801E+01 * x - 3.79941007690502E+02) * x + 3.18726712728548E+02; + } else { + return (2.28085532626505E+02 * x - 7.25770100421835E+02) * x + 4.99177793972139E+02; + } +} + +float4 colormap(float x) { + float v = clamp(colormap_f1(x) / 255.0, 0.0, 1.0); + return float4(v, v, v, 1.0); +} + +} // namespace CB_Greys +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-OrRd.metal b/colormap-shaders/shaders/metal/IDL_CB-OrRd.metal new file mode 100644 index 0000000..e22c2b4 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-OrRd.metal @@ -0,0 +1,53 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_OrRd { + +float colormap_erf(float x) { + // erf approximation formula + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0)); + float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x)); + return sign(x) * sqrt(v); +} + +float colormap_red(float x) { + return 127.0548665301906 * (1.0 - colormap_erf(2.926357498911938 * (x - 1.0))); +} + +float colormap_green(float x) { + if (x < 0.3619403852314316) { + return (-1.54198428391755E+02 * x - 1.02444772146395E+02) * x + 2.46537152765234E+02; + } else { + return (-9.36243338922068E+01 * x - 2.52981049073614E+02) * x + 2.93087053416795E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.257177186368595) { + return -3.12872659968267E+02 * x + 2.36904283447911E+02; + } else if (x < 0.3782584246092673) { + return -2.10348217636022E+02 * x + 2.10537335834895E+02; + } else if (x < 0.4977365973504272) { + return -3.49969458128060E+02 * x + 2.63350246305405E+02; + } else if (x < 0.6243924786616242) { + return -1.32763025210105E+02 * x + 1.55238655462198E+02; + } else if (x < 0.7554357868699768) { + return -3.23593609804140E+02 * x + 2.74391837181314E+02; + } else { + return -2.41701581027554E+02 * x + 2.12527667984095E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_OrRd +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Oranges.metal b/colormap-shaders/shaders/metal/IDL_CB-Oranges.metal new file mode 100644 index 0000000..3e6ba3d --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Oranges.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Oranges { + +float colormap_red(float x) { + if (x < 0.4798405468463898) { + return 255.0; + } else if (x < 0.7629524491886985) { + return (-3.67617638383468E+02 * x + 3.17332748024787E+02) * x + 1.85373720793787E+02; + } else { + return (3.68357233392831E+02 * x - 1.00617951362078E+03) * x + 7.66695019519326E+02; + } +} + +float colormap_green(float x) { + if (x < 0.748539247687408) { + return (((-8.92644295264035E+01 * x + 3.93421870424412E+02) * x - 4.73834129104390E+02) * x - 5.60962544745416E+01) * x + 2.43354168263028E+02; + } else { + return (1.06683260838348E+02 * x - 3.18020138166420E+02) * x + 2.51126712492908E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.76) { + return ((7.32034492098544E+02 * x - 7.55283914444663E+02) * x - 1.53168890861198E+02) * x + 2.33567667053916E+02; + } else { + return 1.23702752385982E+01 * x - 8.09423081765692E+00; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Oranges +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PRGn.metal b/colormap-shaders/shaders/metal/IDL_CB-PRGn.metal new file mode 100644 index 0000000..0f91f6f --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PRGn.metal @@ -0,0 +1,51 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PRGn { + +float colormap_red(float x) { + if (x < 0.09963276982307434) { + return 5.56064615384614E+02 * x + 6.34200000000000E+01; + } else if (x < 0.4070911109447479) { + return ((-1.64134573262743E+03 * x + 1.26126075878571E+03) * x + 8.30228593437549E+01) * x + 9.96536529647110E+01; + } else if (x < 0.5013306438922882) { + return 1.64123076923114E+02 * x + 1.64926153846145E+02; + } else if (x < 0.9049346148967743) { + return ((((-4.17783076764345E+04 * x + 1.55735420068591E+05) * x - 2.27018068370619E+05) * x + 1.61149115838926E+05) * x - 5.60588504546212E+04) * x + 7.93919652573346E+03; + } else { + return -2.67676923076906E+02 * x + 2.68590769230752E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1011035144329071) { + return 4.30627692307691E+02 * x - 1.56923076923038E-01; + } else if (x < 0.5013851821422577) { + return ((2.21240993583109E+02 * x - 7.23499016773187E+02) * x + 8.74292145995924E+02) * x - 3.78460594811949E+01; + } else { + return ((((-8.82260255008935E+03 * x + 3.69735516719018E+04) * x - 5.94940784200438E+04) * x + 4.54236515662453E+04) * x - 1.66043372157228E+04) * x + 2.59449114260420E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.50031378865242) { + return ((((1.32543265346288E+04 * x - 1.82876583834065E+04) * x + 9.17087085537958E+03) * x - 2.45909850441496E+03) * x + 7.42893247681885E+02) * x + 7.26668497072812E+01; + } else if (x < 0.609173446893692) { + return -3.50141636141726E+02 * x + 4.22147741147797E+02; + } else { + return ((1.79776073728688E+03 * x - 3.80142452792079E+03) * x + 2.10214624189039E+03) * x - 6.74426111651015E+01; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PRGn +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Paired.metal b/colormap-shaders/shaders/metal/IDL_CB-Paired.metal new file mode 100644 index 0000000..18523d3 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Paired.metal @@ -0,0 +1,91 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Paired { + +float colormap_red(float x) { + if (x < 0.0906416957946237) { + return -1.48766695652174E+03 * x + 1.65896666666667E+02; + } else if (x < 0.181137969063194) { + return 1.62263833992095E+03 * x - 1.16026679841898E+02; + } else if (x < 0.2716806139960391) { + return -1.40227075098820E+03 * x + 4.31899209486178E+02; + } else if (x < 0.3621693275308975) { + return 2.21145652173927E+03 * x - 5.49880434782653E+02; + } else if (x < 0.4514347780510689) { + return -2.73075098814252E+02 * x + 3.49940711462467E+02; + } else if (x < 0.5478389816716595) { + return 2.75424347826088E+02 * x + 1.02328985507251E+02; + } else if (x < 0.6384253260915684) { + return 1.95770750987722E+01 * x + 2.42492094861655E+02; + } else if (x < 0.7280391465804739) { + return -5.92081027667844E+02 * x + 6.32990118576982E+02; + } else if (x < 0.8191050219893012) { + return -1.05189130434770E+03 * x + 9.67749999999916E+02; + } else if (x < 0.9092300295745469) { + return 1.64974505928811E+03 * x - 1.24517391304309E+03; + } else { + return -8.20731225296366E+02 * x + 1.00105731225287E+03; + } +} + +float colormap_green(float x) { + if (x < 0.09069203671589791) { + return -9.49076521739127E+02 * x + 2.05970000000000E+02; + } else if (x < 0.1811205395903491) { + return 1.14400395256917E+03 * x + 1.61442687747026E+01; + } else if (x < 0.271076794014141) { + return -7.04272727272755E+02 * x + 3.50905138339931E+02; + } else if (x < 0.3618506954718166) { + return -6.35000000000221E+01 * x + 1.77206521739141E+02; + } else if (x < 0.4527247821743651) { + return -1.40603557312254E+03 * x + 6.63003952569178E+02; + } else if (x < 0.5472660653935183) { + return 1.73713913043494E+03 * x - 7.59989130434857E+02; + } else if (x < 0.6379975539161487) { + return -7.00507905138483E+02 * x + 5.74052371541584E+02; + } else if (x < 0.7283304980067641) { + return 5.64723320158019E+02 * x - 2.33162055335916E+02; } else if (x < 0.8189077039268755) { + return -1.29283992094844E+03 * x + 1.11975790513821E+03; } else if (x < 0.9094178747563795) { + return 2.14293675889271E+03 * x - 1.69382608695601E+03; + } else { + return -1.75290118577070E+03 * x + 1.84911857707505E+03; + } +} + +float colormap_blue(float x) { + if (x < 0.1835817221386023) { + return -4.93278367346940E+02 * x + 2.25853877551021E+02; + } else if (x < 0.2718482976477959) { + return -1.04124223602495E+03 * x + 3.26450028232661E+02; + } else if (x < 0.3623519200472859) { + return 1.21151976284592E+03 * x - 2.85959486166031E+02; + } else if (x < 0.4526344257525674) { + return -1.38645849802374E+03 * x + 6.55422924901199E+02; + } else if (x < 0.5474992417588231) { + return 8.80275652173975E+02 * x - 3.70578985507278E+02; + } else if (x < 0.6375259518892261) { + return -1.24038339920972E+03 * x + 7.90480237154278E+02; + } else if (x < 0.7280438873117513) { + return 2.36255138339872E+03 * x - 1.50648418972297E+03; + } else if (x < 0.8192397843702398) { + return -6.51816205533491E+02 * x + 6.88107707509788E+02; + } else if (x < 0.9092328860678134) { + return -1.35533596837590E+01 * x + 1.65217391304318E+02; + } else { + return -1.19420158102770E+03 * x + 1.23870158102770E+03; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Paired +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Pastel1.metal b/colormap-shaders/shaders/metal/IDL_CB-Pastel1.metal new file mode 100644 index 0000000..0fdf880 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Pastel1.metal @@ -0,0 +1,75 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Pastel1 { + +float colormap_red(float x) { + if (x < 0.122867923365625) { + return -5.81788489736069E+02 * x + 2.50471590909091E+02; + } else if (x < 0.2449046174927113) { + return 1.99984352773830E+02 * x + 1.54416785206258E+02; + } else if (x < 0.3729729104526915) { + return 1.43786086956516E+02 * x + 1.68180000000001E+02; + } else if (x < 0.5011116081610979) { + return 2.52012802275928E+02 * x + 1.27814366998585E+02; + } else if (x < 0.6239282365941264) { + return 7.85450500555661E+00 * x + 2.50164923989616E+02; + } else if (x < 0.7520403577351265) { + return -2.00555718475049E+02 * x + 3.80197947214058E+02; + } else if (x < 0.8796535309192707) { + return 1.86622408963526E+02 * x + 8.90243697479360E+01; + } else { + return -9.30674082313196E+01 * x + 3.35054505005547E+02; + } +} + +float colormap_green(float x) { + if (x < 0.2498801528138394) { + return 2.21725710445469E+02 * x + 1.79002480158730E+02; + } else if (x < 0.3735167574956272) { + return -2.52975806451616E+02 * x + 2.97620967741935E+02; + } else if (x < 0.5007872003710714) { + return 1.09439266615749E+02 * x + 1.62252864782272E+02; + } else if (x < 0.6262274652716027) { + return 3.02956451612894E+02 * x + 6.53419354838611E+01; + } else if (x < 0.752848702686641) { + return -3.10470307917895E+02 * x + 4.49486620234600E+02; + } else if (x < 0.8827503622135592) { + return 2.27675070027963E+01 * x + 1.98608963585427E+02; + } else { + return 1.95678708265011E+02 * x + 4.59715380404256E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1232989588096424) { + return 4.29695747800585E+02 * x + 1.74153409090909E+02; + } else if (x < 0.2476314320040304) { + return -2.40499266862156E+02 * x + 2.56787756598238E+02; + } else if (x < 0.3742360961829455) { + return 2.41095161290329E+02 * x + 1.37529838709676E+02; + } else if (x < 0.4998594481260504) { + return -4.90936497326148E+02 * x + 4.11482508912633E+02; + } else if (x < 0.6256351261233096) { + return 2.96955882352941E+02 * x + 1.76470588235230E+01; + } else if (x < 0.7525509527474964) { + return -1.11771301446066E+02 * x + 2.73361142009640E+02; + } else if (x < 0.8785969154660433) { + return 3.73063712757765E+02 * x - 9.15019098547990E+01; + } else { + return 4.55448275862047E+01 * x + 1.96255172413811E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Pastel1 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Pastel2.metal b/colormap-shaders/shaders/metal/IDL_CB-Pastel2.metal new file mode 100644 index 0000000..9675125 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Pastel2.metal @@ -0,0 +1,69 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Pastel2 { + +float colormap_red(float x) { + if (x < 0.1414470427532423) { + return 5.23716927453769E+02 * x + 1.79102418207681E+02; + } else if (x < 0.2832126252873305) { + return -3.55011583011593E+02 * x + 3.03395967395968E+02; + } else if (x < 0.4293789173286286) { + return 2.81737389211071E+02 * x + 1.23060619323778E+02; + } else if (x < 0.5703484841123749) { + return -9.85406162465110E+01 * x + 2.86343977591045E+02; + } else if (x < 0.7170614267751989) { + return 1.69092460881909E+02 * x + 1.33699857752520E+02; + } else if (x < 0.859829619768543) { + return -9.94710581026121E+01 * x + 3.26276397855329E+02; + } else { + return -2.57056149732620E+02 * x + 4.61772727272750E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1411063922737659) { + return -1.49220483641537E+02 * x + 2.26007112375533E+02; + } else if (x < 0.2816283290590322) { + return 5.77629343629288E+01 * x + 1.96800429000430E+02; + } else if (x < 0.4291887492428612) { + return -7.38876244665610E+01 * x + 2.33876955903267E+02; + } else if (x < 0.571830104540257) { + return 3.01873399715509E+02 * x + 7.26045519203479E+01; + } else if (x < 0.7190262682310248) { + return -2.25206477732972E+01 * x + 2.58102834008109E+02; + } else if (x < 0.8491803538380496) { + return -1.16468292682893E+02 * x + 3.25653658536549E+02; + } else { + return -1.44447728516695E+02 * x + 3.49413245758086E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1425168965591466) { + return -2.26903238866400E+02 * x + 2.04742307692308E+02; + } else if (x < 0.2851292529683606) { + return 4.18120091673021E+02 * x + 1.12815584415585E+02; + } else if (x < 0.4319360871262316) { + return -3.09335813546247E+01 * x + 2.40853922748656E+02; + } else if (x < 0.7146533590447866) { + return -1.88956299440485E+02 * x + 3.09109637275714E+02; + } else if (x < 0.8619542566532371) { + return 2.06196082722327E+02 * x + 2.67126600285119E+01; + } else { + return -6.48097784562050E+00 * x + 2.10030557677552E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Pastel2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PiYG.metal b/colormap-shaders/shaders/metal/IDL_CB-PiYG.metal new file mode 100644 index 0000000..01f8832 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PiYG.metal @@ -0,0 +1,55 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PiYG { + +float colormap_red(float x) { + if (x < 0.09843078255653381) { + return 5.57627692307694E+02 * x + 1.42135384615385E+02; + } else if (x < 0.4093809425830841) { + return ((-4.21748915649019E+02 * x + 1.28054196831998E+01) * x + 2.64504106766935E+02) * x + 1.71265909327078E+02; + } else if (x < 0.5037343473981705) { + return -6.54538461538185E+01 * x + 2.79554615384612E+02; + } else if (x < 0.5982368290424347) { + return -1.66852258852308E+02 * x + 3.30632478632496E+02; + } else { + return ((1.82001891024969E+03 * x - 4.20447326861499E+03) * x + 2.68838861198902E+03) * x - 2.62418693972160E+02; + } +} + +float colormap_green(float x) { + if (x < 0.101902037858963) { + return 2.72322735042735E+02 * x + 5.21367521367536E-01; + } else if (x < 0.5059849917888641) { + return ((6.81035433115437E+02 * x - 1.71408042362240E+03) * x + 1.36671536460816E+03) * x - 9.39210546594673E+01; + } else if (x < 0.5954320132732391) { + return -2.72768472906136E+01 * x + 2.60800985221660E+02; + } else { + return ((1.09164194296742E+03 * x - 3.01508808799416E+03) * x + 2.33004497173996E+03) * x - 3.04306745740377E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.5011215507984161) { + return (((((-3.44764954376220E+04 * x + 6.98813026428223E+04) * x - 4.87748659515380E+04) * x + 1.31832279253005E+04) * x - 1.26691288614273E+03) * x + 4.73465709444135E+02) * x + 8.21916531938477E+01; + } else if (x < 0.5958432303492089) { + return -3.80379731379794E+02 * x + 4.37472934472961E+02; + } else if (x < 0.790071576833725) { + return -7.13383710407293E+02 * x + 6.35891101055846E+02; + } else { + return (1.19760697610430E+03 * x - 2.36001183205723E+03) * x + 1.18928322234544E+03; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PiYG +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PuBu.metal b/colormap-shaders/shaders/metal/IDL_CB-PuBu.metal new file mode 100644 index 0000000..a996462 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PuBu.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PuBu { + +float colormap_red(float x) { + if (x < 0.7520372909206926) { + return (((9.68615208861418E+02 * x - 1.16097242960380E+03) * x + 1.06173672031378E+02) * x - 1.68616613530379E+02) * x + 2.56073136099945E+02; + } else { + return -1.20830453148990E+01 * x + 1.44337397593436E+01; + } +} + +float colormap_green(float x) { + if (x < 0.7485333535031721) { + return (((-4.58537247030064E+02 * x + 5.67323181593790E+02) * x - 2.56714665792882E+02) * x - 1.14205365680507E+02) * x + 2.47073841488433E+02; + } else { + return ((-2.99774273328017E+02 * x + 4.12147041403012E+02) * x - 2.49880079288168E+02) * x + 1.93578601034431E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.7628468501376879) { + return ((-5.44257972228224E+01 * x + 2.70890554876532E+01) * x - 9.12766750739247E+01) * x + 2.52166182860177E+02; + } else { + return (((4.55621137729287E+04 * x - 1.59960900638524E+05) * x + 2.09530452721547E+05) * x - 1.21704642900945E+05) * x + 2.66644674068694E+04; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PuBu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PuBuGn.metal b/colormap-shaders/shaders/metal/IDL_CB-PuBuGn.metal new file mode 100644 index 0000000..474e650 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PuBuGn.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PuBuGn { + +float colormap_red(float x) { + if (x < 0.4874515235424042) { + return ((-4.67299169932026E+02 * x - 9.61558801325737E+01) * x - 1.42239969624745E+02) * x + 2.55174176214321E+02; + } else if (x < 0.7547346238979944) { + return -4.01060227272736E+02 * x + 3.04365078671334E+02; + } else { + return -4.15773809523774E+00 * x + 4.80902777777746E+0; + } +} + +float colormap_green(float x) { + if (x < 0.6119840443134308) { + return ((-1.86575654193875E+02 * x + 1.34788465541787E+02) * x - 1.76719831637092E+02) * x + 2.46604381236178E+02; + } else { + return ((-8.15961797068245E+02 * x + 1.63871690240040E+03) * x - 1.21797539379991E+03) * x + 4.64835362086844E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.626910001039505) { + return (((1.51117885576561E+02 * x - 3.02884959951043E+02) * x + 1.53322134227491E+02) * x - 1.09362189530744E+02) * x + 2.51508758745276E+02; + } else { + return ((6.51665430892026E+02 * x - 1.29049314879284E+03) * x + 4.20233542130992E+02) * x + 2.75096926634035E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PuBuGn +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PuOr.metal b/colormap-shaders/shaders/metal/IDL_CB-PuOr.metal new file mode 100644 index 0000000..f6729fa --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PuOr.metal @@ -0,0 +1,53 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PuOr { + +float colormap_red(float x) { + if (x < 0.3021800816059113) { + return ((-8.74206463186070E+02 * x - 1.85426300850231E+02) * x + 5.51285275571572E+02) * x + 1.26643739338646E+02; + } else if (x < 0.5021429359912872) { + return (-3.88346609612054E+02 * x + 2.84470703793855E+02) * x + 2.01677105728121E+02; + } else { + return ((((-1.46535873909592E+04 * x + 5.53022453680932E+04) * x - 8.13970779339075E+04) * x + 5.81771336215697E+04) * x - 2.05245461242988E+04) * x + 3.14144977294882E+03; + } +} + +float colormap_green(float x) { + if (x < 0.05763718485832214) { + return 2.95595213675214E+02 * x + 5.90683760683760E+01; + } else if (x < 0.5007581412792206) { + return ((((2.62405984206199E+04 * x - 3.27451861162955E+04) * x + 1.22107381531950E+04) * x - 1.00838782028235E+03) * x + 2.70642765981150E+02) * x + 6.36961934872237E+01; + } else if (x < 0.8994744718074799) { + return ((-2.60499440597370E+02 * x - 1.69367458674853E+02) * x + 1.12913289561831E+02) * x + 2.65534872970494E+02; + } else { + return -3.86892551892486E+02 * x + 3.88498371998310E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09708546522206818) { + return -2.18830769230769E+01 * x + 8.03384615384615E+00; + } else if (x < 0.2041181623935699) { + return 1.36731800766284E+02 * x - 7.36535303776692E+00; + } else if (x < 0.4982341825962067) { + return (-3.57661007879491E+02 * x + 1.02135850891279E+03) * x - 1.73032069862183E+02; + } else if (x < 0.6063862144947052) { + return -1.17230769230812E+02 * x + 3.05467236467253E+02; + } else { + return (((((6.76307238761902E+05 * x - 3.23892241330779E+06) * x + 6.41842651908440E+06) * x - 6.73646783203943E+06) * x + 3.94913439210334E+06) * x - 1.22625641797298E+06) * x + 1.57856249228480E+05; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PuOr +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-PuRd.metal b/colormap-shaders/shaders/metal/IDL_CB-PuRd.metal new file mode 100644 index 0000000..61785bc --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-PuRd.metal @@ -0,0 +1,49 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_PuRd { + +float colormap_red(float x) { + if (x < 25.0 / 254.0) { + return -1.41567647058826E+02 * x + 2.46492647058824E+02; + } else if (x < 0.3715468440779919) { + return (1.64817020395145E+02 * x - 2.01032852327719E+02) * x + 2.52820173539371E+02; + } else if (x < 0.6232413065898157) { + return (((2.61012828741073E+04 * x - 5.18905872811356E+04) * x + 3.78968358931486E+04) * x - 1.19124127524292E+04) * x + 1.55945779375675E+03; + } else if (x < 0.7481208809057023) { + return -2.02469919786095E+02 * x + 3.57739416221033E+02; + } else { + return -4.08324020737294E+02 * x + 5.11743167562695E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1303350956955242) { + return -1.59734759358287E+02 * x + 2.44376470588235E+02; + } else if (x < 0.6227215280200861) { + return (((1.21347373400442E+03 * x - 2.42854832541048E+03) * x + 1.42039752537243E+03) * x - 6.27806679597789E+02) * x + 2.86280758506240E+02; + } else { + return (1.61877993987291E+02 * x - 4.06294499392671E+02) * x + 2.32401278080262E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.7508644163608551) { + return ((((2.96852143551409E+03 * x - 6.12155011029541E+03) * x + 4.21719423212110E+03) * x - 1.29520280960574E+03) * x + 2.78723913454450E+01) * x + 2.47133504519275E+02; + } else { + return ((-6.55064010825706E+02 * x + 1.23635622822904E+03) * x - 8.68481725874416E+02) * x + 3.18158180572088E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_PuRd +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Purples.metal b/colormap-shaders/shaders/metal/IDL_CB-Purples.metal new file mode 100644 index 0000000..721d8e5 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Purples.metal @@ -0,0 +1,33 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Purples { + +float colormap_red(float x) { + return (((-3.03160346735036E+02 * x + 7.95537661771755E+02) * x - 6.68077287777559E+02) * x - 9.83523581613554E+00) * x + 2.49241870138829E+02; +} + +float colormap_green(float x) { + if (x < 0.6238275468349457) { + return ((((-1.64962450015544E+03 * x + 3.91401450219750E+03) * x - 2.81559997409582E+03) * x + 5.71903768479824E+02) * x - 1.63510103061329E+02) * x + 2.52440721674553E+02; + } else { + return (8.00008172182588E+01 * x - 4.62535128626795E+02) * x + 3.83781070034667E+02; + } +} + +float colormap_blue(float x) { + return (((((1.42855146044492E+03 * x - 4.10835541903972E+03) * x + 4.43536620247364E+03) * x - 2.15825854188203E+03) * x + 3.66481133684515E+02) * x - 9.02285603303462E+01) * x + 2.53802694290353E+02; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Purples +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-RdBu.metal b/colormap-shaders/shaders/metal/IDL_CB-RdBu.metal new file mode 100644 index 0000000..d577736 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-RdBu.metal @@ -0,0 +1,69 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_RdBu { + +float colormap_red(float x) { + if (x < 0.09771832105856419) { + return 7.60263247863246E+02 * x + 1.02931623931624E+02; + } else if (x < 0.3017162107441106) { + return (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + 1.37642085716717E+02; + } else if (x < 0.4014205790737471) { + return 8.67103448276151E+01 * x + 2.18034482758611E+02; + } else if (x < 0.5019932233215039) { + return -6.15461538461498E+01 * x + 2.77547692307680E+02; + } else if (x < 0.5969483882550937) { + return -3.77588522588624E+02 * x + 4.36198819698878E+02; + } else if (x < 0.8046060096654594) { + return (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + 3.17674951640855E+02; + } else { + return -3.08431855203590E+02 * x + 3.12956742081421E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09881640500975222) { + return 2.41408547008547E+02 * x + 3.50427350427364E-01; + } else if (x < 0.5000816285610199) { + return ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + 1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) * x - 4.82944517518776E+01; + } else if (x < 0.8922355473041534) { + return (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + 1.45172137257997E+04) * x - 5.80944127411621E+03) * x + 1.12477959061948E+03; + } else { + return -5.28313797313699E+02 * x + 5.78459299959206E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1033699568661857) { + return 1.30256410256410E+02 * x + 3.08518518518519E+01; + } else if (x < 0.2037526071071625) { + return 3.38458128078815E+02 * x + 9.33004926108412E+00; + } else if (x < 0.2973267734050751) { + return (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - 3.81852747252658E+01; + } else if (x < 0.4029109179973602) { + return 6.68959706959723E+02 * x - 7.00740740740798E+01; + } else if (x < 0.5006715489526758) { + return 4.87348695652202E+02 * x + 3.09898550724286E+00; + } else if (x < 0.6004396902588283) { + return -6.85799999999829E+01 * x + 2.81436666666663E+02; + } else if (x < 0.702576607465744) { + return -1.81331701891043E+02 * x + 3.49137263626287E+02; + } else if (x < 0.9010407030582428) { + return (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + 5.26198653917172E+02; + } else { + return -7.36990769230737E+02 * x + 8.36652307692262E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_RdBu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-RdGy.metal b/colormap-shaders/shaders/metal/IDL_CB-RdGy.metal new file mode 100644 index 0000000..383a350 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-RdGy.metal @@ -0,0 +1,69 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_RdGy { + +float colormap_f(float x) { + if (x < 0.8110263645648956) { + return (((4.41347880412638E+03 * x - 1.18250308887283E+04) * x + 1.13092070303101E+04) * x - 4.94879610401395E+03) * x + 1.10376673162241E+03; + } else { + return (4.44045986053970E+02 * x - 1.34196160353499E+03) * x + 9.26518306556645E+02; + } +} + +float colormap_red(float x) { + if (x < 0.09384074807167053) { + return 7.56664615384615E+02 * x + 1.05870769230769E+02; + } else if (x < 0.3011957705020905) { + return (-2.97052932130813E+02 * x + 4.43575866219751E+02) * x + 1.37867123966178E+02; + } else if (x < 0.3963058760920129) { + return 8.61868131868288E+01 * x + 2.18562881562874E+02; + } else if (x < 0.5) { + return 2.19915384615048E+01 * x + 2.44003846153861E+02; + } else { + return colormap_f(x); + } +} + +float colormap_green(float x) { + if (x < 0.09568486400411116) { + return 2.40631111111111E+02 * x + 1.26495726495727E+00; + } else if (x < 0.2945883673263987) { + return 7.00971783488427E+02 * x - 4.27826773670273E+01; + } else if (x < 0.3971604611945229) { + return 5.31775726495706E+02 * x + 7.06051282052287E+00; + } else if (x < 0.5) { + return 3.64925470085438E+02 * x + 7.33268376068493E+01; + } else { + return colormap_f(x); + } +} + +float colormap_blue(float x) { + if (x < 0.09892375498249567) { + return 1.30670329670329E+02 * x + 3.12116402116402E+01; + } else if (x < 0.1985468629735229) { + return 3.33268034188035E+02 * x + 1.11699145299146E+01; + } else if (x < 0.2928770209555256) { + return 5.36891330891336E+02 * x - 2.92588522588527E+01; + } else if (x < 0.4061551302245808) { + return 6.60915763546766E+02 * x - 6.55827586206742E+01; + } else if (x < 0.5) { + return 5.64285714285700E+02 * x - 2.63359683794383E+01; + } else { + return colormap_f(x); + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_RdGy +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-RdPu.metal b/colormap-shaders/shaders/metal/IDL_CB-RdPu.metal new file mode 100644 index 0000000..534a8b5 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-RdPu.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_RdPu { + +float colormap_red(float x) { + if (x < 0.4668049514293671) { + return -1.36007661451525E+01 * x + 2.54876081825334E+02; + } else { + return ((9.11043267377652E+02 * x - 2.27422817830303E+03) * x + 1.47691217772832E+03) * x - 3.80041369120933E+01; + } +} + +float colormap_green(float x) { + return ((((-2.12978937384858E+03 * x + 5.05211767883971E+03) * x - 3.95843947196006E+03) * x + 9.49632208843715E+02) * x - 2.70366761763812E+02) * x + 2.48595803511253E+02; +} + +float colormap_blue(float x) { + if (x < 0.2484821379184723) { + return ((1.12923860577866E+02 * x - 2.02431339810602E+02) * x - 1.60306874714734E+02) * x + 2.42581612831587E+02; + } else if (x < 0.5019654333591461) { + return (-2.24073120483401E+02 * x + 4.46032892337713E+01) * x + 1.94733826112356E+02; + } else if (x < 0.7505462467670441) { + return (-4.08932859712077E+02 * x + 3.70448937862306E+02) * x + 7.77495522761299E+01; + } else { + return (-1.99803137524475E+02 * x + 2.71497008797383E+02) * x + 3.42106616941255E+01; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_RdPu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-RdYiBu.metal b/colormap-shaders/shaders/metal/IDL_CB-RdYiBu.metal new file mode 100644 index 0000000..d1e3130 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-RdYiBu.metal @@ -0,0 +1,67 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_RdYiBu { + +float colormap_red(float x) { + if (x < 0.09790863520700754) { + return 5.14512820512820E+02 * x + 1.64641025641026E+02; + } else if (x < 0.2001887081633112) { + return 2.83195402298854E+02 * x + 1.87288998357964E+02; + } else if (x < 0.3190117539655621) { + return 9.27301587301214E+01 * x + 2.25417989417999E+02; + } else if (x < 0.500517389125164) { + return 255.0; + } else if (x < 0.6068377196788788) { + return -3.04674876847379E+02 * x + 4.07495073891681E+02; + } else if (x < 0.9017468988895416) { + return (1.55336390191951E+02 * x - 7.56394659038288E+02) * x + 6.24412733169483E+02; + } else { + return -1.88350769230735E+02 * x + 2.38492307692292E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09638568758964539) { + return 4.81427692307692E+02 * x + 4.61538461538488E-01; + } else if (x < 0.4987066686153412) { + return ((((3.25545903568267E+04 * x - 4.24067109461319E+04) * x + 1.83751375886345E+04) * x - 3.19145329617892E+03) * x + 8.08315127034676E+02) * x - 1.44611527812961E+01; + } else if (x < 0.6047312345537269) { + return -1.18449917898218E+02 * x + 3.14234811165860E+02; + } else if (x < 0.7067635953426361) { + return -2.70822112753102E+02 * x + 4.06379036672115E+02; + } else { + return (-4.62308723214883E+02 * x + 2.42936159122279E+02) * x + 2.74203431802418E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09982818011951204) { + return 1.64123076923076E+01 * x + 3.72646153846154E+01; + } else if (x < 0.2958717460833126) { + return 2.87014675052409E+02 * x + 1.02508735150248E+01; + } else if (x < 0.4900527540014758) { + return 4.65475113122167E+02 * x - 4.25505279034673E+01; + } else if (x < 0.6017014681258838) { + return 5.61032967032998E+02 * x - 8.93789173789407E+01; + } else if (x < 0.7015737100463595) { + return -1.51655677655728E+02 * x + 3.39446886446912E+02; + } else if (x < 0.8237156500567735) { + return -2.43405347593559E+02 * x + 4.03816042780725E+02; + } else { + return -3.00296889157305E+02 * x + 4.50678495922638E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_RdYiBu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-RdYiGn.metal b/colormap-shaders/shaders/metal/IDL_CB-RdYiGn.metal new file mode 100644 index 0000000..f2cda72 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-RdYiGn.metal @@ -0,0 +1,69 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_RdYiGn { + +float colormap_red(float x) { + if (x < 0.09825118520770205) { + return 5.07556923076926E+02 * x + 1.64923076923077E+02; + } else if (x < 0.2009111350471108) { + return 2.86362637362647E+02 * x + 1.86655677655676E+02; + } else if (x < 0.2994418666360456) { + return 8.90415982485030E+01 * x + 2.26299671592774E+02; + } else if (x < 0.5001300871372223) { + return 9.81627851140242E+00 * x + 2.50023049219689E+02; + } else if (x < 0.9039205014705658) { + return ((-3.30848798119696E+01 * x - 5.65722561191396E+02) * x + 2.78046782759626E+02) * x + 2.61515979057614E+02; + } else { + return -2.53583846153761E+02 * x + 2.55396153846073E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1105575469849737) { + return 4.79433455433456E+02 * x + 3.65079365079361E-01; + } else if (x < 0.3151890079472769) { + return 6.25896582484846E+02 * x - 1.58275246854709E+01; + } else if (x < 0.4023888287265409) { + return 4.80700000000005E+02 * x + 2.99368421052611E+01; + } else if (x < 0.5007980763912201) { + return 3.22042124542111E+02 * x + 9.37789987790044E+01; + } else if (x < 0.9266376793384552) { + return ((-2.91150627193739E+02 * x + 2.73891595228739E+02) * x - 1.97954551648389E+02) * x + 3.22069054828072E+02; + } else { + return -4.70385384615211E+02 * x + 5.78034615384465E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1007720845701718) { + return 1.66813186813184E+01 * x + 3.72910052910053E+01; + } else if (x < 0.2891807195246389) { + return 2.86155895159223E+02 * x + 1.01354904806627E+01; + } else if (x < 0.4061884871072265) { + return 4.02182758620675E+02 * x - 2.34172413793071E+01; + } else if (x < 0.5018816861329155) { + return 5.35500000000025E+02 * x - 7.75691699604942E+01; + } else if (x < 0.604070194492165) { + return -5.10170329670400E+02 * x + 4.47233618233660E+02; + } else if (x < 0.7060918916718424) { + return -3.26878215654109E+02 * x + 3.36512315270959E+02; + } else if (x < 0.812819402403008) { + return -6.62557264957455E+01 * x + 1.52488888888906E+02; + } else { + return -2.16444081632622E+02 * x + 2.74564897959153E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_RdYiGn +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Reds.metal b/colormap-shaders/shaders/metal/IDL_CB-Reds.metal new file mode 100644 index 0000000..dee897c --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Reds.metal @@ -0,0 +1,37 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Reds { + +float colormap_red(float x) { + if (x < 0.7109796106815338) { + return (((-9.58108609441667E+02 * x + 8.89060620527714E+02) * x - 2.42747192807495E+02) * x + 9.97906310565304E+00) * x + 2.54641252219400E+02; + } else { + return ((-9.93985373158007E+02 * x + 1.96524174972026E+03) * x - 1.54068189744713E+03) * x + 6.72947219603874E+02; + } +} + +float colormap_green(float x) { + if (x < 0.7679868638515472) { + return ((((2.66433610509335E+03 * x - 5.05488641558587E+03) * x + 3.69542277742922E+03) * x - 1.36931912848446E+03) * x - 5.12669839132577E+01) * x + 2.41929417192750E+02; + } else { + return (-2.11738816337853E+02 * x + 2.78333107855597E+02) * x - 6.66958752910143E+01; + } +} + +float colormap_blue(float x) { + return (((-6.83475279000297E+02 * x + 1.55250107598171E+03) * x - 9.25799053039285E+02) * x - 1.67380812671938E+02) * x + 2.37145226675143E+02; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Reds +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Set1.metal b/colormap-shaders/shaders/metal/IDL_CB-Set1.metal new file mode 100644 index 0000000..9e48ab4 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Set1.metal @@ -0,0 +1,75 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Set1 { + +float colormap_red(float x) { + if (x < 0.1218978105733187) { + return -1.41278189149560E+03 * x + 2.27681818181818E+02; + } else if (x < 0.2479420725675653) { + return 1.71483957219249E+02 * x + 3.45632798573976E+01; + } else if (x < 0.3737958863310976) { + return 5.93826871657766E+02 * x - 7.01532976827142E+01; + } else if (x < 0.5581935583402973) { + return 8.16999193548379E+02 * x - 1.53574193548385E+02; + } else if (x < 0.7521306441106583) { + return -7.03338903743339E+02 * x + 6.95068738859197E+02; + } else if (x < 0.8778625049273406) { + return 6.43286656891390E+02 * x - 3.17769611436878E+02; + } else { + return -7.44200222469495E+02 * x + 9.00253096032687E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1210132014777112) { + return 8.22324999999999E+02 * x + 2.59536290322581E+01; + } else if (x < 0.2482778857828818) { + return 3.90762700534761E+02 * x + 7.81783645276292E+01; + } else if (x < 0.3736981279637023) { + return -7.75174853372465E+02 * x + 3.67654875366580E+02; + } else if (x < 0.5000834495110191) { + return 3.88169354838696E+02 * x - 6.70846774193464E+01; + } else if (x < 0.6259565510341616) { + return 1.01632587976547E+03 * x - 3.81215359237582E+02; + } else if (x < 0.7519260802219788) { + return -1.34046122994658E+03 * x + 1.09403097147954E+03; + } else if (x < 0.8802211108953331) { + return 3.40231932773057E+02 * x - 1.69726050420116E+02; + } else { + return 1.89186206896551E+02 * x - 3.67724137931057E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1216936022984158) { + return 1.28638709677419E+03 * x + 2.74375000000001E+01; + } else if (x < 0.2481802512682617) { + return -8.68609237536630E+02 * x + 2.89686766862165E+02; + } else if (x < 0.3738953463082063) { + return 7.06041788856318E+02 * x - 1.01110520527863E+02; + } else if (x < 0.499829701274646) { + return -1.29118218475062E+03 * x + 6.45642228738955E+02; + } else if (x < 0.6262008893543518) { + return 3.99252005347605E+02 * x - 1.99286987522289E+02; + } else if (x < 0.752318389825417) { + return -8.38814516128947E+01 * x + 1.03251612903218E+02; + } else if (x < 0.8779851862270176) { + return 1.20109970674463E+03 * x - 8.63463343108315E+02; + } else { + return -3.03613348164648E+02 * x + 4.57652428624434E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Set1 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Set2.metal b/colormap-shaders/shaders/metal/IDL_CB-Set2.metal new file mode 100644 index 0000000..20bc98f --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Set2.metal @@ -0,0 +1,71 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Set2 { + +float colormap_red(float x) { + if (x < 0.1417230259672803) { + return 1.05935704125178E+03 * x + 1.01981507823613E+02; + } else if (x < 0.2832918395614404) { + return -7.84521574205797E+02 * x + 3.63301564722620E+02; + } else if (x < 0.4297095252306736) { + return 6.13507692307669E+02 * x - 3.27487179487109E+01; + } else if (x < 0.5711437760817145) { + return -4.56971171171184E+02 * x + 4.27246246246258E+02; + } else if (x < 0.7170125543394245) { + return 6.08443812233345E+02 * x - 1.81258890469442E+02; + } else if (x < 0.8601498726198596) { + return -1.86129554655803E+02 * x + 3.88460188933823E+02; + } else { + return -3.44927731092377E+02 * x + 5.25050420168008E+02; + } +} + +float colormap_green(float x) { + if (x < 0.1415748781045371) { + return -3.73352299668090E+02 * x + 1.93944523470839E+02; + } else if (x < 0.2833646736626308) { + return 1.32720720720722E+02 * x + 1.22297297297298E+02; + } else if (x < 0.4289465541806786) { + return -1.49887515045407E+02 * x + 2.02378487799539E+02; + } else if (x < 0.5702226800496928) { + return 5.49972024656235E+02 * x - 9.78238501659562E+01; + } else if (x < 0.7146023128494844) { + return 8.99797570850851E+00 * x + 2.10651821862350E+02; + } else if (x < 0.8745816247778255) { + return -1.44022832980902E+02 * x + 3.20000845665901E+02; + } else { + return -1.15363546797967E+02 * x + 2.94935960591057E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1415014758409641) { + return -4.74217638691322E+02 * x + 1.65038406827880E+02; + } else if (x < 0.2835702564175819) { + return 7.39899952584171E+02 * x - 6.76102418207873E+00; + } else if (x < 0.4295821637397355) { + return -5.64243717401478E+01 * x + 2.19052868658126E+02; + } else if (x < 0.5693521153970126) { + return -7.86119327731098E+02 * x + 5.32516806722689E+02; + } else if (x < 0.7156505014449713) { + return -2.61647700331917E+02 * x + 2.33907776197252E+02; + } else if (x < 0.858726752429748) { + return 7.09638034795805E+02 * x - 4.61193347193250E+02; + } else { + return 2.09176470588245E+02 * x - 3.14336134453805E+01; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Set2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Set3.metal b/colormap-shaders/shaders/metal/IDL_CB-Set3.metal new file mode 100644 index 0000000..d08243b --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Set3.metal @@ -0,0 +1,91 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Set3 { + +float colormap_red(float x) { + if (x < 0.09082479229584027) { + return 1.24879652173913E+03 * x + 1.41460000000000E+02; + } else if (x < 0.1809653122266933) { + return -7.21339920948626E+02 * x + 3.20397233201581E+02; + } else if (x < 0.2715720097177793) { + return 6.77416996047422E+02 * x + 6.72707509881444E+01; + } else if (x < 0.3619607687891861) { + return -1.36850782608711E+03 * x + 6.22886666666710E+02; + } else if (x < 0.4527609316115322) { + return 1.38118774703557E+03 * x - 3.72395256916997E+02; + } else if (x < 0.5472860687991931) { + return -7.81436521739194E+02 * x + 6.06756521739174E+02; + } else if (x < 0.6360981817705944) { + return 8.06836521739242E+02 * x - 2.62483188405869E+02; + } else if (x < 0.8158623444475089) { + return -3.49616157878512E+02 * x + 4.73134258402717E+02; + } else if (x < 0.9098023786863947) { + return 1.72428853754953E+02 * x + 4.72173913043111E+01; + } else { + return 5.44142292490101E+02 * x - 2.90968379446626E+02; + } +} + +float colormap_green(float x) { + if (x < 0.08778161310534617) { + return 4.88563478260870E+02 * x + 2.10796666666667E+02; + } else if (x < 0.2697669137324175) { + return -6.96835646006769E+02 * x + 3.14852913968545E+02; + } else if (x < 0.3622079895714037) { + return 5.40799130434797E+02 * x - 1.90200000000068E+01; + } else if (x < 0.4519795462045253) { + return 3.23774703557373E+01 * x + 1.65134387351785E+02; + } else if (x < 0.5466820192751115) { + return 4.43064347826088E+02 * x - 2.04876811594176E+01; + } else if (x < 0.6368889369442862) { + return -1.83472332015826E+02 * x + 3.22028656126484E+02; + } else if (x < 0.728402572416003) { + return 1.27250988142231E+02 * x + 1.24132411067220E+02; + } else if (x < 0.8187333479165154) { + return -9.82116600790428E+02 * x + 9.32198616600708E+02; + } else if (x < 0.9094607880855196) { + return 1.17713438735149E+03 * x - 8.35652173912769E+02; + } else { + return 2.13339920948864E+01 * x + 2.15502964426857E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.09081516507716858) { + return -2.27937391304345E+02 * x + 1.99486666666666E+02; + } else if (x < 0.1809300436999751) { + return 4.33958498023703E+02 * x + 1.39376482213440E+02; + } else if (x < 0.2720053156712806) { + return -1.14300000000004E+03 * x + 4.24695652173923E+02; + } else if (x < 0.3616296568054424) { + return 1.08175889328072E+03 * x - 1.80450592885399E+02; + } else if (x < 0.4537067088757783) { + return -1.22681999999994E+03 * x + 6.54399999999974E+02; + } else if (x < 0.5472726179445029) { + return 8.30770750988243E+01 * x + 6.00909090909056E+01; + } else if (x < 0.6374811920489858) { + return 1.36487351778676E+03 * x - 6.41401185770872E+02; + } else if (x < 0.7237636846906381) { + return -1.27390769230737E+02 * x + 3.09889230769173E+02; + } else if (x < 0.8178226469606309) { + return -3.01831168831021E+02 * x + 4.36142857142782E+02; + } else if (x < 0.9094505664375214) { + return 8.47622811970801E+01 * x + 1.19977978543158E+02; + } else { + return -9.06117391304296E+02 * x + 1.02113405797096E+03; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Set3 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-Spectral.metal b/colormap-shaders/shaders/metal/IDL_CB-Spectral.metal new file mode 100644 index 0000000..8b43fa2 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-Spectral.metal @@ -0,0 +1,75 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_Spectral { + +float colormap_red(float x) { + if (x < 0.09752005946586478) { + return 5.63203907203907E+02 * x + 1.57952380952381E+02; + } else if (x < 0.2005235116443438) { + return 3.02650769230760E+02 * x + 1.83361538461540E+02; + } else if (x < 0.2974133397506856) { + return 9.21045429665647E+01 * x + 2.25581007115501E+02; + } else if (x < 0.5003919130598823) { + return 9.84288115246108E+00 * x + 2.50046722689075E+02; + } else if (x < 0.5989021956920624) { + return -2.48619704433547E+02 * x + 3.79379310344861E+02; + } else if (x < 0.902860552072525) { + return ((2.76764884219295E+03 * x - 6.08393126459837E+03) * x + 3.80008072407485E+03) * x - 4.57725185424742E+02; + } else { + return 4.27603478260530E+02 * x - 3.35293188405479E+02; + } +} + +float colormap_green(float x) { + if (x < 0.09785836420571035) { + return 6.23754529914529E+02 * x + 7.26495726495790E-01; + } else if (x < 0.2034012006283468) { + return 4.60453201970444E+02 * x + 1.67068965517242E+01; + } else if (x < 0.302409765476316) { + return 6.61789401709441E+02 * x - 2.42451282051364E+01; + } else if (x < 0.4005965758690823) { + return 4.82379130434784E+02 * x + 3.00102898550747E+01; + } else if (x < 0.4981907026473237) { + return 3.24710622710631E+02 * x + 9.31717541717582E+01; + } else if (x < 0.6064345916502067) { + return -9.64699507389807E+01 * x + 3.03000000000023E+02; + } else if (x < 0.7987472620841592) { + return -2.54022986425337E+02 * x + 3.98545610859729E+02; + } else { + return -5.71281628959223E+02 * x + 6.51955082956207E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.0997359608740309) { + return 1.26522393162393E+02 * x + 6.65042735042735E+01; + } else if (x < 0.1983790695667267) { + return -1.22037851037851E+02 * x + 9.12946682946686E+01; + } else if (x < 0.4997643530368805) { + return (5.39336225400169E+02 * x + 3.55461986381562E+01) * x + 3.88081126069087E+01; + } else if (x < 0.6025972254407099) { + return -3.79294261294313E+02 * x + 3.80837606837633E+02; + } else if (x < 0.6990141388105746) { + return 1.15990231990252E+02 * x + 8.23805453805459E+01; + } else if (x < 0.8032653181119567) { + return 1.68464957265204E+01 * x + 1.51683418803401E+02; + } else if (x < 0.9035796343050095) { + return 2.40199023199020E+02 * x - 2.77279202279061E+01; + } else { + return -2.78813846153774E+02 * x + 4.41241538461485E+02; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_Spectral +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-YIGn.metal b/colormap-shaders/shaders/metal/IDL_CB-YIGn.metal new file mode 100644 index 0000000..37dd411 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-YIGn.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_YIGn { + +float colormap_red(float x) { + if (x < 0.6289940178394318) { + return ((5.11696133375750E+02 * x - 8.41303218634799E+02) * x + 2.59644604131609E+01) * x + 2.53419788769069E+02; + } else { + return (-1.59266359984140E+02 * x - 2.05336652594121E+01) * x + 1.40166356828632E+02; + } +} + +float colormap_green(float x) { + if (x < 0.7657577693462372) { + return ((1.07839212106774E+00 * x - 1.91222692546201E+02) * x - 1.99072424271726E+01) * x + 2.55781815734834E+02; + } else { + return (-2.23913463560442E+02 * x + 1.41364491447333E+02) * x + 1.51940340657207E+02; + } +} + +float colormap_blue(float x) { + if (x < 0.1102530658245087) { + return (-1.06015269490890E+01 * x - 3.53323657599336E+02) * x + 2.28818914956011E+02; + } else if (x < 0.7528357207775116) { + return (((6.02578715483658E+02 * x - 1.15715802822919E+03) * x + 7.15916939803876E+02) * x - 3.43088208134950E+02) * x + 2.19476164232866E+02; + } else { + return (-6.54502605847083E+01 * x + 1.22002989630042E+01) * x + 9.46764726107154E+01; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_YIGn +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-YIGnBu.metal b/colormap-shaders/shaders/metal/IDL_CB-YIGnBu.metal new file mode 100644 index 0000000..24775d9 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-YIGnBu.metal @@ -0,0 +1,47 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_YIGnBu { + +float colormap_red(float x) { + if (x < 0.2523055374622345) { + return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + 2.53829637096771E+02; + } else if (x < 0.6267540156841278) { + return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - 5.30725139102868E+03) * x + 8.58474724851723E+02) * x + 2.03329669375107E+02; + } else if (x < 0.8763731146612115) { + return 3.28717357910916E+01 * x + 8.82117255504255E+00; + } else { + return -2.29186583577707E+02 * x + 2.38482038123159E+02; + } +} + +float colormap_green(float x) { + if (x < 0.4578040540218353) { + return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + 2.09812296466262E+01) * x + 2.52987561849833E+02; + } else { + return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + 1.52699334501816E+03) * x - 6.48190622715140E+01; + } +} + +float colormap_blue(float x) { + if (x < 0.1239372193813324) { + return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + 2.17553885630496E+02; + } else if (x < 0.7535201013088226) { + return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + 6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) * x + 1.56774650431396E+02; + } else { + return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x - 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - 6.55080846112976E+07) * x + 2.27664953009389E+07) * x - 3.28811994253461E+06; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_YIGnBu +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_CB-YIOrBr.metal b/colormap-shaders/shaders/metal/IDL_CB-YIOrBr.metal new file mode 100644 index 0000000..bccbef8 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_CB-YIOrBr.metal @@ -0,0 +1,35 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace CB_YIOrBr { + +float colormap_red(float x) { + return ((((1.30858855846896E+03 * x - 2.84649723684787E+03) * x + 1.76048857883363E+03) * x - 3.99775093706324E+02) * x + 2.69759225316811E+01) * x + 2.54587325383574E+02; +} + +float colormap_green(float x) { + return ((((-8.85605750526301E+02 * x + 2.20590941129997E+03) * x - 1.50123293069936E+03) * x + 2.38490009587258E+01) * x - 6.03460495073813E+01) * x + 2.54768707485247E+02; +} + +float colormap_blue(float x) { + if (x < 0.2363454401493073) { + return (-3.68734834041388E+01 * x - 3.28163398692792E+02) * x + 2.27342862588147E+02; + } else if (x < 0.7571054399013519) { + return ((((1.60988309475108E+04 * x - 4.18782706486673E+04) * x + 4.14508040221340E+04) * x - 1.88926043556059E+04) * x + 3.50108270140290E+03) * x - 5.28541997751406E+01; + } else { + return 1.68513761929930E+01 * x - 1.06424668227935E+01; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace CB_YIOrBr +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Eos_A.metal b/colormap-shaders/shaders/metal/IDL_Eos_A.metal new file mode 100644 index 0000000..9e2b01f --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Eos_A.metal @@ -0,0 +1,87 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Eos_A { + +float colormap_h(float x) { + if (x < 0.1151580585723306) { + return (2.25507158009032E+00 * x - 1.17973110308697E+00) * x + 7.72551618145170E-01; // H1 + } else if (x < (9.89643667779019E-01 - 6.61604251019618E-01) / (2.80520737708568E+00 - 1.40111938331467E+00)) { + return -2.80520737708568E+00 * x + 9.89643667779019E-01; // H2 + } else if (x < (6.61604251019618E-01 - 4.13849520734156E-01) / (1.40111938331467E+00 - 7.00489176507247E-01)) { + return -1.40111938331467E+00 * x + 6.61604251019618E-01; // H3 + } else if (x < (4.13849520734156E-01 - 2.48319927251200E-01) / (7.00489176507247E-01 - 3.49965224045823E-01)) { + return -7.00489176507247E-01 * x + 4.13849520734156E-01; // H4 + } else { + return -3.49965224045823E-01 * x + 2.48319927251200E-01; // H5 + } +} + +float colormap_v(float x) { + float v = 1.0; + if (x < 0.5) { + v = clamp(2.10566088679245E+00 * x + 7.56360684411500E-01, 0.0, 1.0); + } else { + v = clamp(-1.70132918347782E+00 * x + 2.20637371757606E+00, 0.0, 1.0); + } + float period = 4.0 / 105.0; + float len = 3.0 / 252.0; + float t = fmod(x + 7.0 / 252.0, period); + if (0.0 <= t && t < len) { + if (x < 0.12) { + v = (1.87862631683169E+00 * x + 6.81498517051705E-01); + } else if (x < 0.73) { + v -= 26.0 / 252.0; + } else { + v = -1.53215278202992E+00 * x + 1.98649818445446E+00; + } + } + return v; +} + +// H1 - H2 = 0 +// => [x=-0.8359672286003642,x=0.1151580585723306] + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = 1.0; + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} + +} // namespace Eos_A +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Eos_B.metal b/colormap-shaders/shaders/metal/IDL_Eos_B.metal new file mode 100644 index 0000000..d930b40 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Eos_B.metal @@ -0,0 +1,112 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Eos_B { + +float colormap_h(float x) { + if (x < 0.1167535483837128) { + return 2.0 / 3.0; // H1 + } else if (x < 0.1767823398113251) { + return ((-3.19659402385354E+02 * x + 1.14469539590179E+02) * x - 1.52210982227697E+01) * x + 1.39214703883044E+00; // H2 + } else if (x < 0.2266354262828827) { + return ((-3.55166097640991E+02 * x + 2.51218596935272E+02) * x - 6.08853752315044E+01) * x + 5.38727123476564E+00; // H3 + } else if (x < (6.95053970124612E-01 - 4.13725796136428E-01) / (1.48914458632691E+00 - 6.97458630656247E-01)) { + return -1.48914458632691E+00 * x + 6.95053970124612E-01; // H4 + } else if (x < (4.13725796136428E-01 - 2.48329223043123E-01) / (6.97458630656247E-01 - 3.48617475202321E-01)) { + return -6.97458630656247E-01 * x + 4.13725796136428E-01; // H5 + } else { + return -3.48617475202321E-01 * x + 2.48329223043123E-01; // H6 + } +} + +float colormap_v(float x) { + float v = 1.0; + if (x < 0.115834504365921) { + v = 4.18575376272140E+00 * x + 5.15145240089963E-01; // V1-Hi + } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) { + v = -7.87450803534638E+00 * x + 1.90980360972022E+00; // V2-Hi + } else if (x < 0.5) { + v = 7.87450639585523E+00 * x - 9.13724751363001E-01; // V3-Hi + } else { + v = -1.87540494049556E+00 * x + 2.33603077812338E+00; // V4-Hi + } + v = clamp(v, 0.0, 1.0); + + float period = 4.0 / 105.0; + float len = 3.0 / 252.0; + float t = fmod(x + 7.0 / 252.0, period); + if (0.0 <= t && t < len) { + if (x < 0.115834504365921) { + v = 3.74113124408467E+00 * x + 4.64654322955584E-01; // V1-Lo + } else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) { + v = -3.97326878048783E+00 * x + 1.25308500609757E+00; // V2-Lo + } else if (x < 0.25) { + v = 6.99297032967038E+00 * x - 8.03946549450558E-01; // V3-Lo + } else if (x < 0.72) { + v -= 26.0 / 255.0; + } else { + v = -1.67870020621040E+00 * x + 2.09414636280895E+00; // V4-Lo + } + } + + return v; +} + +// H1 - H2 = 0 +// => [x=0.1167535483837128] + +// H2 - H3 = 0 +// => [x=0.1767823398113251,x=0.1822494566440582,x=3.492328017950058] + +// H3 - H4 = 0 +// => [x=0.2266354262828827] + +// V1-Hi - 1 = 0 +// => [x=0.115834504365921] + +// V2-Hi - V3-Hi = 0 +// => + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = 1.0; + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} + +} // namespace Eos_B +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Green-Pink.metal b/colormap-shaders/shaders/metal/IDL_Green-Pink.metal new file mode 100644 index 0000000..931620e --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Green-Pink.metal @@ -0,0 +1,58 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Green_Pink { + +float colormap_red(float x) { + if (x < (6.20000000000000E+02 - 6.05717647058824E+02) / (5.00000000000000E+00 - 4.87941176470588E+00)) { // 118.43902439 + return 5.00000000000000E+00 * x - 6.20000000000000E+02; + } else if (x < (6.05717647058824E+02 - 3.12000000000000E+02) / (4.87941176470588E+00 - 3.00000000000000E+00)) { // 156.281690141 + return 4.87941176470588E+00 * x - 6.05717647058824E+02; + } else if (x < (252.0 + 3.12000000000000E+02) / 3.00000000000000E+00) { // 188 + return 3.00000000000000E+00 * x - 3.12000000000000E+02; + } else { + return 252.0; + } +} + +float colormap_green(float x) { + if (x < (2.04536133198612E+02 + 1.47941176470588E+01) / (9.95833333333333E+00 + 1.14822299345429E+00)) { + return 9.95833333333333E+00 * x - 1.47941176470588E+01; + } else if (x < (2.72705547652916E+02 - 2.04536133198612E+02) / (1.69701280227596E+00 - 1.14822299345429E+00)) { + return -1.14822299345429E+00 * x + 2.04536133198612E+02; + } else if (x < 2.72705547652916E+02 / 1.69701280227596E+00) { + return -1.69701280227596E+00 * x + 2.72705547652916E+02; + } else if (x < 7.52000000000000E+02 / 4.00000000000000E+00) { + return 0.0; + } else if (x < (7.52000000000000E+02 - 7.45733990147783E+02) / (4.00000000000000E+00 - 3.95785440613027E+00)) { + return 4.00000000000000E+00 * x - 7.52000000000000E+02; + } else { + return 3.95785440613027E+00 * x - 7.45733990147783E+02; + } +} + +float colormap_blue(float x) { + if (x < (2.50785650623886E+02 + 4.04215299263843E+01) / (1.92690173903766E+00 + 4.23796791443850E-01)) { + return 1.92690173903766E+00 * x - 4.04215299263843E+01; + } else if (x < (2.50785650623886E+02 - 1.58221357063404E+02) / (1.75528364849833E-01 + 4.23796791443850E-01)) { + return -4.23796791443850E-01 * x + 2.50785650623886E+02; + } else if (x < (1.58221357063404E+02 - 1.27826659541169E+01) / (9.48066572508303E-01 - 1.75528364849833E-01)) { + return 1.75528364849833E-01 * x + 1.58221357063404E+02; + } else { + return 9.48066572508303E-01 * x + 1.27826659541169E+01; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Green_Pink +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Green-Red-Blue-White.metal b/colormap-shaders/shaders/metal/IDL_Green-Red-Blue-White.metal new file mode 100644 index 0000000..8847d1a --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Green-Red-Blue-White.metal @@ -0,0 +1,95 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Green_Red_Blue_White { + +float colormap_red(float x) { + if (x < 0.2648221343873518) { + return 1518.00 * x - 162.00; + } else if (x < 0.2806324110671937) { + return 759.00 * x + 39.00; + } else if (x < 0.2964426877470356) { + return 252.0; + } else if (x < 0.3122529644268774) { + return -253.00 * x + 327.00; + } else if (x < 0.3280632411067194) { + return 248.0; + } else if (x < 0.3596837944664031) { + return -253.00 * x + 331.00; + } else if (x < 0.3636363636363636) { + return 240.0; + } else if (x < 0.3794466403162055) { + return -253.00 * x + 332.00; + } else if (x < 0.391304347826087) { + return 236.0; + } else if (x < 0.4229249011857708) { + return -253.00 * x + 335.00; + } else if (x < 0.4387351778656127) { + return 228.0; + } else if (x < 0.4861660079051384) { + return -253.00 * x + 339.00; + } else if (x < 0.5019762845849802) { + return 216.0; + } else if (x < 0.549407114624506) { + return -253.00 * x + 343.00; + } else if (x < 0.5652173913043478) { + return 204.0; + } else if (x < 0.5968379446640316) { + return -253.00 * x + 347.00; + } else if (x < 0.6126482213438735) { + return 196.0; + } else if (x < 0.6600790513833992) { + return -253.00 * x + 351.00; + } else if (x < 0.6758893280632411) { + return 184.0; + } else if (x < 0.7075098814229249) { + return -253.00 * x + 355.00; + } else if (x < 0.7233201581027668) { + return 176.0; + } else if (x < 0.7707509881422925) { + return -253.00 * x + 359.00; + } else if (x < 0.7865612648221344) { + return 164.0; + } else if (x < 0.83399209486166) { + return -253.00 * x + 363.00; + } else if (x < 0.849802371541502) { + return 152.0; + } else if (x < 0.8662737248407505) { + return -253.00 * x + 367.00; + } else { + return 8.24946218487293E+02 * x - 5.66796485866989E+02; + } +} + +float colormap_green(float x) { + if (x < 0.04321209459549381) { + return 9.10799999999998E+02 * x + 6.80363636363637E+01; + } else if (x < 0.1067193675889328) { + return 2277.00 * x + 9.00; + } else if (x < 0.1225296442687747) { + return -759.00 * x + 333.00; + } else if (x < 0.6113554850777934) { + return -1518.00 * x + 426.00; + } else if (x < 0.9924501603814814) { + return 1.97884558823513E+03 * x - 1.71181573083763E+03; + } else { + return 253.00 * x + 1.00; + } +} + +float colormap_blue(float x) { + return 5.23682489688790E+02 * x - 1.55016347956506E+02; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Green_Red_Blue_White +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Green-White_Exponential.metal b/colormap-shaders/shaders/metal/IDL_Green-White_Exponential.metal new file mode 100644 index 0000000..b79d1c2 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Green-White_Exponential.metal @@ -0,0 +1,44 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Green_White_Exponential { + +float colormap_red(float x) { + if (x < (5.33164074896858E-01 + 3.69558823529412E+01) / (6.61764705882353E-01 - 3.80845483226613E-01)) { // 133.451339048 + return 3.80845483226613E-01 * x + 5.33164074896858E-01; + } else if(x < (2.21853643274093E+02 - 3.69558823529412E+01) / (1.86816585713397E+00 - 6.61764705882353E-01)) { // 153.263912861 + return 6.61764705882353E-01 * x - 3.69558823529412E+01; + } else { + return 1.86816585713397E+00 * x - 2.21853643274093E+02; + } +} + +float colormap_green(float x) { + if (x < (8.74223522059742E+01 - 3.33294186729301E-01) / (1.34076340457443E+00 - 6.66705813270699E-01)) { // 129.201212393 + return 6.66705813270699E-01 * x - 3.33294186729301E-01; + } else { + return 1.34076340457443E+00 * x - 8.74223522059742E+01; + } +} + +float colormap_blue(float x) { + if (x < (4.92898927047827E+02 - 4.63219741480611E-01) / (2.93126567624928E+00 - 2.63081042553601E-01)) { + return 2.63081042553601E-01 * x - 4.63219741480611E-01; + } else { + return 2.93126567624928E+00 * x - 4.92898927047827E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Green_White_Exponential +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Green-White_Linear.metal b/colormap-shaders/shaders/metal/IDL_Green-White_Linear.metal new file mode 100644 index 0000000..79bbedf --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Green-White_Linear.metal @@ -0,0 +1,30 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Green_White_Linear { + +float colormap_red(float x) { + return 1.61361058036781E+00 * x - 1.55391688559828E+02; +} + +float colormap_green(float x) { + return 9.99817607003891E-01 * x + 1.01544260700389E+00; +} + +float colormap_blue(float x) { + return 3.44167852062589E+00 * x - 6.19885917496444E+02; +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Green_White_Linear +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Hardcandy.metal b/colormap-shaders/shaders/metal/IDL_Hardcandy.metal new file mode 100644 index 0000000..54a0376 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Hardcandy.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Hardcandy { + +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi * (1.0 / (2.0 * 0.143365330321852)) * x + 1.55) * (322.0 * x) + 191.0 * x; + if (v < 0.0) { + v = -v; + } else if (v > 255.0) { + v = 255.0 - (v - 255.0); + } + return v; +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi / 0.675 * (x + 0.015)) * 190.0 + 25.0; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + return sin(2.0 * pi * (x * -3.45 - 0.02)) * 127.5 + 127.5; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Hardcandy +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Haze.metal b/colormap-shaders/shaders/metal/IDL_Haze.metal new file mode 100644 index 0000000..ec95d51 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Haze.metal @@ -0,0 +1,52 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Haze { + +float colormap_red(float x) { + if (x < 0.0) { + return 167.0; + } else if (x < (2.54491177159840E+02 + 2.49117061281287E+02) / (1.94999353031535E+00 + 1.94987400471999E+00)) { + return -1.94987400471999E+00 * x + 2.54491177159840E+02; + } else if (x <= 255.0) { + return 1.94999353031535E+00 * x - 2.49117061281287E+02; + } else { + return 251.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 112.0; + } else if (x < (2.13852573128775E+02 + 1.42633630462899E+02) / (1.31530121382008E+00 + 1.39181683887691E+00)) { + return -1.39181683887691E+00 * x + 2.13852573128775E+02; + } else if (x <= 255.0) { + return 1.31530121382008E+00 * x - 1.42633630462899E+02; + } else { + return 195.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 255.0; + } else if (x <= 255.0) { + return -9.84241021836929E-01 * x + 2.52502692064968E+02; + } else { + return 0.0; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = colormap_red(t) / 255.0; + float g = colormap_green(t) / 255.0; + float b = colormap_blue(t) / 255.0; + return float4(r, g, b, 1.0); +} + +} // namespace Haze +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_1.metal b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_1.metal new file mode 100644 index 0000000..88b737c --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_1.metal @@ -0,0 +1,60 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Hue_Sat_Lightness_1 { + +float colormap_low(float x) { + return (-1.91005335917480E-03 * x + 1.49751468348116E+00) * x - 6.97037614414503E+00; // lower +} + +float colormap_up(float x) { + return (1.88420526249161E-03 * x - 5.03556849093925E-01) * x + 2.55777688663313E+02; // upper +} + +float colormap_red(float x) { + if (x < 43.76015739302458) { // first root of `lower = B1` + return colormap_up(x); + } else if (x < 86.85552651930304) { // first root of `lower = R1` + return (3.42882679808412E-02 * x - 7.47424573913507E+00) * x + 4.99200716753466E+02; // R1 + } else if (x < 174.6136813850324) { // first root of `low = B2` + return colormap_low(x); + } else { + return ((1.12237347384081E-04 * x - 7.83534162528667E-02) * x + 1.86033275155350E+01) * x - 1.25879271751642E+03; + } +} + +float colormap_green(float x) { + if (x < 86.85552651930304) { + return colormap_low(x); + } else if (x < 130.6514942376722) { + return (-2.86318899478317E-02 * x + 8.83599571161434E+00) * x - 4.43544771805581E+02; // G1 + } else { + return colormap_up(x); + } +} + +float colormap_blue(float x) { + if (x < 43.76015739302458) { + return (-3.50205069618621E-02 * x + 7.15746326474339E+00) * x - 8.79902788903102E+00; // B1 + } else if (x < 130.6514942376722) { // first root of `upper = G1` + return colormap_up(x); + } else if (x < 174.6136813850324) { // first root of `low = B2` + return (1.99506804131033E-02 * x - 6.64847464240324E+00) * x + 7.48898397192062E+02; // B2 + } else { + return colormap_low(x); + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Hue_Sat_Lightness_1 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_2.metal b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_2.metal new file mode 100644 index 0000000..e3d4a56 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Lightness_2.metal @@ -0,0 +1,99 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Hue_Sat_Lightness_2 { + +float colormap_up(float x) { + return (1.88200166286601E-03 * x - 4.65545143706978E-01) * x + 2.51008231568770E+02; +} + +float colormap_low(float x) { + return (-1.90879354636631E-03 * x - 5.05775136749144E-01) * x + 2.51839633472648E+02; +} + +float colormap_r1(float x) { + float t = x - 84.41170691108532; + return ((-1.30664056487685E-04 * t - 2.23609578814399E-02) * t - 1.63427831229829E+00) * t + colormap_low(84.41170691108532); +} + +float colormap_r2(float x) { + float t = (x - 172.4679464259528); + return (3.39051205856669E-02 * t + 1.53777364753859E+00) * t + colormap_low(172.4679464259528); +} + +float colormap_g1(float x) { + return (2.06966753567031E-02 * x - 3.81765550976615E+00) * x + 3.70329541512642E+02; +} + +float colormap_g2(float x) { + float t = x - 215.8140719563986; + return (-2.93369381849802E-02 * t - 4.45609461245051E+00) * t + colormap_up(215.8140719563986); +} + +float colormap_b1(float x) { + float t = (x - 129.0039558892991); + return (-2.69029805601284E-02 * t - 1.46365429919324E+00) * t + colormap_up(129.0039558892991); +} + +float colormap_red(float x) { + if (x < 84.41170691108532) { + return colormap_r1(x); + } else if (x < 172.4679464259528) { + return colormap_low(x); + } else if (x < 215.8140719563986) { + return colormap_r2(x); + } else { + return colormap_up(x); + } +} + +float colormap_green(float x) { + if (x < 84.41170691108532) { + return colormap_low(x); + } else if (x < 129.0039558892991) { + return colormap_g1(x); + } else if (x < 215.8140719563986) { + return colormap_up(x); + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 129.0039558892991) { + return colormap_up(x); + } else if (x < 172.4679464259528) { + return colormap_b1(x); + } else { + return colormap_low(x); + } +} + +// G1 = low +// => [x=62.09621943267293,x=84.41170691108532] + +// G1 = up +// => [x=49.16072666680554,x=129.0039558892991] + +// B1 = low +// => [x=66.91982278615977,x=172.4679464259528] + +// R2 = up +// => [x=86.8352194379599,x=215.8140719563986] + +// low(172.4679464259528) = 107.83220272 +// up(215.8140719563986) = 238.192608973 + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Hue_Sat_Lightness_2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_1.metal b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_1.metal new file mode 100644 index 0000000..3b9b50b --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_1.metal @@ -0,0 +1,98 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Hue_Sat_Value_1 { + +float colormap_low(float x) { + return (3.31549320112257E-06 * x + 9.90093135228017E-01) * x - 2.85569629002368E-01; +} + +float colormap_r2(float x) { + float t = x - 172.2021990097892; + return (-2.39029325463818E-02 * t + 2.98715296752437E+00) * t + 170.308961782; +} + +float colormap_g1(float x) { + float t = x - 86.01791713538523; + return (-2.29102048531908E-02 * t + 4.93089581616270E+00) * t + 84.9047112396; +} + +float colormap_g2(float x) { + float t = x - 215.6804047700857; + return ((-2.84214232291614E-04 * t + 3.97502254733824E-02) * t - 1.21659773743153E+00) * t + 255.0; +} + +float colormap_b2(float x) { + float t = x - 129.1625547389263; + return (2.47358957372179E-02 * t - 3.03236899995258E+00) * t + 255.0; +} + +float colormap_red(float x) { + if (x < 43.15291462916737) { + return 255.0; + } else if (x < 86.01791713538523) { + return (2.31649880284905E-02 * x - 6.92920742890475E+00) * x + 5.09541054138852E+02; // R1 + } else if (x < 172.2021990097892) { + return colormap_low(x); + } else if (x < 215.6804047700857) { + return colormap_r2(x); + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < 86.01791713538523) { + return colormap_low(x); + } else if (x < 129.1625547389263) { + return colormap_g1(x); + } else if (x < 215.6804047700857) { + return 255.0; + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 43.15291462916737) { + return (-2.29056417125175E-02 * x + 6.89833449327894E+00) * x - 2.89480825884616E-02; // B1 + } else if (x < 129.1625547389263) { + return 255.0; + } else if (x < 172.2021990097892) { + return colormap_b2(x); + } else { + return colormap_low(x); + } +} + +// B1 - 255 = 0 +// => [x=43.15291462916737,x=258.0102040408121] + +// R1 - low = 0 +// => [x=86.01791713538523,x=255.8961027639475] + +// G1 - 255 = 0 +// => [x=129.1625547389263,x=258.1003299995292] + +// B2 - low = 0 +// => [x=172.2021990097892,x=248.7957319298701] + +// R2 - 255 = 0 +// => [x=215.6804047700857,x=253.6941391396688] + +// low(86.01791713538523) = 84.9047112396 +// low(172.2021990097892) = 170.308961782 + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Hue_Sat_Value_1 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_2.metal b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_2.metal new file mode 100644 index 0000000..eef8b91 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Hue_Sat_Value_2.metal @@ -0,0 +1,103 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Hue_Sat_Value_2 { + +float colormap_low(float x) { + return -9.89123311722871E-01 * x + 2.54113856910082E+02; +} + +float colormap_r1(float x) { + float t = x - 44.52807774916808; + return (-2.10743035084859E-02 * t - 1.14339819510944E+00) * t + 255.0; +} + +float colormap_r2(float x) { + float t = x - 173.2142990353825; + return (2.10464655909683E-02 * t + 3.09770350177039E+00) * t + 82.7835558104; +} + +float colormap_g1(float x) { + float t = x - 87.18599073927922; + return (2.18814766236433E-02 * t + 1.07683877405025E+00) * t + 167.876161014; +} + +float colormap_g2(float x) { + float t = x - 216.2347301863598; + return (-1.75617661106684E-02 * t - 5.19390917463437E+00) * t + 255.0; +} + +float colormap_b2(float x) { + float t = x - 130.3078696041572; + return (-1.97675474706200E-02 * t - 3.16561290370380E+00) * t + 255.0; +} + +float colormap_red(float x) { + if (x < 44.52807774916808) { + return 255.0; + } else if (x < 87.18599073927922) { + return colormap_r1(x); + } else if (x < 173.2142990353825) { + return colormap_low(x); + } else if (x < 216.2347301863598) { + return colormap_r2(x); + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < 87.18599073927922) { + return colormap_low(x); + } else if (x < 130.3078696041572) { + return colormap_g1(x); + } else if (x < 216.2347301863598) { + return 255.0; + } else { + return colormap_g2(x); + } +} + +float colormap_blue(float x) { + if (x < 44.52807774916808) { + return (2.31958376441286E-02 * x - 1.01298265446011E+00) * x + 2.54114630079813E+02; // B1 + } else if (x < 130.3078696041572) { + return 255.0; + } else if (x < 173.2142990353825) { + return colormap_b2(x); + } else { + return colormap_low(x); + } +} + +// B1 - 255 = 0 +// => [x=-0.8571972230440585,x=44.52807774916808] + +// R1 - low = 0 +// => [x=-5.450356335481052,x=87.18599073927922] + +// G1 - 255 = 0 +// => [x=-5.148233003947013,x=130.3078696041572] + +// B2 - low = 0 +// => [x=-22.70273917535556,x=173.2142990353825] + +// R2 - 255 = 0 +// => [x=-16.99015635858727,x=216.2347301863598] + +// low(87.18599073927922) = 167.876161014 +// low(173.2142990353825) = 82.7835558104 + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Hue_Sat_Value_2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Mac_Style.metal b/colormap-shaders/shaders/metal/IDL_Mac_Style.metal new file mode 100644 index 0000000..29a07fb --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Mac_Style.metal @@ -0,0 +1,65 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Mac_Style { + +float colormap_h(float x) { + return -7.44992704834645E-01 * x + 7.47986634976377E-01; +} + +float colormap_s(float x) { + return 1.0; +} + +float colormap_v(float x) { + float i = fmod(fmod(x * 256.0, 2.0) + 2.0, 2.0); + if (0.0 <= i && i < 1.0) { + return 1.0; + } else { + return 254.0 / 255.0; + } +} + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = colormap_s(clamp(x, 0.0, 1.0)); + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} + +} // namespace Mac_Style +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Nature.metal b/colormap-shaders/shaders/metal/IDL_Nature.metal new file mode 100644 index 0000000..5adafbf --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Nature.metal @@ -0,0 +1,72 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Nature { + +float colormap_red(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + float v = sin(2.0 * pi * (x * 2.440771851872335 + 0.03082889566781979)) * 94.0 + 86.68712190457872; + if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 82.0; + } +} + +float colormap_green(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = - 133.8180196373718; + const float b = 105.5963045788319; + const float c = 1.192621559448461; + const float d = 4.00554233186818; + const float e = 0.04779355732364274; + const float f = 218.2356517672776; + const float g = -269.6049419208264; + float v = (a * x + b) * sin(2.0 * pi / c * (d * x + e)) + f + g * x; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.8) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 2.443749115965466; + const float b = 0.02934035424870109; + const float c = 253.745120022022; + const float d = 226.671125688366; + float v = sin(2.0 * pi * (x * a + b))*c + d; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 214.0; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Nature +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Ocean.metal b/colormap-shaders/shaders/metal/IDL_Ocean.metal new file mode 100644 index 0000000..1408eea --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Ocean.metal @@ -0,0 +1,76 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Ocean { + +float colormap_red(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 92.39421034238549; + const float b = 88.02925388837211; + const float c = 0.5467741159150409; + const float d = 0.03040219113949284; + return a * sin(2.0 * pi / c * (x - d)) + b; + } else { + return 105.0; + } +} + +float colormap_green(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 92.44399971120093; + const float b = 22.7616696017667; + const float c = 0.3971750420482239; + const float d = 0.1428144080827581; + const float e = 203.7220396611977; + const float f = 49.51517183258432; + float v = (a * x + b) * sin(2.0 * pi / c * (x + d)) + (e * x + f); + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } + } else { + return 246.0; + } +} + +float colormap_blue(float x) { + if (x < 0.84121424085) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 251.0868719483008; + const float b = 0.5472498585835275; + const float c = 0.02985857858149428; + const float d = 225.9495771701237; + float v = a * sin(2.0 * pi / b * (x - c)) + d; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else if (v < 0.0) { + return -v; + } else { + return v; + } + } else { + return 234.0; + } +} + +// R1 - 105 = 0 +// => 0.8344881408181015 + +// B1 - 234 = 0 +// => 0.847940340889657 + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Ocean +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Pastels.metal b/colormap-shaders/shaders/metal/IDL_Pastels.metal new file mode 100644 index 0000000..98ab7ce --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Pastels.metal @@ -0,0 +1,44 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Pastels { + +float colormap_red(float x) { + if (x < 129.0) { + return -1.95881595881596E+00 * x + 4.39831831831832E+02; + } else { + return 5.70897317298797E+00 * x - 1.11405615171138E+03; + } +} + +float colormap_green(float x) { + if (x < 129.0) { + return 0.0; + } else if (x < 200.0) { + return 5.72337662337662E+00 * x - 6.06801082251082E+02; + } else { + return -5.58823529411765E+00 * x + 1.59313235294118E+03; + } +} + +float colormap_blue(float x) { + if (x < 120.0) { + return 1.95784725990233E+00 * x + 6.90962481913547E+01; + } else { + return -5.71881606765328E+00 * x + 1.11517336152220E+03; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Pastels +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Peppermint.metal b/colormap-shaders/shaders/metal/IDL_Peppermint.metal new file mode 100644 index 0000000..c8a0415 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Peppermint.metal @@ -0,0 +1,29 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Peppermint { + +float colormap_red(float x) { + return float(int(fmod(x * 256.0 / 4.0, 4.0))) * 80.0; +} + +float colormap_green(float x) { + return float(int(x * 256.0 / 16.0)) * 16.0; +} + +float colormap_blue(float x) { + return float(int(fmod(x * 256.0, 4.0))) * 80.0; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Peppermint +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Plasma.metal b/colormap-shaders/shaders/metal/IDL_Plasma.metal new file mode 100644 index 0000000..87ca2f0 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Plasma.metal @@ -0,0 +1,58 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Plasma { + +float colormap_red(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 12.16378802377247; + const float b = 0.05245257017955226; + const float c = 0.2532139106569052; + const float d = 0.02076964056039702; + const float e = 270.124167081014; + const float f = 1.724941960305955; + float v = (a * x + b) * sin(2.0 * pi / c * (x - d)) + e * x + f; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return v; + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 88.08537391182792; + const float b = 0.25280516046667; + const float c = 0.05956080245692388; + const float d = 106.5684078925541; + return a * sin(2.0 * pi / b * (x - c)) + d; +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 63.89922420106684; + const float b = 0.4259605778503662; + const float c = 0.2529247343450655; + const float d = 0.5150868195804643; + const float e = 938.1798072557968; + const float f = 503.0883490697431; + float v = (a * x + b) * sin(2.0 * pi / c * x + d * 2.0 * pi) - e * x + f; + if (v > 255.0) { + return 255.0 - (v - 255.0); + } else { + return fmod(v, 255.0); + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Plasma +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Prism.metal b/colormap-shaders/shaders/metal/IDL_Prism.metal new file mode 100644 index 0000000..f292a3b --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Prism.metal @@ -0,0 +1,42 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Prism { + +float colormap_red(float x) { + if (x < (5.35651507139080E+02 + 4.75703324808184E-01) / (3.80568385693018E+00 + 4.18112109994712E+00)) { + return 3.80568385693018E+00 * x - 4.75703324808184E-01; + } else { + return -4.18112109994712E+00 * x + 5.35651507139080E+02; + } +} + +float colormap_green(float x) { + if (x < (7.72815970386039E+02 + 2.57000000000000E+02) / (4.00000000000000E+00 + 4.04283447911158E+00)) { + return 4.00000000000000E+00 * x - 2.57000000000000E+02; + } else { + return -4.04283447911158E+00 * x + 7.72815970386039E+02; + } +} + +float colormap_blue(float x) { + if (x < (1.03175883256528E+03 + 4.87540173259576E+02) / (3.86517065024528E+00 + 4.04377880184332E+00)) { + return 3.86517065024528E+00 * x - 4.87540173259576E+02; + } else { + return -4.04377880184332E+00 * x + 1.03175883256528E+03; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Prism +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Purple-Red+Stripes.metal b/colormap-shaders/shaders/metal/IDL_Purple-Red+Stripes.metal new file mode 100644 index 0000000..416682a --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Purple-Red+Stripes.metal @@ -0,0 +1,88 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Purple_Red_Stripes { + +float colormap_h(float x) { + if (x < 0.3310005332481092) { + return (4.38091557495284E-01 * x - 6.45518032448820E-01) * x + 8.32595065985926E-01; // H1 + } else if (x < 0.836653386) { + return -9.95987681712782E-01 * x + 9.96092924041492E-01; // H2 + } else if (x < 0.9144920256360881) { + return (-3.25656183098909E+00 * x + 4.39104086393490E+00) * x - 1.23205476222211E+00; // H3 + } else { + return (1.68724608409684E+00 * x - 3.93349028637749E+00) * x + 2.24617746415606E+00; // H4 + } +} + +float colormap_s(float x) { + if (x < 0.9124516770628384) { + return -2.49531958245657E+00 * x + 3.07915192631601E+00; // S1 + } else { + return 2.28056601637550E+00 * x - 1.27861289779857E+00; // S2 + } +} + +float colormap_v(float x) { + float v = clamp(7.55217853407034E-01 * x + 7.48186662435193E-01, 0.0, 1.0); + float period = 0.039840637; + float t = x - 0.027888446; + float tt = t - float(int(t / period)) * period; + if (0.0 <= tt && tt < 0.007968127) { + v -= 0.2; + } + return v; +} + +// H1 - H2 = 0 +// => [x=-1.186402343934078,x=0.3310005332481092] + +// H3 - H4 = 0 +// => [x=0.7693377859773962,x=0.9144920256360881] + +// S1 - 1 = 0 +// => [x=0.9124516770628384] + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + float h = colormap_h(clamp(x, 0.0, 1.0)); + float s = colormap_s(clamp(x, 0.0, 1.0)); + float v = colormap_v(clamp(x, 0.0, 1.0)); + return colormap_hsv2rgb(h, s, v); +} + +} // namespace Purple_Red_Stripes +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Rainbow+Black.metal b/colormap-shaders/shaders/metal/IDL_Rainbow+Black.metal new file mode 100644 index 0000000..d16e6f6 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Rainbow+Black.metal @@ -0,0 +1,54 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Rainbow_Black { + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + if (x < 0.0) { + return float4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return float4(0.0, 0.0, 0.0, 1.0); + } else { + float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0); + float s = 1.0; + float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0); + return colormap_hsv2rgb(h, s, v); + } +} + +} // namespace Rainbow_Black +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Rainbow+White.metal b/colormap-shaders/shaders/metal/IDL_Rainbow+White.metal new file mode 100644 index 0000000..7336cee --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Rainbow+White.metal @@ -0,0 +1,54 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Rainbow_White { + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + if (x < 0.0) { + return float4(0.0, 0.0, 0.0, 1.0); + } else if (1.0 < x) { + return float4(1.0, 1.0, 1.0, 1.0); + } else { + float h = clamp(-9.42274071356572E-01 * x + 8.74326827903982E-01, 0.0, 1.0); + float s = 1.0; + float v = clamp(4.90125513855204E+00 * x + 9.18879034690780E-03, 0.0, 1.0); + return colormap_hsv2rgb(h, s, v); + } +} + +} // namespace Rainbow_White +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Rainbow.metal b/colormap-shaders/shaders/metal/IDL_Rainbow.metal new file mode 100644 index 0000000..3db706a --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Rainbow.metal @@ -0,0 +1,42 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Rainbow { + +float colormap_red(float x) { + if (x < 100.0) { + return (-9.55123422981038E-02 * x + 5.86981763554179E+00) * x - 3.13964093701986E+00; + } else { + return 5.25591836734694E+00 * x - 8.32322857142857E+02; + } +} + +float colormap_green(float x) { + if (x < 150.0) { + return 5.24448979591837E+00 * x - 3.20842448979592E+02; + } else { + return -5.25673469387755E+00 * x + 1.34195877551020E+03; + } +} + +float colormap_blue(float x) { + if (x < 80.0) { + return 4.59774436090226E+00 * x - 2.26315789473684E+00; + } else { + return -5.25112244897959E+00 * x + 8.30385102040816E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Rainbow +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Rainbow_18.metal b/colormap-shaders/shaders/metal/IDL_Rainbow_18.metal new file mode 100644 index 0000000..0f295ed --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Rainbow_18.metal @@ -0,0 +1,49 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Rainbow_18 { + +float4 colormap(float x) { + float x16 = x * 16.0; + const float a = 255.0; + const float s = 1.0 / 255.0; + if (x16 < 1.0) { + return float4(150.0, 0.0, 150.0, a) * s; + } else if (x16 < 2.0) { + return float4(200.0, 0.0, 200.0, a) * s; + } else if (x16 < 3.0) { + return float4(100.0, 100.0, 150.0, a) * s; + } else if (x16 < 4.0) { + return float4(100.0, 100.0, 200.0, a) * s; + } else if (x16 < 5.0) { + return float4(100.0, 100.0, 255.0, a) * s; + } else if (x16 < 6.0) { + return float4(0.0, 140.0, 0.0, a) * s; + } else if (x16 < 7.0) { + return float4(150.0, 170.0, 0.0, a) *s; + } else if (x16 < 8.0) { + return float4(200.0, 200.0, 0.0, a) * s; + } else if (x16 < 9.0) { + return float4(150.0, 200.0, 0.0, a) * s; + } else if (x16 < 10.0) { + return float4(200.0, 255.0, 120.0, a) * s; + } else if (x16 < 11.0) { + return float4(255.0, 255.0, 0.0, a) * s; + } else if (x16 < 12.0) { + return float4(255.0, 200.0, 0.0, a) * s; + } else if (x16 < 13.0) { + return float4(255.0, 160.0, 0.0, a) * s; + } else if (x16 < 14.0) { + return float4(255.0, 125.0, 0.0, a) * s; + } else if (x16 < 15.0) { + return float4(200.0, 50.0, 100.0, a) * s; + } else { + return float4(175.0, 50.0, 75.0, a) * s; + } +} + +} // namespace Rainbow_18 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Rainbow_2.metal b/colormap-shaders/shaders/metal/IDL_Rainbow_2.metal new file mode 100644 index 0000000..a60a293 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Rainbow_2.metal @@ -0,0 +1,48 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Rainbow_2 { + +float4 colormap_hsv2rgb(float h, float s, float v) { + float r = v; + float g = v; + float b = v; + if (s > 0.0) { + h *= 6.0; + int i = int(h); + float f = h - float(i); + if (i == 1) { + r *= 1.0 - s * f; + b *= 1.0 - s; + } else if (i == 2) { + r *= 1.0 - s; + b *= 1.0 - s * (1.0 - f); + } else if (i == 3) { + r *= 1.0 - s; + g *= 1.0 - s * f; + } else if (i == 4) { + r *= 1.0 - s * (1.0 - f); + g *= 1.0 - s; + } else if (i == 5) { + g *= 1.0 - s; + b *= 1.0 - s * f; + } else { + g *= 1.0 - s * (1.0 - f); + b *= 1.0 - s; + } + } + return float4(r, g, b, 1.0); +} + +float4 colormap(float x) { + float h = clamp(-7.44981265666511E-01 * x + 7.47965390904122E-01, 0.0, 1.0); + float s = 1.0; + float v = 1.0; + return colormap_hsv2rgb(h, s, v); +} + +} // namespace Rainbow_2 +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Red-Purple.metal b/colormap-shaders/shaders/metal/IDL_Red-Purple.metal new file mode 100644 index 0000000..1f880aa --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Red-Purple.metal @@ -0,0 +1,42 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Red_Purple { + +float colormap_red(float x) { + if (x < 25.97288868211422) { + return 3.07931034482759E+00 * x - 1.62758620689655E+00; + } else if(x < 154.7883608200706) { + return (-0.002335409922053 * x + 1.770196213987500) * x + 33.949335775363600; + } else { + return 252.0; + } +} + +float colormap_green(float x) { + return ((7.125813968310300E-05 * x - 2.223039020276470E-02) * x + 2.367815929630070E+00) * x - 7.739188304766140E+01; +} + +float colormap_blue(float x) { + if (x < (2.51577880184332E+01 - 5.67741935483871E-01) / (9.88497695852535E-01 - 1.70189098998888E-01)) { // 30.0498444933 + return 1.70189098998888E-01 * x - 5.67741935483871E-01; + } else if(x < 150.2124460352976) { + return 9.88497695852535E-01 * x - 2.51577880184332E+01; + } else { + return (-3.85393764961783E-03 * x + 2.82261880442729E+00) * x - 2.13706208872841E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Red_Purple +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Red_Temperature.metal b/colormap-shaders/shaders/metal/IDL_Red_Temperature.metal new file mode 100644 index 0000000..5516b47 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Red_Temperature.metal @@ -0,0 +1,30 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Red_Temperature { + +float colormap_red(float x) { + return 1.448953446096850 * x - 5.02253539008443e-1; +} + +float colormap_green(float x) { + return 1.889376646180860 * x - 2.272028094820020e2; +} + +float colormap_blue(float x) { + return 3.92613636363636 * x - 7.46528409090909e+2; +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Red_Temperature +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Standard_Gamma-II.metal b/colormap-shaders/shaders/metal/IDL_Standard_Gamma-II.metal new file mode 100644 index 0000000..a1383d2 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Standard_Gamma-II.metal @@ -0,0 +1,66 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Standard_Gamma_II { + +float colormap_red(float x) { + if (x < (8.75333333333333E+01 + 2.19676470588235E+02) / (4.76470588235294E+00 + 1.00000000000000E-01)) { // 63.1507456671 + return 4.76470588235294E+00 * x - 2.19676470588235E+02; + } else if (x < (8.75333333333333E+01 + 3.11000000000000E+02) / (5.00000000000000E+00 + 1.00000000000000E-01)) { // 78.1437908497 + return -1.00000000000000E-01 * x + 8.75333333333333E+01; + } else if (x < (-3.11000000000000E+02 + 3.42345454545455E+02) / (5.32727272727273E+00 - 5.00000000000000E+00)) { // 95.7777777778 + return 5.00000000000000E+00 * x - 3.11000000000000E+02; + } else if (x < (255.0 + 3.42345454545455E+02) / 5.32727272727273E+00) { // 112.129692833 + return 5.32727272727273E+00 * x - 3.42345454545455E+02; + } else if (x < (1.49279020979021E+03 - 255.0) / 7.68531468531468E+00) { // 161.059144677 + return 255.0; + } else if (x < (1.49279020979021E+03 + 7.19657722738218E+02) / (5.10010319917441E+00 + 7.68531468531468E+00)) { // 173.04463198 + return -7.68531468531468E+00 * x + 1.49279020979021E+03; + } else if (x < (255.0 + 7.19657722738218E+02) / 5.10010319917441E+00) { // 191.105490355 + return 5.10010319917441E+00 * x - 7.19657722738218E+02; + } else { + return 255.0; + } +} + +float colormap_green(float x) { + if (x < (163.0 + 5.65896810850440E+02) / 5.07239736070381E+00) { // 143.69868112 + return 5.07239736070381E+00 * x - 5.65896810850440E+02; + } else if (x < (163.0 + 9.06153846153846E+02) / 6.10769230769231E+00) { // 175.050377834 + return 163.0; + } else { + return 6.10769230769231E+00 * x - 9.06153846153846E+02; + } +} + +float colormap_blue(float x) { + if (x < (5.16164662349676E+02 - 4.77795918367347E+00) / (5.20142857142857E+00 + 5.42900092506938E+00)) { // 48.1059305585 + return 5.20142857142857E+00 * x + 4.77795918367347E+00; + } else if (x < 5.16164662349676E+02 / 5.42900092506938E+00) { // 95.0754419595 + return -5.42900092506938E+00 * x + 5.16164662349676E+02; + } else if (x < 6.16058823529412E+02 / 4.84558823529412E+00) { // 127.138088012 + return 0.0; + } else if (x < (9.31184615384615E+02 + 6.16058823529412E+02) / (4.84558823529412E+00 + 5.89230769230769E+00)) { // 144.091863932 + return 4.84558823529412E+00 * x - 6.16058823529412E+02; + } else if (x < 9.31184615384615E+02 / 5.89230769230769E+00) { // 158.033942559 + return -5.89230769230769E+00 * x + 9.31184615384615E+02; + } else if (x < 5.64142909048289E+02 / 3.22177684013127E+00) { // 175.103036939 + return 0.0; + } else { + return 3.22177684013127E+00 * x - 5.64142909048289E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Standard_Gamma_II +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Steps.metal b/colormap-shaders/shaders/metal/IDL_Steps.metal new file mode 100644 index 0000000..824950b --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Steps.metal @@ -0,0 +1,54 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Steps { + +float colormap_erf(float x) { + // erf approximation formula + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = -8.0 * (pi - 3.0) / (3.0 * pi * (pi - 4.0)); + float v = 1.0 - exp(-x * x * (4.0 / pi + a * x * x) / (1.0 + a * x * x)); + return sign(x) * sqrt(v); +} + +float colormap_red(float x) { + if (x <= 95.5) { + return 8.14475806451613E+00 * x - 5.23967741935484E+02; + } else { + return colormap_erf((x - 145.0) * 0.028) * 131.0 + 125.0; + } +} + +float colormap_green(float x) { + if (x < (3.14410256410256E+02 + 2.14285714285714E-01) / (4.25000000000000E+01 + 9.81196581196581E+00)) { + return 4.25000000000000E+01 * x - 2.14285714285714E-01; + } else if (x < 192.0) { // actual root: 193.529143410603 + return -9.81196581196581E+00 * x + 3.14410256410256E+02; + } else { + return ((5.35129859215999E-04 * x - 2.98599683017528E-01) * x + 5.69466901216655E+01) * x - 3.71604038989543E+03; + } +} + +float colormap_blue(float x) { + if (x < 63.0) { + return 8.22620967741936E+00 * x - 2.63729032258065E+02; + } else if (x <= 95.5) { + return 4.97690615835777E+00 * x - 3.16414039589443E+02; + } else { + return (((-7.88871743679920E-05 * x + 7.21525684930384E-02) * x - 2.45956037640571E+01) * x + 3.70824713134765E+03) * x - 2.08852518066406E+05; + } +} + +float4 colormap(float x) { + float t = x * 255.0 - 0.5; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Steps +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Stern_Special.metal b/colormap-shaders/shaders/metal/IDL_Stern_Special.metal new file mode 100644 index 0000000..23cadc0 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Stern_Special.metal @@ -0,0 +1,37 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Stern_Special { + +float colormap_red(float x) { + if (x < (3.27037346938775E+02 + 9.33750000000000E+00) / (1.81250000000000E+01 + 5.18306122448980E+00)) { // 14.0428817217 + return 1.81250000000000E+01 * x - 9.33750000000000E+00; + } else if (x <= 64.0) { + return -5.18306122448980E+00 * x + 3.27037346938775E+02; + } else { + return x; + } +} + +float colormap_blue(float x) { + if (x < (8.01533134203946E+02 + 1.96917113893858E+00) / (1.99964221824687E+00 + 4.25020839121978E+00)) { // 128.063441841 + return 1.99964221824687E+00 * x - 1.96917113893858E+00; + } else if (x < (8.01533134203946E+02 + 7.17997825045893E+02) / (3.80632931598691E+00 + 4.25020839121978E+00)) { + return -4.25020839121978E+00 * x + 8.01533134203946E+02; + } else { + return 3.80632931598691E+00 * x - 7.17997825045893E+02; + } +} + +float4 colormap(float x) { + float t = x * 255.0; + float r = clamp(colormap_red(t) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(t) / 255.0, 0.0, 1.0); + return float4(r, x, b, 1.0); +} + +} // namespace Stern_Special +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Volcano.metal b/colormap-shaders/shaders/metal/IDL_Volcano.metal new file mode 100644 index 0000000..052b6db --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Volcano.metal @@ -0,0 +1,81 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Volcano { + +float colormap_r1(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 216.6901575438631; + const float b = 1.073972444219095; + const float c = 0.6275803332110022; + const float d = 221.6241814852619; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_r2(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 202.3454274460618; + const float b = 1.058678309228987; + const float c = 0.4891299991060677; + const float d = -72.38173481234448; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +float colormap_red(float x) { + if (x < 0.4264009656413063) { + return colormap_r1(x); + } else if (x < 0.6024851624202665) { + const float a = (0.0 - 255.0) / (0.6024851624202665 - 0.4264009656413063); + const float b = -0.6024851624202665 * a; + return a * x + b; + } else { + return colormap_r2(x); + } +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.3856859482602; + const float b = 0.6744554815524477; + const float c = 0.01070628027163306; + const float d = 26.95058522613648; + float v = a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; + if (v < 0.0) { + return -v; + } else { + return v; + } +} + +float colormap_blue(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.9540413031656; + const float b = 0.2891013907955124; + const float c = 0.5136633102640619; + const float d = 126.5159759632338; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +// R1 - 255 = 0 +// => 0.4264009656413063 + +// R2 = 0 +// => 0.6024851624202665 + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Volcano +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/IDL_Waves.metal b/colormap-shaders/shaders/metal/IDL_Waves.metal new file mode 100644 index 0000000..f216ad8 --- /dev/null +++ b/colormap-shaders/shaders/metal/IDL_Waves.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace IDL { +namespace Waves { + +float colormap_f(float x, float phase) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 126.9634465941118; + const float b = 1.011727672706345; + const float c = 0.0038512319231245; + const float d = 127.5277540583575; + return a * sin(2.0 * pi / b * x + 2.0 * pi * (c + phase)) + d; +} + +float colormap_red(float x) { + return colormap_f(x, 0.5); +} + +float colormap_green(float x) { + const float pi = 3.141592653589793238462643383279502884197169399; + const float a = 63.19460736097507; + const float b = 0.06323746667143024; + const float c = 0.06208443629833329; + const float d = 96.56305326777574; + return a * sin(2.0 * pi / b * x + 2.0 * pi * c) + d; +} + +float colormap_blue(float x) { + return colormap_f(x, 0.0); +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0); + float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0); + float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace Waves +} // namespace IDL +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_autumn.metal b/colormap-shaders/shaders/metal/MATLAB_autumn.metal new file mode 100644 index 0000000..ef81c19 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_autumn.metal @@ -0,0 +1,15 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace autumn { + +float4 colormap(float x) { + float g = clamp(x, 0.0, 1.0); + return float4(1.0, g, 0.0, 1.0); +} + +} // namespace autumn +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_bone.metal b/colormap-shaders/shaders/metal/MATLAB_bone.metal new file mode 100644 index 0000000..c55f363 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_bone.metal @@ -0,0 +1,43 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace bone { + +float colormap_red(float x) { + if (x < 0.75) { + return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else { + return (13.0 + 8.0 / 9.0) / 10.0 * x - (3.0 + 8.0 / 9.0) / 10.0; + } +} + +float colormap_green(float x) { + if (x <= 0.375) { + return 8.0 / 9.0 * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else if (x <= 0.75) { + return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 100.0; + } else { + return 8.0 / 9.0 * x + 1.0 / 9.0; + } +} + +float colormap_blue(float x) { + if (x <= 0.375) { + return (1.0 + 2.0 / 9.0) * x - (13.0 + 8.0 / 9.0) / 1000.0; + } else { + return 8.0 / 9.0 * x + 1.0 / 9.0; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace bone +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_cool.metal b/colormap-shaders/shaders/metal/MATLAB_cool.metal new file mode 100644 index 0000000..6cd1ae2 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_cool.metal @@ -0,0 +1,25 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace cool { + +float colormap_red(float x) { + return (1.0 + 1.0 / 63.0) * x - 1.0 / 63.0; +} + +float colormap_green(float x) { + return -(1.0 + 1.0 / 63.0) * x + (1.0 + 1.0 / 63.0); +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = 1.0; + return float4(r, g, b, 1.0); +} + +} // namespace cool +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_copper.metal b/colormap-shaders/shaders/metal/MATLAB_copper.metal new file mode 100644 index 0000000..bc9b923 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_copper.metal @@ -0,0 +1,29 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace copper { + +float colormap_red(float x) { + return 80.0 / 63.0 * x + 5.0 / 252.0; +} + +float colormap_green(float x) { + return 0.7936 * x - 0.0124; +} + +float colormap_blue(float x) { + return 796.0 / 1575.0 * x + 199.0 / 25200.0; +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace copper +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_hot.metal b/colormap-shaders/shaders/metal/MATLAB_hot.metal new file mode 100644 index 0000000..7771c1d --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_hot.metal @@ -0,0 +1,17 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace hot { + +float4 colormap(float x) { + float r = clamp(8.0 / 3.0 * x, 0.0, 1.0); + float g = clamp(8.0 / 3.0 * x - 1.0, 0.0, 1.0); + float b = clamp(4.0 * x - 3.0, 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace hot +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_hsv.metal b/colormap-shaders/shaders/metal/MATLAB_hsv.metal new file mode 100644 index 0000000..1193a97 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_hsv.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace hsv { + +float colormap_red(float x) { + if (x < 0.5) { + return -6.0 * x + 67.0 / 32.0; + } else { + return 6.0 * x - 79.0 / 16.0; + } +} + +float colormap_green(float x) { + if (x < 0.4) { + return 6.0 * x - 3.0 / 32.0; + } else { + return -6.0 * x + 79.0 / 16.0; + } +} + +float colormap_blue(float x) { + if (x < 0.7) { + return 6.0 * x - 67.0 / 32.0; + } else { + return -6.0 * x + 195.0 / 32.0; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace hsv +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_jet.metal b/colormap-shaders/shaders/metal/MATLAB_jet.metal new file mode 100644 index 0000000..37f9eb7 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_jet.metal @@ -0,0 +1,41 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace jet { + +float colormap_red(float x) { + if (x < 0.7) { + return 4.0 * x - 1.5; + } else { + return -4.0 * x + 4.5; + } +} + +float colormap_green(float x) { + if (x < 0.5) { + return 4.0 * x - 0.5; + } else { + return -4.0 * x + 3.5; + } +} + +float colormap_blue(float x) { + if (x < 0.3) { + return 4.0 * x + 0.5; + } else { + return -4.0 * x + 2.5; + } +} + +float4 colormap(float x) { + float r = clamp(colormap_red(x), 0.0, 1.0); + float g = clamp(colormap_green(x), 0.0, 1.0); + float b = clamp(colormap_blue(x), 0.0, 1.0); + return float4(r, g, b, 1.0); +} + +} // namespace jet +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_parula.metal b/colormap-shaders/shaders/metal/MATLAB_parula.metal new file mode 100644 index 0000000..b2dd36e --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_parula.metal @@ -0,0 +1,403 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace parula { + +float4 colormap(float x) { + if (x < 0.0) { + return float4(0.0, 0.0, 0.0, 0.0); + } else if (1.0 < x) { + return float4(0.0, 0.0, 0.0, 0.0); + } + if (x < 3.1250000000000000e-02) { + float dx = x - 1.5625000000000000e-02; + return ((float4(-1.4151576683620706e+02, 2.4271369358056621e+01, 4.5510373586485706e+01, 1.0) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 2.6007355728658488e-01, 1.4968553250962457e+00, 3.0913652594248364e+00, 1.0)) * dx + + float4( 2.0810000000000001e-01, 1.6630000000000000e-01, 5.2920000000000000e-01, 1.0); + } else if (x < 4.6875000000000000e-02) { + float dx = x - 3.1250000000000000e-02; + return ((float4(-5.1390461057291191e+01, 1.2211762733842230e+01, -1.2843448884986955e+01, 1.0) * dx + + float4(-6.6335515704472066e+00, 1.1377204386589042e+00, 2.1332987618665173e+00, 1.0)) * dx + + float4( 1.5642431399834725e-01, 1.5146322069502911e+00, 3.1246980525790007e+00, 1.0)) * dx + + float4( 2.1162380952380999e-01, 1.8978095238095199e-01, 5.7767619047619101e-01, 1.0); + } else if (x < 6.2500000000000000e-02) { + float dx = x - 4.6875000000000000e-02; + return ((float4(-1.4725107464858192e+02, 1.3014608277362621e+01, 5.8634219534912217e+00, 1.0) * dx + + float4(-9.0424794325077311e+00, 1.7101468168077587e+00, 1.5312620953827538e+00, 1.0)) * dx + + float4(-8.8513670422823654e-02, 1.5591301328169576e+00, 3.1819568159735203e+00, 1.0)) * dx + + float4( 2.1225238095238100e-01, 2.1377142857142900e-01, 6.2697142857142896e-01, 1.0); + } else if (x < 7.8125000000000000e-02) { + float dx = x - 6.2500000000000000e-02; + return ((float4(-2.1469400225321081e+02, -1.4338005366630648e+01, -4.1817857976177763e+01, 1.0) * dx + + float4(-1.5944873556660008e+01, 2.3202065798091316e+00, 1.8061099994526548e+00, 1.0)) * dx + + float4(-4.7894106087856969e-01, 1.6221044046390967e+00, 3.2341032549553237e+00, 1.0)) * dx + + float4( 2.0810000000000001e-01, 2.3860000000000001e-01, 6.7708571428571396e-01, 1.0); + } else if (x < 9.3750000000000000e-02) { + float dx = x - 7.8125000000000000e-02; + return ((float4(-2.8846495443400278e+02, 2.0037550842697090e+02, 1.1771734328417965e+02, 1.0) * dx + + float4(-2.6008654912279265e+01, 1.6481125782483199e+00, -1.5410209318067788e-01, 1.0)) * dx + + float4(-1.1344649432057459e+00, 1.6841093914837442e+00, 3.2599158784908235e+00, 1.0)) * dx + + float4( 1.9590476190476200e-01, 2.6445714285714300e-01, 7.2789999999999999e-01, 1.0); + } else if (x < 1.0937500000000000e-01) { + float dx = x - 9.3750000000000000e-02; + return ((float4(-5.4509738001026233e+02, 5.1696771659011155e+01, -6.5374637230314454e+02, 1.0) * dx + + float4(-3.9530449651373146e+01, 1.1040714535762580e+01, 5.3638983732652425e+00, 1.0)) * dx + + float4(-2.1585134520128149e+00, 1.8823723151401646e+00, 3.3413189453671448e+00, 1.0)) * dx + + float4( 1.7072857142857101e-01, 2.9193809523809500e-01, 7.7924761904761897e-01, 1.0); + } else if (x < 1.2500000000000000e-01) { + float dx = x - 1.0937500000000000e-01; + return ((float4( 2.3639968744743715e+03, -8.1036503315845437e+02, -8.1573269216733058e+02, 1.0) * dx + + float4(-6.5081889339354191e+01, 1.3464000707278728e+01, -2.5280462828444659e+01, 1.0)) * dx + + float4(-3.7930812487429293e+00, 2.2652584908126849e+00, 3.0301226257549660e+00, 1.0)) * dx + + float4( 1.2527142857142901e-01, 3.2424285714285700e-01, 8.3027142857142899e-01, 1.0); + } else if (x < 1.4062500000000000e-01) { + float dx = x - 1.2500000000000000e-01; + return ((float4( 1.4125902630655582e+03, 2.5375056097507152e+02, 9.0826266478267496e+02, 1.0) * dx + + float4( 4.5730464151631985e+01, -2.4521860222023822e+01, -6.3517932773788282e+01, 1.0)) * dx + + float4(-4.0954472673010889e+00, 2.0924794358947931e+00, 1.6426476944700765e+00, 1.0)) * dx + + float4( 5.9133333333333399e-02, 3.5983333333333301e-01, 8.6833333333333296e-01, 1.0); + } else if (x < 1.5625000000000000e-01) { + float dx = x - 1.4062500000000000e-01; + return ((float4(-1.9850459267366693e+03, 1.4738473211499172e+02, 2.4976683303608979e+02, 1.0) * dx + + float4( 1.1194563273283002e+02, -1.2627302676317344e+01, -2.0943120362100398e+01, 1.0)) * dx + + float4(-1.6317582534813697e+00, 1.5120237656082123e+00, 3.2294373922181602e-01, 1.0)) * dx + + float4( 1.1695238095238101e-02, 3.8750952380952403e-01, 8.8195714285714299e-01, 1.0); + } else if (x < 1.7187500000000000e-01) { + float dx = x - 1.5625000000000000e-01; + return ((float4(-1.3211246088080517e+02, 6.1731462945951478e+01, 9.6199145930320853e+01, 1.0) * dx + + float4( 1.8896604917048652e+01, -5.7186433584271068e+00, -9.2353000635336890e+00, 1.0)) * dx + + float4( 4.1265170979798449e-01, 1.2253683588153301e+00, -1.4859407992871662e-01, 1.0)) * dx + + float4( 5.9571428571428596e-03, 4.0861428571428599e-01, 8.8284285714285704e-01, 1.0); + } else if (x < 1.8750000000000000e-01) { + float dx = x - 1.7187500000000000e-01; + return ((float4(-2.4276114402580023e+02, 1.8878292291818184e+01, 5.4500811814199913e+01, 1.0) * dx + + float4( 1.2703833313260910e+01, -2.8249810328356313e+00, -4.7259650980498993e+00, 1.0)) * dx + + float4( 9.0640855714657143e-01, 1.0918742277018498e+00, -3.6673884807846019e-01, 1.0)) * dx + + float4( 1.6514285714285700e-02, 4.2659999999999998e-01, 8.7863333333333304e-01, 1.0); + } else if (x < 2.0312500000000000e-01) { + float dx = x - 1.8750000000000000e-01; + return ((float4(-2.4875702015890445e+02, 2.7531596458333780e+01, 1.1605149669749400e+01, 1.0) * dx + + float4( 1.3244046870515243e+00, -1.9400610816566539e+00, -2.1712395442592785e+00, 1.0)) * dx + + float4( 1.1255997759014531e+00, 1.0174204446629080e+00, -4.7450767061454108e-01, 1.0)) * dx + + float4( 3.2852380952381001e-02, 4.4304285714285702e-01, 8.7195714285714299e-01, 1.0); + } else if (x < 2.1875000000000000e-01) { + float dx = x - 2.0312500000000000e-01; + return ((float4( 6.6879357994795782e+01, 3.3156266362545779e+00, 3.1398894268734253e+01, 1.0) * dx + + float4(-1.0336080632897122e+01, -6.4951749767225808e-01, -1.6272481534897754e+00, 1.0)) * dx + + float4( 9.8479233924761567e-01, 9.7695827936089374e-01, -5.3385904089187008e-01, 1.0)) * dx + + float4( 4.9814285714285700e-02, 4.5857142857142902e-01, 8.6405714285714297e-01, 1.0); + } else if (x < 2.3437500000000000e-01) { + float dx = x - 2.1875000000000000e-01; + return ((float4(-3.7807546774099214e+00, 2.9110963663947160e+01, 2.0085673255558202e+01, 1.0) * dx + + float4(-7.2011107268910699e+00, -4.9409749909782474e-01, -1.5542498464285720e-01, 1.0)) * dx + + float4( 7.1077372425092522e-01, 9.5908929503636120e-01, -5.6171330867519242e-01, 1.0)) * dx + + float4( 6.2933333333333299e-02, 4.7369047619047600e-01, 8.5543809523809500e-01, 1.0); + } else if (x < 2.5000000000000000e-01) { + float dx = x - 2.3437500000000000e-01; + return ((float4(-1.8052110713761824e+01, 7.5676044216235097e+00, 2.6820241280346455e+01, 1.0) * dx + + float4(-7.3783336023946600e+00, 8.7047892264969851e-01, 7.8609094921143352e-01, 1.0)) * dx + + float4( 4.8296990660583561e-01, 9.6497025477935916e-01, -5.5185915297880839e-01, 1.0)) * dx + + float4( 7.2266666666666701e-02, 4.8866666666666703e-01, 8.4670000000000001e-01, 1.0); + } else if (x < 2.6562500000000000e-01) { + float dx = x - 2.5000000000000000e-01; + return ((float4(-8.5042116753280467e+01, 3.9234694840689350e+01, 6.3623990194130904e+01, 1.0) * dx + + float4(-8.2245262921022455e+00, 1.2252103799133005e+00, 2.0432897592276738e+00, 1.0)) * dx + + float4( 2.3917522075432149e-01, 9.9771540013190607e-01, -5.0765007940944740e-01, 1.0)) * dx + + float4( 7.7942857142857203e-02, 5.0398571428571404e-01, 8.3837142857142899e-01, 1.0); + } else if (x < 2.8125000000000000e-01) { + float dx = x - 2.6562500000000000e-01; + return ((float4(-4.4981860368289709e+01, 3.5222378119677195e+01, 1.8276940800992332e+01, 1.0) * dx + + float4(-1.2210875514912267e+01, 3.0643367005706139e+00, 5.0256642995775600e+00, 1.0)) * dx + + float4(-8.0127932480280273e-02, 1.0647395732644671e+00, -3.9719767224061564e-01, 1.0)) * dx + + float4( 7.9347619047619000e-02, 5.2002380952381000e-01, 8.3118095238095202e-01, 1.0); + } else if (x < 2.9687500000000000e-01) { + float dx = x - 2.8125000000000000e-01; + return ((float4( 8.8958586797831074e+01, -6.4031864461777545e+01, -5.4343639113056135e+01, 1.0) * dx + + float4(-1.4319400219675847e+01, 4.7153856749304826e+00, 5.8823958996240755e+00, 1.0)) * dx + + float4(-4.9466349083321959e-01, 1.1862977353816719e+00, -2.2675923162809006e-01, 1.0)) * dx + + float4( 7.4942857142857103e-02, 5.3754285714285699e-01, 8.2627142857142899e-01, 1.0); + } else if (x < 3.1250000000000000e-01) { + float dx = x - 2.9687500000000000e-01; + return ((float4( 2.3465669412937996e+02, -7.4943148843863256e+01, -1.7040059387215410e+02, 1.0) * dx + + float4(-1.0149466463527515e+01, 1.7138920282846606e+00, 3.3350378161995691e+00, 1.0)) * dx + + float4(-8.7698953275827207e-01, 1.2867551994944084e+00, -8.2736829818345611e-02, 1.0)) * dx + + float4( 6.4057142857142799e-02, 5.5698571428571397e-01, 8.2395714285714305e-01, 1.0); + } else if (x < 3.2812500000000000e-01) { + float dx = x - 3.1250000000000000e-01; + return ((float4( 3.5054309382746595e+02, -7.5598816353949772e+01, -5.9224118732067950e+01, 1.0) * dx + + float4( 8.5006607378717081e-01, -1.7990680737714295e+00, -4.6524900215576546e+00, 1.0)) * dx + + float4(-1.0222926638479650e+00, 1.2854243237836778e+00, -1.0332202052706571e-01, 1.0)) * dx + + float4( 4.8771428571428597e-02, 5.7722380952381003e-01, 8.2282857142857202e-01, 1.0); + } else if (x < 3.4375000000000000e-01) { + float dx = x - 3.2812500000000000e-01; + return ((float4(-1.3511844086782639e+02, 2.1571557117596814e+01, 6.5912402293741552e+00, 1.0) * dx + + float4( 1.7281773596949638e+01, -5.3427625903628249e+00, -7.4286205871233397e+00, 1.0)) * dx + + float4(-7.3898266899270237e-01, 1.1738332196565799e+00, -2.9208937378770627e-01, 1.0)) * dx + + float4( 3.4342857142857203e-02, 5.9658095238095199e-01, 8.1985238095238100e-01, 1.0); + } else if (x < 3.5937500000000000e-01) { + float dx = x - 3.4375000000000000e-01; + return ((float4(-1.6458788273706924e+02, 1.0533768835542057e+01, 3.0362548290707878e+01, 1.0) * dx + + float4( 1.0948096681270275e+01, -4.3315958504754741e+00, -7.1196562013714262e+00, 1.0)) * dx + + float4(-2.9789094589551629e-01, 1.0226713690184817e+00, -5.1940619860793691e-01, 1.0)) * dx + + float4( 2.6499999999999999e-02, 6.1370000000000002e-01, 8.1350000000000000e-01, 1.0); + } else if (x < 3.7500000000000000e-01) { + float dx = x - 3.5937500000000000e-01; + return ((float4(-1.0406115199344315e+02, 1.9929786587720105e+01, 3.6734795179105028e+01, 1.0) * dx + + float4( 3.2330396779701545e+00, -3.8378254363094402e+00, -5.6964117502444944e+00, 1.0)) * dx + + float4(-7.6310690282384588e-02, 8.9502416141246732e-01, -7.1965726035193567e-01, 1.0)) * dx + + float4( 2.3890476190476202e-02, 6.2866190476190498e-01, 8.0376190476190501e-01, 1.0); + } else if (x < 3.9062500000000000e-01) { + float dx = x - 3.7500000000000000e-01; + return ((float4( 2.3255546213942225e+02, 1.8349599099637384e+01, 1.7433813849989207e+01, 1.0) * dx + + float4(-1.6448268217224928e+00, -2.9036166900100602e+00, -3.9744682262239461e+00, 1.0)) * dx + + float4(-5.1494864403514876e-02, 7.8968912818872505e-01, -8.7076475998425507e-01, 1.0)) * dx + + float4( 2.3090476190476199e-02, 6.4178571428571396e-01, 7.9126666666666701e-01, 1.0); + } else if (x < 4.0625000000000000e-01) { + float dx = x - 3.9062500000000000e-01; + return ((float4( 1.5126193200717549e+02, 2.0267550346934740e+01, 2.0857035135376179e+01, 1.0) * dx + + float4( 9.2562104660629245e+00, -2.0434792322145579e+00, -3.1572582020057021e+00, 1.0)) * dx + + float4( 6.7433005039304356e-02, 7.1239075440396538e-01, -9.8219798542534331e-01, 1.0)) * dx + + float4( 2.2771428571428599e-02, 6.5348571428571400e-01, 7.7675714285714303e-01, 1.0); + } else if (x < 4.2187500000000000e-01) { + float dx = x - 4.0625000000000000e-01; + return ((float4( 1.0861181935568159e+02, -5.7969433444380156e+00, 3.9956456082908054e+00, 1.0) * dx + + float4( 1.6346613528899276e+01, -1.0934378097019919e+00, -2.1795846800349437e+00, 1.0)) * dx + + float4( 4.6747712996058871e-01, 6.6337642562401933e-01, -1.0655861554572283e+00, 1.0)) * dx + + float4( 2.6661904761904800e-02, 6.6419523809523795e-01, 7.6071904761904796e-01, 1.0); + } else if (x < 4.3750000000000000e-01) { + float dx = x - 4.2187500000000000e-01; + return ((float4(-3.0484063800132168e+02, 1.4154965887634640e+01, -3.1353889969814710e+00, 1.0) * dx + + float4( 2.1437792561196851e+01, -1.3651695289725239e+00, -1.9922887921463122e+00, 1.0)) * dx + + float4( 1.0578584751183406e+00, 6.2496068595722998e-01, -1.1307716784600605e+00, 1.0)) * dx + + float4( 3.8371428571428598e-02, 6.7427142857142897e-01, 7.4355238095238096e-01, 1.0); + } else if (x < 4.5312500000000000e-01) { + float dx = x - 4.3750000000000000e-01; + return ((float4( 1.9732370744832981e+01, -3.3873392535419122e+00, -5.1854420010455629e+00, 1.0) * dx + + float4( 7.1483876548848961e+00, -7.0165550298965007e-01, -2.1392601513798186e+00, 1.0)) * dx + + float4( 1.5045175409946179e+00, 5.9266654483282100e-01, -1.1953271307026563e+00, 1.0)) * dx + + float4( 5.8971428571428598e-02, 6.8375714285714295e-01, 7.2538571428571397e-01, 1.0); + } else if (x < 4.6875000000000000e-01) { + float dx = x - 4.5312500000000000e-01; + return ((float4(-5.2460806882781675e+01, -6.0560887320505685e-01, 1.3890718905419471e+01, 1.0) * dx + + float4( 8.0733425335489422e+00, -8.6043703049942721e-01, -2.3823277451788294e+00, 1.0)) * dx + + float4( 1.7423570751888966e+00, 5.6825884899705426e-01, -1.2659769415863851e+00, 1.0)) * dx + + float4( 8.4300000000000000e-02, 6.9283333333333297e-01, 7.0616666666666705e-01, 1.0); + } else if (x < 4.8437500000000000e-01) { + float dx = x - 4.6875000000000000e-01; + return ((float4( 1.0354971072183483e+01, 5.8097747460711062e+00, -5.4384621916749820e+00, 1.0) * dx + + float4( 5.6142422109185510e+00, -8.8882494643091425e-01, -1.7312002964872917e+00, 1.0)) * dx + + float4( 1.9562255868212013e+00, 5.4092663060751767e-01, -1.3302508172374183e+00, 1.0)) * dx + + float4( 1.1329523809523800e-01, 7.0150000000000001e-01, 6.8585714285714305e-01, 1.0); + } else if (x < 5.0000000000000000e-01) { + float dx = x - 4.8437500000000000e-01; + return ((float4(-1.3925172644537971e+01, -8.9021377300786071e+00, -4.6199177582688593e+00, 1.0) * dx + + float4( 6.0996314799271518e+00, -6.1649175520883115e-01, -1.9861282117220564e+00, 1.0)) * dx + + float4( 2.1392548632406654e+00, 5.1740605714439658e-01, -1.3883340751781894e+00, 1.0)) * dx + + float4( 1.4527142857142900e-01, 7.0975714285714298e-01, 6.6462857142857201e-01, 1.0); + } else if (x < 5.1562500000000000e-01) { + float dx = x - 5.0000000000000000e-01; + return ((float4( 3.1614367125520630e+01, -1.1395280968671647e+01, 2.1421523701702025e+01, 1.0) * dx + + float4( 5.4468890122144344e+00, -1.0337794613062659e+00, -2.2026868566409092e+00, 1.0)) * dx + + float4( 2.3196692459303776e+00, 4.9162056938634824e-01, -1.4537843106213608e+00, 1.0)) * dx + + float4( 1.8013333333333301e-01, 7.1765714285714299e-01, 6.4243333333333297e-01, 1.0); + } else if (x < 5.3125000000000000e-01) { + float dx = x - 5.1562500000000000e-01; + return ((float4(-3.7634010143333590e+01, 2.0544616050328934e+00, 1.3219372364175872e+00, 1.0) * dx + + float4( 6.9288124712232140e+00, -1.5679332567127493e+00, -1.1985529331236269e+00, 1.0)) * dx + + float4( 2.5130395816090907e+00, 4.5096880816730112e-01, -1.5069286823364316e+00, 1.0)) * dx + + float4( 2.1782857142857101e-01, 7.2504285714285699e-01, 6.1926190476190501e-01, 1.0); + } else if (x < 5.4687500000000000e-01) { + float dx = x - 5.3125000000000000e-01; + return ((float4( 1.2815768685879013e+01, -1.4298832118473902e+01, 3.9450879734146490e+01, 1.0) * dx + + float4( 5.1647182457544520e+00, -1.4716303689768324e+00, -1.1365871251665525e+00, 1.0)) * dx + + float4( 2.7020009990618670e+00, 4.0347562651590141e-01, -1.5434152457472157e+00, 1.0)) * dx + + float4( 2.5864285714285701e-01, 7.3171428571428598e-01, 5.9542857142857097e-01, 1.0); + } else if (x < 5.6250000000000000e-01) { + float dx = x - 5.4687500000000000e-01; + return ((float4(-7.8540912219456771e+01, -1.8509114083431125e+01, 3.3113477160250433e+01, 1.0) * dx + + float4( 5.7654574029050307e+00, -2.1418881245302965e+00, 7.1267286237156402e-01, 1.0)) * dx + + float4( 2.8727849935721714e+00, 3.4701440005485251e-01, -1.5500389061033872e+00, 1.0)) * dx + + float4( 3.0217142857142898e-01, 7.3760476190476199e-01, 5.7118571428571396e-01, 1.0); + } else if (x < 5.7812500000000000e-01) { + float dx = x - 5.6250000000000000e-01; + return ((float4(-5.8163891236508938e+01, 9.6920884524980497e+00, 3.0320583052976861e+01, 1.0) * dx + + float4( 2.0838521426179946e+00, -3.0095028471911305e+00, 2.2648671042583031e+00, 1.0)) * dx + + float4( 2.9954304552209687e+00, 2.6652391612170523e-01, -1.5035148441247956e+00, 1.0)) * dx + + float4( 3.4816666666666701e-01, 7.4243333333333295e-01, 5.4726666666666701e-01, 1.0); + } else if (x < 5.9375000000000000e-01) { + float dx = x - 5.7812500000000000e-01; + return ((float4(-6.4543256167712116e+01, -2.8636353652780144e-01, 2.8905906284068501e+00, 1.0) * dx + + float4(-6.4258025909336181e-01, -2.5551862009802844e+00, 3.6861444348665935e+00, 1.0)) * dx + + float4( 3.0179503284010409e+00, 1.7957564974402687e-01, -1.4105302888259692e+00, 1.0)) * dx + + float4( 3.9525714285714297e-01, 7.4590000000000001e-01, 5.2444285714285699e-01, 1.0); + } else if (x < 6.0937500000000000e-01) { + float dx = x - 5.9375000000000000e-01; + return ((float4(-2.4450284092939786e+01, 1.3922851408411924e+01, -1.6916850328844372e+01, 1.0) * dx + + float4(-3.6680453919548675e+00, -2.5686094917550251e+00, 3.8216408705731646e+00, 1.0)) * dx + + float4( 2.9505968026034126e+00, 9.9516342045037676e-02, -1.2932211434284731e+00, 1.0)) * dx + + float4( 4.4200952380952402e-01, 7.4808095238095196e-01, 5.0331428571428605e-01, 1.0); + } else if (x < 6.2500000000000000e-01) { + float dx = x - 6.0937500000000000e-01; + return ((float4( 1.2547821111311350e+01, 1.5748329330961459e+01, -1.7611303598786566e+01, 1.0) * dx + + float4(-4.8141524588114200e+00, -1.9159758319857161e+00, 3.0286635114085847e+00, 1.0)) * dx + + float4( 2.8180624611851890e+00, 2.9444696361588602e-02, -1.1861851374600081e+00, 1.0)) * dx + + float4( 4.8712380952380901e-01, 7.4906190476190504e-01, 4.8397619047619100e-01, 1.0); + } else if (x < 6.4062500000000000e-01) { + float dx = x - 6.2500000000000000e-01; + return ((float4( 9.2115329809656430e+00, -3.2661877796437579e+00, -1.2675733711774058e+00, 1.0) * dx + + float4(-4.2259733442187004e+00, -1.1777728945968977e+00, 2.2031336552154643e+00, 1.0)) * dx + + float4( 2.6768104955128438e+00, -1.8895127491264742e-02, -1.1044383067315073e+00, 1.0)) * dx + + float4( 5.3002857142857096e-01, 7.4911428571428595e-01, 4.6611428571428598e-01, 1.0); + } else if (x < 6.5625000000000000e-01) { + float dx = x - 6.4062500000000000e-01; + return ((float4( 1.4269589821681299e+01, 7.3028598827757278e+00, -8.5260219639800940e+00, 1.0) * dx + + float4(-3.7941827357359359e+00, -1.3308754467676989e+00, 2.1437161534415234e+00, 1.0)) * dx + + float4( 2.5514955567635522e+00, -5.8092757825086563e-02, -1.0365187784712420e+00, 1.0)) * dx + + float4( 5.7085714285714295e-01, 7.4851904761904797e-01, 4.4939047619047601e-01, 1.0); + } else if (x < 6.7187500000000000e-01) { + float dx = x - 6.5625000000000000e-01; + return ((float4( 8.6083934467238432e+00, 2.6914824850885094e-01, -1.7057138772896455e+01, 1.0) * dx + + float4(-3.1252957128446250e+00, -9.8855388976258662e-01, 1.7440588738799565e+00, 1.0)) * dx + + float4( 2.4433787060044811e+00, -9.4333841208372265e-02, -9.7577229366934382e-01, 1.0)) * dx + + float4( 6.0985238095238103e-01, 7.4731428571428604e-01, 4.3368571428571401e-01, 1.0); + } else if (x < 6.8750000000000000e-01) { + float dx = x - 6.7187500000000000e-01; + return ((float4( 8.7188554392023345e+00, 1.7834947123447904e+01, -1.8886229447019101e+00, 1.0) * dx + + float4(-2.7217772700294449e+00, -9.7593756561373424e-01, 9.4450549390043514e-01, 1.0)) * dx + + float4( 2.3520181906470738e+00, -1.2502902019862727e-01, -9.3376347542277516e-01, 1.0)) * dx + + float4( 6.4729999999999999e-01, 7.4560000000000004e-01, 4.1880000000000001e-01, 1.0); + } else if (x < 7.0312500000000000e-01) { + float dx = x - 6.8750000000000000e-01; + return ((float4( 8.9449847961700044e+00, -2.1676746266635202e+01, -4.0993789718798466e+00, 1.0) * dx + + float4(-2.3130809213168355e+00, -1.3992441920211368e-01, 8.5597629336753311e-01, 1.0)) * dx + + float4( 2.2733485314072883e+00, -1.4246436371137491e-01, -9.0563094749671313e-01, 1.0)) * dx + + float4( 6.8341904761904804e-01, 7.4347619047619096e-01, 4.0443333333333298e-01, 1.0); + } else if (x < 7.1875000000000000e-01) { + float dx = x - 7.0312500000000000e-01; + return ((float4( 1.1674919661892304e+01, 2.3933066515154213e+01, -1.1673175453308831e+01, 1.0) * dx + + float4(-1.8937847589963666e+00, -1.1560219004506387e+00, 6.6381790406066532e-01, 1.0)) * dx + + float4( 2.2076162551523946e+00, -1.6271352495594915e-01, -8.8188416316189755e-01, 1.0)) * dx + + float4( 7.1840952380952405e-01, 7.4113333333333298e-01, 3.9047619047618998e-01, 1.0); + } else if (x < 7.3437500000000000e-01) { + float dx = x - 7.1875000000000000e-01; + return ((float4(-4.4641682053710623e+00, 2.0910706819426692e+00, 4.6048045942407727e+00, 1.0) * dx + + float4(-1.3465228998451648e+00, -3.4159407552784897e-02, 1.1663780468681384e-01, 1.0)) * dx + + float4( 2.1569864479829954e+00, -1.8131010789350266e-01, -8.6968954271271826e-01, 1.0)) * dx + + float4( 7.5248571428571398e-01, 7.3839999999999995e-01, 3.7681428571428599e-01, 1.0); + } else if (x < 7.5000000000000000e-01) { + float dx = x - 7.3437500000000000e-01; + return ((float4( 1.2423276968973711e+01, -6.0829492432479162e+00, -2.1725700066572116e+01, 1.0) * dx + + float4(-1.5557807844719334e+00, 6.3859530663277708e-02, 3.3248802004185007e-01, 1.0)) * dx + + float4( 2.1116379529155407e+00, -1.8084604346990121e-01, -8.6267195170133282e-01, 1.0)) * dx + + float4( 7.8584285714285695e-01, 7.3556666666666704e-01, 3.6327142857142902e-01, 1.0); + } else if (x < 7.6562500000000000e-01) { + float dx = x - 7.5000000000000000e-01; + return ((float4( 3.4549460436900552e+00, 2.2240726291601970e+01, -7.5799471847609725e+00, 1.0) * dx + + float4(-9.7343967655129060e-01, -2.2127871511396835e-01, -6.8590417057871789e-01, 1.0)) * dx + + float4( 2.0721188832120530e+00, -1.8330571822694325e-01, -8.6819407905347146e-01, 1.0)) * dx + + float4( 8.1850476190476196e-01, 7.3273333333333301e-01, 3.4979047619047599e-01, 1.0); + } else if (x < 7.8125000000000000e-01) { + float dx = x - 7.6562500000000000e-01; + return ((float4( 8.7094721894791203e+00, 1.3239510743088688e+01, -2.2852796908624047e+01, 1.0) * dx + + float4(-8.1148908075331927e-01, 8.2125532980487381e-01, -1.0412141948643885e+00, 1.0)) * dx + + float4( 2.0442293713791684e+00, -1.7393108362239784e-01, -8.9518030351351996e-01, 1.0)) * dx + + float4( 8.5065714285714300e-01, 7.2989999999999999e-01, 3.3602857142857101e-01, 1.0); + } else if (x < 7.9687500000000000e-01) { + float dx = x - 7.8125000000000000e-01; + return ((float4(-1.2078434801289291e+01, 4.3390183117236198e+01, -3.9570693752303733e+01, 1.0) * dx + + float4(-4.0323257187148548e-01, 1.4418573958871561e+00, -2.1124390499561407e+00, 1.0)) * dx + + float4( 2.0252493455569058e+00, -1.3856994728345987e-01, -9.4445613546384066e-01, 1.0)) * dx + + float4( 8.8243333333333296e-01, 7.2743333333333304e-01, 3.2169999999999999e-01, 1.0); + } else if (x < 8.1250000000000000e-01) { + float dx = x - 7.9687500000000000e-01; + return ((float4(-1.2824532984374384e+01, 1.1653781393088177e+02, -1.1096774236821523e+02, 1.0) * dx + + float4(-9.6940920318192092e-01, 3.4757722295076028e+00, -3.9673153195953783e+00, 1.0)) * dx + + float4( 2.0038018178216963e+00, -6.1731984386666772e-02, -1.0394522974880831e+00, 1.0)) * dx + + float4( 9.1393333333333304e-01, 7.2578571428571403e-01, 3.0627619047619098e-01, 1.0); + } else if (x < 8.2812500000000000e-01) { + float dx = x - 8.1250000000000000e-01; + return ((float4(-3.5855044278532131e+02, 2.7064903734930277e+02, -8.0792089155266083e+01, 1.0) * dx + + float4(-1.5705591868244702e+00, 8.9384822575176859e+00, -9.1689282431054675e+00, 1.0)) * dx + + float4( 1.9641148117278464e+00, 1.3224074197310332e-01, -1.2447061031552840e+00, 1.0)) * dx + + float4( 9.4495714285714305e-01, 7.2611428571428605e-01, 2.8864285714285698e-01, 1.0); + } else if (x < 8.4375000000000000e-01) { + float dx = x - 8.2812500000000000e-01; + return ((float4(-3.8174017206443654e+02, -1.9549693475620506e+02, 4.4911575613188438e+02, 1.0) * dx + + float4(-1.8377611192386407e+01, 2.1625155883266252e+01, -1.2956057422258565e+01, 1.0)) * dx + + float4( 1.6524246495526764e+00, 6.0979758792285232e-01, -1.5904090041765968e+00, 1.0)) * dx + + float4( 9.7389523809523804e-01, 7.3139523809523799e-01, 2.6664761904761902e-01, 1.0); + } else if (x < 8.5937500000000000e-01) { + float dx = x - 8.4375000000000000e-01; + return ((float4( 4.3248438818547703e+02, -2.7134838403902307e+02, 3.3204036056432756e+01, 1.0) * dx + + float4(-3.6271681757906869e+01, 1.2461237066569140e+01, 8.0962436464235150e+00, 1.0)) * dx + + float4( 7.9852944720434427e-01, 1.1423974777640304e+00, -1.6663435944240195e+00, 1.0)) * dx + + float4( 9.9377142857142897e-01, 7.4545714285714304e-01, 2.4034761904761900e-01, 1.0); + } else if (x < 8.7500000000000000e-01) { + float dx = x - 8.5937500000000000e-01; + return ((float4( 1.7847934313241271e+02, -6.1117386114828536e+00, -1.0882439559595376e+02, 1.0) * dx + + float4(-1.5998976061712632e+01, -2.5821843526006538e-01, 9.6526828365688004e+00, 1.0)) * dx + + float4(-1.8199581227210410e-02, 1.3330696438782346e+00, -1.3890166181272647e+00, 1.0)) * dx + + float4( 9.9904285714285701e-01, 7.6531428571428595e-01, 2.1641428571428600e-01, 1.0); + } else if (x < 8.9062500000000000e-01) { + float dx = x - 8.7500000000000000e-01; + return ((float4( 1.0065469642774150e+02, 1.1181852770679304e+01, -4.2302948910418884e+01, 1.0) * dx + + float4(-7.6327568523807861e+00, -5.4470618267332416e-01, 4.5515392930084682e+00, 1.0)) * dx + + float4(-3.8744540800992006e-01, 1.3205239467230254e+00, -1.1670756473526198e+00, 1.0)) * dx + + float4( 9.9553333333333305e-01, 7.8605714285714301e-01, 1.9665238095238100e-01, 1.0); + } else if (x < 9.0625000000000000e-01) { + float dx = x - 8.9062500000000000e-01; + return ((float4( 5.1792385442186948e+01, 1.3813127528788970e+01, -4.7771351619749993e+01, 1.0) * dx + + float4(-2.9145679573304033e+00, -2.0556834047731776e-02, 2.5685885628325829e+00, 1.0)) * dx + + float4(-5.5224735816165738e-01, 1.3116917120867588e+00, -1.0558236496051034e+00, 1.0)) * dx + + float4( 9.8799999999999999e-01, 8.0659999999999998e-01, 1.7936666666666701e-01, 1.0); + } else if (x < 9.2187500000000000e-01) { + float dx = x - 9.0625000000000000e-01; + return ((float4( 1.1035785704157649e+02, 5.2154589495154021e+01, -3.9990387467675163e+01, 1.0) * dx + + float4(-4.8679988972789023e-01, 6.2693351886425119e-01, 3.2930645565680206e-01, 1.0)) * dx + + float4(-6.0539373077194325e-01, 1.3211663477870170e+00, -1.0105440399412067e+00, 1.0)) * dx + + float4( 9.7885714285714298e-01, 8.2714285714285696e-01, 1.6331428571428599e-01, 1.0); + } else if (x < 9.3750000000000000e-01) { + float dx = x - 9.2187500000000000e-01; + return ((float4( 4.6043843534396274e+01, 2.0987943062129727e+01, -2.3203479461840441e+01, 1.0) * dx + + float4( 4.6862246590960082e+00, 3.0716799014495959e+00, -1.5452429568904713e+00, 1.0)) * dx + + float4(-5.3977771875056635e-01, 1.3789571824794209e+00, -1.0295430477729828e+00, 1.0)) * dx + + float4( 9.6970000000000001e-01, 8.4813809523809502e-01, 1.4745238095238100e-01, 1.0); + } else if (x < 9.5312500000000000e-01) { + float dx = x - 9.3750000000000000e-01; + return ((float4( 6.1233625963980650e+01, 2.8669866827404956e+01, 2.4201791029260814e+01, 1.0) * dx + + float4( 6.8445298247708335e+00, 4.0554897324869268e+00, -2.6329060566642419e+00, 1.0)) * dx + + float4(-3.5960967994014698e-01, 1.4903192080096790e+00, -1.0948266261097752e+00, 1.0)) * dx + + float4( 9.6258571428571404e-01, 8.7051428571428602e-01, 1.3089999999999999e-01, 1.0); + } else if (x < 9.6875000000000000e-01) { + float dx = x - 9.5312500000000000e-01; + return ((float4( 4.1070719275903762e+01, 5.3910277236601019e+00, 2.0019172487757277e+01, 1.0) * dx + + float4( 9.7148560418324266e+00, 5.3993897400215340e+00, -1.4984471021676413e+00, 1.0)) * dx + + float4(-1.0086927577447102e-01, 1.6380516997676238e+00, -1.1593790192165234e+00, 1.0)) * dx + + float4( 9.5887142857142904e-01, 8.9490000000000003e-01, 1.1324285714285701e-01, 1.0); + } else if (x < 9.8437500000000000e-01) { + float dx = x - 9.6875000000000000e-01; + return ((float4(-5.3250445924665847e+01, -1.6529749150400146e+01, -1.4422423336140781e+02, 1.0) * dx + + float4( 1.1640046007890415e+01, 5.6520941645681013e+00, -5.6004839180401900e-01, 1.0)) * dx + + float4( 2.3280106875244833e-01, 1.8107311357768368e+00, -1.1915430113098306e+00, 1.0)) * dx + + float4( 9.5982380952380997e-01, 9.2183333333333295e-01, 9.4838095238095305e-02, 1.0); + } else if (x < 1.0000000000000000e+00) { + float dx = x - 9.8437500000000000e-01; + return ((float4(-1.9507053557699635e+02, -1.0404825969371934e+02, 1.5617193238656020e+02, 1.0) * dx + + float4( 9.1439313551717039e+00, 4.8772621731430945e+00, -7.3205593306200099e+00, 1.0)) * dx + + float4( 5.5755071505029385e-01, 1.9752523285535741e+00, -1.3146775069727061e+00, 1.0)) * dx + + float4( 9.6609999999999996e-01, 9.5144285714285703e-01, 7.5533333333333300e-02, 1.0); + } else { + float dx = x - 1.0000000000000000e+00; + return ((float4( 0.0000000000000000e+00, 3.4202936336155174e+00, 3.0625241907655076e+00, 1.0) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 9.7629999999999995e-01, 9.8309999999999997e-01, 5.3800000000000001e-02, 1.0); + } +} + +} // namespace parula +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_pink.metal b/colormap-shaders/shaders/metal/MATLAB_pink.metal new file mode 100644 index 0000000..c79fc0d --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_pink.metal @@ -0,0 +1,403 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace pink { + +float4 colormap(float x) { + if (x < 0.0) { + return float4(0.0, 0.0, 0.0, 0.0); + } else if (1.0 < x) { + return float4(0.0, 0.0, 0.0, 0.0); + } + if (x < 3.1250000000000000e-02) { + float dx = x - 1.5625000000000000e-02; + return ((float4(-1.4669881459549135e+03, -4.0682398921086065e+03, -4.0682398921088602e+03, 1.0) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 5.3504982998818882e+00, 7.5768322282919200e+00, 7.5768322282919822e+00, 1.0)) * dx + + float4( 1.1785113019775800e-01, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0); + } else if (x < 4.6875000000000000e-02) { + float dx = x - 3.1250000000000000e-02; + return ((float4( 1.2528152076829322e+03, 4.5446100426089361e+03, 4.5446100426102021e+03, 1.0) * dx + + float4(-6.8765069341636575e+01, -1.9069874494259093e+02, -1.9069874494260281e+02, 1.0)) * dx + + float4( 4.2760440914188163e+00, 4.5971643385639362e+00, 4.5971643385638128e+00, 1.0)) * dx + + float4( 1.9585655046433401e-01, 1.0286889997472801e-01, 1.0286889997472801e-01, 1.0); + } else if (x < 6.2500000000000000e-02) { + float dx = x - 4.6875000000000000e-02; + return ((float4(-8.2547934274917452e+01, -9.1253943618964820e+02, -9.1253943619445545e+02, 1.0) * dx + + float4(-1.0039356481499135e+01, 2.2329850804702957e+01, 2.2329850804750397e+01, 1.0)) * dx + + float4( 3.0447249379323211e+00, 1.9664003676594368e+00, 1.9664003676598694e+00, 1.0)) * dx + + float4( 2.5066050313259902e-01, 1.4547859349066200e-01, 1.4547859349066200e-01, 1.0); + } else if (x < 7.8125000000000000e-02) { + float dx = x - 6.2500000000000000e-02; + return ((float4( 1.3738814812365237e+02, 3.5917185339157112e+02, 3.5917185340953500e+02, 1.0) * dx + + float4(-1.3908790900635891e+01, -2.0445435266686804e+01, -2.0445435266864703e+01, 1.0)) * dx + + float4( 2.6705351350864612e+00, 1.9958443604409393e+00, 1.9958443604393332e+00, 1.0)) * dx + + float4( 2.9546842014263902e-01, 1.7817416127495000e-01, 1.7817416127495000e-01, 1.0); + } else if (x < 9.3750000000000000e-02) { + float dx = x - 7.8125000000000000e-02; + return ((float4( 2.7031959945674146e+01, -3.8567216714497711e+01, -3.8567216781546392e+01, 1.0) * dx + + float4(-7.4687214573396865e+00, -3.6092546389569100e+00, -3.6092546382927484e+00, 1.0)) * dx + + float4( 2.3365115044930929e+00, 1.6199898306652563e+00, 1.6199898306712481e+00, 1.0)) * dx + + float4( 3.3432392491786600e-01, 2.0573779994945601e-01, 2.0573779994945601e-01, 1.0); + } else if (x < 1.0937500000000000e-01) { + float dx = x - 9.3750000000000000e-02; + return ((float4( 3.2452254818731888e+01, 4.4132390168433041e+01, 4.4132390418663725e+01, 1.0) * dx + + float4(-6.2015983348862109e+00, -5.4170929224489903e+00, -5.4170929249277355e+00, 1.0)) * dx + + float4( 2.1229127577395634e+00, 1.4789531500182891e+00, 1.4789531499959279e+00, 1.0)) * dx + + float4( 3.6911161759471400e-01, 2.3002185311411799e-01, 2.3002185311411799e-01, 1.0); + } else if (x < 1.2500000000000000e-01) { + float dx = x - 1.0937500000000000e-01; + return ((float4( 1.7962452314829033e+01, 9.9760928434314167e+00, 9.9760919095573772e+00, 1.0) * dx + + float4(-4.6803988902581537e+00, -3.3483871333036914e+00, -3.3483871240528735e+00, 1.0)) * dx + + float4( 1.9528815510966826e+00, 1.3419925241471533e+00, 1.3419925242306059e+00, 1.0)) * dx + + float4( 4.0089186286863698e-01, 2.5197631533948500e-01, 2.5197631533948500e-01, 1.0); + } else if (x < 1.4062500000000000e-01) { + float dx = x - 1.2500000000000000e-01; + return ((float4( 1.4107229469108253e+01, 1.2353314086225026e+01, 1.2353317571490493e+01, 1.0) * dx + + float4(-3.8384089380005428e+00, -2.8807577812678438e+00, -2.8807578157923714e+00, 1.0)) * dx + + float4( 1.8197751787801404e+00, 1.2446621348569731e+00, 1.2446621345455240e+00, 1.0)) * dx + + float4( 4.3033148291193501e-01, 2.7216552697590901e-01, 2.7216552697590901e-01, 1.0); + } else if (x < 1.5625000000000000e-01) { + float dx = x - 1.4062500000000000e-01; + return ((float4( 1.0219970967189909e+01, 7.5634260052650815e+00, 7.5634129980772871e+00, 1.0) * dx + + float4(-3.1771325566360935e+00, -2.3016961834760457e+00, -2.3016960546287546e+00, 1.0)) * dx + + float4( 1.7101573429264429e+00, 1.1636862916578499e+00, 1.1636862928201939e+00, 1.0)) * dx + + float4( 4.5788217333292702e-01, 2.9095718698132300e-01, 2.9095718698132300e-01, 1.0); + } else if (x < 1.7187500000000000e-01) { + float dx = x - 1.5625000000000000e-01; + return ((float4( 7.9639431579939997e+00, 6.1408899801328447e+00, 6.1409385236185399e+00, 1.0) * dx + + float4(-2.6980714175490665e+00, -1.9471605894792450e+00, -1.9471610703438818e+00, 1.0)) * dx + + float4( 1.6183572808297999e+00, 1.0972979045804234e+00, 1.0972979002424965e+00, 1.0)) * dx + + float4( 4.8386670078337102e-01, 3.0860669992418399e-01, 3.0860669992418399e-01, 1.0); + } else if (x < 1.8750000000000000e-01) { + float dx = x - 1.7187500000000000e-01; + return ((float4( 6.2644603100084071e+00, 4.6737470532015237e+00, 4.6735658864465535e+00, 1.0) * dx + + float4(-2.3247615820180978e+00, -1.6593063716605179e+00, -1.6593045770492627e+00, 1.0)) * dx + + float4( 1.5398755152115629e+00, 1.0409468583126147e+00, 1.0409468745019785e+00, 1.0)) * dx + + float4( 5.0852520448634997e-01, 3.2530002431617799e-01, 3.2530002431617799e-01, 1.0); + } else if (x < 2.0312500000000000e-01) { + float dx = x - 1.8750000000000000e-01; + return ((float4( 5.0557657194808643e+00, 3.7546306563046934e+00, 3.7553067798388895e+00, 1.0) * dx + + float4(-2.0311150049864537e+00, -1.4402244785416964e+00, -1.4402311761220805e+00, 1.0)) * dx + + float4( 1.4718149435396168e+00, 9.9251668877820509e-01, 9.9251662835867638e-01, 1.0)) * dx + + float4( 5.3204208768553596e-01, 3.4117754381277299e-01, 3.4117754381277299e-01, 1.0); + } else if (x < 2.1875000000000000e-01) { + float dx = x - 2.0312500000000000e-01; + return ((float4( 4.1410369504978677e+00, 3.0442611292784201e+00, 3.0417378018965926e+00, 1.0) * dx + + float4(-1.7941259868857882e+00, -1.2642261665274139e+00, -1.2642011708171326e+00, 1.0)) * dx + + float4( 1.4120455530416129e+00, 9.5025964744900027e-01, 9.5025987293775116e-01, 1.0)) * dx + + float4( 5.5456260470724394e-01, 3.5634832254989901e-01, 3.5634832254989901e-01, 1.0); + } else if (x < 2.3437500000000000e-01) { + float dx = x - 2.1875000000000000e-01; + return ((float4( 3.4529542936776019e+00, 2.5030166001054397e+00, 2.5124337860985739e+00, 1.0) * dx + + float4(-1.6000148798312006e+00, -1.1215264260924880e+00, -1.1216197113532298e+00, 1.0)) * dx + + float4( 1.3590121019991601e+00, 9.1298226318931430e-01, 9.1298142165383922e-01, 1.0)) * dx + + float4( 5.7620359423608403e-01, 3.7089909350945799e-01, 3.7089909350945799e-01, 1.0); + } else if (x < 2.5000000000000000e-01) { + float dx = x - 2.3437500000000000e-01; + return ((float4( 2.8804720304898979e+00, 2.1365016738443594e+00, 2.1013562572536415e+00, 1.0) * dx + + float4(-1.4381576473150630e+00, -1.0041975229625455e+00, -1.0038493776298592e+00, 1.0)) * dx + + float4( 1.3115406562624998e+00, 8.7976782648532936e-01, 8.7977096713847847e-01, 1.0)) * dx + + float4( 5.9706070167235203e-01, 3.8490017945975102e-01, 3.8490017945975102e-01, 1.0); + } else if (x < 2.6562500000000000e-01) { + float dx = x - 2.5000000000000000e-01; + return ((float4( 2.5594362349562849e+00, 1.6480351971046261e+00, 1.7791996774743761e+00, 1.0) * dx + + float4(-1.3031355208858491e+00, -9.0404900700109114e-01, -9.0534830307109471e-01, 1.0)) * dx + + float4( 1.2687079505093606e+00, 8.4995147445464758e-01, 8.4993975337752603e-01, 1.0)) * dx + + float4( 6.1721339984836798e-01, 3.9840953644479798e-01, 3.9840953644479798e-01, 1.0); + } else if (x < 2.8125000000000000e-01) { + float dx = x - 2.6562500000000000e-01; + return ((float4( 1.8051368703401163e+00, 2.0114928499339442e+00, 1.5219803450456506e+00, 1.0) * dx + + float4(-1.1831619473722732e+00, -8.2679735713681179e-01, -8.2194831818948333e-01, 1.0)) * dx + + float4( 1.2298595525678273e+00, 8.2290700001499284e-01, 8.2295074367032950e-01, 1.0)) * dx + + float4( 6.3672857672895500e-01, 4.1147559989891203e-01, 4.1147559989891203e-01, 1.0); + } else if (x < 2.9687500000000000e-01) { + float dx = x - 2.8125000000000000e-01; + return ((float4( 3.0463396572174992e+00, -5.1289449769253304e-01, 1.3139910414908893e+00, 1.0) * dx + + float4(-1.0985461565750803e+00, -7.3250862979615816e-01, -7.5060548951546846e-01, 1.0)) * dx + + float4( 1.1942078634436499e+00, 7.9854284396916519e-01, 7.9837959042493967e-01, 1.0)) * dx + + float4( 6.5566316039120298e-01, 4.2413934018690103e-01, 4.2413934018690103e-01, 1.0); + } else if (x < 3.1250000000000000e-01) { + float dx = x - 2.9687500000000000e-01; + return ((float4(-2.8704741000704268e+00, 7.9617278728423395e+00, 1.1436982209969482e+00, 1.0) * dx + + float4(-9.5574898514300999e-01, -7.5655055937549565e-01, -6.8901215944558303e-01, 1.0)) * dx + + float4( 1.1621095018543048e+00, 7.7527629413835808e-01, 7.7588556465992320e-01, 1.0)) * dx + + float4( 6.7406607937581298e-01, 4.3643578047198500e-01, 4.3643578047198500e-01, 1.0); + } else if (x < 3.2812500000000000e-01) { + float dx = x - 3.1250000000000000e-01; + return ((float4( 1.8151104486259406e+01, -2.4442464044541747e+01, 1.0027690236563866e+00, 1.0) * dx + + float4(-1.0903024585838113e+00, -3.8334456533601097e-01, -6.3540130533635109e-01, 1.0)) * dx + + float4( 1.1301399480460732e+00, 7.5746543281474077e-01, 7.5519160427270549e-01, 1.0)) * dx + + float4( 6.9197975319800997e-01, 4.4839513942303300e-01, 4.4839513942303300e-01, 1.0); + } else if (x < 3.4375000000000000e-01) { + float dx = x - 3.2812500000000000e-01; + return ((float4(-6.1186402817835244e+01, 9.5847900752188593e+01, 8.8499813124143623e-01, 1.0) * dx + + float4(-2.3946943579040159e-01, -1.5290850674239054e+00, -5.8839650735245796e-01, 1.0)) * dx + + float4( 1.1093622621964760e+00, 7.2758371980286707e-01, 7.3606976344944286e-01, 1.0)) * dx + + float4( 7.0944124373120399e-01, 4.6004370622823598e-01, 4.6004370622823598e-01, 1.0); + } else if (x < 3.5937500000000000e-01) { + float dx = x - 3.4375000000000000e-01; + return ((float4( 2.3416165617778907e+02, -3.5362066219986355e+02, 7.8571521572691694e-01, 1.0) * dx + + float4(-3.1075820678764288e+00, 2.9637852803349345e+00, -5.4691221995051564e-01, 1.0)) * dx + + float4( 1.0570645824516820e+00, 7.5000091062960195e-01, 7.1833056458533395e-01, 1.0)) * dx + + float4( 7.2648315725677903e-01, 4.7140452079103201e-01, 4.7140452079103201e-01, 1.0); + } else if (x < 3.7500000000000000e-01) { + float dx = x - 3.5937500000000000e-01; + return ((float4(-8.6872290443392524e+02, 1.3233639570551793e+03, 7.0135001376448258e-01, 1.0) * dx + + float4( 7.8687455654574343e+00, -1.3612183260283668e+01, -5.1008181921331641e-01, 1.0)) * dx + + float4( 1.1314577621013850e+00, 5.8361969219290288e-01, 7.0181503272339907e-01, 1.0)) * dx + + float4( 7.4313436015883205e-01, 4.8249790963716399e-01, 4.8249790963716399e-01, 1.0); + } else if (x < 3.9062500000000000e-01) { + float dx = x - 3.7500000000000000e-01; + return ((float4( 8.8518476063177650e+02, -1.3713638359409479e+03, 6.2914033536808966e-01, 1.0) * dx + + float4(-3.2852640579882809e+01, 4.8420502226677854e+01, -4.7720603731810629e-01, 1.0)) * dx + + float4( 7.4108440250098861e-01, 1.1274996760428120e+00, 6.8638865996509557e-01, 1.0)) * dx + + float4( 7.5942055326385305e-01, 4.9334191326730298e-01, 4.9334191326730298e-01, 1.0); + } else if (x < 4.0625000000000000e-01) { + float dx = x - 3.9062500000000000e-01; + return ((float4(-2.3709260415260931e+02, 3.7516300791309146e+02, 5.6692410339443688e-01, 1.0) * dx + + float4( 8.6403950747317122e+00, -1.5862177583054082e+01, -4.4771508409772709e-01, 1.0)) * dx + + float4( 3.6276806648300275e-01, 1.6362234985994335e+00, 6.7193676744297315e-01, 1.0)) * dx + + float4( 7.6635604473481300e-01, 5.1754916950676599e-01, 5.0395263067897000e-01, 1.0); + } else if (x < 4.2187500000000000e-01) { + float dx = x - 4.0625000000000000e-01; + return ((float4( 6.3616714987678073e+01, -9.4300538300030098e+01, 5.1299127761488117e-01, 1.0) * dx + + float4(-2.4733207449218502e+00, 1.7235884128720800e+00, -4.2114051675111286e-01, 1.0)) * dx + + float4( 4.5912860288628182e-01, 1.4153080428153397e+00, 6.5836089867971004e-01, 1.0)) * dx + + float4( 7.7322933071864097e-01, 5.4067369302384405e-01, 5.1434449987363995e-01, 1.0); + } else if (x < 4.3750000000000000e-01) { + float dx = x - 4.2187500000000000e-01; + return ((float4(-1.6961859855932584e+01, 3.0379726001371605e+01, 4.6597626654549629e-01, 1.0) * dx + + float4( 5.0871277012555960e-01, -2.6967493199418304e+00, -3.9709405061291531e-01, 1.0)) * dx + + float4( 4.2843160328008978e-01, 1.4001024036423748e+00, 6.4557598356464707e-01, 1.0)) * dx + + float4( 7.8004205557495998e-01, 5.6284895113959499e-01, 5.2453052831296199e-01, 1.0); + } else if (x < 4.5312500000000000e-01) { + float dx = x - 4.3750000000000000e-01; + return ((float4( 4.6255693417292765e+00, -3.8807368791610912e+00, 4.2477880151371511e-01, 1.0) * dx + + float4(-2.8637441062128022e-01, -1.2726996636275365e+00, -3.7525141311859517e-01, 1.0)) * dx + + float4( 4.3190564014734417e-01, 1.3380797632741035e+00, 6.3350808569384220e-01, 1.0)) * dx + + float4( 7.8679579246944298e-01, 5.8418305458977604e-01, 5.3452248382484902e-01, 1.0); + } else if (x < 4.6875000000000000e-01) { + float dx = x - 4.5312500000000000e-01; + return ((float4(-1.1620953817302908e+00, 4.6334128006838897e+00, 3.8850531365210134e-01, 1.0) * dx + + float4(-6.9550847727720383e-02, -1.4546092048382127e+00, -3.5533990679763977e-01, 1.0)) * dx + + float4( 4.2634430798564099e-01, 1.2954655622043261e+00, 6.2209259632015113e-01, 1.0)) * dx + + float4( 7.9349204761587200e-01, 6.0476502936325705e-01, 5.4433105395181702e-01, 1.0); + } else if (x < 4.8437500000000000e-01) { + float dx = x - 4.6875000000000000e-01; + return ((float4( 3.8556361698416303e-01, 1.8233043610892945e+00, 3.5642377965443828e-01, 1.0) * dx + + float4(-1.2402406874632776e-01, -1.2374179798061553e+00, -3.3712872022019752e-01, 1.0)) * dx + + float4( 4.2331969991573404e-01, 1.2534026374442579e+00, 6.1127277402299740e-01, 1.0)) * dx + + float4( 8.0013226419863903e-01, 6.2466922463944097e-01, 5.5396597989254404e-01, 1.0); + } else if (x < 5.0000000000000000e-01) { + float dx = x - 4.8437500000000000e-01; + return ((float4(-3.2095667390052242e-02, 2.1503801318034825e+00, 3.2793327560925789e-01, 1.0) * dx + + float4(-1.0595077420019512e-01, -1.1519505878800946e+00, -3.2042135554889573e-01, 1.0)) * dx + + float4( 4.1972634299469458e-01, 1.2160687535741603e+00, 6.0099855408910530e-01, 1.0)) * dx + + float4( 8.0671782600463904e-01, 6.4395849220469203e-01, 5.6343616981901101e-01, 1.0); + } else if (x < 5.1562500000000000e-01) { + float dx = x - 5.0000000000000000e-01; + return ((float4( 7.7013830342289147e-02, 1.7153408159410617e+00, 3.0252602235293108e-01, 1.0) * dx + + float4(-1.0745525860910382e-01, -1.0511515192018064e+00, -3.0504948325471176e-01, 1.0)) * dx + + float4( 4.1639187373204928e-01, 1.1816452831510056e+00, 5.9122557223279892e-01, 1.0)) * dx + + float4( 8.1325006079044404e-01, 6.6268653159200297e-01, 5.7274979532281600e-01, 1.0); + } else if (x < 5.3125000000000000e-01) { + float dx = x - 5.1562500000000000e-01; + return ((float4( 4.5128006172428847e-02, 1.5453203541034857e+00, 2.7981246555779532e-01, 1.0) * dx + + float4(-1.0384523531180902e-01, -9.7074491845456912e-01, -2.9086857595691812e-01, 1.0)) * dx + + float4( 4.1309030351453502e-01, 1.1500531513126246e+00, 5.8191435255761725e-01, 1.0)) * dx + + float4( 8.1973024340795897e-01, 6.8089965385828999e-01, 5.8191437396264600e-01, 1.0); + } else if (x < 5.4687500000000000e-01) { + float dx = x - 5.3125000000000000e-01; + return ((float4( 5.1163279076130053e-02, 1.3521114454007919e+00, 2.5933722356445560e-01, 1.0) * dx + + float4(-1.0172986002247641e-01, -8.9830802685596822e-01, -2.7775236663389646e-01, 1.0)) * dx + + float4( 4.0987819264993680e-01, 1.1208491990421476e+00, 5.7302965032963571e-01, 1.0)) * dx + + float4( 8.2615959870940303e-01, 6.9863813100577199e-01, 5.9093684028527904e-01, 1.0); + } else if (x < 5.6250000000000000e-01) { + float dx = x - 5.4687500000000000e-01; + return ((float4( 4.7169570095915013e-02, 1.2029732434271569e+00, 2.4119519806979875e-01, 1.0) * dx + + float4(-9.9331581315782819e-02, -8.3492780285280610e-01, -2.6559593427931261e-01, 1.0)) * dx + + float4( 4.0673660762902653e-01, 1.0937673892029480e+00, 5.6453983312786682e-01, 1.0)) * dx + + float4( 8.3253930425037204e-01, 7.1593724415352000e-01, 5.9982360722829198e-01, 1.0); + } else if (x < 5.7812500000000000e-01) { + float dx = x - 5.6250000000000000e-01; + return ((float4( 4.5986272021792729e-02, 1.0731479391457011e+00, 2.2367640273462128e-01, 1.0) * dx + + float4(-9.7120507717536803e-02, -7.7853843206715811e-01, -2.5428990936979079e-01, 1.0)) * dx + + float4( 4.0366704373788093e-01, 1.0685569792823235e+00, 5.5641661682084964e-01, 1.0)) * dx + + float4( 8.3887049280786097e-01, 7.3282810879294003e-01, 6.0858061945018505e-01, 1.0); + } else if (x < 5.9375000000000000e-01) { + float dx = x - 5.7812500000000000e-01; + return ((float4( 4.4164995395678787e-02, 9.6091304374043085e-01, 2.1201124590809547e-01, 1.0) * dx + + float4(-9.4964901216515268e-02, -7.2823462241970338e-01, -2.4380507799160542e-01, 1.0)) * dx + + float4( 4.0066570922328631e-01, 1.0450136503059664e+00, 5.4863388264332780e-01, 1.0)) * dx + + float4( 8.4515425472851702e-01, 7.4933833246934400e-01, 6.1721339984836798e-01, 1.0); + } else if (x < 6.0937500000000000e-01) { + float dx = x - 5.9375000000000000e-01; + return ((float4( 4.2622287162048224e-02, 8.7204745369720627e-01, 1.8569722378857575e-01, 1.0) * dx + + float4(-9.2894667057342825e-02, -6.8319182349437069e-01, -2.3386705083966344e-01, 1.0)) * dx + + float4( 3.9773040346900729e-01, 1.0229601120885590e+00, 5.4117025563033927e-01, 1.0)) * dx + + float4( 8.5139164012088198e-01, 7.6549254469187100e-01, 6.2572709029927098e-01, 1.0); + } else if (x < 6.2500000000000000e-01) { + float dx = x - 6.0937500000000000e-01; + return ((float4( 4.1105693265725961e-02, 7.6494427361798978e-01, 2.2040881261248599e-01, 1.0) * dx + + float4(-9.0896747346621815e-02, -6.4231459910231414e-01, -2.2516249347457395e-01, 1.0)) * dx + + float4( 3.9485866261894537e-01, 1.0022490742354857e+00, 5.3399791900042926e-01, 1.0)) * dx + + float4( 8.5758366090413296e-01, 7.8131282816150904e-01, 6.3412648747422795e-01, 1.0); + } else if (x < 6.4062500000000000e-01) { + float dx = x - 6.2500000000000000e-01; + return ((float4( 3.9676521680195975e-02, 7.8428805986266303e-01, 3.3000425741025317e-02, 1.0) * dx + + float4(-8.8969917974790910e-02, -6.0645783627647087e-01, -2.1483083038336367e-01, 1.0)) * dx + + float4( 3.9204824597329829e-01, 9.8273700493269212e-01, 5.2712302331514893e-01, 1.0)) * dx + + float4( 8.6373129272462201e-01, 7.9681907288959597e-01, 6.4241607443962101e-01, 1.0); + } else if (x < 6.5625000000000000e-01) { + float dx = x - 6.4062500000000000e-01; + return ((float4( 3.8312487764607418e-02, 3.8021584708698697e-01, 6.7955965978490873e-01, 1.0) * dx + + float4(-8.7110081021031724e-02, -5.6969433347040854e-01, -2.1328393542675311e-01, 1.0)) * dx + + float4( 3.8929699598898854e-01, 9.6435962728039715e-01, 5.2043373009936589e-01, 1.0)) * dx + + float4( 8.6983547675049300e-01, 8.1202926941800202e-01, 6.5060004863235499e-01, 1.0); + } else if (x < 6.7187500000000000e-01) { + float dx = x - 6.5625000000000000e-01; + return ((float4( 3.7014142710244315e-02, 1.5972496107531242e+00, -1.7818291365727916e+00, 1.0) * dx + + float4(-8.5314183157065751e-02, -5.5187171563820603e-01, -1.8142957637433552e-01, 1.0)) * dx + + float4( 3.8660286686120576e-01, 9.4683515776307503e-01, 5.1426633147747391e-01, 1.0)) * dx + + float4( 8.7589712135373898e-01, 8.2695975347197803e-01, 6.5868234670623604e-01, 1.0); + } else if (x < 6.8750000000000000e-01) { + float dx = x - 6.7187500000000000e-01; + return ((float4( 3.5776320711640310e-02, -3.2011488281931193e+00, 7.3597907806637606e+00, 1.0) * dx + + float4(-8.3579145217523049e-02, -4.7700064013415333e-01, -2.6495281715118513e-01, 1.0)) * dx + + float4( 3.8396390860535284e-01, 9.3075902720413195e-01, 5.0729160657863759e-01, 1.0)) * dx + + float4( 8.8191710368819698e-01, 8.4162541153017301e-01, 6.6666666666666696e-01, 1.0); + } else if (x < 7.0312500000000000e-01) { + float dx = x - 6.8750000000000000e-01; + return ((float4( 3.4595751258128971e-02, 1.4479853717875505e+01, -2.6798031522024559e+01, 1.0) * dx + + float4(-8.1902130184164909e-02, -6.2705449145570580e-01, 8.0037375692428664e-02, 1.0)) * dx + + float4( 3.8137826367720146e-01, 9.1350816577304039e-01, 5.0440230280584453e-01, 1.0)) * dx + + float4( 8.8789627117123804e-01, 8.5603985468214805e-01, 6.7455648764684994e-01, 1.0); + } else if (x < 7.1875000000000000e-01) { + float dx = x - 7.0312500000000000e-01; + return ((float4( 3.3468991753281919e-02, -5.1708135322659281e+01, 1.0064307843765410e+02, 1.0) * dx + + float4(-8.0280454343940114e-02, 5.1688651569708526e-02, -1.1761203519024725e+00, 1.0)) * dx + + float4( 3.7884416079394984e-01, 9.0451807452482169e-01, 4.8727600630256263e-01, 1.0)) * dx + + float4( 8.9383544287626004e-01, 8.7021556655528298e-01, 6.8235508762554498e-01, 1.0); + } else if (x < 7.3437500000000000e-01) { + float dx = x - 7.1875000000000000e-01; + return ((float4( 3.2392951100837251e-02, 1.9512898026633002e+02, -3.7500834138704249e+02, 1.0) * dx + + float4(-7.8711595355505024e-02, -2.3721301916799455e+00, 3.5415239498625635e+00, 1.0)) * dx + + float4( 3.7635991001739599e-01, 8.6826117546059922e-01, 5.2423543752068902e-01, 1.0)) * dx + + float4( 8.9973541084243802e-01, 8.8416402988700704e-01, 6.9006555934235403e-01, 1.0); + } else if (x < 7.5000000000000000e-01) { + float dx = x - 7.3437500000000000e-01; + return ((float4( 3.1364727379629663e-02, -7.2624066315039011e+02, 1.4001148170350855e+03, 1.0) * dx + + float4(-7.7193175772653277e-02, 6.7745407583042745e+00, -1.4036992052655055e+01, 1.0)) * dx + + float4( 3.7392389796851849e-01, 9.3704884056410442e-01, 3.6024374841455642e-01, 1.0)) * dx + + float4( 9.0559694130767698e-01, 8.9789583539346696e-01, 6.9769082462971099e-01, 1.0); + } else if (x < 7.6562500000000000e-01) { + float dx = x - 7.5000000000000000e-01; + return ((float4( 3.0381616356811136e-02, 7.3556986866868601e+02, -1.4318093578633127e+03, 1.0) * dx + + float4(-7.5722954176733137e-02, -2.7267990326870265e+01, 5.1593389995864584e+01, 1.0)) * dx + + float4( 3.7153458343805934e-01, 6.1683869105526079e-01, 9.4706246627720525e-01, 1.0)) * dx + + float4( 9.1142077587019599e-01, 9.1142077587019599e-01, 7.0523364734993799e-01, 1.0); + } else if (x < 7.8125000000000000e-01) { + float dx = x - 7.6562500000000000e-01; + return ((float4( 2.9441135219075026e-02, -1.9705777042165474e+02, 3.8669242628155297e+02, 1.0) * dx + + float4(-7.4298815910007615e-02, 7.2118472669743907e+00, -1.5522673653978197e+01, 1.0)) * dx + + float4( 3.6919049328045406e-01, 3.0346145574438771e-01, 1.5106674091191798e+00, 1.0)) * dx + + float4( 9.1720763258372495e-01, 9.1720763258372495e-01, 7.2716562162264098e-01, 1.0); + } else if (x < 7.9687500000000000e-01) { + float dx = x - 7.8125000000000000e-01; + return ((float4( 2.8540822829984158e-02, 5.2837899997996146e+01, -1.0097631834123302e+02, 1.0) * dx + + float4(-7.2918762696613473e-02, -2.0252357215406760e+00, 2.6035338279695983e+00, 1.0)) * dx + + float4( 3.6689021861472559e-01, 3.8450226114178948e-01, 1.3088058493377956e+00, 1.0)) * dx + + float4( 9.2295820699089703e-01, 9.2295820699089703e-01, 7.4845519918374903e-01, 1.0); + } else if (x < 8.1250000000000000e-01) { + float dx = x - 7.9687500000000000e-01; + return ((float4( 2.7678922768475427e-02, -1.4122546221022333e+01, 2.9362371786331625e+01, 1.0) * dx + + float4(-7.1580911626457966e-02, 4.5154084086539337e-01, -2.1297310942756997e+00, 1.0)) * dx + + float4( 3.6463241120342760e-01, 3.5991327863123823e-01, 1.3162090170517629e+00, 1.0)) * dx + + float4( 9.2867317309905195e-01, 9.2867317309905195e-01, 7.6915572487015205e-01, 1.0); + } else if (x < 8.2812500000000000e-01) { + float dx = x - 8.1250000000000000e-01; + return ((float4( 2.6851775131151001e-02, 3.8183931751282176e+00, -5.8379224589604535e+00, 1.0) * dx + + float4(-7.0283462121685680e-02, -2.1045351324502842e-01, -7.5336991679140475e-01, 1.0)) * dx + + float4( 3.6241578036361283e-01, 3.6368026812530641e-01, 1.2711605637538392e+00, 1.0)) * dx + + float4( 9.3435318430231395e-01, 9.3435318430231395e-01, 7.8931354544051302e-01, 1.0); + } else if (x < 8.4375000000000000e-01) { + float dx = x - 8.2812500000000000e-01; + return ((float4( 2.6063496580937279e-02, -9.8987695961652500e-01, 3.3620382019700017e+00, 1.0) * dx + + float4(-6.9024785162412977e-02, -3.1466333160893228e-02, -1.0270225320551760e+00, 1.0)) * dx + + float4( 3.6023908899979878e-01, 3.5990027052521389e-01, 1.2433419317406114e+00, 1.0)) * dx + + float4( 9.3999887425351902e-01, 9.3999887425351902e-01, 8.0896923113998398e-01, 1.0); + } else if (x < 8.5937500000000000e-01) { + float dx = x - 8.4375000000000000e-01; + return ((float4( 2.5289790701126986e-02, 2.9751021549391093e-01, 7.0033007973428829e-01, 1.0) * dx + + float4(-6.7803058760181542e-02, -7.7866815642917836e-02, -8.6942699133783219e-01, 1.0)) * dx + + float4( 3.5810115393850828e-01, 3.5819194007515431e-01, 1.2137099079375957e+00, 1.0)) * dx + + float4( 9.4561085768929998e-01, 9.4561085768929998e-01, 8.2815853605850198e-01, 1.0); + } else if (x < 8.7500000000000000e-01) { + float dx = x - 8.5937500000000000e-01; + return ((float4( 2.4612980139061474e-02, -4.8328262834613035e-02, 1.2462888208522547e+00, 1.0) * dx + + float4(-6.6617599821066215e-02, -6.3921024291640760e-02, -8.3659901885028742e-01, 1.0)) * dx + + float4( 3.5600083114817627e-01, 3.5597650507617684e-01, 1.1870532515284062e+00, 1.0)) * dx + + float4( 9.5118973121134198e-01, 9.5118973121134198e-01, 8.4691316246821002e-01, 1.0); + } else if (x < 8.9062500000000000e-01) { + float dx = x - 8.7500000000000000e-01; + return ((float4( 2.3718003357877809e-02, 4.3262550459793069e-02, 9.5432454482368223e-01, 1.0) * dx + + float4(-6.5463866377047708e-02, -6.6186411612013246e-02, -7.7817923037283798e-01, 1.0)) * dx + + float4( 3.5393705823883076e-01, 3.5394357639018226e-01, 1.1618223413842950e+00, 1.0)) * dx + + float4( 9.5673607402664396e-01, 9.5673607402664396e-01, 8.6526137593056196e-01, 1.0); + } else if (x < 9.0625000000000000e-01) { + float dx = x - 8.9062500000000000e-01; + return ((float4( 2.3773347988404581e-02, 1.8536402554417759e-02, 9.1391585031942668e-01, 1.0) * dx + + float4(-6.4352084969647186e-02, -6.4158479559210446e-02, -7.3344526733422788e-01, 1.0)) * dx + + float4( 3.5190868399903863e-01, 3.5190693746563190e-01, 1.1382032086076221e+00, 1.0)) * dx + + float4( 9.6225044864937603e-01, 9.6225044864937603e-01, 8.8322850531025798e-01, 1.0); + } else if (x < 9.2187500000000000e-01) { + float dx = x - 9.0625000000000000e-01; + return ((float4( 2.0411271658957286e-02, 2.1814506292989311e-02, 7.9416477361003268e-01, 1.0) * dx + + float4(-6.3237709282690721e-02, -6.3289585689472114e-02, -6.9060546185050475e-01, 1.0)) * dx + + float4( 3.4991509346384586e-01, 3.4991556144612124e-01, 1.1159524159641105e+00, 1.0)) * dx + + float4( 9.6773340156674204e-01, 9.6773340156674204e-01, 9.0083735297107703e-01, 1.0); + } else if (x < 9.3750000000000000e-01) { + float dx = x - 9.2187500000000000e-01; + return ((float4( 2.9925950574317017e-02, 2.9549957472174999e-02, 8.1438789217981622e-01, 1.0) * dx + + float4(-6.2280930923677098e-02, -6.2267030706988240e-02, -6.5337898808753447e-01, 1.0)) * dx + + float4( 3.4795386471062134e-01, 3.4795373931492651e-01, 1.0949526589338288e+00, 1.0)) * dx + + float4( 9.7318546387106897e-01, 9.7318546387106897e-01, 9.1810853411962201e-01, 1.0); + } else if (x < 9.5312500000000000e-01) { + float dx = x - 9.3750000000000000e-01; + return ((float4(-8.4993852229346221e-03, -8.3986474483984299e-03, 4.1632155771993951e-01, 1.0) * dx + + float4(-6.0878151990505988e-02, -6.0881876450480037e-02, -6.1520455564160559e-01, 1.0)) * dx + + float4( 3.4602950404008725e-01, 3.4602953764059108e-01, 1.0751310410630610e+00, 1.0)) * dx + + float4( 9.7860715186021296e-01, 9.7860715186021296e-01, 9.3506075970421498e-01, 1.0); + } else if (x < 9.6875000000000000e-01) { + float dx = x - 9.5312500000000000e-01; + return ((float4( 1.3210083171865797e-01, 1.3207387372265536e-01, 1.6040605599926014e+00, 1.0) * dx + + float4(-6.1276560672831049e-02, -6.1275563049623713e-02, -5.9568948262348342e-01, 1.0)) * dx + + float4( 3.4412083665472259e-01, 3.4412082764840196e-01, 1.0562108217151689e+00, 1.0)) * dx + + float4( 9.8399896760818195e-01, 9.8399896760818195e-01, 9.5171107393681598e-01, 1.0); + } else if (x < 9.8437500000000000e-01) { + float dx = x - 9.6875000000000000e-01; + return ((float4(-3.9532580170327219e-01, -3.9531870749379783e-01, -3.0883889522318717e+00, 1.0) * dx + + float4(-5.5084334186018956e-02, -5.5084600218874243e-02, -5.2049914387383023e-01, 1.0)) * dx + + float4( 3.4230269767255306e-01, 3.4230270009733171e-01, 1.0387703744261485e+00, 1.0)) * dx + + float4( 9.8936139950777302e-01, 9.8936139950777302e-01, 9.6807505502895397e-01, 1.0); + } else if (x < 1.0000000000000000e+00) { + float dx = x - 9.8437500000000000e-01; + return ((float4( 1.5704582643383433e+00, 1.5704568454964483e+00, 1.4192370688206916e+01, 1.0) * dx + + float4(-7.3615231140859841e-02, -7.3615164632646016e-02, -6.6526737600969921e-01, 1.0)) * dx + + float4( 3.4029176696432056e-01, 3.4029176627152669e-01, 1.0202427725529684e+00, 1.0)) * dx + + float4( 9.9469492278687599e-01, 9.9469492278687599e-01, 9.8416698587417395e-01, 1.0); + } else { + float dx = x - 1.0000000000000000e+00; + return ((float4(-2.0078712962998271e+01, 4.4659701609405914e+01, 4.4659701609500793e+01, 1.0) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx + + float4( 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00, 1.0); + } +} + +} // namespace pink +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_spring.metal b/colormap-shaders/shaders/metal/MATLAB_spring.metal new file mode 100644 index 0000000..70456f8 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_spring.metal @@ -0,0 +1,14 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace spring { + +float4 colormap(float x) { + return float4(1.0, clamp(x, 0.0, 1.0), clamp(1.0 - x, 0.0, 1.0), 1.0); +} + +} // namespace spring +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_summer.metal b/colormap-shaders/shaders/metal/MATLAB_summer.metal new file mode 100644 index 0000000..f4116e4 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_summer.metal @@ -0,0 +1,14 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace summer { + +float4 colormap(float x) { + return float4(clamp(x, 0.0, 1.0), clamp(0.5 * x + 0.5, 0.0, 1.0), 0.4, 1.0); +} + +} // namespace summer +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/MATLAB_winter.metal b/colormap-shaders/shaders/metal/MATLAB_winter.metal new file mode 100644 index 0000000..2e8fb85 --- /dev/null +++ b/colormap-shaders/shaders/metal/MATLAB_winter.metal @@ -0,0 +1,14 @@ +#include +using namespace metal; + +namespace colormap { +namespace MATLAB { +namespace winter { + +float4 colormap(float x) { + return float4(0.0, clamp(x, 0.0, 1.0), clamp(-0.5 * x + 1.0, 0.0, 1.0), 1.0); +} + +} // namespace winter +} // namespace MATLAB +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/gnuplot.metal b/colormap-shaders/shaders/metal/gnuplot.metal new file mode 100644 index 0000000..d198562 --- /dev/null +++ b/colormap-shaders/shaders/metal/gnuplot.metal @@ -0,0 +1,123 @@ +#include +using namespace metal; + +namespace colormap { +namespace gnuplot { + +float colormap_f1(int formula, float x) { + float DEG2RAD = 3.1415926535897932384 / 180.0; + if (formula < 0) { + x = 1.0 - x; + formula = -formula; + } + float d = 0.0; + if (formula == 0) { + return 0.0; + } else if (formula == 1) { + return 0.5; + } else if (formula == 2) { + return 1.0; + } else if (formula == 3) { + d = x; + } else if (formula == 4) { + d = x * x; + } else if (formula == 5) { + d = x * x * x; + } else if (formula == 6) { + d = x * x * x * x; + } else if (formula == 7) { + d = sqrt(x); + } else if (formula == 8) { + d = sqrt(sqrt(x)); + } else if (formula == 9) { + d = sin(90.0 * x * DEG2RAD); + } else if (formula == 10) { + d = cos(90.0 * x * DEG2RAD); + } else if (formula == 11) { + d = abs(x - 0.5); + } else if (formula == 12) { + d = (2.0 * x - 1.0) * (2.0 * x - 1.0); + } else if (formula == 13) { + d = sin(180.0 * x * DEG2RAD); + } else if (formula == 14) { + d = abs(cos(180.0 * x * DEG2RAD)); + } else if (formula == 15) { + d = sin(360.0 * x * DEG2RAD); + } else if (formula == 16) { + d = cos(360.0 * x * DEG2RAD); + } else if (formula == 17) { + d = abs(sin(360.0 * x * DEG2RAD)); + } else if (formula == 18) { + d = abs(cos(360.0e0 * x * DEG2RAD)); + } else if (formula == 19) { + d = abs(sin(720.0e0 * x * DEG2RAD)); + } else if (formula == 20) { + d = abs(cos(720.0e0 * x * DEG2RAD)); + } else if (formula == 21) { + d = 3.0e0 * x; + } else if (formula == 22) { + d = 3.0e0 * x - 1.0e0; + } else if (formula == 23) { + d = 3.0e0 * x - 2.0e0; + } else if (formula == 24) { + d = abs(3.0e0 * x - 1.0e0); + } else if (formula == 25) { + d = abs(3.0e0 * x - 2.0e0); + } else if (formula == 26) { + d = 1.5e0 * x - 0.5e0; + } else if (formula == 27) { + d = 1.5e0 * x - 1.0e0; + } else if (formula == 28) { + d = abs(1.5e0 * x - 0.5e0); + } else if (formula == 29) { + d = abs(1.5e0 * x - 1.0e0); + } else if (formula == 30) { + if (x <= 0.25e0) { + return 0.0; + } else if (x >= 0.57) { + return 1.0; + } else { + d = x / 0.32 - 0.78125; + } + } else if (formula == 31) { + if (x <= 0.42) { + return 0.0; + } else if (x >= 0.92) { + return d = 1.0; + } else { + d = 2.0 * x - 0.84; + } + } else if (formula == 32) { + if (x <= 0.42) { + d = x * 4.0; + } else { + if (x <= 0.92e0) { + d = -2.0 * x + 1.84; + } else { + d = x / 0.08 - 11.5; + } + } + } else if (formula == 33) { + d = abs(2.0 * x - 0.5); + } else if (formula == 34) { + d = 2.0 * x; + } else if (formula == 35) { + d = 2.0 * x - 0.5; + } else if (formula == 36) { + d = 2.0 * x - 1.0; + } + if (d <= 0.0) { + return 0.0; + } else if (d >= 1.0) { + return 1.0; + } else { + return d; + } +} + +float4 colormap(float x, int red_type, int green_type, int blue_type) { + return float4(colormap_f1(red_type, x), colormap_f1(green_type, x), colormap_f1(blue_type, x), 1.0); +} + +} // namespace gnuplot +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/kbinani_altitude.metal b/colormap-shaders/shaders/metal/kbinani_altitude.metal new file mode 100644 index 0000000..1fe9f90 --- /dev/null +++ b/colormap-shaders/shaders/metal/kbinani_altitude.metal @@ -0,0 +1,22 @@ +#include +using namespace metal; + +namespace colormap { +namespace kbinani { +namespace altitude { + +float colormap_func(float x, float a, float c, float d, float e, float f, float g) { + x = 193.0 * clamp(x, 0.0, 1.0); + return a * exp(-x * x / (2.0 * c * c)) + ((d * x + e) * x + f) * x + g; +} + +float4 colormap(float x) { + float r = colormap_func(x, 48.6399, 13.3443, 0.00000732641, -0.00154886, -0.211758, 83.3109); + float g = colormap_func(x, 92.7934, 9.66818, 0.00000334955, -0.000491041, -0.189276, 56.8844); + float b = colormap_func(x, 43.4277, 8.92338, 0.00000387675, -0.00112176, 0.0373863, 15.9435); + return float4(r / 255.0, g / 255.0, b / 255.0, 1.0); +} + +} // namespace altitude +} // namespace kbinani +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_apricot.metal b/colormap-shaders/shaders/metal/transform_apricot.metal new file mode 100644 index 0000000..3b515ec --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_apricot.metal @@ -0,0 +1,79 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace apricot { + +static constant float colormap_pi = 3.141592653589793; + +float colormap_f(float x, float c) { + return abs((((-5.563e-5 * x + 3.331e-16) * x + 3.045e-1) * x + 4.396e-12) * x + c); +} + +float colormap_f2(float x) { + return 262.0 * x + 12.0 * x * sin(((x - 8.0) * x + 66.0 * colormap_pi) * x); +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 1.0) { + float r = colormap_f2(x); + if (r > 255.0) { + r = 510.0 - r; + } + return r / 255.0; + } else { + return 1.0; + } +} + + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 1.0) { + return (109.0 * x + 25.0 * sin(9.92 * colormap_pi * x) * x) / 255.0; + } else { + return 102.0 / 255.0; + } +} + +float colormap_blue(float x) { + float b = 0.0; + x = x * 256.0; + + if (x < 0.0) { + b = 241.0 / 255.0; + } else if (x < 66.82) { + b = colormap_f(x - 32.0, -27.0); + if (x > 32.0 && b > 225.0) { + b = b - 10.0; + } + } else if (x < 126.67) { + b = colormap_f(x - 97.0, 30.0); + } else if (x < 195.83) { + b = colormap_f(x - 161.0, -27.0); + if (x > 161.0 && b > 225.0) { + b -= 10.0; + } + } else if (x < 256.0) { + b = colormap_f(x - 226.0, 30.0); + } else { + b = 251.0; + } + if (b > 255.0) { + b = 255.0; + } + + return b / 255.0; +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace apricot +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_carnation.metal b/colormap-shaders/shaders/metal/transform_carnation.metal new file mode 100644 index 0000000..55c68eb --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_carnation.metal @@ -0,0 +1,64 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace carnation { + +float colormap_f(float x) { + return ((-9.93427e0 * x + 1.56301e1) * x + 2.44663e2 * x) / 255.0; +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 11.0 / 255.0; + } else if (x < 0.16531216481302) { + return (((-1635.0 * x) + 1789.0) * x + 3.938) / 255.0; + } else if (x < 0.50663669203696) { + return 1.0; + } else if (x < 0.67502056695956) { + return ((((1.28932e3 * x) - 7.74147e2) * x - 9.47634e2) * x + 7.65071e2) / 255.0; + } else if (x < 1.0) { + return colormap_f(x); + } else { + return 251.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.33807590140751) { + return colormap_f(x); + } else if (x < 0.50663669203696) { + return (((-5.83014e2 * x - 8.38523e2) * x + 2.03823e3) * x - 4.86592e2) / 255.0; + } else if (x < 0.84702285244773) { + return 1.0; + } else if (x < 1.0) { + return (((-5.03306e2 * x + 2.95545e3) * x - 4.19210e3) * x + 1.99128e3) / 255.0; + } else { + return 251.0 / 255.0; + } +} + +float colormap_red(float x) { + if (x < 0.16531216481302) { + return 1.0; + } else if (x < 0.33807590140751) { + return (((-5.15164e3 * x + 5.30564e3) * x - 2.65098e3) * x + 5.70771e2) / 255.0; + } else if (x < 0.67502056695956) { + return colormap_f(x); + } else if (x < 0.84702285244773) { + return (((3.34136e3 * x - 9.01976e3) * x + 8.39740e3) * x - 2.41682e3) / 255.0; + } else { + return 1.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace carnation +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_ether.metal b/colormap-shaders/shaders/metal/transform_ether.metal new file mode 100644 index 0000000..77fb666 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_ether.metal @@ -0,0 +1,76 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace ether { + +float colormap_f(float x, float b) { + float x2 = x * x; + return ((-1.89814e5 * x2 + 1.50967e4) * x2 + b) / 255.0; +} + +float colormap_f2(float x, float b) { + float x2 = x * x; + return ((1.88330e5 * x2 - 1.50839e4) * x2 + b) / 255.0; +} + +float colormap_blue(float x) { + if (x < 0.0e0) { + return 246.0 / 255.0; + } else if (x < 0.25) { + return colormap_f(x - 32.0 / 256.0, 65.0); + } else if (x < 130.0 / 256.0) { + return colormap_f2(x - 97.0 / 256.0, 190.0); + } else if (x < 193.0 / 256.0) { + return colormap_f(x - 161.0 / 256.0, 65.0); + } else if (x < 1.0) { + return colormap_f2(x - 226.0 / 256.0, 190.0); + } else { + return 18.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.20615790927912) { + return ((((-3.81619e4 * x - 2.94574e3) * x + 2.61347e3) * x - 7.92183e1) * x) / 255.0; + } else if (x < 0.54757171958025) { + return (((((2.65271e5 * x - 4.14808e5) * x + 2.26118e5) * x - 5.16491e4) * x + 5.06893e3) * x - 1.80630e2) / 255.0; + } else if (x < 0.71235558668792) { + return ((((1.77058e5 * x - 4.62571e5) * x + 4.39628e5) * x - 1.80143e5) * x + 2.68555e4) / 255.0; + } else if (x < 1.0) { + float xx = ((((1.70556e5 * x - 6.20429e5) * x + 8.28331e5) * x - 4.80913e5) * x + 1.02608e5); + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 154.0 / 255.0; + } +} + +float colormap_red(float x) { + if (x < 0.0) { + return 2.0 / 255.0; + } else if (x < 1.0) { + float xx = 2.83088e2 * x + 8.17847e-1; + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 226.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace ether +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_grayscale_banded.metal b/colormap-shaders/shaders/metal/transform_grayscale_banded.metal new file mode 100644 index 0000000..cf40e6f --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_grayscale_banded.metal @@ -0,0 +1,19 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace grayscale_banded { + +float4 colormap(float x) { + float v = cos(133.0 * x) * 28.0 + 230.0 * x + 27.0; + if (v > 255.0) { + v = 510.0 - v; + } + v = v / 255.0; + return float4(v, v, v, 1.0); +} + +} // namespace grayscale_banded +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_hot_metal.metal b/colormap-shaders/shaders/metal/transform_hot_metal.metal new file mode 100644 index 0000000..9307cac --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_hot_metal.metal @@ -0,0 +1,38 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace hot_metal { + +float colormap_blue(float x) { + return 0.0; +} + +float colormap_green(float x) { + if (x < 0.6) { + return 0.0; + } else if (x <= 0.95) { + return ((x - 0.6) * 728.57) / 255.0; + } else { + return 1.0; + } +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 0.57147) { + return 446.22 * x / 255.0; + } else { + return 1.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace hot_metal +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_lava_waves.metal b/colormap-shaders/shaders/metal/transform_lava_waves.metal new file mode 100644 index 0000000..85100d3 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_lava_waves.metal @@ -0,0 +1,45 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace lava_waves { + +float colormap_red(float x) { + if (x < 0.0) { + return 124.0 / 255.0; + } else if (x <= 1.0) { + return (128.0 * sin(6.25 * (x + 0.5)) + 128.0) / 255.0; + } else { + return 134.0 / 255.0; + } +} + + +float colormap_green(float x) { + if (x < 0.0) { + return 121.0 / 255.0; + } else if (x <= 1.0) { + return (63.0 * sin(x * 99.72) + 97.0) / 255.0; + } else { + return 52.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 131.0 / 255.0; + } else if (x <= 1.0) { + return (128.0 * sin(6.23 * x) + 128.0) / 255.0; + } else { + return 121.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace lava_waves +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_malachite.metal b/colormap-shaders/shaders/metal/transform_malachite.metal new file mode 100644 index 0000000..07b3ac4 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_malachite.metal @@ -0,0 +1,64 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace malachite { + +float colormap_blue(float x) { + if (x < 248.25 / 1066.8) { + return 0.0; + } else if (x < 384.25 / 1066.8) { + return (1066.8 * x - 248.25) / 255.0; + } else if (x < 0.5) { + return 136.0 / 255.0; + } else if (x < 595.14 / 1037.9) { + return (-1037.9 * x + 595.14) / 255.0; + } else if (x < 666.68 / 913.22) { + return 0.0; + } else if (x <= 1.0) { + return (913.22 * x - 666.68) / 255.0; + } else { + return 246.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 253.0 / 255.0; + } else if (x < 248.25 / 1066.8) { + return (-545.75 * x + 253.36) / 255.0; + } else if (x < 384.25 / 1066.8) { + return (426.18 * x + 19335217.0 / 711200.0) / 255.0; + } else if (x < 0.5) { + return (-385524981.0 / 298300.0 * x + 385524981.0 / 596600.0) / 255.0; + } else if (x < 666.68 / 913.22) { + return (3065810.0 / 3001.0 * x - 1532906.0 / 3001.0) / 255.0; + } else { + return 0.0; + } +} + +float colormap_red(float x) { + if (x < 384.25 / 1066.8) { + return 0.0; + } else if (x < 0.5) { + return (1092.0 * x - 99905.0 / 254.0) / 255.0; + } else if (x < 259.3 / 454.5) { + return (1091.9 * x - 478.18) / 255.0; + } else if (x < 34188.3 / 51989.0) { + return (819.2 * x - 322.6) / 255.0; + } else if (x < 666.68 / 913.22) { + return (299.31 * x + 19.283) / 255.0; + } else { + return 0.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace malachite +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_morning_glory.metal b/colormap-shaders/shaders/metal/transform_morning_glory.metal new file mode 100644 index 0000000..cc88cd6 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_morning_glory.metal @@ -0,0 +1,56 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace morning_glory { + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 1.0) { + float xx = 270.9 * x + 0.7703; + if (xx > 255.0) { + return (510.0 - xx) / 266.0; + } else { + return xx / 255.0; + } + } else { + return 239.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 124.0 / 255.0; + } else if (x <= 1.0) { + float xx = 180.0 * sin(x * 3.97 + 9.46) + 131.0; + if (xx < 0.0) { + return abs(xx) / 255.0; + } else if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 242.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 78.0 / 255.0; + } else if (x <= 1.0e0) { + return (95.0 * sin((x - 0.041) * 7.46) + 106.9) / 255.0; + } else { + return 179.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace morning_glory +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_peanut_butter_and_jerry.metal b/colormap-shaders/shaders/metal/transform_peanut_butter_and_jerry.metal new file mode 100644 index 0000000..c067001 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_peanut_butter_and_jerry.metal @@ -0,0 +1,49 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace peanut_butter_and_jerry { + +float colormap_red(float x) { + if (x < 0.0) { + return 1.0 / 255.0; + } else if (x <= 1.0) { + float xx = 407.92 * x + 1.3181; + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else { + return 100.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x <= 1.0) { + return (128.7 * x + 0.2089) / 255.0; + } else { + return 128.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 73.0 / 255.0; + } else if (x <= 1.0) { + return (63.0 * sin(x * 6.21 - 0.3) + 92.0) / 255.0; + } else { + return 69.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace peanut_butter_and_jerry +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_purple_haze.metal b/colormap-shaders/shaders/metal/transform_purple_haze.metal new file mode 100644 index 0000000..59ed5d1 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_purple_haze.metal @@ -0,0 +1,64 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace purple_haze { + +static constant float colormap_e = exp(1.0); + +float colormap_red(float x) { + if (x < 0.0) { + return 13.0 / 255.0; + } else if (x < colormap_e * 0.1) { + return (706.48 * x + 13.06) / 255.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return (166.35 * x + 28.3) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (313.65 * x - 47.179) / 255.0; + } else if (x < colormap_e * 0.05 + 202.0 / 255.0) { + return (557.93 * x - 310.05) / 255.0; + } else if (x <= 1.0) { + return (319.64 * x + 439093.0 / 34000.0 * colormap_e - 1030939.0 / 8500.0) / 255.0; + } else { + return 249.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < colormap_e * 0.1) { + return 0.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return ((3166.59 / 14.9 * colormap_e + 2098.7 / 74.5) * x - (316.659 / 14.9 * colormap_e + 209.87 / 74.5) * colormap_e) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (725.0 * x - 394.35) / 255.0; + } else if (x <= 1.0) { + return (-716.23 * x + 721.38) / 255.0; + } else { + return 5.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 16.0 / 255.0; + } else if (x < colormap_e * 0.1) { + return (878.72 * x + 16.389) / 255.0; + } else if (x < colormap_e * 0.1 + 149.0 / 510.0) { + return (-166.35 * x + 227.7) / 255.0; + } else if (x < colormap_e * 0.1 + 298.0 / 510.0) { + return (-317.2 * x + 305.21) / 255.0; + } else if (x < 1.0) { + return ((1530.0 / (212.0 -51.0 * colormap_e)) * x + (153.0 * colormap_e + 894.0) / (51.0 * colormap_e - 212.0)) / 255.0; + } else { + return 2.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace purple_haze +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_rainbow.metal b/colormap-shaders/shaders/metal/transform_rainbow.metal new file mode 100644 index 0000000..d36ece3 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_rainbow.metal @@ -0,0 +1,48 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace rainbow { + +float4 colormap(float x) { + float r = 0.0, g = 0.0, b = 0.0; + + if (x < 0.0) { + r = 127.0 / 255.0; + } else if (x <= 1.0 / 9.0) { + r = 1147.5 * (1.0 / 9.0 - x) / 255.0; + } else if (x <= 5.0 / 9.0) { + r = 0.0; + } else if (x <= 7.0 / 9.0) { + r = 1147.5 * (x - 5.0 / 9.0) / 255.0; + } else { + r = 1.0; + } + + if (x <= 1.0 / 9.0) { + g = 0.0; + } else if (x <= 3.0 / 9.0) { + g = 1147.5 * (x - 1.0 / 9.0) / 255.0; + } else if (x <= 7.0 / 9.0) { + g = 1.0; + } else if (x <= 1.0) { + g = 1.0 - 1147.5 * (x - 7.0 / 9.0) / 255.0; + } else { + g = 0.0; + } + + if (x <= 3.0 / 9.0) { + b = 1.0; + } else if (x <= 5.0 / 9.0) { + b = 1.0 - 1147.5 * (x - 3.0 / 9.0) / 255.0; + } else { + b = 0.0; + } + + return float4(r, g, b, 1.0); +} + +} // namespace rainbow +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_rose.metal b/colormap-shaders/shaders/metal/transform_rose.metal new file mode 100644 index 0000000..b375da6 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_rose.metal @@ -0,0 +1,50 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace rose { + +float colormap_red(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 20049.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + if (x < 20049.0 / 82979.0) { + return 0.0; + } else if (x < 327013.0 / 810990.0) { + return (8546482679670.0 / 10875673217.0 * x - 2064961390770.0 / 10875673217.0) / 255.0; + } else if (x <= 1.0) { + return (103806720.0 / 483977.0 * x + 19607415.0 / 483977.0) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 7249.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else if (x < 20049.0 / 82979.0) { + return 127.0 / 255.0; + } else if (x < 327013.0 / 810990.0) { + return (792.02249341361393720147485376583 * x - 64.364790735602331034989206222672) / 255.0; + } else { + return 1.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace rose +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_saturn.metal b/colormap-shaders/shaders/metal/transform_saturn.metal new file mode 100644 index 0000000..a269a03 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_saturn.metal @@ -0,0 +1,86 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace saturn { + +float colormap_f1(float x) { + return -510.0 * x + 255.0; +} + +float colormap_f2(float x) { + return (-1891.7 * x + 217.46) * x + 255.0; +} + +float colormap_f3(float x) { + return 9.26643676359015e1 * sin((x - 4.83450094847127e-1) * 9.93) + 1.35940451627965e2; +} + +float colormap_f4(float x) { + return -510.0 * x + 510.0; +} + +float colormap_f5(float x) { + float xx = x - 197169.0 / 251000.0; + return (2510.0 * xx - 538.31) * xx; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 1.0; + } else if (x < 10873.0 / 94585.0) { + float xx = colormap_f2(x); + if (xx > 255.0) { + return (510.0 - xx) / 255.0; + } else { + return xx / 255.0; + } + } else if (x < 0.5) { + return 1.0; + } else if (x < 146169.0 / 251000.0) { + return colormap_f4(x) / 255.0; + } else if (x < 197169.0 / 251000.0) { + return colormap_f5(x) / 255.0; + } else { + return 0.0; + } +} + +float colormap_green(float x) { + if (x < 10873.0 / 94585.0) { + return 1.0; + } else if (x < 36373.0 / 94585.0) { + return colormap_f2(x) / 255.0; + } else if (x < 0.5) { + return colormap_f1(x) / 255.0; + } else if (x < 197169.0 / 251000.0) { + return 0.0; + } else if (x <= 1.0) { + return abs(colormap_f5(x)) / 255.0; + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 36373.0 / 94585.0) { + return colormap_f1(x) / 255.0; + } else if (x < 146169.0 / 251000.0) { + return colormap_f3(x) / 255.0; + } else if (x <= 1.0) { + return colormap_f4(x) / 255.0; + } else { + return 0.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace saturn +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_seismic.metal b/colormap-shaders/shaders/metal/transform_seismic.metal new file mode 100644 index 0000000..d93d3ff --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_seismic.metal @@ -0,0 +1,68 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace seismic { + +float colormap_f(float x) { + return ((-2010.0 * x + 2502.5950459) * x - 481.763180924) / 255.0; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 3.0 / 255.0; + } else if (x < 0.238) { + return ((-1810.0 * x + 414.49) * x + 3.87702) / 255.0; + } else if (x < 51611.0 / 108060.0) { + return (344441250.0 / 323659.0 * x - 23422005.0 / 92474.0) / 255.0; + } else if (x < 25851.0 / 34402.0) { + return 1.0; + } else if (x <= 1.0) { + return (-688.04 * x + 772.02) / 255.0; + } else { + return 83.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.238) { + return 0.0; + } else if (x < 51611.0 / 108060.0) { + return colormap_f(x); + } else if (x < 0.739376978894039) { + float xx = x - 51611.0 / 108060.0; + return ((-914.74 * xx - 734.72) * xx + 255.) / 255.0; + } else { + return 0.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 19.0 / 255.0; + } else if (x < 0.238) { + float xx = x - 0.238; + return (((1624.6 * xx + 1191.4) * xx + 1180.2) * xx + 255.0) / 255.0; + } else if (x < 51611.0 / 108060.0) { + return 1.0; + } else if (x < 174.5 / 256.0) { + return (-951.67322673866 * x + 709.532730938451) / 255.0; + } else if (x < 0.745745353439206) { + return (-705.250074130877 * x + 559.620050530617) / 255.0; + } else if (x <= 1.0) { + return ((-399.29 * x + 655.71) * x - 233.25) / 255.0; + } else { + return 23.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace seismic +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_space.metal b/colormap-shaders/shaders/metal/transform_space.metal new file mode 100644 index 0000000..a172586 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_space.metal @@ -0,0 +1,79 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace space { + +float colormap_red(float x) { + if (x < 37067.0 / 158860.0) { + return 0.0; + } else if (x < 85181.0 / 230350.0) { + float xx = x - 37067.0 / 158860.0; + return (780.25 * xx + 319.71) * xx / 255.0; + } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) { + return ((1035.33580904442 * x - 82.5380748768798) * x - 52.8985266363332) / 255.0; + } else if (x < 231408.0 / 362695.0) { + return (339.41 * x - 33.194) / 255.0; + } else if (x < 152073.0 / 222340.0) { + return (1064.8 * x - 496.01) / 255.0; + } else if (x < 294791.0 / 397780.0) { + return (397.78 * x - 39.791) / 255.0; + } else if (x < 491189.0 / 550980.0) { + return 1.0; + } else if (x < 1.0) { + return (5509.8 * x + 597.91) * x / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + float xx; + if (x < 0.0) { + return 0.0; + } else if (x < (-sqrt(166317494.0) + 39104.0) / 183830.0) { + return (-1838.3 * x + 464.36) * x / 255.0; + } else if (x < 37067.0 / 158860.0) { + return (-317.72 * x + 74.134) / 255.0; + } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) { + return 0.0; + } else if (x < 294791.0 / 397780.0) { + xx = x - (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0; + return (-1945.0 * xx + 1430.2) * xx / 255.0; + } else if (x < 491189.0 / 550980.0) { + return ((-1770.0 * x + 3.92813840044638e3) * x - 1.84017494792245e3) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 51987.0 / 349730.0) { + return (458.79 * x) / 255.0; + } else if (x < 85181.0 / 230350.0) { + return (109.06 * x + 51.987) / 255.0; + } else if (x < (sqrt(3196965649.0) + 83129.0) / 310480.0) { + return (339.41 * x - 33.194) / 255.0; + } else if (x < (3.0 * sqrt(220297369.0) + 58535.0) / 155240.0) { + return ((-1552.4 * x + 1170.7) * x - 92.996) / 255.0; + } else if (x < 27568.0 / 38629.0) { + return 0.0; + } else if (x < 81692.0 / 96241.0) { + return (386.29 * x - 275.68) / 255.0; + } else if (x <= 1.0) { + return (1348.7 * x - 1092.6) / 255.0; + } else { + return 1.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace space +} // namespace transform +} // namespace colormap diff --git a/colormap-shaders/shaders/metal/transform_supernova.metal b/colormap-shaders/shaders/metal/transform_supernova.metal new file mode 100644 index 0000000..5e3e889 --- /dev/null +++ b/colormap-shaders/shaders/metal/transform_supernova.metal @@ -0,0 +1,76 @@ +#include +using namespace metal; + +namespace colormap { +namespace transform { +namespace supernova { + +float colormap_f1(float x) { + return (0.3647 * x + 164.02) * x + 154.21; +} + +float colormap_f2(float x) { + return (126.68 * x + 114.35) * x + 0.1551; +} + +float colormap_red(float x) { + if (x < 0.0) { + return 0.0; + } else if (x < 0.136721748106749) { + return colormap_f2(x) / 255.0; + } else if (x < 0.23422409711017) { + return (1789.6 * x - 226.52) / 255.0; + } else if (x < 0.498842730309711) { + return colormap_f1(x) / 255.0; + } else if (x < 0.549121259378134) { + return (-654.951781800243 * x + 562.838873112072) / 255.0; + } else if (x < 1.0) { + return ((3.6897 * x + 11.125) * x + 223.15) / 255.0; + } else { + return 237.0 / 255.0; + } +} + +float colormap_green(float x) { + if (x < 0.0) { + return 154.0 / 255.0; + } else if (x < 3.888853260731947e-2) { + return colormap_f1(x) / 255.0; + } else if (x < 0.136721748106749e0) { + return (-1455.86353067466 * x + 217.205447330541) / 255.0; + } else if (x < 0.330799131955394) { + return colormap_f2(x) / 255.0; + } else if (x < 0.498842730309711) { + return (1096.6 * x - 310.91) / 255.0; + } else if (x < 0.549121259378134) { + return colormap_f1(x) / 255.0; + } else { + return 244.0 / 255.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 93.0 / 255.0; + } else if (x < 3.888853260731947e-2) { + return (1734.6 * x + 93.133) / 255.0; + } else if (x < 0.234224097110170) { + return colormap_f1(x) / 255.0; + } else if (x < 0.330799131955394) { + return (-1457.96598791534 * x + 534.138211325166) / 255.0; + } else if (x < 0.549121259378134) { + return colormap_f2(x) / 255.0; + } else if (x < 1.0) { + return ((3.8931 * x + 176.32) * x + 3.1505) / 255.0; + } else { + return 183.0 / 255.0; + } +} + +float4 colormap(float x) { + return float4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +} // namespace supernova +} // namespace transform +} // namespace colormap