@mapcatch/util 1.0.15 → 2.0.0

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 (81) hide show
  1. package/dist/catchUtil.min.esm.js +67984 -14011
  2. package/dist/catchUtil.min.js +2695 -55
  3. package/package.json +22 -3
  4. package/src/constants/annotation_color.js +7 -0
  5. package/src/constants/annotation_draw_style.js +228 -0
  6. package/src/constants/annotation_label_style.js +76 -0
  7. package/src/constants/annotation_style.js +118 -0
  8. package/src/constants/cameras.js +1 -1
  9. package/src/constants/crs.js +31473 -31473
  10. package/src/constants/error_codes.js +44 -0
  11. package/src/constants/height_colors.js +1 -0
  12. package/src/constants/index.js +9 -2
  13. package/src/constants/map_style.js +11 -0
  14. package/src/constants/measurement_fields.js +3 -3
  15. package/src/{event.js → event/event.js} +1 -14
  16. package/src/event/event_bus.js +5 -0
  17. package/src/event/index.js +2 -0
  18. package/src/gl-operations/constants.js +9 -11
  19. package/src/gl-operations/default_options.js +5 -5
  20. package/src/gl-operations/index.js +166 -239
  21. package/src/gl-operations/reglCommands/contours.js +20 -20
  22. package/src/gl-operations/reglCommands/default.js +34 -34
  23. package/src/gl-operations/reglCommands/hillshading.js +116 -116
  24. package/src/gl-operations/reglCommands/index.js +6 -6
  25. package/src/gl-operations/reglCommands/multiLayers.js +55 -55
  26. package/src/gl-operations/reglCommands/transitions.js +24 -24
  27. package/src/gl-operations/reglCommands/util.js +54 -54
  28. package/src/gl-operations/renderer.js +69 -69
  29. package/src/gl-operations/shaders/transform.js +2 -2
  30. package/src/gl-operations/shaders/util/rgbaToFloat.glsl +11 -11
  31. package/src/gl-operations/texture_manager.js +58 -58
  32. package/src/gl-operations/util.js +154 -154
  33. package/src/index.js +14 -2
  34. package/src/measure/index.js +198 -0
  35. package/src/measure/tile_cache.js +88 -0
  36. package/src/mvs/index.js +26 -0
  37. package/src/mvs/protos/index.js +12 -0
  38. package/src/mvs/protos/proto_10.js +155 -0
  39. package/src/observation_pretict.js +168 -0
  40. package/src/photo-parser/exif/gps_tags.js +33 -0
  41. package/src/photo-parser/exif/ifd1_tags.js +22 -0
  42. package/src/photo-parser/exif/index.js +130 -0
  43. package/src/photo-parser/exif/parse_image.js +290 -0
  44. package/src/photo-parser/exif/string_values.js +137 -0
  45. package/src/photo-parser/exif/tags.js +75 -0
  46. package/src/photo-parser/exif/tiff_tags.js +35 -0
  47. package/src/photo-parser/exif/util.js +103 -0
  48. package/src/photo-parser/image-size/detector.js +24 -0
  49. package/src/photo-parser/image-size/fromFile.js +55 -0
  50. package/src/photo-parser/image-size/index.js +2 -0
  51. package/src/photo-parser/image-size/lookup.js +37 -0
  52. package/src/photo-parser/image-size/types/bmp.js +10 -0
  53. package/src/photo-parser/image-size/types/cur.js +16 -0
  54. package/src/photo-parser/image-size/types/dds.js +10 -0
  55. package/src/photo-parser/image-size/types/gif.js +11 -0
  56. package/src/photo-parser/image-size/types/heif.js +35 -0
  57. package/src/photo-parser/image-size/types/icns.js +112 -0
  58. package/src/photo-parser/image-size/types/ico.js +74 -0
  59. package/src/photo-parser/image-size/types/index.js +43 -0
  60. package/src/photo-parser/image-size/types/j2c.js +11 -0
  61. package/src/photo-parser/image-size/types/jp2.js +22 -0
  62. package/src/photo-parser/image-size/types/jpg.js +157 -0
  63. package/src/photo-parser/image-size/types/ktx.js +18 -0
  64. package/src/photo-parser/image-size/types/png.js +36 -0
  65. package/src/photo-parser/image-size/types/pnm.js +74 -0
  66. package/src/photo-parser/image-size/types/psd.js +10 -0
  67. package/src/photo-parser/image-size/types/svg.js +100 -0
  68. package/src/photo-parser/image-size/types/tga.js +14 -0
  69. package/src/photo-parser/image-size/types/tiff.js +92 -0
  70. package/src/photo-parser/image-size/types/utils.js +83 -0
  71. package/src/photo-parser/image-size/types/webp.js +67 -0
  72. package/src/photo-parser/index.js +181 -0
  73. package/src/report/annotations_report.js +446 -0
  74. package/src/report/index.js +2 -0
  75. package/src/report/map_util.js +81 -0
  76. package/src/report/pdf_creator.js +247 -0
  77. package/src/report/report.js +583 -0
  78. package/src/transform.js +204 -0
  79. package/src/util.js +371 -75
  80. package/CHANGELOG.md +0 -60
  81. /package/src/constants/{colors.js → dsm_colors.js} +0 -0
