@mapcatch/util 2.0.5-b → 2.0.6

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 (54) hide show
  1. package/dist/catchUtil.min.esm.js +4 -4
  2. package/dist/catchUtil.min.js +1 -1
  3. package/package.json +1 -21
  4. package/src/constants/crs.js +42098 -42098
  5. package/src/event/event.js +4 -5
  6. package/src/gl-operations/constants.js +9 -9
  7. package/src/gl-operations/default_options.js +97 -97
  8. package/src/gl-operations/index.js +532 -532
  9. package/src/gl-operations/reglCommands/contours.js +27 -27
  10. package/src/gl-operations/reglCommands/default.js +45 -45
  11. package/src/gl-operations/reglCommands/hillshading.js +340 -340
  12. package/src/gl-operations/reglCommands/index.js +6 -6
  13. package/src/gl-operations/reglCommands/multiLayers.js +303 -303
  14. package/src/gl-operations/reglCommands/transitions.js +111 -111
  15. package/src/gl-operations/reglCommands/util.js +71 -71
  16. package/src/gl-operations/renderer.js +209 -209
  17. package/src/gl-operations/shaders/fragment/convertDem.js +25 -25
  18. package/src/gl-operations/shaders/fragment/convolutionSmooth.js +54 -54
  19. package/src/gl-operations/shaders/fragment/diffCalc.js +33 -33
  20. package/src/gl-operations/shaders/fragment/drawResult.js +46 -46
  21. package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +78 -78
  22. package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +59 -59
  23. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +30 -30
  24. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +60 -60
  25. package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +26 -26
  26. package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +25 -25
  27. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +53 -53
  28. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +80 -80
  29. package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +54 -54
  30. package/src/gl-operations/shaders/fragment/interpolateColor.js +65 -65
  31. package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +49 -49
  32. package/src/gl-operations/shaders/fragment/interpolateValue.js +136 -136
  33. package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +35 -35
  34. package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +45 -45
  35. package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +53 -53
  36. package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +61 -61
  37. package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +69 -69
  38. package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +77 -77
  39. package/src/gl-operations/shaders/fragment/single.js +93 -93
  40. package/src/gl-operations/shaders/transform.js +21 -21
  41. package/src/gl-operations/shaders/util/computeColor.glsl +85 -85
  42. package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -10
  43. package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -9
  44. package/src/gl-operations/shaders/util/rgbaToFloat.glsl +17 -17
  45. package/src/gl-operations/shaders/vertex/double.js +16 -16
  46. package/src/gl-operations/shaders/vertex/multi3.js +19 -19
  47. package/src/gl-operations/shaders/vertex/multi4.js +22 -22
  48. package/src/gl-operations/shaders/vertex/multi5.js +25 -25
  49. package/src/gl-operations/shaders/vertex/multi6.js +28 -28
  50. package/src/gl-operations/shaders/vertex/single.js +13 -13
  51. package/src/gl-operations/shaders/vertex/singleNotTransformed.js +11 -11
  52. package/src/gl-operations/texture_manager.js +141 -141
  53. package/src/gl-operations/util.js +336 -336
  54. package/README.md +0 -44
