From 1ba90817c55feb92e79ec04e74e06213b3dd252a Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Wed, 17 Aug 2022 18:17:11 -0400 Subject: [PATCH 01/12] Support passing in loaders --- package-lock.json | 6 +- .../extensions/src/generated-colormaps.js | 1386 +++++++++++++++++ src/viewers/PictureInPictureViewer.jsx | 3 + src/viewers/VivViewer.jsx | 20 +- 4 files changed, 1409 insertions(+), 6 deletions(-) create mode 100644 packages/extensions/src/generated-colormaps.js diff --git a/package-lock.json b/package-lock.json index e43a4f494..0d9abd031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2299,7 +2299,7 @@ "@mapbox/point-geometry": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", - "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=", + "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==", "dev": true }, "@mapbox/tiny-sdf": { @@ -8990,7 +8990,7 @@ "hammerjs": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", - "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=", + "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==", "dev": true }, "handlebars": { @@ -10361,7 +10361,7 @@ "long": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "integrity": "sha512-ZYvPPOMqUwPoDsbJaR10iQJYnMuZhRTvHYl62ErLIEX7RgFlziSBUUvrt3OVfc47QlHHpzPZYP17g3Fv7oeJkg==", "dev": true }, "longest-streak": { diff --git a/packages/extensions/src/generated-colormaps.js b/packages/extensions/src/generated-colormaps.js new file mode 100644 index 000000000..2a3413696 --- /dev/null +++ b/packages/extensions/src/generated-colormaps.js @@ -0,0 +1,1386 @@ +// The contents of this file are automatically written by +// `packages/extensions/prepare.mjs`. Do not modify directly. +export const alpha = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(1,1,1,0); + const float e1 = 1.0; + const vec4 v1 = vec4(1,1,1,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const autumn = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(1,0,0,1); + const float e1 = 1.0; + const vec4 v1 = vec4(1,1,0,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const bathymetry = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.1568627450980392,0.10196078431372549,0.17254901960784313,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.23137254901960785,0.19215686274509805,0.35294117647058826,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.25098039215686274,0.2980392156862745,0.5450980392156862,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.24705882352941178,0.43137254901960786,0.592156862745098,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.2823529411764706,0.5568627450980392,0.6196078431372549,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.3333333333333333,0.6823529411764706,0.6392156862745098,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.47058823529411764,0.807843137254902,0.6392156862745098,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.7333333333333333,0.9019607843137255,0.6745098039215687,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9921568627450981,0.996078431372549,0.8,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const blackbody = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.2; + const vec4 v1 = vec4(0.9019607843137255,0,0,1); + const float e2 = 0.4; + const vec4 v2 = vec4(0.9019607843137255,0.8235294117647058,0,1); + const float e3 = 0.7; + const vec4 v3 = vec4(1,1,1,1); + const float e4 = 1.0; + const vec4 v4 = vec4(0.6274509803921569,0.7843137254901961,1,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3),mix(v3,v4,a3)*step(e3,x)*step(x,e4) + ))); +} +`; +export const bluered = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,1,1); + const float e1 = 1.0; + const vec4 v1 = vec4(1,0,0,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const bone = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.376; + const vec4 v1 = vec4(0.32941176470588235,0.32941176470588235,0.4549019607843137,1); + const float e2 = 0.753; + const vec4 v2 = vec4(0.6627450980392157,0.7843137254901961,0.7843137254901961,1); + const float e3 = 1.0; + const vec4 v3 = vec4(1,1,1,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2),mix(v2,v3,a2)*step(e2,x)*step(x,e3) + )); +} +`; +export const cdom = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.1843137254901961,0.058823529411764705,0.24313725490196078,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.3411764705882353,0.09019607843137255,0.33725490196078434,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.5098039215686274,0.10980392156862745,0.38823529411764707,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6705882352941176,0.1607843137254902,0.3764705882352941,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.807843137254902,0.2627450980392157,0.33725490196078434,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.9019607843137255,0.41568627450980394,0.32941176470588235,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.9490196078431372,0.5843137254901961,0.403921568627451,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9764705882352941,0.7568627450980392,0.5294117647058824,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.996078431372549,0.9294117647058824,0.6901960784313725,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const chlorophyll = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.07058823529411765,0.1411764705882353,0.0784313725490196,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.09803921568627451,0.24705882352941178,0.1607843137254902,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.09411764705882353,0.3568627450980392,0.23137254901960785,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.050980392156862744,0.4666666666666667,0.2823529411764706,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.07058823529411765,0.5803921568627451,0.3137254901960784,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.3137254901960784,0.6784313725490196,0.34901960784313724,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.5176470588235295,0.7686274509803922,0.47843137254901963,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.6862745098039216,0.8666666666666667,0.6352941176470588,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.8431372549019608,0.9764705882352941,0.8156862745098039,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const cool = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.4549019607843137,0,0.8549019607843137,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.3843137254901961,0.2901960784313726,0.9294117647058824,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.26666666666666666,0.5725490196078431,0.9058823529411765,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0,0.8,0.7725490196078432,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0,0.9686274509803922,0.5725490196078431,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0,1,0.34509803921568627,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.1568627450980392,1,0.03137254901960784,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.5764705882352941,1,0,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const copper = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.804; + const vec4 v1 = vec4(1,0.6274509803921569,0.4,1); + const float e2 = 1.0; + const vec4 v2 = vec4(1,0.7803921568627451,0.4980392156862745,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1),mix(v1,v2,a1)*step(e1,x)*step(x,e2) + ); +} +`; +export const cubehelix = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.07; + const vec4 v1 = vec4(0.08627450980392157,0.0196078431372549,0.23137254901960785,1); + const float e2 = 0.13; + const vec4 v2 = vec4(0.23529411764705882,0.01568627450980392,0.4117647058823529,1); + const float e3 = 0.2; + const vec4 v3 = vec4(0.42745098039215684,0.00392156862745098,0.5294117647058824,1); + const float e4 = 0.27; + const vec4 v4 = vec4(0.6313725490196078,0,0.5764705882352941,1); + const float e5 = 0.33; + const vec4 v5 = vec4(0.8235294117647058,0.00784313725490196,0.5568627450980392,1); + const float e6 = 0.4; + const vec4 v6 = vec4(0.984313725490196,0.043137254901960784,0.4823529411764706,1); + const float e7 = 0.47; + const vec4 v7 = vec4(1,0.11372549019607843,0.3803921568627451,1); + const float e8 = 0.53; + const vec4 v8 = vec4(1,0.21176470588235294,0.27058823529411763,1); + const float e9 = 0.6; + const vec4 v9 = vec4(1,0.3333333333333333,0.1803921568627451,1); + const float e10 = 0.67; + const vec4 v10 = vec4(1,0.47058823529411764,0.13333333333333333,1); + const float e11 = 0.73; + const vec4 v11 = vec4(1,0.615686274509804,0.1450980392156863,1); + const float e12 = 0.8; + const vec4 v12 = vec4(0.9450980392156862,0.7490196078431373,0.2235294117647059,1); + const float e13 = 0.87; + const vec4 v13 = vec4(0.8784313725490196,0.8627450980392157,0.36470588235294116,1); + const float e14 = 0.93; + const vec4 v14 = vec4(0.8549019607843137,0.9450980392156862,0.5568627450980392,1); + const float e15 = 1.0; + const vec4 v15 = vec4(0.8901960784313725,0.9921568627450981,0.7764705882352941,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + float a8 = smoothstep(e8,e9,x); + float a9 = smoothstep(e9,e10,x); + float a10 = smoothstep(e10,e11,x); + float a11 = smoothstep(e11,e12,x); + float a12 = smoothstep(e12,e13,x); + float a13 = smoothstep(e13,e14,x); + float a14 = smoothstep(e14,e15,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), + max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), + max(mix(v8,v9,a8)*step(e8,x)*step(x,e9), + max(mix(v9,v10,a9)*step(e9,x)*step(x,e10), + max(mix(v10,v11,a10)*step(e10,x)*step(x,e11), + max(mix(v11,v12,a11)*step(e11,x)*step(x,e12), + max(mix(v12,v13,a12)*step(e12,x)*step(x,e13), + max(mix(v13,v14,a13)*step(e13,x)*step(x,e14),mix(v14,v15,a14)*step(e14,x)*step(x,e15) + )))))))))))))); +} +`; +export const density = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.21176470588235294,0.054901960784313725,0.1411764705882353,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.34901960784313724,0.09019607843137255,0.3137254901960784,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.43137254901960786,0.17647058823529413,0.5176470588235295,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.47058823529411764,0.30196078431372547,0.6980392156862745,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.47058823529411764,0.44313725490196076,0.8352941176470589,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.45098039215686275,0.592156862745098,0.8941176470588236,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.5254901960784314,0.7254901960784313,0.8901960784313725,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.6941176470588235,0.8392156862745098,0.8901960784313725,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9019607843137255,0.9450980392156862,0.9450980392156862,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const earth = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0.5098039215686274,1); + const float e1 = 0.1; + const vec4 v1 = vec4(0,0.7058823529411765,0.7058823529411765,1); + const float e2 = 0.2; + const vec4 v2 = vec4(0.1568627450980392,0.8235294117647058,0.1568627450980392,1); + const float e3 = 0.4; + const vec4 v3 = vec4(0.9019607843137255,0.9019607843137255,0.19607843137254902,1); + const float e4 = 0.6; + const vec4 v4 = vec4(0.47058823529411764,0.27450980392156865,0.0784313725490196,1); + const float e5 = 1.0; + const vec4 v5 = vec4(1,1,1,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) + )))); +} +`; +export const electric = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.15; + const vec4 v1 = vec4(0.11764705882352941,0,0.39215686274509803,1); + const float e2 = 0.4; + const vec4 v2 = vec4(0.47058823529411764,0,0.39215686274509803,1); + const float e3 = 0.6; + const vec4 v3 = vec4(0.6274509803921569,0.35294117647058826,0,1); + const float e4 = 0.8; + const vec4 v4 = vec4(0.9019607843137255,0.7843137254901961,0,1); + const float e5 = 1.0; + const vec4 v5 = vec4(1,0.9803921568627451,0.8627450980392157,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) + )))); +} +`; +export const freesurface_blue = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.11764705882352941,0.01568627450980392,0.43137254901960786,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.1843137254901961,0.054901960784313725,0.6901960784313725,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.1607843137254902,0.17647058823529413,0.9254901960784314,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.09803921568627451,0.38823529411764707,0.8313725490196079,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.26666666666666666,0.5137254901960784,0.7843137254901961,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.4470588235294118,0.611764705882353,0.7725490196078432,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.615686274509804,0.7098039215686275,0.796078431372549,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.7843137254901961,0.8156862745098039,0.8470588235294118,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9450980392156862,0.9294117647058824,0.9254901960784314,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const freesurface_red = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.23529411764705882,0.03529411764705882,0.07058823529411765,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.39215686274509803,0.06666666666666667,0.10588235294117647,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.5568627450980392,0.0784313725490196,0.11372549019607843,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6941176470588235,0.16862745098039217,0.10588235294117647,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.7529411764705882,0.3411764705882353,0.24705882352941178,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.803921568627451,0.49019607843137253,0.4117647058823529,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.8470588235294118,0.6352941176470588,0.5803921568627451,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.8901960784313725,0.7803921568627451,0.7568627450980392,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9450980392156862,0.9294117647058824,0.9254901960784314,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const greens = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0.26666666666666666,0.10588235294117647,1); + const float e1 = 0.125; + const vec4 v1 = vec4(0,0.42745098039215684,0.17254901960784313,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.13725490196078433,0.5450980392156862,0.27058823529411763,1); + const float e3 = 0.375; + const vec4 v3 = vec4(0.2549019607843137,0.6705882352941176,0.36470588235294116,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.4549019607843137,0.7686274509803922,0.4627450980392157,1); + const float e5 = 0.625; + const vec4 v5 = vec4(0.6313725490196078,0.8509803921568627,0.6078431372549019,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.7803921568627451,0.9137254901960784,0.7529411764705882,1); + const float e7 = 0.875; + const vec4 v7 = vec4(0.8980392156862745,0.9607843137254902,0.8784313725490196,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9686274509803922,0.9882352941176471,0.9607843137254902,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const greys = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 1.0; + const vec4 v1 = vec4(1,1,1,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const hot = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0,1); + const float e1 = 0.3; + const vec4 v1 = vec4(0.9019607843137255,0,0,1); + const float e2 = 0.6; + const vec4 v2 = vec4(1,0.8235294117647058,0,1); + const float e3 = 1.0; + const vec4 v3 = vec4(1,1,1,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2),mix(v2,v3,a2)*step(e2,x)*step(x,e3) + )); +} +`; +export const hsv = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(1,0,0,1); + const float e1 = 0.169; + const vec4 v1 = vec4(0.9921568627450981,1,0.00784313725490196,1); + const float e2 = 0.173; + const vec4 v2 = vec4(0.9686274509803922,1,0.00784313725490196,1); + const float e3 = 0.337; + const vec4 v3 = vec4(0,0.9882352941176471,0.01568627450980392,1); + const float e4 = 0.341; + const vec4 v4 = vec4(0,0.9882352941176471,0.0392156862745098,1); + const float e5 = 0.506; + const vec4 v5 = vec4(0.00392156862745098,0.9764705882352941,1,1); + const float e6 = 0.671; + const vec4 v6 = vec4(0.00784313725490196,0,0.9921568627450981,1); + const float e7 = 0.675; + const vec4 v7 = vec4(0.03137254901960784,0,0.9921568627450981,1); + const float e8 = 0.839; + const vec4 v8 = vec4(1,0,0.984313725490196,1); + const float e9 = 0.843; + const vec4 v9 = vec4(1,0,0.9607843137254902,1); + const float e10 = 1.0; + const vec4 v10 = vec4(1,0,0.023529411764705882,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + float a8 = smoothstep(e8,e9,x); + float a9 = smoothstep(e9,e10,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), + max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), + max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) + ))))))))); +} +`; +export const inferno = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0.01568627450980392,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.12156862745098039,0.047058823529411764,0.2823529411764706,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.3333333333333333,0.058823529411764705,0.42745098039215684,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.5333333333333333,0.13333333333333333,0.41568627450980394,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.7294117647058823,0.21176470588235294,0.3333333333333333,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.8901960784313725,0.34901960784313724,0.2,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.9764705882352941,0.5490196078431373,0.0392156862745098,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9764705882352941,0.788235294117647,0.19607843137254902,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9882352941176471,1,0.6431372549019608,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const jet = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0.5137254901960784,1); + const float e1 = 0.125; + const vec4 v1 = vec4(0,0.23529411764705882,0.6666666666666666,1); + const float e2 = 0.375; + const vec4 v2 = vec4(0.0196078431372549,1,1,1); + const float e3 = 0.625; + const vec4 v3 = vec4(1,1,0,1); + const float e4 = 0.875; + const vec4 v4 = vec4(0.9803921568627451,0,0,1); + const float e5 = 1.0; + const vec4 v5 = vec4(0.5019607843137255,0,0,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) + )))); +} +`; +export const magma = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,0.01568627450980392,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.10980392156862745,0.06274509803921569,0.26666666666666666,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.30980392156862746,0.07058823529411765,0.4823529411764706,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.5058823529411764,0.1450980392156863,0.5058823529411764,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.7098039215686275,0.21176470588235294,0.47843137254901963,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.8980392156862745,0.3137254901960784,0.39215686274509803,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.984313725490196,0.5294117647058824,0.3803921568627451,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.996078431372549,0.7607843137254902,0.5294117647058824,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9882352941176471,0.9921568627450981,0.7490196078431373,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const oxygen = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.25098039215686274,0.0196078431372549,0.0196078431372549,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.41568627450980394,0.023529411764705882,0.058823529411764705,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.5647058823529412,0.10196078431372549,0.027450980392156862,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6588235294117647,0.25098039215686274,0.011764705882352941,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.7372549019607844,0.39215686274509803,0.01568627450980392,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.807843137254902,0.5333333333333333,0.043137254901960784,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.8627450980392157,0.6823529411764706,0.09803921568627451,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9058823529411765,0.8431372549019608,0.17254901960784313,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9725490196078431,0.996078431372549,0.4117647058823529,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const par = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.2,0.0784313725490196,0.09411764705882353,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.35294117647058826,0.12549019607843137,0.13725490196078433,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.5058823529411764,0.17254901960784313,0.13333333333333333,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6235294117647059,0.26666666666666666,0.09803921568627451,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.7137254901960784,0.38823529411764707,0.07450980392156863,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.7803921568627451,0.5254901960784314,0.08627450980392157,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.8313725490196079,0.6705882352941176,0.13725490196078433,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.8666666666666667,0.8235294117647058,0.21176470588235294,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.8823529411764706,0.9921568627450981,0.29411764705882354,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const phase = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.5686274509803921,0.4117647058823529,0.07058823529411765,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.7215686274509804,0.2784313725490196,0.14901960784313725,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.7294117647058823,0.22745098039215686,0.45098039215686275,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6274509803921569,0.2784313725490196,0.7254901960784313,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.43137254901960786,0.3803921568627451,0.8549019607843137,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.19607843137254902,0.4823529411764706,0.6431372549019608,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.12156862745098039,0.5137254901960784,0.43137254901960786,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.30196078431372547,0.5058823529411764,0.13333333333333333,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.5686274509803921,0.4117647058823529,0.07058823529411765,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const picnic = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,1,1); + const float e1 = 0.1; + const vec4 v1 = vec4(0.2,0.6,1,1); + const float e2 = 0.2; + const vec4 v2 = vec4(0.4,0.8,1,1); + const float e3 = 0.3; + const vec4 v3 = vec4(0.6,0.8,1,1); + const float e4 = 0.4; + const vec4 v4 = vec4(0.8,0.8,1,1); + const float e5 = 0.5; + const vec4 v5 = vec4(1,1,1,1); + const float e6 = 0.6; + const vec4 v6 = vec4(1,0.8,1,1); + const float e7 = 0.7; + const vec4 v7 = vec4(1,0.6,1,1); + const float e8 = 0.8; + const vec4 v8 = vec4(1,0.4,0.8,1); + const float e9 = 0.9; + const vec4 v9 = vec4(1,0.4,0.4,1); + const float e10 = 1.0; + const vec4 v10 = vec4(1,0,0,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + float a8 = smoothstep(e8,e9,x); + float a9 = smoothstep(e9,e10,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), + max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), + max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) + ))))))))); +} +`; +export const plasma = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.050980392156862744,0.03137254901960784,0.5294117647058824,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.29411764705882354,0.011764705882352941,0.6313725490196078,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.49019607843137253,0.011764705882352941,0.6588235294117647,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.6588235294117647,0.13333333333333333,0.5882352941176471,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.796078431372549,0.27450980392156865,0.4745098039215686,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.8980392156862745,0.4196078431372549,0.36470588235294116,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.9725490196078431,0.5803921568627451,0.2549019607843137,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9921568627450981,0.7647058823529411,0.1568627450980392,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9411764705882353,0.9764705882352941,0.12941176470588237,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const portland = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.047058823529411764,0.2,0.5137254901960784,1); + const float e1 = 0.25; + const vec4 v1 = vec4(0.0392156862745098,0.5333333333333333,0.7294117647058823,1); + const float e2 = 0.5; + const vec4 v2 = vec4(0.9490196078431372,0.8274509803921568,0.2196078431372549,1); + const float e3 = 0.75; + const vec4 v3 = vec4(0.9490196078431372,0.5607843137254902,0.2196078431372549,1); + const float e4 = 1.0; + const vec4 v4 = vec4(0.8509803921568627,0.11764705882352941,0.11764705882352941,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3),mix(v3,v4,a3)*step(e3,x)*step(x,e4) + ))); +} +`; +export const rainbow_soft = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); + const float e1 = 0.1; + const vec4 v1 = vec4(0.7803921568627451,0,0.7058823529411765,1); + const float e2 = 0.2; + const vec4 v2 = vec4(1,0,0.4745098039215686,1); + const float e3 = 0.3; + const vec4 v3 = vec4(1,0.4235294117647059,0,1); + const float e4 = 0.4; + const vec4 v4 = vec4(0.8705882352941177,0.7607843137254902,0,1); + const float e5 = 0.5; + const vec4 v5 = vec4(0.5882352941176471,1,0,1); + const float e6 = 0.6; + const vec4 v6 = vec4(0,1,0.21568627450980393,1); + const float e7 = 0.7; + const vec4 v7 = vec4(0,0.9647058823529412,0.5882352941176471,1); + const float e8 = 0.8; + const vec4 v8 = vec4(0.19607843137254902,0.6549019607843137,0.8705882352941177,1); + const float e9 = 0.9; + const vec4 v9 = vec4(0.403921568627451,0.2,0.9215686274509803,1); + const float e10 = 1.0; + const vec4 v10 = vec4(0.48627450980392156,0,0.7294117647058823,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + float a8 = smoothstep(e8,e9,x); + float a9 = smoothstep(e9,e10,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), + max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), + max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) + ))))))))); +} +`; +export const rainbow = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.5882352941176471,0,0.35294117647058826,1); + const float e1 = 0.125; + const vec4 v1 = vec4(0,0,0.7843137254901961,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0,0.09803921568627451,1,1); + const float e3 = 0.375; + const vec4 v3 = vec4(0,0.596078431372549,1,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.17254901960784313,1,0.5882352941176471,1); + const float e5 = 0.625; + const vec4 v5 = vec4(0.592156862745098,1,0,1); + const float e6 = 0.75; + const vec4 v6 = vec4(1,0.9176470588235294,0,1); + const float e7 = 0.875; + const vec4 v7 = vec4(1,0.43529411764705883,0,1); + const float e8 = 1.0; + const vec4 v8 = vec4(1,0,0,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const rdbu = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.0196078431372549,0.0392156862745098,0.6745098039215687,1); + const float e1 = 0.35; + const vec4 v1 = vec4(0.41568627450980394,0.5372549019607843,0.9686274509803922,1); + const float e2 = 0.5; + const vec4 v2 = vec4(0.7450980392156863,0.7450980392156863,0.7450980392156863,1); + const float e3 = 0.6; + const vec4 v3 = vec4(0.8627450980392157,0.6666666666666666,0.5176470588235295,1); + const float e4 = 0.7; + const vec4 v4 = vec4(0.9019607843137255,0.5686274509803921,0.35294117647058826,1); + const float e5 = 1.0; + const vec4 v5 = vec4(0.6980392156862745,0.0392156862745098,0.10980392156862745,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) + )))); +} +`; +export const salinity = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.16470588235294117,0.09411764705882353,0.4235294117647059,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.12941176470588237,0.19607843137254902,0.6352941176470588,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.058823529411764705,0.35294117647058826,0.5686274509803921,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.1568627450980392,0.4627450980392157,0.5372549019607843,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.23137254901960785,0.5725490196078431,0.5294117647058824,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.30980392156862746,0.6862745098039216,0.49411764705882355,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.47058823529411764,0.796078431372549,0.40784313725490196,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.7568627450980392,0.8666666666666667,0.39215686274509803,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9921568627450981,0.9372549019607843,0.6039215686274509,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const spring = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(1,0,1,1); + const float e1 = 1.0; + const vec4 v1 = vec4(1,1,0,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const summer = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0.5019607843137255,0.4,1); + const float e1 = 1.0; + const vec4 v1 = vec4(1,1,0.4,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const temperature = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.01568627450980392,0.13725490196078433,0.2,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.09019607843137255,0.2,0.47843137254901963,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.3333333333333333,0.23137254901960785,0.615686274509804,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.5058823529411764,0.30980392156862746,0.5607843137254902,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.6862745098039216,0.37254901960784315,0.5098039215686274,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.8705882352941177,0.4392156862745098,0.396078431372549,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.9764705882352941,0.5725490196078431,0.25882352941176473,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9764705882352941,0.7686274509803922,0.2549019607843137,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9098039215686274,0.9803921568627451,0.3568627450980392,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const turbidity = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.13333333333333333,0.12156862745098039,0.10588235294117647,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.2549019607843137,0.19607843137254902,0.1607843137254902,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.3843137254901961,0.27058823529411763,0.20392156862745098,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.5137254901960784,0.34901960784313724,0.2235294117647059,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.6313725490196078,0.4392156862745098,0.23137254901960785,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.7254901960784313,0.5490196078431373,0.25882352941176473,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.792156862745098,0.6823529411764706,0.34509803921568627,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.8470588235294118,0.8196078431372549,0.49411764705882355,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9137254901960784,0.9647058823529412,0.6705882352941176,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const velocity_blue = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.06666666666666667,0.12549019607843137,0.25098039215686274,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.13725490196078433,0.20392156862745098,0.4549019607843137,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.11372549019607843,0.3176470588235294,0.611764705882353,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.12156862745098039,0.44313725490196076,0.6352941176470588,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.19607843137254902,0.5647058823529412,0.6627450980392157,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.3411764705882353,0.6784313725490196,0.6901960784313725,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.5843137254901961,0.7686274509803922,0.7411764705882353,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.796078431372549,0.8666666666666667,0.8274509803921568,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.996078431372549,0.984313725490196,0.9019607843137255,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const velocity_green = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.09019607843137255,0.13725490196078433,0.07450980392156863,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.09411764705882353,0.25098039215686274,0.14901960784313725,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.043137254901960784,0.37254901960784315,0.17647058823529413,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.15294117647058825,0.4823529411764706,0.13725490196078433,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.37254901960784315,0.5725490196078431,0.047058823529411764,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.596078431372549,0.6470588235294118,0.07058823529411765,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.788235294117647,0.7294117647058823,0.27058823529411763,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.9137254901960784,0.8470588235294118,0.5372549019607843,1); + const float e8 = 1.0; + const vec4 v8 = vec4(1,0.9921568627450981,0.803921568627451,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const viridis = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.26666666666666666,0.00392156862745098,0.32941176470588235,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.2784313725490196,0.17254901960784313,0.47843137254901963,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.23137254901960785,0.3176470588235294,0.5450980392156862,1); + const float e3 = 0.38; + const vec4 v3 = vec4(0.17254901960784313,0.44313725490196076,0.5568627450980392,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.12941176470588237,0.5647058823529412,0.5529411764705883,1); + const float e5 = 0.63; + const vec4 v5 = vec4(0.15294117647058825,0.6784313725490196,0.5058823529411764,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.3607843137254902,0.7843137254901961,0.38823529411764707,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.6666666666666666,0.8627450980392157,0.19607843137254902,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.9921568627450981,0.9058823529411765,0.1450980392156863,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const warm = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); + const float e1 = 0.13; + const vec4 v1 = vec4(0.6745098039215687,0,0.7333333333333333,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.8588235294117647,0,0.6666666666666666,1); + const float e3 = 0.38; + const vec4 v3 = vec4(1,0,0.5098039215686274,1); + const float e4 = 0.5; + const vec4 v4 = vec4(1,0.24705882352941178,0.2901960784313726,1); + const float e5 = 0.63; + const vec4 v5 = vec4(1,0.4823529411764706,0,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.9176470588235294,0.6901960784313725,0,1); + const float e7 = 0.88; + const vec4 v7 = vec4(0.7450980392156863,0.8941176470588236,0,1); + const float e8 = 1.0; + const vec4 v8 = vec4(0.5764705882352941,1,0,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const winter = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0,0,1,1); + const float e1 = 1.0; + const vec4 v1 = vec4(0,1,0.5019607843137255,1); + float a0 = smoothstep(e0,e1,x); + return mix(v0,v1,a0)*step(e0,x)*step(x,e1); +} +`; +export const yignbu = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.03137254901960784,0.11372549019607843,0.34509803921568627,1); + const float e1 = 0.125; + const vec4 v1 = vec4(0.1450980392156863,0.20392156862745098,0.5803921568627451,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.13333333333333333,0.3686274509803922,0.6588235294117647,1); + const float e3 = 0.375; + const vec4 v3 = vec4(0.11372549019607843,0.5686274509803921,0.7529411764705882,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.2549019607843137,0.7137254901960784,0.7686274509803922,1); + const float e5 = 0.625; + const vec4 v5 = vec4(0.4980392156862745,0.803921568627451,0.7333333333333333,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.7803921568627451,0.9137254901960784,0.7058823529411765,1); + const float e7 = 0.875; + const vec4 v7 = vec4(0.9294117647058824,0.9725490196078431,0.8509803921568627,1); + const float e8 = 1.0; + const vec4 v8 = vec4(1,1,0.8509803921568627,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; +export const yiorrd = `\ +vec4 apply_cmap (float x) { + const float e0 = 0.0; + const vec4 v0 = vec4(0.5019607843137255,0,0.14901960784313725,1); + const float e1 = 0.125; + const vec4 v1 = vec4(0.7411764705882353,0,0.14901960784313725,1); + const float e2 = 0.25; + const vec4 v2 = vec4(0.8901960784313725,0.10196078431372549,0.10980392156862745,1); + const float e3 = 0.375; + const vec4 v3 = vec4(0.9882352941176471,0.3058823529411765,0.16470588235294117,1); + const float e4 = 0.5; + const vec4 v4 = vec4(0.9921568627450981,0.5529411764705883,0.23529411764705882,1); + const float e5 = 0.625; + const vec4 v5 = vec4(0.996078431372549,0.6980392156862745,0.2980392156862745,1); + const float e6 = 0.75; + const vec4 v6 = vec4(0.996078431372549,0.8509803921568627,0.4627450980392157,1); + const float e7 = 0.875; + const vec4 v7 = vec4(1,0.9294117647058824,0.6274509803921569,1); + const float e8 = 1.0; + const vec4 v8 = vec4(1,1,0.8,1); + float a0 = smoothstep(e0,e1,x); + float a1 = smoothstep(e1,e2,x); + float a2 = smoothstep(e2,e3,x); + float a3 = smoothstep(e3,e4,x); + float a4 = smoothstep(e4,e5,x); + float a5 = smoothstep(e5,e6,x); + float a6 = smoothstep(e6,e7,x); + float a7 = smoothstep(e7,e8,x); + return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), + max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), + max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), + max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), + max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), + max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), + max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) + ))))))); +} +`; diff --git a/src/viewers/PictureInPictureViewer.jsx b/src/viewers/PictureInPictureViewer.jsx index 8d7806357..2656a0d8d 100644 --- a/src/viewers/PictureInPictureViewer.jsx +++ b/src/viewers/PictureInPictureViewer.jsx @@ -17,6 +17,7 @@ import { ColorPaletteExtension } from '../extensions'; * @param {Array} props.channelsVisible List of boolean values for each channel for whether or not it is visible. * @param {string} [props.colormap] String indicating a colormap (default: ''). The full list of options is here: https://github.com/glslify/glsl-colormap#glsl-colormap * @param {Array} props.loader The data source for the viewer, PixelSource[]. If loader.length > 1, data is assumed to be multiscale. + * @param {Array} props.loaders Array of loaders * @param {Array} props.selections Selection to be used for fetching data. * @param {Object} props.overview Allows you to pass settings into the OverviewView: { scale, margin, position, minimumWidth, maximumWidth, * boundingBoxColor, boundingBoxOutlineWidth, viewportOutlineColor, viewportOutlineWidth}. See http://viv.gehlenborglab.org/#overviewview for defaults. @@ -48,6 +49,7 @@ import { ColorPaletteExtension } from '../extensions'; const PictureInPictureViewer = props => { const { loader, + loaders, contrastLimits, colors, channelsVisible, @@ -125,6 +127,7 @@ const PictureInPictureViewer = props => { if (!loader) return null; return ( { return ( @@ -260,7 +261,7 @@ class VivViewerWrapper extends PureComponent { /** * This renders the layers in the DeckGL context. */ - _renderLayers() { + _renderLayers(loader) { const { onHover } = this; const { viewStates } = this.state; const { views, layerProps } = this.props; @@ -269,6 +270,7 @@ class VivViewerWrapper extends PureComponent { viewStates, props: { ...layerProps[i], + ...(loader ? {loader} : {}), onHover } }) @@ -297,6 +299,17 @@ class VivViewerWrapper extends PureComponent { deckGLViews[0] = deckGLViews[randomizedIndex]; deckGLViews[randomizedIndex] = holdFirstElement; } + + const IDENTITY = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; + const row =20; + const layers=this.props.loaders.map((loader, i)=>{ + const modelMatrix = new Matrix4(IDENTITY).translate([140000*(i%row), 140000*Math.floor(i/row), 0]); + return this._renderLayers(loader.data)[0][0].clone({id:"ZarrPixelSource-"+i+"-#detail#", modelMatrix}); + }) + return ( } props.views Various `VivView`s to render. From c8fc94a90e0b680ceebb404b045e0579de414690 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Wed, 17 Aug 2022 18:48:33 -0400 Subject: [PATCH 02/12] Add spacing and number of columns --- src/viewers/PictureInPictureViewer.jsx | 6 +++--- src/viewers/VivViewer.jsx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/viewers/PictureInPictureViewer.jsx b/src/viewers/PictureInPictureViewer.jsx index 2656a0d8d..029eb1dea 100644 --- a/src/viewers/PictureInPictureViewer.jsx +++ b/src/viewers/PictureInPictureViewer.jsx @@ -17,7 +17,7 @@ import { ColorPaletteExtension } from '../extensions'; * @param {Array} props.channelsVisible List of boolean values for each channel for whether or not it is visible. * @param {string} [props.colormap] String indicating a colormap (default: ''). The full list of options is here: https://github.com/glslify/glsl-colormap#glsl-colormap * @param {Array} props.loader The data source for the viewer, PixelSource[]. If loader.length > 1, data is assumed to be multiscale. - * @param {Array} props.loaders Array of loaders + * @param {Array} props.multipleDatasets Object with the following properties: loaders, spacingX, spacingY, numberOfColumns. loaders is an array of loaders. spacingX, spacingY, numberOfColumns are numbers. * @param {Array} props.selections Selection to be used for fetching data. * @param {Object} props.overview Allows you to pass settings into the OverviewView: { scale, margin, position, minimumWidth, maximumWidth, * boundingBoxColor, boundingBoxOutlineWidth, viewportOutlineColor, viewportOutlineWidth}. See http://viv.gehlenborglab.org/#overviewview for defaults. @@ -49,7 +49,7 @@ import { ColorPaletteExtension } from '../extensions'; const PictureInPictureViewer = props => { const { loader, - loaders, + multipleDatasets, contrastLimits, colors, channelsVisible, @@ -127,7 +127,7 @@ const PictureInPictureViewer = props => { if (!loader) return null; return ( { - const modelMatrix = new Matrix4(IDENTITY).translate([140000*(i%row), 140000*Math.floor(i/row), 0]); + const layers=this.props.multipleDatasets.loaders.map((loader, i)=>{ + const modelMatrix = new Matrix4(IDENTITY).translate([this.props.multipleDatasets.spacingX*(i%this.props.multipleDatasets.numberOfColumns), this.props.multipleDatasets.spacingY*Math.floor(i/this.props.multipleDatasets.numberOfColumns), 0]); return this._renderLayers(loader.data)[0][0].clone({id:"ZarrPixelSource-"+i+"-#detail#", modelMatrix}); }) @@ -335,7 +334,7 @@ class VivViewerWrapper extends PureComponent { /** * This component wraps the DeckGL component. * @param {Object} props - * @param {Array} props.loaders Array of loaders + * @param {Array} props.multipleDatasets Object with the following properties: loaders, spacingX, spacingY, numberOfColumns. loaders is an array of loaders. spacingX, spacingY, numberOfColumns are numbers. * @param {Array} props.layerProps Props for the layers in each view. * @param {boolean} [props.randomize] Whether or not to randomize which view goes first (for dynamic rendering of multiple linked views). * @param {Array.} props.views Various `VivView`s to render. From d5409d6c87d386824db9509a49b2fdccd7a99c23 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Thu, 18 Aug 2022 12:04:08 -0400 Subject: [PATCH 03/12] fix: remove unneeded file --- .../extensions/src/generated-colormaps.js | 1386 ----------------- 1 file changed, 1386 deletions(-) delete mode 100644 packages/extensions/src/generated-colormaps.js diff --git a/packages/extensions/src/generated-colormaps.js b/packages/extensions/src/generated-colormaps.js deleted file mode 100644 index 2a3413696..000000000 --- a/packages/extensions/src/generated-colormaps.js +++ /dev/null @@ -1,1386 +0,0 @@ -// The contents of this file are automatically written by -// `packages/extensions/prepare.mjs`. Do not modify directly. -export const alpha = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(1,1,1,0); - const float e1 = 1.0; - const vec4 v1 = vec4(1,1,1,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const autumn = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(1,0,0,1); - const float e1 = 1.0; - const vec4 v1 = vec4(1,1,0,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const bathymetry = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.1568627450980392,0.10196078431372549,0.17254901960784313,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.23137254901960785,0.19215686274509805,0.35294117647058826,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.25098039215686274,0.2980392156862745,0.5450980392156862,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.24705882352941178,0.43137254901960786,0.592156862745098,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.2823529411764706,0.5568627450980392,0.6196078431372549,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.3333333333333333,0.6823529411764706,0.6392156862745098,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.47058823529411764,0.807843137254902,0.6392156862745098,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.7333333333333333,0.9019607843137255,0.6745098039215687,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9921568627450981,0.996078431372549,0.8,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const blackbody = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.2; - const vec4 v1 = vec4(0.9019607843137255,0,0,1); - const float e2 = 0.4; - const vec4 v2 = vec4(0.9019607843137255,0.8235294117647058,0,1); - const float e3 = 0.7; - const vec4 v3 = vec4(1,1,1,1); - const float e4 = 1.0; - const vec4 v4 = vec4(0.6274509803921569,0.7843137254901961,1,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3),mix(v3,v4,a3)*step(e3,x)*step(x,e4) - ))); -} -`; -export const bluered = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,1,1); - const float e1 = 1.0; - const vec4 v1 = vec4(1,0,0,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const bone = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.376; - const vec4 v1 = vec4(0.32941176470588235,0.32941176470588235,0.4549019607843137,1); - const float e2 = 0.753; - const vec4 v2 = vec4(0.6627450980392157,0.7843137254901961,0.7843137254901961,1); - const float e3 = 1.0; - const vec4 v3 = vec4(1,1,1,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2),mix(v2,v3,a2)*step(e2,x)*step(x,e3) - )); -} -`; -export const cdom = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.1843137254901961,0.058823529411764705,0.24313725490196078,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.3411764705882353,0.09019607843137255,0.33725490196078434,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.5098039215686274,0.10980392156862745,0.38823529411764707,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6705882352941176,0.1607843137254902,0.3764705882352941,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.807843137254902,0.2627450980392157,0.33725490196078434,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.9019607843137255,0.41568627450980394,0.32941176470588235,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.9490196078431372,0.5843137254901961,0.403921568627451,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9764705882352941,0.7568627450980392,0.5294117647058824,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.996078431372549,0.9294117647058824,0.6901960784313725,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const chlorophyll = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.07058823529411765,0.1411764705882353,0.0784313725490196,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.09803921568627451,0.24705882352941178,0.1607843137254902,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.09411764705882353,0.3568627450980392,0.23137254901960785,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.050980392156862744,0.4666666666666667,0.2823529411764706,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.07058823529411765,0.5803921568627451,0.3137254901960784,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.3137254901960784,0.6784313725490196,0.34901960784313724,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.5176470588235295,0.7686274509803922,0.47843137254901963,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.6862745098039216,0.8666666666666667,0.6352941176470588,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.8431372549019608,0.9764705882352941,0.8156862745098039,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const cool = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.4549019607843137,0,0.8549019607843137,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.3843137254901961,0.2901960784313726,0.9294117647058824,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.26666666666666666,0.5725490196078431,0.9058823529411765,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0,0.8,0.7725490196078432,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0,0.9686274509803922,0.5725490196078431,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0,1,0.34509803921568627,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.1568627450980392,1,0.03137254901960784,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.5764705882352941,1,0,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const copper = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.804; - const vec4 v1 = vec4(1,0.6274509803921569,0.4,1); - const float e2 = 1.0; - const vec4 v2 = vec4(1,0.7803921568627451,0.4980392156862745,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1),mix(v1,v2,a1)*step(e1,x)*step(x,e2) - ); -} -`; -export const cubehelix = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.07; - const vec4 v1 = vec4(0.08627450980392157,0.0196078431372549,0.23137254901960785,1); - const float e2 = 0.13; - const vec4 v2 = vec4(0.23529411764705882,0.01568627450980392,0.4117647058823529,1); - const float e3 = 0.2; - const vec4 v3 = vec4(0.42745098039215684,0.00392156862745098,0.5294117647058824,1); - const float e4 = 0.27; - const vec4 v4 = vec4(0.6313725490196078,0,0.5764705882352941,1); - const float e5 = 0.33; - const vec4 v5 = vec4(0.8235294117647058,0.00784313725490196,0.5568627450980392,1); - const float e6 = 0.4; - const vec4 v6 = vec4(0.984313725490196,0.043137254901960784,0.4823529411764706,1); - const float e7 = 0.47; - const vec4 v7 = vec4(1,0.11372549019607843,0.3803921568627451,1); - const float e8 = 0.53; - const vec4 v8 = vec4(1,0.21176470588235294,0.27058823529411763,1); - const float e9 = 0.6; - const vec4 v9 = vec4(1,0.3333333333333333,0.1803921568627451,1); - const float e10 = 0.67; - const vec4 v10 = vec4(1,0.47058823529411764,0.13333333333333333,1); - const float e11 = 0.73; - const vec4 v11 = vec4(1,0.615686274509804,0.1450980392156863,1); - const float e12 = 0.8; - const vec4 v12 = vec4(0.9450980392156862,0.7490196078431373,0.2235294117647059,1); - const float e13 = 0.87; - const vec4 v13 = vec4(0.8784313725490196,0.8627450980392157,0.36470588235294116,1); - const float e14 = 0.93; - const vec4 v14 = vec4(0.8549019607843137,0.9450980392156862,0.5568627450980392,1); - const float e15 = 1.0; - const vec4 v15 = vec4(0.8901960784313725,0.9921568627450981,0.7764705882352941,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - float a8 = smoothstep(e8,e9,x); - float a9 = smoothstep(e9,e10,x); - float a10 = smoothstep(e10,e11,x); - float a11 = smoothstep(e11,e12,x); - float a12 = smoothstep(e12,e13,x); - float a13 = smoothstep(e13,e14,x); - float a14 = smoothstep(e14,e15,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), - max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), - max(mix(v8,v9,a8)*step(e8,x)*step(x,e9), - max(mix(v9,v10,a9)*step(e9,x)*step(x,e10), - max(mix(v10,v11,a10)*step(e10,x)*step(x,e11), - max(mix(v11,v12,a11)*step(e11,x)*step(x,e12), - max(mix(v12,v13,a12)*step(e12,x)*step(x,e13), - max(mix(v13,v14,a13)*step(e13,x)*step(x,e14),mix(v14,v15,a14)*step(e14,x)*step(x,e15) - )))))))))))))); -} -`; -export const density = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.21176470588235294,0.054901960784313725,0.1411764705882353,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.34901960784313724,0.09019607843137255,0.3137254901960784,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.43137254901960786,0.17647058823529413,0.5176470588235295,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.47058823529411764,0.30196078431372547,0.6980392156862745,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.47058823529411764,0.44313725490196076,0.8352941176470589,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.45098039215686275,0.592156862745098,0.8941176470588236,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.5254901960784314,0.7254901960784313,0.8901960784313725,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.6941176470588235,0.8392156862745098,0.8901960784313725,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9019607843137255,0.9450980392156862,0.9450980392156862,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const earth = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0.5098039215686274,1); - const float e1 = 0.1; - const vec4 v1 = vec4(0,0.7058823529411765,0.7058823529411765,1); - const float e2 = 0.2; - const vec4 v2 = vec4(0.1568627450980392,0.8235294117647058,0.1568627450980392,1); - const float e3 = 0.4; - const vec4 v3 = vec4(0.9019607843137255,0.9019607843137255,0.19607843137254902,1); - const float e4 = 0.6; - const vec4 v4 = vec4(0.47058823529411764,0.27450980392156865,0.0784313725490196,1); - const float e5 = 1.0; - const vec4 v5 = vec4(1,1,1,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) - )))); -} -`; -export const electric = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.15; - const vec4 v1 = vec4(0.11764705882352941,0,0.39215686274509803,1); - const float e2 = 0.4; - const vec4 v2 = vec4(0.47058823529411764,0,0.39215686274509803,1); - const float e3 = 0.6; - const vec4 v3 = vec4(0.6274509803921569,0.35294117647058826,0,1); - const float e4 = 0.8; - const vec4 v4 = vec4(0.9019607843137255,0.7843137254901961,0,1); - const float e5 = 1.0; - const vec4 v5 = vec4(1,0.9803921568627451,0.8627450980392157,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) - )))); -} -`; -export const freesurface_blue = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.11764705882352941,0.01568627450980392,0.43137254901960786,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.1843137254901961,0.054901960784313725,0.6901960784313725,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.1607843137254902,0.17647058823529413,0.9254901960784314,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.09803921568627451,0.38823529411764707,0.8313725490196079,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.26666666666666666,0.5137254901960784,0.7843137254901961,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.4470588235294118,0.611764705882353,0.7725490196078432,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.615686274509804,0.7098039215686275,0.796078431372549,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.7843137254901961,0.8156862745098039,0.8470588235294118,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9450980392156862,0.9294117647058824,0.9254901960784314,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const freesurface_red = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.23529411764705882,0.03529411764705882,0.07058823529411765,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.39215686274509803,0.06666666666666667,0.10588235294117647,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.5568627450980392,0.0784313725490196,0.11372549019607843,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6941176470588235,0.16862745098039217,0.10588235294117647,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.7529411764705882,0.3411764705882353,0.24705882352941178,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.803921568627451,0.49019607843137253,0.4117647058823529,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.8470588235294118,0.6352941176470588,0.5803921568627451,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.8901960784313725,0.7803921568627451,0.7568627450980392,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9450980392156862,0.9294117647058824,0.9254901960784314,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const greens = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0.26666666666666666,0.10588235294117647,1); - const float e1 = 0.125; - const vec4 v1 = vec4(0,0.42745098039215684,0.17254901960784313,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.13725490196078433,0.5450980392156862,0.27058823529411763,1); - const float e3 = 0.375; - const vec4 v3 = vec4(0.2549019607843137,0.6705882352941176,0.36470588235294116,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.4549019607843137,0.7686274509803922,0.4627450980392157,1); - const float e5 = 0.625; - const vec4 v5 = vec4(0.6313725490196078,0.8509803921568627,0.6078431372549019,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.7803921568627451,0.9137254901960784,0.7529411764705882,1); - const float e7 = 0.875; - const vec4 v7 = vec4(0.8980392156862745,0.9607843137254902,0.8784313725490196,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9686274509803922,0.9882352941176471,0.9607843137254902,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const greys = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 1.0; - const vec4 v1 = vec4(1,1,1,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const hot = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0,1); - const float e1 = 0.3; - const vec4 v1 = vec4(0.9019607843137255,0,0,1); - const float e2 = 0.6; - const vec4 v2 = vec4(1,0.8235294117647058,0,1); - const float e3 = 1.0; - const vec4 v3 = vec4(1,1,1,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2),mix(v2,v3,a2)*step(e2,x)*step(x,e3) - )); -} -`; -export const hsv = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(1,0,0,1); - const float e1 = 0.169; - const vec4 v1 = vec4(0.9921568627450981,1,0.00784313725490196,1); - const float e2 = 0.173; - const vec4 v2 = vec4(0.9686274509803922,1,0.00784313725490196,1); - const float e3 = 0.337; - const vec4 v3 = vec4(0,0.9882352941176471,0.01568627450980392,1); - const float e4 = 0.341; - const vec4 v4 = vec4(0,0.9882352941176471,0.0392156862745098,1); - const float e5 = 0.506; - const vec4 v5 = vec4(0.00392156862745098,0.9764705882352941,1,1); - const float e6 = 0.671; - const vec4 v6 = vec4(0.00784313725490196,0,0.9921568627450981,1); - const float e7 = 0.675; - const vec4 v7 = vec4(0.03137254901960784,0,0.9921568627450981,1); - const float e8 = 0.839; - const vec4 v8 = vec4(1,0,0.984313725490196,1); - const float e9 = 0.843; - const vec4 v9 = vec4(1,0,0.9607843137254902,1); - const float e10 = 1.0; - const vec4 v10 = vec4(1,0,0.023529411764705882,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - float a8 = smoothstep(e8,e9,x); - float a9 = smoothstep(e9,e10,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), - max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), - max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) - ))))))))); -} -`; -export const inferno = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0.01568627450980392,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.12156862745098039,0.047058823529411764,0.2823529411764706,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.3333333333333333,0.058823529411764705,0.42745098039215684,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.5333333333333333,0.13333333333333333,0.41568627450980394,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.7294117647058823,0.21176470588235294,0.3333333333333333,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.8901960784313725,0.34901960784313724,0.2,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.9764705882352941,0.5490196078431373,0.0392156862745098,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9764705882352941,0.788235294117647,0.19607843137254902,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9882352941176471,1,0.6431372549019608,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const jet = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0.5137254901960784,1); - const float e1 = 0.125; - const vec4 v1 = vec4(0,0.23529411764705882,0.6666666666666666,1); - const float e2 = 0.375; - const vec4 v2 = vec4(0.0196078431372549,1,1,1); - const float e3 = 0.625; - const vec4 v3 = vec4(1,1,0,1); - const float e4 = 0.875; - const vec4 v4 = vec4(0.9803921568627451,0,0,1); - const float e5 = 1.0; - const vec4 v5 = vec4(0.5019607843137255,0,0,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) - )))); -} -`; -export const magma = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,0.01568627450980392,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.10980392156862745,0.06274509803921569,0.26666666666666666,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.30980392156862746,0.07058823529411765,0.4823529411764706,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.5058823529411764,0.1450980392156863,0.5058823529411764,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.7098039215686275,0.21176470588235294,0.47843137254901963,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.8980392156862745,0.3137254901960784,0.39215686274509803,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.984313725490196,0.5294117647058824,0.3803921568627451,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.996078431372549,0.7607843137254902,0.5294117647058824,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9882352941176471,0.9921568627450981,0.7490196078431373,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const oxygen = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.25098039215686274,0.0196078431372549,0.0196078431372549,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.41568627450980394,0.023529411764705882,0.058823529411764705,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.5647058823529412,0.10196078431372549,0.027450980392156862,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6588235294117647,0.25098039215686274,0.011764705882352941,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.7372549019607844,0.39215686274509803,0.01568627450980392,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.807843137254902,0.5333333333333333,0.043137254901960784,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.8627450980392157,0.6823529411764706,0.09803921568627451,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9058823529411765,0.8431372549019608,0.17254901960784313,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9725490196078431,0.996078431372549,0.4117647058823529,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const par = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.2,0.0784313725490196,0.09411764705882353,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.35294117647058826,0.12549019607843137,0.13725490196078433,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.5058823529411764,0.17254901960784313,0.13333333333333333,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6235294117647059,0.26666666666666666,0.09803921568627451,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.7137254901960784,0.38823529411764707,0.07450980392156863,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.7803921568627451,0.5254901960784314,0.08627450980392157,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.8313725490196079,0.6705882352941176,0.13725490196078433,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.8666666666666667,0.8235294117647058,0.21176470588235294,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.8823529411764706,0.9921568627450981,0.29411764705882354,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const phase = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.5686274509803921,0.4117647058823529,0.07058823529411765,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.7215686274509804,0.2784313725490196,0.14901960784313725,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.7294117647058823,0.22745098039215686,0.45098039215686275,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6274509803921569,0.2784313725490196,0.7254901960784313,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.43137254901960786,0.3803921568627451,0.8549019607843137,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.19607843137254902,0.4823529411764706,0.6431372549019608,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.12156862745098039,0.5137254901960784,0.43137254901960786,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.30196078431372547,0.5058823529411764,0.13333333333333333,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.5686274509803921,0.4117647058823529,0.07058823529411765,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const picnic = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,1,1); - const float e1 = 0.1; - const vec4 v1 = vec4(0.2,0.6,1,1); - const float e2 = 0.2; - const vec4 v2 = vec4(0.4,0.8,1,1); - const float e3 = 0.3; - const vec4 v3 = vec4(0.6,0.8,1,1); - const float e4 = 0.4; - const vec4 v4 = vec4(0.8,0.8,1,1); - const float e5 = 0.5; - const vec4 v5 = vec4(1,1,1,1); - const float e6 = 0.6; - const vec4 v6 = vec4(1,0.8,1,1); - const float e7 = 0.7; - const vec4 v7 = vec4(1,0.6,1,1); - const float e8 = 0.8; - const vec4 v8 = vec4(1,0.4,0.8,1); - const float e9 = 0.9; - const vec4 v9 = vec4(1,0.4,0.4,1); - const float e10 = 1.0; - const vec4 v10 = vec4(1,0,0,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - float a8 = smoothstep(e8,e9,x); - float a9 = smoothstep(e9,e10,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), - max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), - max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) - ))))))))); -} -`; -export const plasma = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.050980392156862744,0.03137254901960784,0.5294117647058824,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.29411764705882354,0.011764705882352941,0.6313725490196078,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.49019607843137253,0.011764705882352941,0.6588235294117647,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.6588235294117647,0.13333333333333333,0.5882352941176471,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.796078431372549,0.27450980392156865,0.4745098039215686,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.8980392156862745,0.4196078431372549,0.36470588235294116,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.9725490196078431,0.5803921568627451,0.2549019607843137,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9921568627450981,0.7647058823529411,0.1568627450980392,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9411764705882353,0.9764705882352941,0.12941176470588237,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const portland = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.047058823529411764,0.2,0.5137254901960784,1); - const float e1 = 0.25; - const vec4 v1 = vec4(0.0392156862745098,0.5333333333333333,0.7294117647058823,1); - const float e2 = 0.5; - const vec4 v2 = vec4(0.9490196078431372,0.8274509803921568,0.2196078431372549,1); - const float e3 = 0.75; - const vec4 v3 = vec4(0.9490196078431372,0.5607843137254902,0.2196078431372549,1); - const float e4 = 1.0; - const vec4 v4 = vec4(0.8509803921568627,0.11764705882352941,0.11764705882352941,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3),mix(v3,v4,a3)*step(e3,x)*step(x,e4) - ))); -} -`; -export const rainbow_soft = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); - const float e1 = 0.1; - const vec4 v1 = vec4(0.7803921568627451,0,0.7058823529411765,1); - const float e2 = 0.2; - const vec4 v2 = vec4(1,0,0.4745098039215686,1); - const float e3 = 0.3; - const vec4 v3 = vec4(1,0.4235294117647059,0,1); - const float e4 = 0.4; - const vec4 v4 = vec4(0.8705882352941177,0.7607843137254902,0,1); - const float e5 = 0.5; - const vec4 v5 = vec4(0.5882352941176471,1,0,1); - const float e6 = 0.6; - const vec4 v6 = vec4(0,1,0.21568627450980393,1); - const float e7 = 0.7; - const vec4 v7 = vec4(0,0.9647058823529412,0.5882352941176471,1); - const float e8 = 0.8; - const vec4 v8 = vec4(0.19607843137254902,0.6549019607843137,0.8705882352941177,1); - const float e9 = 0.9; - const vec4 v9 = vec4(0.403921568627451,0.2,0.9215686274509803,1); - const float e10 = 1.0; - const vec4 v10 = vec4(0.48627450980392156,0,0.7294117647058823,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - float a8 = smoothstep(e8,e9,x); - float a9 = smoothstep(e9,e10,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7), - max(mix(v7,v8,a7)*step(e7,x)*step(x,e8), - max(mix(v8,v9,a8)*step(e8,x)*step(x,e9),mix(v9,v10,a9)*step(e9,x)*step(x,e10) - ))))))))); -} -`; -export const rainbow = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.5882352941176471,0,0.35294117647058826,1); - const float e1 = 0.125; - const vec4 v1 = vec4(0,0,0.7843137254901961,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0,0.09803921568627451,1,1); - const float e3 = 0.375; - const vec4 v3 = vec4(0,0.596078431372549,1,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.17254901960784313,1,0.5882352941176471,1); - const float e5 = 0.625; - const vec4 v5 = vec4(0.592156862745098,1,0,1); - const float e6 = 0.75; - const vec4 v6 = vec4(1,0.9176470588235294,0,1); - const float e7 = 0.875; - const vec4 v7 = vec4(1,0.43529411764705883,0,1); - const float e8 = 1.0; - const vec4 v8 = vec4(1,0,0,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const rdbu = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.0196078431372549,0.0392156862745098,0.6745098039215687,1); - const float e1 = 0.35; - const vec4 v1 = vec4(0.41568627450980394,0.5372549019607843,0.9686274509803922,1); - const float e2 = 0.5; - const vec4 v2 = vec4(0.7450980392156863,0.7450980392156863,0.7450980392156863,1); - const float e3 = 0.6; - const vec4 v3 = vec4(0.8627450980392157,0.6666666666666666,0.5176470588235295,1); - const float e4 = 0.7; - const vec4 v4 = vec4(0.9019607843137255,0.5686274509803921,0.35294117647058826,1); - const float e5 = 1.0; - const vec4 v5 = vec4(0.6980392156862745,0.0392156862745098,0.10980392156862745,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4),mix(v4,v5,a4)*step(e4,x)*step(x,e5) - )))); -} -`; -export const salinity = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.16470588235294117,0.09411764705882353,0.4235294117647059,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.12941176470588237,0.19607843137254902,0.6352941176470588,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.058823529411764705,0.35294117647058826,0.5686274509803921,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.1568627450980392,0.4627450980392157,0.5372549019607843,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.23137254901960785,0.5725490196078431,0.5294117647058824,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.30980392156862746,0.6862745098039216,0.49411764705882355,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.47058823529411764,0.796078431372549,0.40784313725490196,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.7568627450980392,0.8666666666666667,0.39215686274509803,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9921568627450981,0.9372549019607843,0.6039215686274509,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const spring = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(1,0,1,1); - const float e1 = 1.0; - const vec4 v1 = vec4(1,1,0,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const summer = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0.5019607843137255,0.4,1); - const float e1 = 1.0; - const vec4 v1 = vec4(1,1,0.4,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const temperature = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.01568627450980392,0.13725490196078433,0.2,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.09019607843137255,0.2,0.47843137254901963,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.3333333333333333,0.23137254901960785,0.615686274509804,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.5058823529411764,0.30980392156862746,0.5607843137254902,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.6862745098039216,0.37254901960784315,0.5098039215686274,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.8705882352941177,0.4392156862745098,0.396078431372549,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.9764705882352941,0.5725490196078431,0.25882352941176473,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9764705882352941,0.7686274509803922,0.2549019607843137,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9098039215686274,0.9803921568627451,0.3568627450980392,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const turbidity = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.13333333333333333,0.12156862745098039,0.10588235294117647,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.2549019607843137,0.19607843137254902,0.1607843137254902,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.3843137254901961,0.27058823529411763,0.20392156862745098,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.5137254901960784,0.34901960784313724,0.2235294117647059,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.6313725490196078,0.4392156862745098,0.23137254901960785,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.7254901960784313,0.5490196078431373,0.25882352941176473,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.792156862745098,0.6823529411764706,0.34509803921568627,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.8470588235294118,0.8196078431372549,0.49411764705882355,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9137254901960784,0.9647058823529412,0.6705882352941176,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const velocity_blue = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.06666666666666667,0.12549019607843137,0.25098039215686274,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.13725490196078433,0.20392156862745098,0.4549019607843137,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.11372549019607843,0.3176470588235294,0.611764705882353,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.12156862745098039,0.44313725490196076,0.6352941176470588,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.19607843137254902,0.5647058823529412,0.6627450980392157,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.3411764705882353,0.6784313725490196,0.6901960784313725,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.5843137254901961,0.7686274509803922,0.7411764705882353,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.796078431372549,0.8666666666666667,0.8274509803921568,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.996078431372549,0.984313725490196,0.9019607843137255,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const velocity_green = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.09019607843137255,0.13725490196078433,0.07450980392156863,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.09411764705882353,0.25098039215686274,0.14901960784313725,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.043137254901960784,0.37254901960784315,0.17647058823529413,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.15294117647058825,0.4823529411764706,0.13725490196078433,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.37254901960784315,0.5725490196078431,0.047058823529411764,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.596078431372549,0.6470588235294118,0.07058823529411765,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.788235294117647,0.7294117647058823,0.27058823529411763,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.9137254901960784,0.8470588235294118,0.5372549019607843,1); - const float e8 = 1.0; - const vec4 v8 = vec4(1,0.9921568627450981,0.803921568627451,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const viridis = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.26666666666666666,0.00392156862745098,0.32941176470588235,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.2784313725490196,0.17254901960784313,0.47843137254901963,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.23137254901960785,0.3176470588235294,0.5450980392156862,1); - const float e3 = 0.38; - const vec4 v3 = vec4(0.17254901960784313,0.44313725490196076,0.5568627450980392,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.12941176470588237,0.5647058823529412,0.5529411764705883,1); - const float e5 = 0.63; - const vec4 v5 = vec4(0.15294117647058825,0.6784313725490196,0.5058823529411764,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.3607843137254902,0.7843137254901961,0.38823529411764707,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.6666666666666666,0.8627450980392157,0.19607843137254902,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.9921568627450981,0.9058823529411765,0.1450980392156863,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const warm = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.49019607843137253,0,0.7019607843137254,1); - const float e1 = 0.13; - const vec4 v1 = vec4(0.6745098039215687,0,0.7333333333333333,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.8588235294117647,0,0.6666666666666666,1); - const float e3 = 0.38; - const vec4 v3 = vec4(1,0,0.5098039215686274,1); - const float e4 = 0.5; - const vec4 v4 = vec4(1,0.24705882352941178,0.2901960784313726,1); - const float e5 = 0.63; - const vec4 v5 = vec4(1,0.4823529411764706,0,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.9176470588235294,0.6901960784313725,0,1); - const float e7 = 0.88; - const vec4 v7 = vec4(0.7450980392156863,0.8941176470588236,0,1); - const float e8 = 1.0; - const vec4 v8 = vec4(0.5764705882352941,1,0,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const winter = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0,0,1,1); - const float e1 = 1.0; - const vec4 v1 = vec4(0,1,0.5019607843137255,1); - float a0 = smoothstep(e0,e1,x); - return mix(v0,v1,a0)*step(e0,x)*step(x,e1); -} -`; -export const yignbu = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.03137254901960784,0.11372549019607843,0.34509803921568627,1); - const float e1 = 0.125; - const vec4 v1 = vec4(0.1450980392156863,0.20392156862745098,0.5803921568627451,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.13333333333333333,0.3686274509803922,0.6588235294117647,1); - const float e3 = 0.375; - const vec4 v3 = vec4(0.11372549019607843,0.5686274509803921,0.7529411764705882,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.2549019607843137,0.7137254901960784,0.7686274509803922,1); - const float e5 = 0.625; - const vec4 v5 = vec4(0.4980392156862745,0.803921568627451,0.7333333333333333,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.7803921568627451,0.9137254901960784,0.7058823529411765,1); - const float e7 = 0.875; - const vec4 v7 = vec4(0.9294117647058824,0.9725490196078431,0.8509803921568627,1); - const float e8 = 1.0; - const vec4 v8 = vec4(1,1,0.8509803921568627,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; -export const yiorrd = `\ -vec4 apply_cmap (float x) { - const float e0 = 0.0; - const vec4 v0 = vec4(0.5019607843137255,0,0.14901960784313725,1); - const float e1 = 0.125; - const vec4 v1 = vec4(0.7411764705882353,0,0.14901960784313725,1); - const float e2 = 0.25; - const vec4 v2 = vec4(0.8901960784313725,0.10196078431372549,0.10980392156862745,1); - const float e3 = 0.375; - const vec4 v3 = vec4(0.9882352941176471,0.3058823529411765,0.16470588235294117,1); - const float e4 = 0.5; - const vec4 v4 = vec4(0.9921568627450981,0.5529411764705883,0.23529411764705882,1); - const float e5 = 0.625; - const vec4 v5 = vec4(0.996078431372549,0.6980392156862745,0.2980392156862745,1); - const float e6 = 0.75; - const vec4 v6 = vec4(0.996078431372549,0.8509803921568627,0.4627450980392157,1); - const float e7 = 0.875; - const vec4 v7 = vec4(1,0.9294117647058824,0.6274509803921569,1); - const float e8 = 1.0; - const vec4 v8 = vec4(1,1,0.8,1); - float a0 = smoothstep(e0,e1,x); - float a1 = smoothstep(e1,e2,x); - float a2 = smoothstep(e2,e3,x); - float a3 = smoothstep(e3,e4,x); - float a4 = smoothstep(e4,e5,x); - float a5 = smoothstep(e5,e6,x); - float a6 = smoothstep(e6,e7,x); - float a7 = smoothstep(e7,e8,x); - return max(mix(v0,v1,a0)*step(e0,x)*step(x,e1), - max(mix(v1,v2,a1)*step(e1,x)*step(x,e2), - max(mix(v2,v3,a2)*step(e2,x)*step(x,e3), - max(mix(v3,v4,a3)*step(e3,x)*step(x,e4), - max(mix(v4,v5,a4)*step(e4,x)*step(x,e5), - max(mix(v5,v6,a5)*step(e5,x)*step(x,e6), - max(mix(v6,v7,a6)*step(e6,x)*step(x,e7),mix(v7,v8,a7)*step(e7,x)*step(x,e8) - ))))))); -} -`; From 18209384caf516c9eff89bd1f31a659c0706d8a0 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Thu, 18 Aug 2022 12:30:33 -0400 Subject: [PATCH 04/12] Support single dataset --- src/viewers/VivViewer.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/viewers/VivViewer.jsx b/src/viewers/VivViewer.jsx index ea08697cb..ff421eb23 100644 --- a/src/viewers/VivViewer.jsx +++ b/src/viewers/VivViewer.jsx @@ -304,7 +304,9 @@ class VivViewerWrapper extends PureComponent { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; - const layers=this.props.multipleDatasets.loaders.map((loader, i)=>{ + const layers=this.props.multipleDatasets === undefined ? + this._renderLayers() : + this.props.multipleDatasets.loaders.map((loader, i)=>{ const modelMatrix = new Matrix4(IDENTITY).translate([this.props.multipleDatasets.spacingX*(i%this.props.multipleDatasets.numberOfColumns), this.props.multipleDatasets.spacingY*Math.floor(i/this.props.multipleDatasets.numberOfColumns), 0]); return this._renderLayers(loader.data)[0][0].clone({id:"ZarrPixelSource-"+i+"-#detail#", modelMatrix}); }) From f789f1138b2cffb7d456a7ccc57b8709202475ed Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Thu, 18 Aug 2022 12:42:48 -0400 Subject: [PATCH 05/12] Format --- src/viewers/VivViewer.jsx | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/viewers/VivViewer.jsx b/src/viewers/VivViewer.jsx index ff421eb23..21f71b01a 100644 --- a/src/viewers/VivViewer.jsx +++ b/src/viewers/VivViewer.jsx @@ -270,7 +270,7 @@ class VivViewerWrapper extends PureComponent { viewStates, props: { ...layerProps[i], - ...(loader ? {loader} : {}), + ...(loader ? { loader } : {}), onHover } }) @@ -300,16 +300,23 @@ class VivViewerWrapper extends PureComponent { deckGLViews[randomizedIndex] = holdFirstElement; } - const IDENTITY = [1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]; - const layers=this.props.multipleDatasets === undefined ? - this._renderLayers() : - this.props.multipleDatasets.loaders.map((loader, i)=>{ - const modelMatrix = new Matrix4(IDENTITY).translate([this.props.multipleDatasets.spacingX*(i%this.props.multipleDatasets.numberOfColumns), this.props.multipleDatasets.spacingY*Math.floor(i/this.props.multipleDatasets.numberOfColumns), 0]); - return this._renderLayers(loader.data)[0][0].clone({id:"ZarrPixelSource-"+i+"-#detail#", modelMatrix}); - }) + const IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; + const layers = + this.props.multipleDatasets === undefined + ? this._renderLayers() + : this.props.multipleDatasets.loaders.map((loader, i) => { + const modelMatrix = new Matrix4(IDENTITY).translate([ + this.props.multipleDatasets.spacingX * + (i % this.props.multipleDatasets.numberOfColumns), + this.props.multipleDatasets.spacingY * + Math.floor(i / this.props.multipleDatasets.numberOfColumns), + 0 + ]); + return this._renderLayers(loader.data)[0][0].clone({ + id: 'ZarrPixelSource-' + i + '-#detail#', + modelMatrix + }); + }); return ( Date: Thu, 18 Aug 2022 12:45:21 -0400 Subject: [PATCH 06/12] change check --- src/viewers/VivViewer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewers/VivViewer.jsx b/src/viewers/VivViewer.jsx index 21f71b01a..b8cfc55ba 100644 --- a/src/viewers/VivViewer.jsx +++ b/src/viewers/VivViewer.jsx @@ -270,7 +270,7 @@ class VivViewerWrapper extends PureComponent { viewStates, props: { ...layerProps[i], - ...(loader ? { loader } : {}), + ...(loader !== undefined ? { loader } : {}), onHover } }) From 296b86ca565f69de63ee249ace2028ad5c7f0204 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Thu, 18 Aug 2022 12:56:41 -0400 Subject: [PATCH 07/12] Documentation --- src/viewers/PictureInPictureViewer.jsx | 6 +++++- src/viewers/VivViewer.jsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/viewers/PictureInPictureViewer.jsx b/src/viewers/PictureInPictureViewer.jsx index 029eb1dea..7be643f6a 100644 --- a/src/viewers/PictureInPictureViewer.jsx +++ b/src/viewers/PictureInPictureViewer.jsx @@ -17,7 +17,11 @@ import { ColorPaletteExtension } from '../extensions'; * @param {Array} props.channelsVisible List of boolean values for each channel for whether or not it is visible. * @param {string} [props.colormap] String indicating a colormap (default: ''). The full list of options is here: https://github.com/glslify/glsl-colormap#glsl-colormap * @param {Array} props.loader The data source for the viewer, PixelSource[]. If loader.length > 1, data is assumed to be multiscale. - * @param {Array} props.multipleDatasets Object with the following properties: loaders, spacingX, spacingY, numberOfColumns. loaders is an array of loaders. spacingX, spacingY, numberOfColumns are numbers. + * @param {Object} props.multipleDatasets + * @param {Array} props.multipleDatasets.loaders Array of loaders + * @param {Number} props.multipleDatasets.spacingX Horizontal spacing between datasets + * @param {Number} props.multipleDatasets.spacingY Vertical spacing between datasets + * @param {Number} props.multipleDatasets.numberOfColumns This determines after how many datasets a new row should be started * @param {Array} props.selections Selection to be used for fetching data. * @param {Object} props.overview Allows you to pass settings into the OverviewView: { scale, margin, position, minimumWidth, maximumWidth, * boundingBoxColor, boundingBoxOutlineWidth, viewportOutlineColor, viewportOutlineWidth}. See http://viv.gehlenborglab.org/#overviewview for defaults. diff --git a/src/viewers/VivViewer.jsx b/src/viewers/VivViewer.jsx index b8cfc55ba..ee65167ef 100644 --- a/src/viewers/VivViewer.jsx +++ b/src/viewers/VivViewer.jsx @@ -343,7 +343,11 @@ class VivViewerWrapper extends PureComponent { /** * This component wraps the DeckGL component. * @param {Object} props - * @param {Array} props.multipleDatasets Object with the following properties: loaders, spacingX, spacingY, numberOfColumns. loaders is an array of loaders. spacingX, spacingY, numberOfColumns are numbers. + * @param {Object} props.multipleDatasets + * @param {Array} props.multipleDatasets.loaders Array of loaders + * @param {Number} props.multipleDatasets.spacingX Horizontal spacing between datasets + * @param {Number} props.multipleDatasets.spacingY Vertical spacing between datasets + * @param {Number} props.multipleDatasets.numberOfColumns This determines after how many datasets a new row should be started * @param {Array} props.layerProps Props for the layers in each view. * @param {boolean} [props.randomize] Whether or not to randomize which view goes first (for dynamic rendering of multiple linked views). * @param {Array.} props.views Various `VivView`s to render. From 1ac079d704140819fc2f93faef24921b37cbe282 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Thu, 18 Aug 2022 15:41:26 -0400 Subject: [PATCH 08/12] Have items in loaders match the shape of loader, use first item in loaders if no loader has been passed in --- src/viewers/PictureInPictureViewer.jsx | 2 +- src/viewers/VivViewer.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewers/PictureInPictureViewer.jsx b/src/viewers/PictureInPictureViewer.jsx index 7be643f6a..670c5c304 100644 --- a/src/viewers/PictureInPictureViewer.jsx +++ b/src/viewers/PictureInPictureViewer.jsx @@ -52,7 +52,6 @@ import { ColorPaletteExtension } from '../extensions'; const PictureInPictureViewer = props => { const { - loader, multipleDatasets, contrastLimits, colors, @@ -78,6 +77,7 @@ const PictureInPictureViewer = props => { extensions = [new ColorPaletteExtension()], deckProps } = props; + const loader = props.loader !== undefined ? props.loader : props?.multipleDatasets?.loaders?.[0]; const detailViewState = viewStatesProp?.find(v => v.id === DETAIL_VIEW_ID); const baseViewState = useMemo(() => { return ( diff --git a/src/viewers/VivViewer.jsx b/src/viewers/VivViewer.jsx index ee65167ef..0980c49b1 100644 --- a/src/viewers/VivViewer.jsx +++ b/src/viewers/VivViewer.jsx @@ -312,7 +312,7 @@ class VivViewerWrapper extends PureComponent { Math.floor(i / this.props.multipleDatasets.numberOfColumns), 0 ]); - return this._renderLayers(loader.data)[0][0].clone({ + return this._renderLayers(loader)[0][0].clone({ id: 'ZarrPixelSource-' + i + '-#detail#', modelMatrix }); From 81cd603b1b6f0eb6b06d5c3f80bc13717010777c Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Fri, 19 Aug 2022 14:40:33 -0400 Subject: [PATCH 09/12] Rename prop --- src/viewers/PictureInPictureViewer.jsx | 16 ++++++++-------- src/viewers/VivViewer.jsx | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/viewers/PictureInPictureViewer.jsx b/src/viewers/PictureInPictureViewer.jsx index 670c5c304..e6a950f91 100644 --- a/src/viewers/PictureInPictureViewer.jsx +++ b/src/viewers/PictureInPictureViewer.jsx @@ -17,11 +17,11 @@ import { ColorPaletteExtension } from '../extensions'; * @param {Array} props.channelsVisible List of boolean values for each channel for whether or not it is visible. * @param {string} [props.colormap] String indicating a colormap (default: ''). The full list of options is here: https://github.com/glslify/glsl-colormap#glsl-colormap * @param {Array} props.loader The data source for the viewer, PixelSource[]. If loader.length > 1, data is assumed to be multiscale. - * @param {Object} props.multipleDatasets - * @param {Array} props.multipleDatasets.loaders Array of loaders - * @param {Number} props.multipleDatasets.spacingX Horizontal spacing between datasets - * @param {Number} props.multipleDatasets.spacingY Vertical spacing between datasets - * @param {Number} props.multipleDatasets.numberOfColumns This determines after how many datasets a new row should be started + * @param {Object} props.gridLoaders + * @param {Array} props.gridLoaders.loaders Array of loaders + * @param {Number} props.gridLoaders.spacingX Horizontal spacing between datasets + * @param {Number} props.gridLoaders.spacingY Vertical spacing between datasets + * @param {Number} props.gridLoaders.numberOfColumns This determines after how many datasets a new row should be started * @param {Array} props.selections Selection to be used for fetching data. * @param {Object} props.overview Allows you to pass settings into the OverviewView: { scale, margin, position, minimumWidth, maximumWidth, * boundingBoxColor, boundingBoxOutlineWidth, viewportOutlineColor, viewportOutlineWidth}. See http://viv.gehlenborglab.org/#overviewview for defaults. @@ -52,7 +52,7 @@ import { ColorPaletteExtension } from '../extensions'; const PictureInPictureViewer = props => { const { - multipleDatasets, + gridLoaders, contrastLimits, colors, channelsVisible, @@ -77,7 +77,7 @@ const PictureInPictureViewer = props => { extensions = [new ColorPaletteExtension()], deckProps } = props; - const loader = props.loader !== undefined ? props.loader : props?.multipleDatasets?.loaders?.[0]; + const loader = props.loader !== undefined ? props.loader : props?.gridLoaders?.loaders?.[0]; const detailViewState = viewStatesProp?.find(v => v.id === DETAIL_VIEW_ID); const baseViewState = useMemo(() => { return ( @@ -131,7 +131,7 @@ const PictureInPictureViewer = props => { if (!loader) return null; return ( { + : this.props.gridLoaders.loaders.map((loader, i) => { const modelMatrix = new Matrix4(IDENTITY).translate([ - this.props.multipleDatasets.spacingX * - (i % this.props.multipleDatasets.numberOfColumns), - this.props.multipleDatasets.spacingY * - Math.floor(i / this.props.multipleDatasets.numberOfColumns), + this.props.gridLoaders.spacingX * + (i % this.props.gridLoaders.numberOfColumns), + this.props.gridLoaders.spacingY * + Math.floor(i / this.props.gridLoaders.numberOfColumns), 0 ]); return this._renderLayers(loader)[0][0].clone({ @@ -343,11 +343,11 @@ class VivViewerWrapper extends PureComponent { /** * This component wraps the DeckGL component. * @param {Object} props - * @param {Object} props.multipleDatasets - * @param {Array} props.multipleDatasets.loaders Array of loaders - * @param {Number} props.multipleDatasets.spacingX Horizontal spacing between datasets - * @param {Number} props.multipleDatasets.spacingY Vertical spacing between datasets - * @param {Number} props.multipleDatasets.numberOfColumns This determines after how many datasets a new row should be started + * @param {Object} props.gridLoaders + * @param {Array} props.gridLoaders.loaders Array of loaders + * @param {Number} props.gridLoaders.spacingX Horizontal spacing between datasets + * @param {Number} props.gridLoaders.spacingY Vertical spacing between datasets + * @param {Number} props.gridLoaders.numberOfColumns This determines after how many datasets a new row should be started * @param {Array} props.layerProps Props for the layers in each view. * @param {boolean} [props.randomize] Whether or not to randomize which view goes first (for dynamic rendering of multiple linked views). * @param {Array.} props.views Various `VivView`s to render. From ebcce3938e807e989c0d6f2a4c47f87b49487488 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Fri, 26 Aug 2022 10:58:09 -0400 Subject: [PATCH 10/12] fix: package name --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d8018fe66..8cb54e935 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@hms-dbmi/viv", - "version": "0.12.9", + "name": "@labshare/viv", + "version": "0.12.10", "main": "dist/viv.es.js", "module": "dist/viv.es.js", "types": "dist/index.d.ts", From 05d429318b9e1b4acd05ac53d6e0782ecea6b850 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Tue, 30 Aug 2022 11:47:55 -0400 Subject: [PATCH 11/12] Replace viv library references, increment version --- README.md | 4 ++-- .../src/components/Controller/components/CameraOptions.jsx | 2 +- .../components/Controller/components/RenderingModeSelect.jsx | 2 +- avivator/src/components/RenderingModeSelect.jsx | 2 +- avivator/src/components/Viewer.jsx | 2 +- avivator/src/state.js | 2 +- avivator/src/utils.js | 2 +- docs/SAMPLES.md | 2 +- package-lock.json | 2 +- package.json | 2 +- vite.config.js | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f4fe81433..cdf59b8f6 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Please see the [tutorial](./tutorial/README.md) for more information. ## 💽 Installation ```bash -$ npm install @hms-dbmi/viv +$ npm install @labshare/viv ``` You will also need to install [deck.gl](https://deck.gl) and other `peerDependencies` manually. @@ -90,7 +90,7 @@ current versions are tested in our CI by naviating to our ## 🛠️ Build -- `@hms-dbmi/viv` library: `npm run build` +- `@labshare/viv` library: `npm run build` - `Avivator` viewer: `npm run build:avivator` ## 📄 Publish diff --git a/avivator/src/components/Controller/components/CameraOptions.jsx b/avivator/src/components/Controller/components/CameraOptions.jsx index 3ec577055..0b09bbf46 100644 --- a/avivator/src/components/Controller/components/CameraOptions.jsx +++ b/avivator/src/components/Controller/components/CameraOptions.jsx @@ -7,7 +7,7 @@ import { makeStyles, createStyles } from '@material-ui/core/styles'; import shallow from 'zustand/shallow'; // eslint-disable-next-line import/no-unresolved -import { getDefaultInitialViewState } from '@hms-dbmi/viv'; +import { getDefaultInitialViewState } from '@labshare/viv'; import { useImageSettingsStore, useViewerStore, diff --git a/avivator/src/components/Controller/components/RenderingModeSelect.jsx b/avivator/src/components/Controller/components/RenderingModeSelect.jsx index 2945af4f3..5cfa09fba 100644 --- a/avivator/src/components/Controller/components/RenderingModeSelect.jsx +++ b/avivator/src/components/Controller/components/RenderingModeSelect.jsx @@ -5,7 +5,7 @@ import InputLabel from '@material-ui/core/InputLabel'; import shallow from 'zustand/shallow'; // eslint-disable-next-line import/no-unresolved -import { RENDERING_MODES } from '@hms-dbmi/viv'; +import { RENDERING_MODES } from '@labshare/viv'; import { useImageSettingsStore, useViewerStore } from '../../../state'; const renderingOptions = Object.values(RENDERING_MODES); diff --git a/avivator/src/components/RenderingModeSelect.jsx b/avivator/src/components/RenderingModeSelect.jsx index 74ba05d0d..6ee632e46 100644 --- a/avivator/src/components/RenderingModeSelect.jsx +++ b/avivator/src/components/RenderingModeSelect.jsx @@ -3,7 +3,7 @@ import FormControl from '@material-ui/core/FormControl'; import Select from '@material-ui/core/Select'; import InputLabel from '@material-ui/core/InputLabel'; -import { RENDERING_MODES } from '@hms-dbmi/viv'; // eslint-disable-line import/no-unresolved +import { RENDERING_MODES } from '@labshare/viv'; // eslint-disable-line import/no-unresolved function RenderingModeSelect({ value, handleChange, disabled }) { return ( diff --git a/avivator/src/components/Viewer.jsx b/avivator/src/components/Viewer.jsx index 91efdbe65..8d31346c6 100644 --- a/avivator/src/components/Viewer.jsx +++ b/avivator/src/components/Viewer.jsx @@ -9,7 +9,7 @@ import { AdditiveColormapExtension, LensExtension // eslint-disable-next-line import/no-unresolved -} from '@hms-dbmi/viv'; +} from '@labshare/viv'; import { useImageSettingsStore, useViewerStore, diff --git a/avivator/src/state.js b/avivator/src/state.js index 1dcb698af..056f4822d 100644 --- a/avivator/src/state.js +++ b/avivator/src/state.js @@ -2,7 +2,7 @@ import create from 'zustand'; // eslint-disable-next-line import/no-unresolved -import { RENDERING_MODES } from '@hms-dbmi/viv'; +import { RENDERING_MODES } from '@labshare/viv'; const captialize = string => string.charAt(0).toUpperCase() + string.slice(1); diff --git a/avivator/src/utils.js b/avivator/src/utils.js index 076ec1417..75ab72544 100644 --- a/avivator/src/utils.js +++ b/avivator/src/utils.js @@ -11,7 +11,7 @@ import { ColorPalette3DExtensions, AdditiveColormap3DExtensions // eslint-disable-next-line import/no-unresolved -} from '@hms-dbmi/viv'; +} from '@labshare/viv'; import { GLOBAL_SLIDER_DIMENSION_FIELDS } from './constants'; diff --git a/docs/SAMPLES.md b/docs/SAMPLES.md index 87bfee63f..624bdffcf 100644 --- a/docs/SAMPLES.md +++ b/docs/SAMPLES.md @@ -15,7 +15,7 @@ import { getChannelStats, loadOmeTiff, PictureInPictureViewer, -} from '@hms-dbmi/viv'; +} from '@labshare/viv'; const url = 'http://localhost:8000/LuCa-7color_Scan1.ome.tif'; // OME-TIFF diff --git a/package-lock.json b/package-lock.json index 0d9abd031..d1dfccf39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "@hms-dbmi/viv", + "name": "@labshare/viv", "version": "0.12.9", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 8cb54e935..24a4f8ec2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labshare/viv", - "version": "0.12.10", + "version": "0.12.11", "main": "dist/viv.es.js", "module": "dist/viv.es.js", "types": "dist/index.d.ts", diff --git a/vite.config.js b/vite.config.js index b13875201..b391e68aa 100644 --- a/vite.config.js +++ b/vite.config.js @@ -87,7 +87,7 @@ const configAvivator = defineConfig({ }, resolve: { alias: { - '@hms-dbmi/viv': resolve(__dirname, 'src'), + '@labshare/viv': resolve(__dirname, 'src'), 'react': resolve(__dirname, 'avivator/node_modules/react'), 'react-dom': resolve(__dirname, 'avivator/node_modules/react-dom'), }, From 6092d4366de9660c63e8f10f577fcc621adfcef8 Mon Sep 17 00:00:00 2001 From: Nikita Sharakhov Date: Tue, 30 Aug 2022 16:11:16 -0400 Subject: [PATCH 12/12] Exclude background --- package-lock.json | 2 +- package.json | 2 +- src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d1dfccf39..6e5c3029c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@labshare/viv", - "version": "0.12.9", + "version": "0.12.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 24a4f8ec2..cf8cbc374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labshare/viv", - "version": "0.12.11", + "version": "0.12.12", "main": "dist/viv.es.js", "module": "dist/viv.es.js", "types": "dist/index.d.ts", diff --git a/src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js b/src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js index f11c2a197..249fadc34 100644 --- a/src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js +++ b/src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js @@ -21,7 +21,7 @@ const defaultProps = { maxRequests: { type: 'number', value: 10, compare: true }, onClick: { type: 'function', value: null, compare: true }, refinementStrategy: { type: 'string', value: null, compare: true }, - excludeBackground: { type: 'boolean', value: false, compare: true }, + excludeBackground: { type: 'boolean', value: true, compare: true }, extensions: { type: 'array', value: [new ColorPaletteExtension()],