@@ -1,23 +1,23 @@
1
- import vertSingle from '../shaders/vertex/single.js';
2
- import vertDouble from '../shaders/vertex/double.js';
3
- import vertMulti3 from '../shaders/vertex/multi3.js';
4
- import vertMulti4 from '../shaders/vertex/multi4.js';
5
- import vertMulti5 from '../shaders/vertex/multi5.js';
6
- import vertMulti6 from '../shaders/vertex/multi6.js';
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+ import vertDouble from '../shaders/vertex/double.js'
3
+ import vertMulti3 from '../shaders/vertex/multi3.js'
4
+ import vertMulti4 from '../shaders/vertex/multi4.js'
5
+ import vertMulti5 from '../shaders/vertex/multi5.js'
6
+ import vertMulti6 from '../shaders/vertex/multi6.js'
7
7
 
8
- import fragMulti1Calc from '../shaders/fragment/multiAnalyze1Calc.js';
9
- import fragMulti2Calc from '../shaders/fragment/multiAnalyze2Calc.js';
10
- import fragMulti3Calc from '../shaders/fragment/multiAnalyze3Calc.js';
11
- import fragMulti4Calc from '../shaders/fragment/multiAnalyze4Calc.js';
12
- import fragMulti5Calc from '../shaders/fragment/multiAnalyze5Calc.js';
13
- import fragMulti6Calc from '../shaders/fragment/multiAnalyze6Calc.js';
14
- import fragDiffCalc from '../shaders/fragment/diffCalc.js';
15
- import fragDrawResult from '../shaders/fragment/drawResult.js';
8
+ import fragMulti1Calc from '../shaders/fragment/multiAnalyze1Calc.js'
9
+ import fragMulti2Calc from '../shaders/fragment/multiAnalyze2Calc.js'
10
+ import fragMulti3Calc from '../shaders/fragment/multiAnalyze3Calc.js'
11
+ import fragMulti4Calc from '../shaders/fragment/multiAnalyze4Calc.js'
12
+ import fragMulti5Calc from '../shaders/fragment/multiAnalyze5Calc.js'
13
+ import fragMulti6Calc from '../shaders/fragment/multiAnalyze6Calc.js'
14
+ import fragDiffCalc from '../shaders/fragment/diffCalc.js'
15
+ import fragDrawResult from '../shaders/fragment/drawResult.js'
16
16
 
17
- import * as util from '../util';
17
+ import * as util from '../util'
18
18
 
19
19
 
20
- export function createCalcTileMultiAnalyze1Command(
20
+ export function createCalcTileMultiAnalyze1Command (
21
21
  regl,
22
22
  commonConfig
23
23
  ) {
@@ -33,17 +33,17 @@ export function createCalcTileMultiAnalyze1Command(
33
33
  filterLowA: (_, { filterLowA }) => filterLowA,
34
34
  filterHighA: (_, { filterHighA }) => filterHighA,
35
35
  multiplierA: (_, { multiplierA }) => multiplierA,
36
- textureA: (_, { textureA }) => textureA,
36
+ textureA: (_, { textureA }) => textureA
37
37
  },
38
38
  attributes: {
39
39
  ...commonConfig.attributes,
40
- texCoord: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
40
+ texCoord: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA)
41
41
  },
42
- framebuffer: regl.prop("fbo"),
43
- });
42
+ framebuffer: regl.prop('fbo')
43
+ })
44
44
  }
