@mapcatch/util 2.0.4 → 2.0.5-b

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.
Files changed (56) hide show
  1. package/README.md +44 -0
  2. package/dist/catchUtil.min.esm.js +56 -102
  3. package/dist/catchUtil.min.js +2 -2
  4. package/package.json +26 -2
  5. package/src/constants/crs.js +42098 -42098
  6. package/src/constants/default_layers.js +42 -94
  7. package/src/gl-operations/constants.js +9 -9
  8. package/src/gl-operations/default_options.js +97 -97
  9. package/src/gl-operations/index.js +532 -532
  10. package/src/gl-operations/reglCommands/contours.js +27 -27
  11. package/src/gl-operations/reglCommands/default.js +45 -45
  12. package/src/gl-operations/reglCommands/hillshading.js +340 -340
  13. package/src/gl-operations/reglCommands/index.js +6 -6
  14. package/src/gl-operations/reglCommands/multiLayers.js +303 -303
  15. package/src/gl-operations/reglCommands/transitions.js +111 -111
  16. package/src/gl-operations/reglCommands/util.js +71 -71
  17. package/src/gl-operations/renderer.js +209 -209
  18. package/src/gl-operations/shaders/fragment/convertDem.js +25 -25
  19. package/src/gl-operations/shaders/fragment/convolutionSmooth.js +54 -54
  20. package/src/gl-operations/shaders/fragment/diffCalc.js +33 -33
  21. package/src/gl-operations/shaders/fragment/drawResult.js +46 -46
  22. package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +78 -78
  23. package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +59 -59
  24. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +30 -30
  25. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +60 -60
  26. package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +26 -26
  27. package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +25 -25
  28. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +53 -53
  29. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +80 -80
  30. package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +54 -54
  31. package/src/gl-operations/shaders/fragment/interpolateColor.js +65 -65
  32. package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +49 -49
  33. package/src/gl-operations/shaders/fragment/interpolateValue.js +136 -136
  34. package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +35 -35
  35. package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +45 -45
  36. package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +53 -53
  37. package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +61 -61
  38. package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +69 -69
  39. package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +77 -77
  40. package/src/gl-operations/shaders/fragment/single.js +93 -93
  41. package/src/gl-operations/shaders/transform.js +21 -21
  42. package/src/gl-operations/shaders/util/computeColor.glsl +85 -85
  43. package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -10
  44. package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -9
  45. package/src/gl-operations/shaders/util/rgbaToFloat.glsl +17 -17
  46. package/src/gl-operations/shaders/vertex/double.js +16 -16
  47. package/src/gl-operations/shaders/vertex/multi3.js +19 -19
  48. package/src/gl-operations/shaders/vertex/multi4.js +22 -22
  49. package/src/gl-operations/shaders/vertex/multi5.js +25 -25
  50. package/src/gl-operations/shaders/vertex/multi6.js +28 -28
  51. package/src/gl-operations/shaders/vertex/single.js +13 -13
  52. package/src/gl-operations/shaders/vertex/singleNotTransformed.js +11 -11
  53. package/src/gl-operations/texture_manager.js +141 -141
  54. package/src/gl-operations/util.js +336 -336
  55. package/src/util.js +14 -6
  56. package/CHANGELOG.md +0 -72