@@ -1,111 +1,111 @@
1
- import vertSingle from '../shaders/vertex/single.js'
2
- import vertDouble from '../shaders/vertex/double.js'
3
-
4
- import fragInterpolateColor from '../shaders/fragment/interpolateColor.js'
5
- import fragInterpolateColorOnly from '../shaders/fragment/interpolateColorOnly.js'
6
- import fragInterpolateValue from '../shaders/fragment/interpolateValue.js'
7
-
8
- import * as util from '../util'
9
-
10
- /**
11
- * The DrawCommand output by this function interpolates, for each pixel, between two values, one
12
- * from `textureA` and one from `textureB`. The same color scale / sentinel values are applied to
13
- * both.
14
- */
15
- export function createDrawTileInterpolateValueCommand (
16
- regl,
17
- commonConfig,
18
- fragMacros
19
- ) {
20
- return regl({
21
- ...commonConfig,
22
- vert: vertDouble,
23
- frag: util.defineMacros(fragInterpolateValue, fragMacros),
24
- uniforms: {
25
- ...commonConfig.uniforms,
26
- scaleLength: regl.prop('scaleLength'),
27
- sentinelLength: regl.prop('sentinelLength'),
28
- scaleColormap: regl.prop('scaleColormap'),
29
- sentinelColormap: regl.prop('sentinelColormap'),
30
- aboveColor: regl.prop('aboveColor'),
31
- belowColor: regl.prop('belowColor'),
32
- textureA: (_, { textureA }) => textureA,
33
- textureB: (_, { textureB }) => textureB,
34
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
35
- },
36
- attributes: {
37
- ...commonConfig.attributes,
38
- texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
39
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
40
- }
41
- })
42
- }
43
-
44
- /**
45
- * The behavior of this DrawCommand is similar to the one above, except that pixels from `textureA`
46
- * are colorized with one color scale / set of sentinel values, while pixels from `textureB` use a
47
- * different color scale / set of sentinel values.
48
- */
49
- export function createDrawTileInterpolateColorCommand (
50
- regl,
51
- commonConfig,
52
- fragMacros
53
- ) {
54
- return regl({
55
- ...commonConfig,
56
- vert: vertDouble,
57
- frag: util.defineMacros(fragInterpolateColor, fragMacros),
58
- uniforms: {
59
- ...commonConfig.uniforms,
60
- scaleLengthA: regl.prop('scaleLengthA'),
61
- sentinelLengthA: regl.prop('sentinelLengthA'),
62
- scaleColormapA: regl.prop('scaleColormapA'),
63
- sentinelColormapA: regl.prop('sentinelColormapA'),
64
- scaleLengthB: regl.prop('scaleLengthB'),
65
- sentinelLengthB: regl.prop('sentinelLengthB'),
66
- scaleColormapB: regl.prop('scaleColormapB'),
67
- sentinelColormapB: regl.prop('sentinelColormapB'),
68
- textureA: (_, { textureA }) => textureA,
69
- textureB: (_, { textureB }) => textureB,
70
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
71
- },
72
- attributes: {
73
- ...commonConfig.attributes,
74
- texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
75
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
76
- }
77
- })
78
- }
79
-
80
- /**
81
- * The behavior of this DrawCommand is similar to the one above, except that the pixel values
82
- * are the same. Only the colorscale changes.
83
- */
84
- export function createDrawTileInterpolateColorOnlyCommand (
85
- regl,
86
- commonConfig,
87
- fragMacros
88
- ) {
89
- return regl({
90
- ...commonConfig,
91
- vert: vertSingle,
92
- frag: util.defineMacros(fragInterpolateColorOnly, fragMacros),
93
- uniforms: {
94
- ...commonConfig.uniforms,
95
- scaleLengthA: regl.prop('scaleLengthA'),
96
- sentinelLengthA: regl.prop('sentinelLengthA'),
97
- scaleColormapA: regl.prop('scaleColormapA'),
98
- sentinelColormapA: regl.prop('sentinelColormapA'),
99
- scaleLengthB: regl.prop('scaleLengthB'),
100
- sentinelLengthB: regl.prop('sentinelLengthB'),
101
- scaleColormapB: regl.prop('scaleColormapB'),
102
- sentinelColormapB: regl.prop('sentinelColormapB'),
103
- texture: (_, { texture }) => texture,
104
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
105
- },
106
- attributes: {
107
- ...commonConfig.attributes,
108
- texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds)
109
- }
110
- })
111
- }
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+ import vertDouble from '../shaders/vertex/double.js'
3
+
4
+ import fragInterpolateColor from '../shaders/fragment/interpolateColor.js'
5
+ import fragInterpolateColorOnly from '../shaders/fragment/interpolateColorOnly.js'
6
+ import fragInterpolateValue from '../shaders/fragment/interpolateValue.js'
7
+
8
+ import * as util from '../util'
9
+
10
+ /**
11
+ * The DrawCommand output by this function interpolates, for each pixel, between two values, one
12
+ * from `textureA` and one from `textureB`. The same color scale / sentinel values are applied to
13
+ * both.
14
+ */
15
+ export function createDrawTileInterpolateValueCommand (
16
+ regl,
17
+ commonConfig,
18
+ fragMacros
19
+ ) {
20
+ return regl({
21
+ ...commonConfig,
22
+ vert: vertDouble,
23
+ frag: util.defineMacros(fragInterpolateValue, fragMacros),
24
+ uniforms: {
25
+ ...commonConfig.uniforms,
26
+ scaleLength: regl.prop('scaleLength'),
27
+ sentinelLength: regl.prop('sentinelLength'),
28
+ scaleColormap: regl.prop('scaleColormap'),
29
+ sentinelColormap: regl.prop('sentinelColormap'),
30
+ aboveColor: regl.prop('aboveColor'),
31
+ belowColor: regl.prop('belowColor'),
32
+ textureA: (_, { textureA }) => textureA,
33
+ textureB: (_, { textureB }) => textureB,
34
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
35
+ },
36
+ attributes: {
37
+ ...commonConfig.attributes,
38
+ texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
39
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
40
+ }
41
+ })
42
+ }
43
+
44
+ /**
45
+ * The behavior of this DrawCommand is similar to the one above, except that pixels from `textureA`
46
+ * are colorized with one color scale / set of sentinel values, while pixels from `textureB` use a
47
+ * different color scale / set of sentinel values.
48
+ */
49
+ export function createDrawTileInterpolateColorCommand (
50
+ regl,
51
+ commonConfig,
52
+ fragMacros
53
+ ) {
54
+ return regl({
55
+ ...commonConfig,
56
+ vert: vertDouble,
57
+ frag: util.defineMacros(fragInterpolateColor, fragMacros),
58
+ uniforms: {
59
+ ...commonConfig.uniforms,
60
+ scaleLengthA: regl.prop('scaleLengthA'),
61
+ sentinelLengthA: regl.prop('sentinelLengthA'),
62
+ scaleColormapA: regl.prop('scaleColormapA'),
63
+ sentinelColormapA: regl.prop('sentinelColormapA'),
64
+ scaleLengthB: regl.prop('scaleLengthB'),
65
+ sentinelLengthB: regl.prop('sentinelLengthB'),
66
+ scaleColormapB: regl.prop('scaleColormapB'),
67
+ sentinelColormapB: regl.prop('sentinelColormapB'),
68
+ textureA: (_, { textureA }) => textureA,
69
+ textureB: (_, { textureB }) => textureB,
70
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
71
+ },
72
+ attributes: {
73
+ ...commonConfig.attributes,
74
+ texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
75
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
76
+ }
77
+ })
78
+ }
79
+
80
+ /**
81
+ * The behavior of this DrawCommand is similar to the one above, except that the pixel values
82
+ * are the same. Only the colorscale changes.
83
+ */
84
+ export function createDrawTileInterpolateColorOnlyCommand (
85
+ regl,
86
+ commonConfig,
87
+ fragMacros
88
+ ) {
89
+ return regl({
90
+ ...commonConfig,
91
+ vert: vertSingle,
92
+ frag: util.defineMacros(fragInterpolateColorOnly, fragMacros),
93
+ uniforms: {
94
+ ...commonConfig.uniforms,
95
+ scaleLengthA: regl.prop('scaleLengthA'),
96
+ sentinelLengthA: regl.prop('sentinelLengthA'),
97
+ scaleColormapA: regl.prop('scaleColormapA'),
98
+ sentinelColormapA: regl.prop('sentinelColormapA'),
99
+ scaleLengthB: regl.prop('scaleLengthB'),
100
+ sentinelLengthB: regl.prop('sentinelLengthB'),
101
+ scaleColormapB: regl.prop('scaleColormapB'),
102
+ sentinelColormapB: regl.prop('sentinelColormapB'),
103
+ texture: (_, { texture }) => texture,
104
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
105
+ },
106
+ attributes: {
107
+ ...commonConfig.attributes,
108
+ texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds)
109
+ }
110
+ })
111
+ }
@@ -1,71 +1,71 @@
1
- import vertSingle from '../shaders/vertex/single.js'
2
-
3
- import fragConvertDem from '../shaders/fragment/convertDem.js'
4
-
5
- import * as util from '../util'
6
-
7
- const littleEndian = util.machineIsLittleEndian()
8
-
9
- /**
10
- * The object generated by this function should be merged into the DrawConfig for each Regl
11
- * command in the application.
12
- */
13
- export function getCommonDrawConfiguration (
14
- tileSize,
15
- nodataValue
16
- ) {
17
- return {
18
- uniforms: {
19
- nodataValue,
20
- littleEndian,
21
- transformMatrix: ({ viewportWidth, viewportHeight }) => (
22
- util.getTransformMatrix(viewportWidth, viewportHeight)
23
- )
24
- },
25
- attributes: {
26
- position: (_, { canvasCoordinates }) => {
27
- const [left, top] = canvasCoordinates
28
- const [right, bottom] = [left + tileSize, top + tileSize]
29
- return [
30
- [left, top ],
31
- [right, top ],
32
- [left, bottom],
33
- [right, bottom]
34
- ]
35
- }
36
- },
37
- // We don't need the depth buffer for 2D drawing. Leaving it enabled (and failing to clear it
38
- // between draw calls) results in visual artifacts.
39
- depth: { enable: false },
40
- primitive: 'triangle strip',
41
- count: 4,
42
- viewport: (_, { canvasSize: [width, height] }) => ({ width, height })
43
- }
44
- }
45
-
46
- /**
47
- * The command output by this function converts a tile in DEM format
48
- * to float32 packed as rgba.
49
- */
50
- export function createConvertDemCommand (
51
- regl,
52
- commonConfig
53
- ) {
54
- return regl({
55
- ...commonConfig,
56
- vert: vertSingle,
57
- frag: fragConvertDem,
58
- depth: {
59
- enable: false
60
- },
61
- uniforms: {
62
- ...commonConfig.uniforms,
63
- texture: (_, { texture }) => texture
64
- },
65
- attributes: {
66
- ...commonConfig.attributes,
67
- texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]]
68
- },
69
- framebuffer: regl.prop('fbo')
70
- })
71
- }
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+
3
+ import fragConvertDem from '../shaders/fragment/convertDem.js'
4
+
5
+ import * as util from '../util'
6
+
7
+ const littleEndian = util.machineIsLittleEndian()
8
+
9
+ /**
10
+ * The object generated by this function should be merged into the DrawConfig for each Regl
11
+ * command in the application.
12
+ */
13
+ export function getCommonDrawConfiguration (
14
+ tileSize,
15
+ nodataValue
16
+ ) {
17
+ return {
18
+ uniforms: {
19
+ nodataValue,
20
+ littleEndian,
21
+ transformMatrix: ({ viewportWidth, viewportHeight }) => (
22
+ util.getTransformMatrix(viewportWidth, viewportHeight)
23
+ )
24
+ },
25
+ attributes: {
26
+ position: (_, { canvasCoordinates }) => {
27
+ const [left, top] = canvasCoordinates
28
+ const [right, bottom] = [left + tileSize, top + tileSize]
29
+ return [
30
+ [left, top ],
31
+ [right, top ],
32
+ [left, bottom],
33
+ [right, bottom]
34
+ ]
35
+ }
36
+ },
37
+ // We don't need the depth buffer for 2D drawing. Leaving it enabled (and failing to clear it
38
+ // between draw calls) results in visual artifacts.
39
+ depth: { enable: false },
40
+ primitive: 'triangle strip',
41
+ count: 4,
42
+ viewport: (_, { canvasSize: [width, height] }) => ({ width, height })
43
+ }
44
+ }
45
+
46
+ /**
47
+ * The command output by this function converts a tile in DEM format
48
+ * to float32 packed as rgba.
49
+ */
50
+ export function createConvertDemCommand (
51
+ regl,
52
+ commonConfig
53
+ ) {
54
+ return regl({
55
+ ...commonConfig,
56
+ vert: vertSingle,
57
+ frag: fragConvertDem,
58
+ depth: {
59
+ enable: false
60
+ },
61
+ uniforms: {
62
+ ...commonConfig.uniforms,
63
+ texture: (_, { texture }) => texture
64
+ },
65
+ attributes: {
66
+ ...commonConfig.attributes,
67
+ texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]]
68
+ },
69
+ framebuffer: regl.prop('fbo')
70
+ })
71
+ }