45
45
 
46
- export function createCalcTileMultiAnalyze2Command(
46
+ export function createCalcTileMultiAnalyze2Command (
47
47
  regl,
48
48
  commonConfig
49
49
  ) {
@@ -63,18 +63,18 @@ export function createCalcTileMultiAnalyze2Command(
63
63
  multiplierA: (_, { multiplierA }) => multiplierA,
64
64
  multiplierB: (_, { multiplierB }) => multiplierB,
65
65
  textureA: (_, { textureA }) => textureA,
66
- textureB: (_, { textureB }) => textureB,
66
+ textureB: (_, { textureB }) => textureB
67
67
  },
68
68
  attributes: {
69
69
  ...commonConfig.attributes,
70
70
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
71
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
71
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
72
72
  },
73
- framebuffer: regl.prop("fbo"),
74
- });
73
+ framebuffer: regl.prop('fbo')
74
+ })
75
75
  }
76
76
 
77
- export function createCalcTileMultiAnalyze3Command(
77
+ export function createCalcTileMultiAnalyze3Command (
78
78
  regl,
79
79
  commonConfig
80
80
  ) {
@@ -98,19 +98,19 @@ export function createCalcTileMultiAnalyze3Command(
98
98
  multiplierC: (_, { multiplierC }) => multiplierC,
99
99
  textureA: (_, { textureA }) => textureA,
100
100
  textureB: (_, { textureB }) => textureB,
101
- textureC: (_, { textureC }) => textureC,
101
+ textureC: (_, { textureC }) => textureC
102
102
  },
103
103
  attributes: {
104
104
  ...commonConfig.attributes,
105
105
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
106
106
  texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
107
- texCoordC: (_, { textureBoundsC }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsC),
107
+ texCoordC: (_, { textureBoundsC }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsC)
108
108
  },
109
- framebuffer: regl.prop("fbo"),
110
- });
109
+ framebuffer: regl.prop('fbo')
110
+ })
111
111
  }
112
112
 
113
- export function createCalcTileMultiAnalyze4Command(
113
+ export function createCalcTileMultiAnalyze4Command (
114
114
  regl,
115
115
  commonConfig
116
116
  ) {
@@ -138,20 +138,20 @@ export function createCalcTileMultiAnalyze4Command(
138
138
  textureA: (_, { textureA }) => textureA,
139
139
  textureB: (_, { textureB }) => textureB,
140
140
  textureC: (_, { textureC }) => textureC,
141
- textureD: (_, { textureD }) => textureD,
141
+ textureD: (_, { textureD }) => textureD
142
142
  },
143
143
  attributes: {
144
144
  ...commonConfig.attributes,
145
145
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
146
146
  texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
147
147
  texCoordC: (_, { textureBoundsC }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsC),
148
- texCoordD: (_, { textureBoundsD }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsD),
148
+ texCoordD: (_, { textureBoundsD }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsD)
149
149
  },
150
- framebuffer: regl.prop("fbo"),
151
- });
150
+ framebuffer: regl.prop('fbo')
151
+ })
152
152
  }
153
153
 
154
- export function createCalcTileMultiAnalyze5Command(
154
+ export function createCalcTileMultiAnalyze5Command (
155
155
  regl,
156
156
  commonConfig
157
157
  ) {
@@ -183,7 +183,7 @@ export function createCalcTileMultiAnalyze5Command(
183
183
  textureB: (_, { textureB }) => textureB,
184
184
  textureC: (_, { textureC }) => textureC,
185
185
  textureD: (_, { textureD }) => textureD,
186
- textureE: (_, { textureE }) => textureE,
186
+ textureE: (_, { textureE }) => textureE
187
187
  },
188
188
  attributes: {
189
189
  ...commonConfig.attributes,
@@ -191,13 +191,13 @@ export function createCalcTileMultiAnalyze5Command(
191
191
  texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
192
192
  texCoordC: (_, { textureBoundsC }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsC),
193
193
  texCoordD: (_, { textureBoundsD }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsD),
194
- texCoordE: (_, { textureBoundsE }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsE),
194
+ texCoordE: (_, { textureBoundsE }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsE)
195
195
  },
196
- framebuffer: regl.prop("fbo"),
197
- });
196
+ framebuffer: regl.prop('fbo')
197
+ })
198
198
  }
