@mapcatch/util 2.0.3 → 2.0.5-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +54 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +4 -0
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +5 -1
- package/README.md +44 -0
- package/debug/app.js +26 -0
- package/debug/index.html +55 -0
- package/debug/libs/vue.global.js +16159 -0
- package/debug/my_icon.png +0 -0
- package/docs/Catolog.md +24 -0
- package/docs/Constant.md +92 -0
- package/docs/Event.md +90 -0
- package/docs/Util.md +345 -0
- package/package.json +2 -2
- package/src/constants/crs.js +42098 -42098
- package/src/constants/default_layers.js +102 -11
- package/src/constants/index.js +1 -0
- package/src/constants/layer_groups_multispectral.js +34 -0
- package/src/constants/layer_icons.js +1 -0
- package/src/gl-operations/constants.js +9 -9
- package/src/gl-operations/default_options.js +97 -97
- package/src/gl-operations/index.js +532 -520
- package/src/gl-operations/reglCommands/contours.js +27 -27
- package/src/gl-operations/reglCommands/default.js +45 -43
- package/src/gl-operations/reglCommands/hillshading.js +340 -332
- package/src/gl-operations/reglCommands/index.js +6 -6
- package/src/gl-operations/reglCommands/multiLayers.js +303 -301
- package/src/gl-operations/reglCommands/transitions.js +111 -109
- package/src/gl-operations/reglCommands/util.js +71 -71
- package/src/gl-operations/renderer.js +209 -192
- package/src/gl-operations/shaders/fragment/convertDem.js +25 -25
- package/src/gl-operations/shaders/fragment/convolutionSmooth.js +54 -54
- package/src/gl-operations/shaders/fragment/diffCalc.js +33 -33
- package/src/gl-operations/shaders/fragment/drawResult.js +46 -41
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +78 -78
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +59 -54
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +30 -30
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +60 -55
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +26 -26
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +25 -25
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +53 -53
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +80 -80
- package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +54 -49
- package/src/gl-operations/shaders/fragment/interpolateColor.js +65 -62
- package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +49 -46
- package/src/gl-operations/shaders/fragment/interpolateValue.js +136 -123
- package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +35 -35
- package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +45 -45
- package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +53 -53
- package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +61 -61
- package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +69 -69
- package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +77 -77
- package/src/gl-operations/shaders/fragment/single.js +93 -88
- package/src/gl-operations/shaders/transform.js +21 -21
- package/src/gl-operations/shaders/util/computeColor.glsl +85 -84
- package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -10
- package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -9
- package/src/gl-operations/shaders/util/rgbaToFloat.glsl +17 -17
- package/src/gl-operations/shaders/vertex/double.js +16 -16
- package/src/gl-operations/shaders/vertex/multi3.js +19 -19
- package/src/gl-operations/shaders/vertex/multi4.js +22 -22
- package/src/gl-operations/shaders/vertex/multi5.js +25 -25
- package/src/gl-operations/shaders/vertex/multi6.js +28 -28
- package/src/gl-operations/shaders/vertex/single.js +13 -13
- package/src/gl-operations/shaders/vertex/singleNotTransformed.js +11 -11
- package/src/gl-operations/texture_manager.js +141 -141
- package/src/gl-operations/util.js +336 -336
- package/src/measure/index.js +14 -8
- package/src/transform.js +3 -0
- package/src/util.js +14 -6
- package/vite.config.js +58 -0
- package/dist/catchUtil.min.esm.js +0 -112833
- package/dist/catchUtil.min.js +0 -2922
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import glsl from 'glslify'
|
|
2
|
-
|
|
3
|
-
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
-
precision highp float;
|
|
5
|
-
#else
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
#pragma glslify: isCloseEnough = require(../../util/isCloseEnough.glsl)
|
|
10
|
-
|
|
11
|
-
uniform float nodataValue;
|
|
12
|
-
uniform bool littleEndian;
|
|
13
|
-
uniform sampler2D tInput;
|
|
14
|
-
uniform float pixelScale;
|
|
15
|
-
uniform int kernelSize;
|
|
16
|
-
varying vec2 vTexCoord;
|
|
17
|
-
|
|
18
|
-
uniform float textureSize;
|
|
19
|
-
|
|
20
|
-
int kernelEnd = int(kernelSize/2);
|
|
21
|
-
int kernelStart = kernelEnd * -1;
|
|
22
|
-
|
|
23
|
-
float runConvKernel(vec2 pos, vec2 onePixel) {
|
|
24
|
-
float convKernelWeight = 0.0;
|
|
25
|
-
float sum = 0.0;
|
|
26
|
-
|
|
27
|
-
for (int i = -20; i < 20; i ++) {
|
|
28
|
-
if (i < kernelStart) continue;
|
|
29
|
-
if (i > kernelEnd) break;
|
|
30
|
-
for (int j = -20; j < 20; j ++) {
|
|
31
|
-
if (j < kernelStart) continue;
|
|
32
|
-
if (j > kernelEnd) break;
|
|
33
|
-
float texelValue = texture2D(tInput, pos + onePixel * vec2(i, j)).r;
|
|
34
|
-
if (!isCloseEnough(texelValue, nodataValue)) {
|
|
35
|
-
sum = sum + texelValue;
|
|
36
|
-
convKernelWeight = convKernelWeight + 1.0;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return (sum / convKernelWeight);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
void main() {
|
|
45
|
-
float texelFloat = texture2D(tInput, vTexCoord).r;
|
|
46
|
-
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
47
|
-
gl_FragColor = vec4(nodataValue);
|
|
48
|
-
} else {
|
|
49
|
-
vec2 onePixel = vec2(1.0, 1.0) / textureSize;
|
|
50
|
-
float texelFloatSmoothed = runConvKernel(vTexCoord, onePixel);
|
|
51
|
-
gl_FragColor = vec4(texelFloatSmoothed);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
import glsl from 'glslify'
|
|
2
|
+
|
|
3
|
+
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
+
precision highp float;
|
|
5
|
+
#else
|
|
6
|
+
precision mediump float;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#pragma glslify: isCloseEnough = require(../../util/isCloseEnough.glsl)
|
|
10
|
+
|
|
11
|
+
uniform float nodataValue;
|
|
12
|
+
uniform bool littleEndian;
|
|
13
|
+
uniform sampler2D tInput;
|
|
14
|
+
uniform float pixelScale;
|
|
15
|
+
uniform int kernelSize;
|
|
16
|
+
varying vec2 vTexCoord;
|
|
17
|
+
|
|
18
|
+
uniform float textureSize;
|
|
19
|
+
|
|
20
|
+
int kernelEnd = int(kernelSize/2);
|
|
21
|
+
int kernelStart = kernelEnd * -1;
|
|
22
|
+
|
|
23
|
+
float runConvKernel(vec2 pos, vec2 onePixel) {
|
|
24
|
+
float convKernelWeight = 0.0;
|
|
25
|
+
float sum = 0.0;
|
|
26
|
+
|
|
27
|
+
for (int i = -20; i < 20; i ++) {
|
|
28
|
+
if (i < kernelStart) continue;
|
|
29
|
+
if (i > kernelEnd) break;
|
|
30
|
+
for (int j = -20; j < 20; j ++) {
|
|
31
|
+
if (j < kernelStart) continue;
|
|
32
|
+
if (j > kernelEnd) break;
|
|
33
|
+
float texelValue = texture2D(tInput, pos + onePixel * vec2(i, j)).r;
|
|
34
|
+
if (!isCloseEnough(texelValue, nodataValue)) {
|
|
35
|
+
sum = sum + texelValue;
|
|
36
|
+
convKernelWeight = convKernelWeight + 1.0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return (sum / convKernelWeight);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
void main() {
|
|
45
|
+
float texelFloat = texture2D(tInput, vTexCoord).r;
|
|
46
|
+
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
47
|
+
gl_FragColor = vec4(nodataValue);
|
|
48
|
+
} else {
|
|
49
|
+
vec2 onePixel = vec2(1.0, 1.0) / textureSize;
|
|
50
|
+
float texelFloatSmoothed = runConvKernel(vTexCoord, onePixel);
|
|
51
|
+
gl_FragColor = vec4(texelFloatSmoothed);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
`
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import glsl from 'glslify'
|
|
2
|
-
|
|
3
|
-
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
-
precision highp float;
|
|
5
|
-
#else
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
uniform sampler2D tInput;
|
|
10
|
-
uniform sampler2D tNormal;
|
|
11
|
-
uniform sampler2D tSrc;
|
|
12
|
-
uniform vec3 sunDirection;
|
|
13
|
-
uniform vec2 resolution;
|
|
14
|
-
uniform float pixelScale;
|
|
15
|
-
uniform float softIterations;
|
|
16
|
-
varying vec2 vTexCoord;
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
vec2 ires = 1.0 / resolution;
|
|
20
|
-
vec3 src = texture2D(tSrc, gl_FragCoord.xy * ires).rgb;
|
|
21
|
-
vec4 e0 = texture2D(tInput, vTexCoord);
|
|
22
|
-
vec3 n0 = texture2D(tNormal, vTexCoord).rgb;
|
|
23
|
-
|
|
24
|
-
// get 2D ray direction
|
|
25
|
-
vec2 sr = normalize(sunDirection.xy);
|
|
26
|
-
|
|
27
|
-
// initialize pixel traversal algorithm
|
|
28
|
-
vec2 p0 = vTexCoord * resolution;
|
|
29
|
-
vec2 p = floor(p0); // pixel we are starting in
|
|
30
|
-
vec2 stp = sign(sr);
|
|
31
|
-
|
|
32
|
-
// how far we need to travel in our ray direction to intersect the next pixel
|
|
33
|
-
// in the x- and y- directions
|
|
34
|
-
vec2 tMax = step(0.0, sr) * (1.0 - fract(p0)) + (1.0 - step(0.0, sr)) * fract(p0);
|
|
35
|
-
tMax /= abs(sr);
|
|
36
|
-
// how far must we travel along our ray to cover the width and height of a pixel
|
|
37
|
-
vec2 tDelta = 1.0 / abs(sr);
|
|
38
|
-
|
|
39
|
-
// pixel traversal routine
|
|
40
|
-
for (int i = 0; i < 65536; i++) {
|
|
41
|
-
if (tMax.x < tMax.y) {
|
|
42
|
-
tMax.x += tDelta.x;
|
|
43
|
-
p.x += stp.x;
|
|
44
|
-
} else {
|
|
45
|
-
tMax.y += tDelta.y;
|
|
46
|
-
p.y += stp.y;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// normalized texture coordinate for the center of the current pixel
|
|
50
|
-
vec2 ptex = ires * (p + 0.5);
|
|
51
|
-
|
|
52
|
-
// If we left the tile: add some illumination to the pixel for this iteration and stop traversing
|
|
53
|
-
if (ptex.x < 0.0 || ptex.x > 1.0 || ptex.y < 0.0 || ptex.y > 1.0) {
|
|
54
|
-
// illumination of this single ray
|
|
55
|
-
vec3 illumination = vec3(1.0/softIterations) * clamp(dot(n0, sunDirection), 0.0, 1.0);
|
|
56
|
-
// add illumination of this ray to result of previous iteration
|
|
57
|
-
gl_FragColor = vec4(src + illumination, 1.0);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// elevation/value at current pixel
|
|
62
|
-
vec4 e = texture2D(tInput, ptex);
|
|
63
|
-
// time we have traveled along the 2D ray
|
|
64
|
-
float time = distance(p + 0.5, p0);
|
|
65
|
-
// elevation along our original 3D ray at the current point
|
|
66
|
-
float z = e0.r + time * pixelScale * sunDirection.z;
|
|
67
|
-
|
|
68
|
-
// If we did not exit tile, have we hit the terrain?
|
|
69
|
-
if (e.r > z) {
|
|
70
|
-
// We hit terrain. Do not add illumination for this iteration
|
|
71
|
-
gl_FragColor = vec4(src, 1.0);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Should have hit terrain or left the tile by this point, so should never need this
|
|
77
|
-
// If we finish the loop somehow, let’s pretend it’s been illuminated
|
|
78
|
-
vec3 illumination = vec3(1.0/softIterations) * clamp(dot(n0, sunDirection), 0.0, 1.0);
|
|
79
|
-
gl_FragColor = vec4(src + illumination, 1.0);
|
|
80
|
-
}
|
|
1
|
+
import glsl from 'glslify'
|
|
2
|
+
|
|
3
|
+
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
+
precision highp float;
|
|
5
|
+
#else
|
|
6
|
+
precision mediump float;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
uniform sampler2D tInput;
|
|
10
|
+
uniform sampler2D tNormal;
|
|
11
|
+
uniform sampler2D tSrc;
|
|
12
|
+
uniform vec3 sunDirection;
|
|
13
|
+
uniform vec2 resolution;
|
|
14
|
+
uniform float pixelScale;
|
|
15
|
+
uniform float softIterations;
|
|
16
|
+
varying vec2 vTexCoord;
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
vec2 ires = 1.0 / resolution;
|
|
20
|
+
vec3 src = texture2D(tSrc, gl_FragCoord.xy * ires).rgb;
|
|
21
|
+
vec4 e0 = texture2D(tInput, vTexCoord);
|
|
22
|
+
vec3 n0 = texture2D(tNormal, vTexCoord).rgb;
|
|
23
|
+
|
|
24
|
+
// get 2D ray direction
|
|
25
|
+
vec2 sr = normalize(sunDirection.xy);
|
|
26
|
+
|
|
27
|
+
// initialize pixel traversal algorithm
|
|
28
|
+
vec2 p0 = vTexCoord * resolution;
|
|
29
|
+
vec2 p = floor(p0); // pixel we are starting in
|
|
30
|
+
vec2 stp = sign(sr);
|
|
31
|
+
|
|
32
|
+
// how far we need to travel in our ray direction to intersect the next pixel
|
|
33
|
+
// in the x- and y- directions
|
|
34
|
+
vec2 tMax = step(0.0, sr) * (1.0 - fract(p0)) + (1.0 - step(0.0, sr)) * fract(p0);
|
|
35
|
+
tMax /= abs(sr);
|
|
36
|
+
// how far must we travel along our ray to cover the width and height of a pixel
|
|
37
|
+
vec2 tDelta = 1.0 / abs(sr);
|
|
38
|
+
|
|
39
|
+
// pixel traversal routine
|
|
40
|
+
for (int i = 0; i < 65536; i++) {
|
|
41
|
+
if (tMax.x < tMax.y) {
|
|
42
|
+
tMax.x += tDelta.x;
|
|
43
|
+
p.x += stp.x;
|
|
44
|
+
} else {
|
|
45
|
+
tMax.y += tDelta.y;
|
|
46
|
+
p.y += stp.y;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// normalized texture coordinate for the center of the current pixel
|
|
50
|
+
vec2 ptex = ires * (p + 0.5);
|
|
51
|
+
|
|
52
|
+
// If we left the tile: add some illumination to the pixel for this iteration and stop traversing
|
|
53
|
+
if (ptex.x < 0.0 || ptex.x > 1.0 || ptex.y < 0.0 || ptex.y > 1.0) {
|
|
54
|
+
// illumination of this single ray
|
|
55
|
+
vec3 illumination = vec3(1.0/softIterations) * clamp(dot(n0, sunDirection), 0.0, 1.0);
|
|
56
|
+
// add illumination of this ray to result of previous iteration
|
|
57
|
+
gl_FragColor = vec4(src + illumination, 1.0);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// elevation/value at current pixel
|
|
62
|
+
vec4 e = texture2D(tInput, ptex);
|
|
63
|
+
// time we have traveled along the 2D ray
|
|
64
|
+
float time = distance(p + 0.5, p0);
|
|
65
|
+
// elevation along our original 3D ray at the current point
|
|
66
|
+
float z = e0.r + time * pixelScale * sunDirection.z;
|
|
67
|
+
|
|
68
|
+
// If we did not exit tile, have we hit the terrain?
|
|
69
|
+
if (e.r > z) {
|
|
70
|
+
// We hit terrain. Do not add illumination for this iteration
|
|
71
|
+
gl_FragColor = vec4(src, 1.0);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Should have hit terrain or left the tile by this point, so should never need this
|
|
77
|
+
// If we finish the loop somehow, let’s pretend it’s been illuminated
|
|
78
|
+
vec3 illumination = vec3(1.0/softIterations) * clamp(dot(n0, sunDirection), 0.0, 1.0);
|
|
79
|
+
gl_FragColor = vec4(src + illumination, 1.0);
|
|
80
|
+
}
|
|
81
81
|
`
|
|
@@ -1,50 +1,55 @@
|
|
|
1
|
-
import glsl from 'glslify'
|
|
2
|
-
|
|
3
|
-
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
-
precision highp float;
|
|
5
|
-
#else
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
#pragma glslify: computeColor = require(../../util/computeColor.glsl)
|
|
10
|
-
#pragma glslify: isCloseEnough = require(../../util/isCloseEnough.glsl)
|
|
11
|
-
#pragma glslify: getTexelValue = require(../../util/getTexelValue.glsl)
|
|
12
|
-
|
|
13
|
-
uniform int scaleLength;
|
|
14
|
-
uniform int sentinelLength;
|
|
15
|
-
uniform sampler2D scaleColormap;
|
|
16
|
-
uniform sampler2D sentinelColormap;
|
|
17
|
-
|
|
18
|
-
uniform
|
|
19
|
-
uniform
|
|
20
|
-
|
|
21
|
-
uniform
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import glsl from 'glslify'
|
|
2
|
+
|
|
3
|
+
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
+
precision highp float;
|
|
5
|
+
#else
|
|
6
|
+
precision mediump float;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#pragma glslify: computeColor = require(../../util/computeColor.glsl)
|
|
10
|
+
#pragma glslify: isCloseEnough = require(../../util/isCloseEnough.glsl)
|
|
11
|
+
#pragma glslify: getTexelValue = require(../../util/getTexelValue.glsl)
|
|
12
|
+
|
|
13
|
+
uniform int scaleLength;
|
|
14
|
+
uniform int sentinelLength;
|
|
15
|
+
uniform sampler2D scaleColormap;
|
|
16
|
+
uniform sampler2D sentinelColormap;
|
|
17
|
+
|
|
18
|
+
uniform vec4 aboveColor;
|
|
19
|
+
uniform vec4 belowColor;
|
|
20
|
+
|
|
21
|
+
uniform float nodataValue;
|
|
22
|
+
uniform sampler2D texture;
|
|
23
|
+
uniform bool littleEndian;
|
|
24
|
+
uniform sampler2D hillshadePregenTexture;
|
|
25
|
+
|
|
26
|
+
varying vec2 vTexCoordA;
|
|
27
|
+
varying vec2 vTexCoordB;
|
|
28
|
+
|
|
29
|
+
void main() {
|
|
30
|
+
float texelFloat = getTexelValue(texture, vTexCoordA, littleEndian);
|
|
31
|
+
|
|
32
|
+
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
33
|
+
discard;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec4 clr = computeColor(
|
|
37
|
+
texelFloat,
|
|
38
|
+
scaleColormap,
|
|
39
|
+
sentinelColormap,
|
|
40
|
+
scaleLength,
|
|
41
|
+
sentinelLength,
|
|
42
|
+
littleEndian,
|
|
43
|
+
aboveColor,
|
|
44
|
+
belowColor
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Hillshade
|
|
48
|
+
float light = texture2D(hillshadePregenTexture, vTexCoordB).r;
|
|
49
|
+
// float light = getTexelValue(vTexCoordB, hillshadePregenTexture, littleEndian).r;
|
|
50
|
+
clr.rgb = light * pow(clr.rgb, vec3(2.0));
|
|
51
|
+
clr.rgb = pow(clr.rgb, vec3(1.0/2.2));
|
|
52
|
+
|
|
53
|
+
gl_FragColor = clr;
|
|
54
|
+
}
|
|
50
55
|
`
|
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
import glsl from 'glslify'
|
|
2
|
-
|
|
3
|
-
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
-
precision highp float;
|
|
5
|
-
#else
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
#define TRANSPARENT vec4(0.0)
|
|
10
|
-
|
|
11
|
-
#pragma glslify: computeColor = require(../util/computeColor.glsl)
|
|
12
|
-
#pragma glslify: isCloseEnough = require(../util/isCloseEnough.glsl)
|
|
13
|
-
#pragma glslify: getTexelValue = require(../util/getTexelValue.glsl)
|
|
14
|
-
|
|
15
|
-
uniform sampler2D textureA;
|
|
16
|
-
uniform sampler2D textureB;
|
|
17
|
-
|
|
18
|
-
uniform int scaleLengthA;
|
|
19
|
-
uniform int sentinelLengthA;
|
|
20
|
-
uniform sampler2D scaleColormapA;
|
|
21
|
-
uniform sampler2D sentinelColormapA;
|
|
22
|
-
|
|
23
|
-
uniform int scaleLengthB;
|
|
24
|
-
uniform int sentinelLengthB;
|
|
25
|
-
uniform sampler2D scaleColormapB;
|
|
26
|
-
uniform sampler2D sentinelColormapB;
|
|
27
|
-
|
|
28
|
-
uniform float nodataValue;
|
|
29
|
-
uniform bool littleEndian;
|
|
30
|
-
uniform float interpolationFraction;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import glsl from 'glslify'
|
|
2
|
+
|
|
3
|
+
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
+
precision highp float;
|
|
5
|
+
#else
|
|
6
|
+
precision mediump float;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#define TRANSPARENT vec4(0.0)
|
|
10
|
+
|
|
11
|
+
#pragma glslify: computeColor = require(../util/computeColor.glsl)
|
|
12
|
+
#pragma glslify: isCloseEnough = require(../util/isCloseEnough.glsl)
|
|
13
|
+
#pragma glslify: getTexelValue = require(../util/getTexelValue.glsl)
|
|
14
|
+
|
|
15
|
+
uniform sampler2D textureA;
|
|
16
|
+
uniform sampler2D textureB;
|
|
17
|
+
|
|
18
|
+
uniform int scaleLengthA;
|
|
19
|
+
uniform int sentinelLengthA;
|
|
20
|
+
uniform sampler2D scaleColormapA;
|
|
21
|
+
uniform sampler2D sentinelColormapA;
|
|
22
|
+
|
|
23
|
+
uniform int scaleLengthB;
|
|
24
|
+
uniform int sentinelLengthB;
|
|
25
|
+
uniform sampler2D scaleColormapB;
|
|
26
|
+
uniform sampler2D sentinelColormapB;
|
|
27
|
+
|
|
28
|
+
uniform float nodataValue;
|
|
29
|
+
uniform bool littleEndian;
|
|
30
|
+
uniform float interpolationFraction;
|
|
31
|
+
|
|
32
|
+
uniform vec4 aboveColor;
|
|
33
|
+
uniform vec4 belowColor;
|
|
34
|
+
|
|
35
|
+
varying vec2 vTexCoordA;
|
|
36
|
+
varying vec2 vTexCoordB;
|
|
37
|
+
|
|
38
|
+
void main() {
|
|
39
|
+
if (interpolationFraction <= 0.0) {
|
|
40
|
+
float texelFloat = getTexelValue(textureA, vTexCoordA, littleEndian);
|
|
41
|
+
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
42
|
+
discard;
|
|
43
|
+
}
|
|
44
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
45
|
+
} else if (interpolationFraction >= 1.0) {
|
|
46
|
+
float texelFloat = getTexelValue(textureB, vTexCoordB, littleEndian);
|
|
47
|
+
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
48
|
+
discard;
|
|
49
|
+
}
|
|
50
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
51
|
+
} else {
|
|
52
|
+
float texelFloatA = getTexelValue(textureA, vTexCoordA, littleEndian);
|
|
53
|
+
float texelFloatB = getTexelValue(textureB, vTexCoordB, littleEndian);
|
|
54
|
+
vec4 colorA = (
|
|
55
|
+
isCloseEnough(texelFloatA, nodataValue)
|
|
56
|
+
? TRANSPARENT
|
|
57
|
+
: computeColor(texelFloatA, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor)
|
|
58
|
+
);
|
|
59
|
+
vec4 colorB = (
|
|
60
|
+
isCloseEnough(texelFloatB, nodataValue)
|
|
61
|
+
? TRANSPARENT
|
|
62
|
+
: computeColor(texelFloatB, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor)
|
|
63
|
+
);
|
|
64
|
+
gl_FragColor = mix(colorA, colorB, interpolationFraction);
|
|
65
|
+
}
|
|
63
66
|
}`
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import glsl from 'glslify'
|
|
2
|
-
|
|
3
|
-
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
-
precision highp float;
|
|
5
|
-
#else
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
#pragma glslify: computeColor = require(../util/computeColor.glsl)
|
|
10
|
-
#pragma glslify: isCloseEnough = require(../util/isCloseEnough.glsl)
|
|
11
|
-
#pragma glslify: getTexelValue = require(../util/getTexelValue.glsl)
|
|
12
|
-
|
|
13
|
-
uniform sampler2D texture;
|
|
14
|
-
|
|
15
|
-
uniform int scaleLengthA;
|
|
16
|
-
uniform int sentinelLengthA;
|
|
17
|
-
uniform sampler2D scaleColormapA;
|
|
18
|
-
uniform sampler2D sentinelColormapA;
|
|
19
|
-
|
|
20
|
-
uniform int scaleLengthB;
|
|
21
|
-
uniform int sentinelLengthB;
|
|
22
|
-
uniform sampler2D scaleColormapB;
|
|
23
|
-
uniform sampler2D sentinelColormapB;
|
|
24
|
-
|
|
25
|
-
uniform float nodataValue;
|
|
26
|
-
uniform bool littleEndian;
|
|
27
|
-
uniform float interpolationFraction;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import glsl from 'glslify'
|
|
2
|
+
|
|
3
|
+
export default glsl`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
4
|
+
precision highp float;
|
|
5
|
+
#else
|
|
6
|
+
precision mediump float;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#pragma glslify: computeColor = require(../util/computeColor.glsl)
|
|
10
|
+
#pragma glslify: isCloseEnough = require(../util/isCloseEnough.glsl)
|
|
11
|
+
#pragma glslify: getTexelValue = require(../util/getTexelValue.glsl)
|
|
12
|
+
|
|
13
|
+
uniform sampler2D texture;
|
|
14
|
+
|
|
15
|
+
uniform int scaleLengthA;
|
|
16
|
+
uniform int sentinelLengthA;
|
|
17
|
+
uniform sampler2D scaleColormapA;
|
|
18
|
+
uniform sampler2D sentinelColormapA;
|
|
19
|
+
|
|
20
|
+
uniform int scaleLengthB;
|
|
21
|
+
uniform int sentinelLengthB;
|
|
22
|
+
uniform sampler2D scaleColormapB;
|
|
23
|
+
uniform sampler2D sentinelColormapB;
|
|
24
|
+
|
|
25
|
+
uniform float nodataValue;
|
|
26
|
+
uniform bool littleEndian;
|
|
27
|
+
uniform float interpolationFraction;
|
|
28
|
+
|
|
29
|
+
uniform vec4 aboveColor;
|
|
30
|
+
uniform vec4 belowColor;
|
|
31
|
+
|
|
32
|
+
varying vec2 vTexCoord;
|
|
33
|
+
|
|
34
|
+
void main() {
|
|
35
|
+
float texelFloat = getTexelValue(texture, vTexCoord, littleEndian);
|
|
36
|
+
|
|
37
|
+
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
38
|
+
discard;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (interpolationFraction <= 0.0) {
|
|
42
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
43
|
+
} else if (interpolationFraction >= 1.0) {
|
|
44
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
45
|
+
} else {
|
|
46
|
+
vec4 colorA = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
47
|
+
vec4 colorB = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
48
|
+
gl_FragColor = mix(colorA, colorB, interpolationFraction);
|
|
49
|
+
}
|
|
47
50
|
}`
|