@@ -1,47 +1,47 @@
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 int scaleLength;
16
- uniform int sentinelLength;
17
- uniform sampler2D scaleColormap;
18
- uniform sampler2D sentinelColormap;
19
-
20
- uniform float nodataValue;
21
- uniform sampler2D texture;
22
- uniform bool littleEndian;
23
-
24
- uniform vec4 aboveColor;
25
- uniform vec4 belowColor;
26
-
27
- varying vec2 vTexCoord;
28
-
29
- void main() {
30
- float f = getTexelValue(texture, vTexCoord, littleEndian);
31
-
32
- if (isCloseEnough(f, nodataValue)) {
33
- gl_FragColor = TRANSPARENT;
34
- } else {
35
- gl_FragColor = computeColor(
36
- f,
37
- scaleColormap,
38
- sentinelColormap,
39
- scaleLength,
40
- sentinelLength,
41
- littleEndian,
42
- aboveColor,
43
- belowColor
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
+ #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 int scaleLength;
16
+ uniform int sentinelLength;
17
+ uniform sampler2D scaleColormap;
18
+ uniform sampler2D sentinelColormap;
19
+
20
+ uniform float nodataValue;
21
+ uniform sampler2D texture;
22
+ uniform bool littleEndian;
23
+
24
+ uniform vec4 aboveColor;
25
+ uniform vec4 belowColor;
26
+
27
+ varying vec2 vTexCoord;
28
+
29
+ void main() {
30
+ float f = getTexelValue(texture, vTexCoord, littleEndian);
31
+
32
+ if (isCloseEnough(f, nodataValue)) {
33
+ gl_FragColor = TRANSPARENT;
34
+ } else {
35
+ gl_FragColor = computeColor(
36
+ f,
37
+ scaleColormap,
38
+ sentinelColormap,
39
+ scaleLength,
40
+ sentinelLength,
41
+ littleEndian,
42
+ aboveColor,
43
+ belowColor
44
+ );
45
+ }
46
+ }
47
47
  `
@@ -1,79 +1,79 @@
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 direction;
13
- uniform vec2 resolution;
14
- uniform float pixelScale;
15
- uniform float ambientIterations;
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
- vec3 sr3d = normalize(n0 + direction); // ray direction
25
- vec2 sr = normalize(sr3d.xy); // get 2D ray direction
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/ambientIterations);
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 * sr3d.z;
67
- // If we did not exit tile, have we hit the terrain?
68
- if (e.r > z) {
69
- // We hit terrain. Do not add illumination for this iteration
70
- gl_FragColor = vec4(src, 1.0);
71
- return;
72
- }
73
- }
74
-
75
- // Should have hit terrain or left the tile by this point, so should never need this
76
- // If we finish the loop somehow, let’s pretend it’s been illuminated
77
- vec3 illumination = vec3(1.0/ambientIterations);
78
- gl_FragColor = vec4(src + illumination, 1.0);
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 direction;
13
+ uniform vec2 resolution;
14
+ uniform float pixelScale;
15
+ uniform float ambientIterations;
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
+ vec3 sr3d = normalize(n0 + direction); // ray direction
25
+ vec2 sr = normalize(sr3d.xy); // get 2D ray direction
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/ambientIterations);
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 * sr3d.z;
67
+ // If we did not exit tile, have we hit the terrain?
68
+ if (e.r > z) {
69
+ // We hit terrain. Do not add illumination for this iteration
70
+ gl_FragColor = vec4(src, 1.0);
71
+ return;
72
+ }
73
+ }
74
+
75
+ // Should have hit terrain or left the tile by this point, so should never need this
76
+ // If we finish the loop somehow, let’s pretend it’s been illuminated
77
+ vec3 illumination = vec3(1.0/ambientIterations);
78
+ gl_FragColor = vec4(src + illumination, 1.0);
79
79
  }`
@@ -1,60 +1,60 @@
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
-
12
- uniform sampler2D tInput;
13
- uniform sampler2D tNormal;
14
- uniform float floatScale;
15
- uniform vec3 sunDirection;
16
- uniform float nodataValue;
17
- uniform bool littleEndian;
18
- varying vec2 vTexCoord;
19
-
20
- uniform vec4 aboveColor;
21
- uniform vec4 belowColor;
22
-
23
- uniform int scaleLength;
24
- uniform int sentinelLength;
25
- uniform sampler2D scaleColormap;
26
- uniform sampler2D sentinelColormap;
27
-
28
- void main() {
29
- float f = texture2D(tInput, vTexCoord).r;
30
-
31
- if (isCloseEnough(f, nodataValue)) {
32
- // discard;
33
- gl_FragColor = vec4(0.0);
34
- } else {
35
- vec4 clr = computeColor(
36
- f / floatScale,
37
- scaleColormap,
38
- sentinelColormap,
39
- scaleLength,
40
- sentinelLength,
41
- littleEndian,
42
- aboveColor,
43
- belowColor
44
- );
45
-
46
- vec3 n = texture2D(tNormal, vTexCoord).rgb;
47
-
48
- // light intensity that varies on the range [−1..1]
49
- float light = dot(n, sunDirection);
50
- // transform the light intensity to the range [0..1]
51
- light = 0.5 * light + 0.5;
52
-
53
- // gl_FragColor = vec4(l, l, l, 1.0); // to show light
54
-
55
- vec3 color = light * pow(clr.rgb, vec3(2.0));
56
- color = pow(color, vec3(1.0/2.2));
57
- gl_FragColor = vec4(color, 1.0);
58
- }
59
- }
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
+
12
+ uniform sampler2D tInput;
13
+ uniform sampler2D tNormal;
14
+ uniform float floatScale;
15
+ uniform vec3 sunDirection;
16
+ uniform float nodataValue;
17
+ uniform bool littleEndian;
18
+ varying vec2 vTexCoord;
19
+
20
+ uniform vec4 aboveColor;
21
+ uniform vec4 belowColor;
22
+
23
+ uniform int scaleLength;
24
+ uniform int sentinelLength;
25
+ uniform sampler2D scaleColormap;
26
+ uniform sampler2D sentinelColormap;
27
+
28
+ void main() {
29
+ float f = texture2D(tInput, vTexCoord).r;
30
+
31
+ if (isCloseEnough(f, nodataValue)) {
32
+ // discard;
33
+ gl_FragColor = vec4(0.0);
34
+ } else {
35
+ vec4 clr = computeColor(
36
+ f / floatScale,
37
+ scaleColormap,
38
+ sentinelColormap,
39
+ scaleLength,
40
+ sentinelLength,
41
+ littleEndian,
42
+ aboveColor,
43
+ belowColor
44
+ );
45
+
46
+ vec3 n = texture2D(tNormal, vTexCoord).rgb;
47
+
48
+ // light intensity that varies on the range [−1..1]
49
+ float light = dot(n, sunDirection);
50
+ // transform the light intensity to the range [0..1]
51
+ light = 0.5 * light + 0.5;
52
+
53
+ // gl_FragColor = vec4(l, l, l, 1.0); // to show light
54
+
55
+ vec3 color = light * pow(clr.rgb, vec3(2.0));
56
+ color = pow(color, vec3(1.0/2.2));
57
+ gl_FragColor = vec4(color, 1.0);
58
+ }
59
+ }
60
60
  `
@@ -1,31 +1,31 @@
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 tBase;
10
- uniform sampler2D tSoftShadow;
11
- uniform sampler2D tAmbient;
12
- uniform float finalSoftMultiplier;
13
- uniform float finalAmbientMultiplier;
14
- uniform float nodataValue;
15
- uniform bool littleEndian;
16
- varying vec2 vTexCoordA;
17
- varying vec2 vTexCoordB;
18
-
19
- void main() {
20
- vec3 baselayer = texture2D(tBase, vTexCoordA).rgb;
21
-
22
- float softShadow = texture2D(tSoftShadow, vTexCoordB).r;
23
- float ambient = texture2D(tAmbient, vTexCoordB).r;
24
- // Add up the lighting
25
- float light = finalSoftMultiplier * softShadow + finalAmbientMultiplier * ambient;
26
- //Deepen the original color a bit by applying a curve, and multiply it by the light
27
- vec3 color = light * pow(baselayer.rgb, vec3(2.0));
28
- // apply gamma correction
29
- color = pow(color, vec3(1.0/2.2));
30
- gl_FragColor = vec4(color, 1.0);
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 tBase;
10
+ uniform sampler2D tSoftShadow;
11
+ uniform sampler2D tAmbient;
12
+ uniform float finalSoftMultiplier;
13
+ uniform float finalAmbientMultiplier;
14
+ uniform float nodataValue;
15
+ uniform bool littleEndian;
16
+ varying vec2 vTexCoordA;
17
+ varying vec2 vTexCoordB;
18
+
19
+ void main() {
20
+ vec3 baselayer = texture2D(tBase, vTexCoordA).rgb;
21
+
22
+ float softShadow = texture2D(tSoftShadow, vTexCoordB).r;
23
+ float ambient = texture2D(tAmbient, vTexCoordB).r;
24
+ // Add up the lighting
25
+ float light = finalSoftMultiplier * softShadow + finalAmbientMultiplier * ambient;
26
+ //Deepen the original color a bit by applying a curve, and multiply it by the light
27
+ vec3 color = light * pow(baselayer.rgb, vec3(2.0));
28
+ // apply gamma correction
29
+ color = pow(color, vec3(1.0/2.2));
30
+ gl_FragColor = vec4(color, 1.0);
31
31
  }`
@@ -1,61 +1,61 @@
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
-
12
- uniform sampler2D tInput;
13
- uniform sampler2D tSoftShadow;
14
- uniform sampler2D tAmbient;
15
- uniform float floatScale;
16
- uniform float finalSoftMultiplier;
17
- uniform float finalAmbientMultiplier;
18
- uniform float nodataValue;
19
- uniform bool littleEndian;
20
- uniform int scaleLength;
21
- uniform int sentinelLength;
22
- uniform sampler2D scaleColormap;
23
- uniform sampler2D sentinelColormap;
24
- varying vec2 vTexCoordA;
25
- varying vec2 vTexCoordB;
26
-
27
- uniform vec4 aboveColor;
28
- uniform vec4 belowColor;
29
-
30
- void main() {
31
- float f = texture2D(tInput, vTexCoordA).r;
32
-
33
- if (isCloseEnough(f, nodataValue)) {
34
- gl_FragColor = vec4(0.0);
35
- return;
36
- } else {
37
- vec4 clr = computeColor(
38
- f / floatScale,
39
- scaleColormap,
40
- sentinelColormap,
41
- scaleLength,
42
- sentinelLength,
43
- littleEndian,
44
- aboveColor,
45
- belowColor
46
- );
47
-
48
- float softShadow = texture2D(tSoftShadow, vTexCoordB).r;
49
- float ambient = texture2D(tAmbient, vTexCoordB).r;
50
- // Add up the lighting
51
- float light = finalSoftMultiplier * softShadow + finalAmbientMultiplier * ambient;
52
- // Deepen the original color a bit by applying a curve, and multiply it by the light
53
- vec3 color = light * pow(clr.rgb, vec3(2.0));
54
- // apply gamma correction
55
- color = pow(color, vec3(1.0/2.2));
56
- gl_FragColor = vec4(color, 1.0);
57
- // gl_FragColor = vec4(clr.rgb, 1.0);
58
- }
59
- // vec3 n = texture2D(tInput, vTexCoordA).rgb;
60
- // gl_FragColor = vec4((0.5 * n + 0.5)*0.1, 1.0);
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
+
12
+ uniform sampler2D tInput;
13
+ uniform sampler2D tSoftShadow;
14
+ uniform sampler2D tAmbient;
15
+ uniform float floatScale;
16
+ uniform float finalSoftMultiplier;
17
+ uniform float finalAmbientMultiplier;
18
+ uniform float nodataValue;
19
+ uniform bool littleEndian;
20
+ uniform int scaleLength;
21
+ uniform int sentinelLength;
22
+ uniform sampler2D scaleColormap;
23
+ uniform sampler2D sentinelColormap;
24
+ varying vec2 vTexCoordA;
25
+ varying vec2 vTexCoordB;
26
+
27
+ uniform vec4 aboveColor;
28
+ uniform vec4 belowColor;
29
+
30
+ void main() {
31
+ float f = texture2D(tInput, vTexCoordA).r;
32
+
33
+ if (isCloseEnough(f, nodataValue)) {
34
+ gl_FragColor = vec4(0.0);
35
+ return;
36
+ } else {
37
+ vec4 clr = computeColor(
38
+ f / floatScale,
39
+ scaleColormap,
40
+ sentinelColormap,
41
+ scaleLength,
42
+ sentinelLength,
43
+ littleEndian,
44
+ aboveColor,
45
+ belowColor
46
+ );
47
+
48
+ float softShadow = texture2D(tSoftShadow, vTexCoordB).r;
49
+ float ambient = texture2D(tAmbient, vTexCoordB).r;
50
+ // Add up the lighting
51
+ float light = finalSoftMultiplier * softShadow + finalAmbientMultiplier * ambient;
52
+ // Deepen the original color a bit by applying a curve, and multiply it by the light
53
+ vec3 color = light * pow(clr.rgb, vec3(2.0));
54
+ // apply gamma correction
55
+ color = pow(color, vec3(1.0/2.2));
56
+ gl_FragColor = vec4(color, 1.0);
57
+ // gl_FragColor = vec4(clr.rgb, 1.0);
58
+ }
59
+ // vec3 n = texture2D(tInput, vTexCoordA).rgb;
60
+ // gl_FragColor = vec4((0.5 * n + 0.5)*0.1, 1.0);
61
61
  }`
@@ -1,27 +1,27 @@
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
- #pragma glslify: getTexelValue = require(../../util/getTexelValue.glsl)
11
-
12
- uniform float nodataValue;
13
- uniform bool littleEndian;
14
- uniform sampler2D texture;
15
- uniform float floatScale;
16
- varying vec2 vTexCoord;
17
-
18
- void main() {
19
- float f = getTexelValue(texture, vTexCoord, littleEndian);
20
-
21
- if (isCloseEnough(f, nodataValue)) {
22
- gl_FragColor = vec4(nodataValue);
23
- } else {
24
- // Scale the input value and write to framebuffer
25
- gl_FragColor = vec4(f * floatScale);
26
- }
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
+ #pragma glslify: getTexelValue = require(../../util/getTexelValue.glsl)
11
+
12
+ uniform float nodataValue;
13
+ uniform bool littleEndian;
14
+ uniform sampler2D texture;
15
+ uniform float floatScale;
16
+ varying vec2 vTexCoord;
17
+
18
+ void main() {
19
+ float f = getTexelValue(texture, vTexCoord, littleEndian);
20
+
21
+ if (isCloseEnough(f, nodataValue)) {
22
+ gl_FragColor = vec4(nodataValue);
23
+ } else {
24
+ // Scale the input value and write to framebuffer
25
+ gl_FragColor = vec4(f * floatScale);
26
+ }
27
27
  }`
@@ -1,26 +1,26 @@
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 float nodataValue;
10
- uniform bool littleEndian;
11
- uniform sampler2D tInput;
12
- uniform float pixelScale;
13
- uniform float onePixel;
14
- varying vec2 vTexCoord;
15
-
16
- void main() {
17
- float p0 = texture2D(tInput, vTexCoord).r;
18
- float px = texture2D(tInput, vec2(vTexCoord.x + onePixel, vTexCoord.y)).r;
19
- float py = texture2D(tInput, vec2(vTexCoord.x, vTexCoord.y + onePixel)).r;
20
- vec3 dx = vec3(pixelScale, 0.0, px - p0);
21
- vec3 dy = vec3(0.0, pixelScale, py - p0);
22
- vec3 n = normalize(cross(dx, dy));
23
-
24
- gl_FragColor = vec4(n, 1.0);
25
- // gl_FragColor = vec4(0.5 * n + 0.5, 1.0); // to show
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 float nodataValue;
10
+ uniform bool littleEndian;
11
+ uniform sampler2D tInput;
12
+ uniform float pixelScale;
13
+ uniform float onePixel;
14
+ varying vec2 vTexCoord;
15
+
16
+ void main() {
17
+ float p0 = texture2D(tInput, vTexCoord).r;
18
+ float px = texture2D(tInput, vec2(vTexCoord.x + onePixel, vTexCoord.y)).r;
19
+ float py = texture2D(tInput, vec2(vTexCoord.x, vTexCoord.y + onePixel)).r;
20
+ vec3 dx = vec3(pixelScale, 0.0, px - p0);
21
+ vec3 dy = vec3(0.0, pixelScale, py - p0);
22
+ vec3 n = normalize(cross(dx, dy));
23
+
24
+ gl_FragColor = vec4(n, 1.0);
25
+ // gl_FragColor = vec4(0.5 * n + 0.5, 1.0); // to show
26
26
  }`