199
199
 
200
- export function createCalcTileMultiAnalyze6Command(
200
+ export function createCalcTileMultiAnalyze6Command (
201
201
  regl,
202
202
  commonConfig
203
203
  ) {
@@ -233,7 +233,7 @@ export function createCalcTileMultiAnalyze6Command(
233
233
  textureC: (_, { textureC }) => textureC,
234
234
  textureD: (_, { textureD }) => textureD,
235
235
  textureE: (_, { textureE }) => textureE,
236
- textureF: (_, { textureF }) => textureF,
236
+ textureF: (_, { textureF }) => textureF
237
237
  },
238
238
  attributes: {
239
239
  ...commonConfig.attributes,
@@ -244,11 +244,11 @@ export function createCalcTileMultiAnalyze6Command(
244
244
  texCoordE: (_, { textureBoundsE }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsE),
245
245
  texCoordF: (_, { textureBoundsF }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsF)
246
246
  },
247
- framebuffer: regl.prop("fbo"),
248
- });
247
+ framebuffer: regl.prop('fbo')
248
+ })
249
249
  }
250
250
 
251
- export function createCalcTileDiffCommand(
251
+ export function createCalcTileDiffCommand (
252
252
  regl,
253
253
  commonConfig
254
254
  ) {
@@ -262,21 +262,21 @@ export function createCalcTileDiffCommand(
262
262
  uniforms: {
263
263
  ...commonConfig.uniforms,
264
264
  textureA: (_, { textureA }) => textureA,
265
- textureB: (_, { textureB }) => textureB,
265
+ textureB: (_, { textureB }) => textureB
266
266
  },
267
267
  attributes: {
268
268
  ...commonConfig.attributes,
269
269
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
270
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
270
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
271
271
  },
272
- framebuffer: regl.prop("fbo"),
273
- });
272
+ framebuffer: regl.prop('fbo')
273
+ })
274
274
  }
275
275
 
276
- export function createDrawResultCommand(
276
+ export function createDrawResultCommand (
277
277
  regl,
278
278
  commonConfig,
279
- fragMacros,
279
+ fragMacros
280
280
  ) {
281
281
  return regl({
282
282
  ...commonConfig,
@@ -291,11 +291,11 @@ export function createDrawResultCommand(
291
291
  sentinelLength: regl.prop('sentinelLength'),
292
292
  scaleColormap: regl.prop('scaleColormap'),
293
293
  sentinelColormap: regl.prop('sentinelColormap'),
294
- texture: regl.prop("texture"),
294
+ texture: regl.prop('texture')
295
295
  },
296
296
  attributes: {
297
297
  ...commonConfig.attributes,
298
- texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]],
299
- },
300
- });
298
+ texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]]
299
+ }
300
+ })
301
301
  }
@@ -1,21 +1,21 @@
1
- import vertSingle from '../shaders/vertex/single.js';
2
- import vertDouble from '../shaders/vertex/double.js';
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+ import vertDouble from '../shaders/vertex/double.js'
3
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';
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
7
 
8
- import * as util from '../util';
8
+ import * as util from '../util'
9
9
 
10
10
  /**
11
11
  * The DrawCommand output by this function interpolates, for each pixel, between two values, one
12
12
  * from `textureA` and one from `textureB`. The same color scale / sentinel values are applied to
13
13
  * both.
14
14
  */
15
- export function createDrawTileInterpolateValueCommand(
15
+ export function createDrawTileInterpolateValueCommand (
16
16
  regl,
17
17
  commonConfig,
18
- fragMacros,
18
+ fragMacros
19
19
  ) {
20
20
  return regl({
21
21
  ...commonConfig,
@@ -29,14 +29,14 @@ export function createDrawTileInterpolateValueCommand(
29
29
  sentinelColormap: regl.prop('sentinelColormap'),
30
30
  textureA: (_, { textureA }) => textureA,
31
31
  textureB: (_, { textureB }) => textureB,
32
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction,
32
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
33
33
  },
34
34
  attributes: {
35
35
  ...commonConfig.attributes,
36
36
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
37
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
38
- },
39
- });
37
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
38
+ }
39
+ })
40
40
  }
41
41
 
42
42
  /**
@@ -44,10 +44,10 @@ export function createDrawTileInterpolateValueCommand(
44
44
  * are colorized with one color scale / set of sentinel values, while pixels from `textureB` use a
45
45
  * different color scale / set of sentinel values.
46
46
  */
47
- export function createDrawTileInterpolateColorCommand(
47
+ export function createDrawTileInterpolateColorCommand (
48
48
  regl,
49
49
  commonConfig,
50
- fragMacros,
50
+ fragMacros
51
51
  ) {
52
52
  return regl({
53
53
  ...commonConfig,
@@ -65,24 +65,24 @@ export function createDrawTileInterpolateColorCommand(
65
65
  sentinelColormapB: regl.prop('sentinelColormapB'),
66
66
  textureA: (_, { textureA }) => textureA,
67
67
  textureB: (_, { textureB }) => textureB,
68
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction,
68
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
69
69
  },
70
70
  attributes: {
71
71
  ...commonConfig.attributes,
72
72
  texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
73
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB),
74
- },
75
- });
73
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
74
+ }
75
+ })
76
76
  }
77
77
 
78
78
  /**
79
79
  * The behavior of this DrawCommand is similar to the one above, except that the pixel values
80
80
  * are the same. Only the colorscale changes.
81
81
  */
82
- export function createDrawTileInterpolateColorOnlyCommand(
82
+ export function createDrawTileInterpolateColorOnlyCommand (
83
83
  regl,
84
84
  commonConfig,
85
- fragMacros,
85
+ fragMacros
86
86
  ) {
87
87
  return regl({
88
88
  ...commonConfig,
@@ -99,11 +99,11 @@ export function createDrawTileInterpolateColorOnlyCommand(
99
99
  scaleColormapB: regl.prop('scaleColormapB'),
100
100
  sentinelColormapB: regl.prop('sentinelColormapB'),
101
101
  texture: (_, { texture }) => texture,
102
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction,
102
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
103
103
  },
104
104
  attributes: {
105
105
  ...commonConfig.attributes,
106
- texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds),
107
- },
108
- });
106
+ texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds)
107
+ }
108
+ })
109
109
  }
@@ -1,71 +1,71 @@
1
- import vertSingle from '../shaders/vertex/single.js';
1
+ import vertSingle from '../shaders/vertex/single.js'
2
2
 
3
- import fragConvertDem from '../shaders/fragment/convertDem.js';
3
+ import fragConvertDem from '../shaders/fragment/convertDem.js'
4
4
 
5
- import * as util from '../util';
5
+ import * as util from '../util'
6
6
 
7
- const littleEndian = util.machineIsLittleEndian();
7
+ const littleEndian = util.machineIsLittleEndian()
8
8
 
9
9
  /**
10
10
  * The object generated by this function should be merged into the DrawConfig for each Regl
11
11
  * command in the application.
12
12
  */
13
- export function getCommonDrawConfiguration(
14
- tileSize,
15
- nodataValue,
13
+ export function getCommonDrawConfiguration (
14
+ tileSize,
15
+ nodataValue
16
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
- };
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
44
  }
45
45
 
46
46
  /**
47
47
  * The command output by this function converts a tile in DEM format
48
48
  * to float32 packed as rgba.
49
49
  */
50
- export function createConvertDemCommand(
51
- regl,
52
- commonConfig
50
+ export function createConvertDemCommand (
51
+ regl,
52
+ commonConfig
53
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
- });
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
71
  }