@deck.gl/extensions 8.9.5 → 8.9.7

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 (131) hide show
  1. package/dist/dist.dev.js +17 -17
  2. package/dist/es5/brushing/{brushing.js → brushing-extension.js} +1 -1
  3. package/dist/es5/brushing/brushing-extension.js.map +1 -0
  4. package/dist/es5/brushing/shader-module.js.map +1 -1
  5. package/dist/es5/clip/{clip.js → clip-extension.js} +1 -1
  6. package/dist/es5/clip/clip-extension.js.map +1 -0
  7. package/dist/es5/collision-filter/{collision-filter.js → collision-filter-extension.js} +1 -1
  8. package/dist/es5/collision-filter/collision-filter-extension.js.map +1 -0
  9. package/dist/es5/data-filter/{data-filter.js → data-filter-extension.js} +1 -1
  10. package/dist/es5/data-filter/data-filter-extension.js.map +1 -0
  11. package/dist/es5/data-filter/shader-module.js.map +1 -1
  12. package/dist/es5/fill-style/{fill-style.js → fill-style-extension.js} +1 -1
  13. package/dist/es5/fill-style/fill-style-extension.js.map +1 -0
  14. package/dist/es5/fp64/{fp64.js → fp64-extension.js} +1 -1
  15. package/dist/es5/fp64/fp64-extension.js.map +1 -0
  16. package/dist/es5/index.js +18 -18
  17. package/dist/es5/index.js.map +1 -1
  18. package/dist/es5/mask/{mask.js → mask-extension.js} +1 -1
  19. package/dist/es5/mask/mask-extension.js.map +1 -0
  20. package/dist/es5/path-style/{path-style.js → path-style-extension.js} +1 -1
  21. package/dist/es5/path-style/path-style-extension.js.map +1 -0
  22. package/dist/es5/terrain/{terrain.js → terrain-extension.js} +1 -1
  23. package/dist/es5/terrain/terrain-extension.js.map +1 -0
  24. package/dist/esm/brushing/{brushing.js → brushing-extension.js} +1 -1
  25. package/dist/esm/brushing/brushing-extension.js.map +1 -0
  26. package/dist/esm/brushing/shader-module.js.map +1 -1
  27. package/dist/esm/clip/{clip.js → clip-extension.js} +1 -1
  28. package/dist/esm/clip/clip-extension.js.map +1 -0
  29. package/dist/esm/collision-filter/{collision-filter.js → collision-filter-extension.js} +1 -1
  30. package/dist/esm/collision-filter/collision-filter-extension.js.map +1 -0
  31. package/dist/esm/data-filter/{data-filter.js → data-filter-extension.js} +1 -1
  32. package/dist/esm/data-filter/data-filter-extension.js.map +1 -0
  33. package/dist/esm/data-filter/shader-module.js.map +1 -1
  34. package/dist/esm/fill-style/{fill-style.js → fill-style-extension.js} +1 -1
  35. package/dist/esm/fill-style/fill-style-extension.js.map +1 -0
  36. package/dist/esm/fp64/{fp64.js → fp64-extension.js} +1 -1
  37. package/dist/esm/fp64/fp64-extension.js.map +1 -0
  38. package/dist/esm/index.js +9 -9
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/mask/{mask.js → mask-extension.js} +1 -1
  41. package/dist/esm/mask/mask-extension.js.map +1 -0
  42. package/dist/esm/path-style/{path-style.js → path-style-extension.js} +1 -1
  43. package/dist/esm/path-style/path-style-extension.js.map +1 -0
  44. package/dist/esm/terrain/{terrain.js → terrain-extension.js} +1 -1
  45. package/dist/esm/terrain/terrain-extension.js.map +1 -0
  46. package/package.json +2 -2
  47. package/src/brushing/shader-module.ts +1 -1
  48. package/src/data-filter/shader-module.ts +1 -1
  49. package/src/index.ts +17 -17
  50. package/typed/brushing/brushing-extension.d.ts +39 -0
  51. package/typed/brushing/brushing-extension.d.ts.map +1 -0
  52. package/typed/brushing/brushing.js +83 -0
  53. package/typed/brushing/shader-module.d.ts +1 -1
  54. package/typed/brushing/shader-module.d.ts.map +1 -1
  55. package/typed/brushing/shader-module.js +116 -0
  56. package/typed/clip/clip-extension.d.ts +32 -0
  57. package/typed/clip/clip-extension.d.ts.map +1 -0
  58. package/typed/clip/clip.js +114 -0
  59. package/typed/collide/collide-effect.d.ts +1 -1
  60. package/typed/collide/collide-effect.d.ts.map +1 -1
  61. package/typed/collide/collide-pass.d.ts +0 -1
  62. package/typed/collide/collide-pass.d.ts.map +1 -1
  63. package/typed/collide/collide.d.ts +0 -1
  64. package/typed/collide/collide.d.ts.map +1 -1
  65. package/typed/collide/shader-module.d.ts.map +1 -1
  66. package/typed/collision-filter/collision-filter-extension.d.ts +41 -0
  67. package/typed/collision-filter/collision-filter-extension.d.ts.map +1 -0
  68. package/typed/data-filter/aggregator.js +98 -0
  69. package/typed/data-filter/data-filter-extension.d.ts +90 -0
  70. package/typed/data-filter/data-filter-extension.d.ts.map +1 -0
  71. package/typed/data-filter/data-filter.js +159 -0
  72. package/typed/data-filter/shader-module.d.ts +1 -1
  73. package/typed/data-filter/shader-module.d.ts.map +1 -1
  74. package/typed/data-filter/shader-module.js +152 -0
  75. package/typed/fill-style/fill-style-extension.d.ts +86 -0
  76. package/typed/fill-style/fill-style-extension.d.ts.map +1 -0
  77. package/typed/fill-style/fill-style.js +152 -0
  78. package/typed/fill-style/shaders.glsl.js +95 -0
  79. package/typed/fp64/fp64-extension.d.ts +8 -0
  80. package/typed/fp64/fp64-extension.d.ts.map +1 -0
  81. package/typed/fp64/fp64.js +34 -0
  82. package/typed/fp64/project64.glsl.js +100 -0
  83. package/typed/fp64/project64.js +50 -0
  84. package/typed/index.d.ts +17 -17
  85. package/typed/index.d.ts.map +1 -1
  86. package/typed/index.js +9 -0
  87. package/typed/mask/mask-extension.d.ts +30 -0
  88. package/typed/mask/mask-extension.d.ts.map +1 -0
  89. package/typed/mask/mask.js +48 -0
  90. package/typed/mask/shader-module.js +73 -0
  91. package/typed/path-style/path-style-extension.d.ts +66 -0
  92. package/typed/path-style/path-style-extension.d.ts.map +1 -0
  93. package/typed/path-style/path-style.js +107 -0
  94. package/typed/path-style/shaders.glsl.js +93 -0
  95. package/typed/terrain/height-map.d.ts +27 -0
  96. package/typed/terrain/height-map.d.ts.map +1 -0
  97. package/typed/terrain/shader-module-offset.d.ts +4 -0
  98. package/typed/terrain/shader-module-offset.d.ts.map +1 -0
  99. package/typed/terrain/shader-module-source.d.ts +4 -0
  100. package/typed/terrain/shader-module-source.d.ts.map +1 -0
  101. package/typed/terrain/terrain-extension.d.ts +21 -0
  102. package/typed/terrain/terrain-extension.d.ts.map +1 -0
  103. package/dist/es5/brushing/brushing.js.map +0 -1
  104. package/dist/es5/clip/clip.js.map +0 -1
  105. package/dist/es5/collision-filter/collision-filter.js.map +0 -1
  106. package/dist/es5/data-filter/data-filter.js.map +0 -1
  107. package/dist/es5/fill-style/fill-style.js.map +0 -1
  108. package/dist/es5/fp64/fp64.js.map +0 -1
  109. package/dist/es5/mask/mask.js.map +0 -1
  110. package/dist/es5/path-style/path-style.js.map +0 -1
  111. package/dist/es5/terrain/terrain.js.map +0 -1
  112. package/dist/esm/brushing/brushing.js.map +0 -1
  113. package/dist/esm/clip/clip.js.map +0 -1
  114. package/dist/esm/collision-filter/collision-filter.js.map +0 -1
  115. package/dist/esm/data-filter/data-filter.js.map +0 -1
  116. package/dist/esm/fill-style/fill-style.js.map +0 -1
  117. package/dist/esm/fp64/fp64.js.map +0 -1
  118. package/dist/esm/mask/mask.js.map +0 -1
  119. package/dist/esm/path-style/path-style.js.map +0 -1
  120. package/dist/esm/terrain/terrain.js.map +0 -1
  121. package/typed/effect-order.d.ts +0 -6
  122. package/typed/effect-order.d.ts.map +0 -1
  123. /package/src/brushing/{brushing.ts → brushing-extension.ts} +0 -0
  124. /package/src/clip/{clip.ts → clip-extension.ts} +0 -0
  125. /package/src/collision-filter/{collision-filter.ts → collision-filter-extension.ts} +0 -0
  126. /package/src/data-filter/{data-filter.ts → data-filter-extension.ts} +0 -0
  127. /package/src/fill-style/{fill-style.ts → fill-style-extension.ts} +0 -0
  128. /package/src/fp64/{fp64.ts → fp64-extension.ts} +0 -0
  129. /package/src/mask/{mask.ts → mask-extension.ts} +0 -0
  130. /package/src/path-style/{path-style.ts → path-style-extension.ts} +0 -0
  131. /package/src/terrain/{terrain.ts → terrain-extension.ts} +0 -0
@@ -0,0 +1,34 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { LayerExtension, COORDINATE_SYSTEM } from '@deck.gl/core';
21
+ import project64 from './project64';
22
+ export default class Fp64Extension extends LayerExtension {
23
+ getShaders(opts) {
24
+ const { coordinateSystem } = this.props;
25
+ if (coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&
26
+ coordinateSystem !== COORDINATE_SYSTEM.DEFAULT) {
27
+ throw new Error('fp64: coordinateSystem must be LNGLAT');
28
+ }
29
+ return {
30
+ modules: [project64]
31
+ };
32
+ }
33
+ }
34
+ Fp64Extension.extensionName = 'Fp64Extension';
@@ -0,0 +1,100 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ export default `\
21
+
22
+ const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
23
+
24
+ uniform vec2 project_uViewProjectionMatrixFP64[16];
25
+
26
+ // longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw
27
+ void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
28
+
29
+ #if defined(NVIDIA_FP64_WORKAROUND)
30
+ out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);
31
+ #else
32
+ out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);
33
+ #endif
34
+ out_val[1] = sum_fp64(PI_FP64,
35
+ log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));
36
+ return;
37
+ }
38
+
39
+ void project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {
40
+ vec2 pos_fp64[2];
41
+ mercatorProject_fp64(position_fp64, pos_fp64);
42
+ out_val[0] = mul_fp64(pos_fp64[0], WORLD_SCALE_FP64);
43
+ out_val[1] = mul_fp64(pos_fp64[1], WORLD_SCALE_FP64);
44
+
45
+ return;
46
+ }
47
+
48
+ void project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) {
49
+ vec4 position64xy = vec4(
50
+ position.x, position64xyLow.x,
51
+ position.y, position64xyLow.y);
52
+
53
+ project_position_fp64(position64xy, out_val);
54
+ }
55
+
56
+ vec4 project_common_position_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {
57
+ vec2 vertex_pos_clipspace[4];
58
+ mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,
59
+ vertex_pos_clipspace);
60
+ return vec4(
61
+ vertex_pos_clipspace[0].x,
62
+ vertex_pos_clipspace[1].x,
63
+ vertex_pos_clipspace[2].x,
64
+ vertex_pos_clipspace[3].x
65
+ );
66
+ }
67
+
68
+ vec4 project_position_to_clipspace(
69
+ vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition
70
+ ) {
71
+ // This is the local offset to the instance position
72
+ vec2 offset64[4];
73
+ vec4_fp64(vec4(offset, 0.0), offset64);
74
+
75
+ float z = project_size(position.z);
76
+
77
+ // Apply web mercator projection (depends on coordinate system imn use)
78
+ vec2 projectedPosition64xy[2];
79
+ project_position_fp64(position.xy, position64xyLow.xy, projectedPosition64xy);
80
+
81
+ vec2 commonPosition64[4];
82
+ commonPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]);
83
+ commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);
84
+ commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));
85
+ commonPosition64[3] = vec2(1.0, 0.0);
86
+
87
+ commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);
88
+
89
+ return project_common_position_to_clipspace_fp64(commonPosition64);
90
+ }
91
+
92
+ vec4 project_position_to_clipspace(
93
+ vec3 position, vec3 position64xyLow, vec3 offset
94
+ ) {
95
+ vec4 commonPosition;
96
+ return project_position_to_clipspace(
97
+ position, position64xyLow, offset, commonPosition
98
+ );
99
+ }
100
+ `;
@@ -0,0 +1,50 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { fp64 } from '@luma.gl/shadertools';
21
+ const { fp64ify, fp64ifyMatrix4 } = fp64;
22
+ import { project, _memoize as memoize } from '@deck.gl/core';
23
+ import project64Shader from './project64.glsl';
24
+ export default {
25
+ name: 'project64',
26
+ dependencies: [project, fp64],
27
+ vs: project64Shader,
28
+ getUniforms
29
+ };
30
+ // TODO - this module should calculate the 64 bit uniforms
31
+ // It is currently done by project to minimize duplicated work
32
+ const DEFAULT_MODULE_OPTIONS = {};
33
+ const getMemoizedUniforms = memoize(calculateUniforms);
34
+ function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
35
+ if (opts.viewport) {
36
+ const { viewProjectionMatrix, scale } = opts.viewport;
37
+ // We only need to update fp64 uniforms if fp32 projection is being updated
38
+ return getMemoizedUniforms({ viewProjectionMatrix, scale });
39
+ }
40
+ return {};
41
+ }
42
+ function calculateUniforms({ viewProjectionMatrix, scale }) {
43
+ const glViewProjectionMatrixFP64 = fp64ifyMatrix4(viewProjectionMatrix);
44
+ const scaleFP64 = fp64ify(scale);
45
+ return {
46
+ project_uViewProjectionMatrixFP64: glViewProjectionMatrixFP64,
47
+ project64_uViewProjectionMatrix: glViewProjectionMatrixFP64,
48
+ project64_uScale: scaleFP64
49
+ };
50
+ }
package/typed/index.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- export { default as BrushingExtension } from './brushing/brushing';
2
- export { default as DataFilterExtension } from './data-filter/data-filter';
3
- export { default as Fp64Extension } from './fp64/fp64';
4
- export { default as PathStyleExtension } from './path-style/path-style';
5
- export { default as FillStyleExtension } from './fill-style/fill-style';
6
- export { default as ClipExtension } from './clip/clip';
7
- export { default as CollisionFilterExtension } from './collision-filter/collision-filter';
8
- export { default as MaskExtension } from './mask/mask';
9
- export { default as _TerrainExtension } from './terrain/terrain';
1
+ export { default as BrushingExtension } from './brushing/brushing-extension';
2
+ export { default as DataFilterExtension } from './data-filter/data-filter-extension';
3
+ export { default as Fp64Extension } from './fp64/fp64-extension';
4
+ export { default as PathStyleExtension } from './path-style/path-style-extension';
5
+ export { default as FillStyleExtension } from './fill-style/fill-style-extension';
6
+ export { default as ClipExtension } from './clip/clip-extension';
7
+ export { default as CollisionFilterExtension } from './collision-filter/collision-filter-extension';
8
+ export { default as MaskExtension } from './mask/mask-extension';
9
+ export { default as _TerrainExtension } from './terrain/terrain-extension';
10
10
  export { default as project64 } from './fp64/project64';
11
- export type { BrushingExtensionProps } from './brushing/brushing';
12
- export type { DataFilterExtensionProps } from './data-filter/data-filter';
13
- export type { PathStyleExtensionProps } from './path-style/path-style';
14
- export type { FillStyleExtensionProps } from './fill-style/fill-style';
15
- export type { ClipExtensionProps } from './clip/clip';
16
- export type { CollisionFilterExtensionProps } from './collision-filter/collision-filter';
17
- export type { MaskExtensionProps } from './mask/mask';
18
- export type { TerrainExtensionProps } from './terrain/terrain';
11
+ export type { BrushingExtensionProps } from './brushing/brushing-extension';
12
+ export type { DataFilterExtensionProps } from './data-filter/data-filter-extension';
13
+ export type { PathStyleExtensionProps } from './path-style/path-style-extension';
14
+ export type { FillStyleExtensionProps } from './fill-style/fill-style-extension';
15
+ export type { ClipExtensionProps } from './clip/clip-extension';
16
+ export type { CollisionFilterExtensionProps } from './collision-filter/collision-filter-extension';
17
+ export type { MaskExtensionProps } from './mask/mask-extension';
18
+ export type { TerrainExtensionProps } from './terrain/terrain-extension';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,OAAO,IAAI,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAGtD,YAAY,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAC,uBAAuB,EAA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BAAkB,EAAC,MAAM,uBAAuB,CAAC;AAC9D,YAAY,EAAC,6BAA6B,EAAC,MAAM,+CAA+C,CAAC;AACjG,YAAY,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAC9D,YAAY,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAC"}
package/typed/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export { default as BrushingExtension } from './brushing/brushing-extension';
2
+ export { default as DataFilterExtension } from './data-filter/data-filter-extension';
3
+ export { default as Fp64Extension } from './fp64/fp64-extension';
4
+ export { default as PathStyleExtension } from './path-style/path-style-extension';
5
+ export { default as FillStyleExtension } from './fill-style/fill-style';
6
+ export { default as ClipExtension } from './clip/clip-extension';
7
+ export { default as MaskExtension } from './mask/mask';
8
+ // Shader module
9
+ export { default as project64 } from './fp64/project64';
@@ -0,0 +1,30 @@
1
+ import { Layer, LayerExtension } from '@deck.gl/core/typed';
2
+ export declare type MaskExtensionProps = {
3
+ /**
4
+ * Id of the layer that defines the mask. The mask layer must use the prop `operation: 'mask'`.
5
+ * Masking is disabled if `maskId` is empty or no valid mask layer with the specified id is found.
6
+ */
7
+ maskId?: string;
8
+ /**
9
+ * controls whether an object is clipped by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).
10
+ * If not specified, it is automatically deduced from the layer.
11
+ */
12
+ maskByInstance?: boolean;
13
+ /**
14
+ * Inverts the masking operation
15
+ */
16
+ maskInverted?: boolean;
17
+ };
18
+ /** Allows layers to show/hide objects by a geofence. */
19
+ export default class MaskExtension extends LayerExtension {
20
+ static defaultProps: {
21
+ maskId: string;
22
+ maskByInstance: undefined;
23
+ maskInverted: boolean;
24
+ };
25
+ static extensionName: string;
26
+ initializeState(this: Layer<MaskExtensionProps>): void;
27
+ getShaders(this: Layer<MaskExtensionProps>): any;
28
+ draw(this: Layer<Required<MaskExtensionProps>>, { uniforms, context, moduleParameters }: any): void;
29
+ }
30
+ //# sourceMappingURL=mask-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask-extension.d.ts","sourceRoot":"","sources":["../../src/mask/mask-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,cAAc,EAAM,MAAM,eAAe,CAAC;AAU5E,oBAAY,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wDAAwD;AACxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAC,YAAY;;;;MAAgB;IACnC,MAAM,CAAC,aAAa,SAAmB;IAEvC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC;IAI/C,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,GAAG;IAehD,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAC,EAAE,GAAG;CA4B3F"}
@@ -0,0 +1,48 @@
1
+ import { COORDINATE_SYSTEM, LayerExtension, log } from '@deck.gl/core';
2
+ import mask from './shader-module';
3
+ const defaultProps = {
4
+ maskId: ''
5
+ };
6
+ export default class MaskExtension extends LayerExtension {
7
+ getShaders() {
8
+ // Infer by geometry if 'maskByInstance' prop isn't explictly set
9
+ let maskByInstance = 'instancePositions' in this.getAttributeManager().attributes;
10
+ // Users can override by setting the `maskByInstance` prop
11
+ if ('maskByInstance' in this.props) {
12
+ maskByInstance = this.props.maskByInstance;
13
+ }
14
+ this.state.maskByInstance = maskByInstance;
15
+ return {
16
+ modules: [mask]
17
+ };
18
+ }
19
+ draw({ uniforms, context, moduleParameters }) {
20
+ uniforms.mask_maskByInstance = this.state.maskByInstance;
21
+ const { maskId } = this.props;
22
+ const { maskChannels } = moduleParameters;
23
+ const { viewport } = context;
24
+ if (maskChannels && maskChannels[maskId]) {
25
+ const { index, bounds, coordinateOrigin: fromCoordinateOrigin } = maskChannels[maskId];
26
+ let { coordinateSystem: fromCoordinateSystem } = maskChannels[maskId];
27
+ uniforms.mask_enabled = true;
28
+ uniforms.mask_channel = index;
29
+ if (fromCoordinateSystem === COORDINATE_SYSTEM.DEFAULT) {
30
+ fromCoordinateSystem = viewport.isGeospatial
31
+ ? COORDINATE_SYSTEM.LNGLAT
32
+ : COORDINATE_SYSTEM.CARTESIAN;
33
+ }
34
+ const opts = { modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem };
35
+ const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
36
+ const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);
37
+ uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
38
+ }
39
+ else {
40
+ if (maskId) {
41
+ log.warn(`Could not find a mask layer with id: ${maskId}`)();
42
+ }
43
+ uniforms.mask_enabled = false;
44
+ }
45
+ }
46
+ }
47
+ MaskExtension.extensionName = 'MaskExtension';
48
+ MaskExtension.defaultProps = defaultProps;
@@ -0,0 +1,73 @@
1
+ import { project } from '@deck.gl/core';
2
+ const vs = `
3
+ uniform vec4 mask_bounds;
4
+ uniform bool mask_maskByInstance;
5
+ vec2 mask_getCoords(vec4 position) {
6
+ return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
7
+ }
8
+ `;
9
+ const fs = `
10
+ uniform sampler2D mask_texture;
11
+ uniform int mask_channel;
12
+ uniform bool mask_enabled;
13
+ bool mask_isInBounds(vec2 texCoords) {
14
+ if (!mask_enabled) {
15
+ return true;
16
+ }
17
+ vec4 maskColor = texture2D(mask_texture, texCoords);
18
+ float maskValue = 1.0;
19
+ if (mask_channel == 0) {
20
+ maskValue = maskColor.r;
21
+ } else if (mask_channel == 1) {
22
+ maskValue = maskColor.g;
23
+ } else if (mask_channel == 2) {
24
+ maskValue = maskColor.b;
25
+ } else if (mask_channel == 3) {
26
+ maskValue = maskColor.a;
27
+ }
28
+ return maskValue < 0.5;
29
+ }
30
+ `;
31
+ const inject = {
32
+ 'vs:#decl': `
33
+ varying vec2 mask_texCoords;
34
+ `,
35
+ 'vs:#main-end': `
36
+ vec4 mask_common_position;
37
+ if (mask_maskByInstance) {
38
+ mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
39
+ } else {
40
+ mask_common_position = geometry.position;
41
+ }
42
+ mask_texCoords = mask_getCoords(mask_common_position);
43
+ `,
44
+ 'fs:#decl': `
45
+ varying vec2 mask_texCoords;
46
+ `,
47
+ 'fs:#main-start': `
48
+ if (mask_enabled) {
49
+ bool mask = mask_isInBounds(mask_texCoords);
50
+
51
+ // Debug: show extent of render target
52
+ // gl_FragColor = vec4(mask_texCoords, 0.0, 1.0);
53
+ gl_FragColor = texture2D(mask_texture, mask_texCoords);
54
+
55
+ if (!mask) discard;
56
+ }
57
+ `
58
+ };
59
+ const getMaskUniforms = (opts = {}) => {
60
+ const uniforms = {};
61
+ if (opts.maskMap) {
62
+ uniforms.mask_texture = opts.maskMap;
63
+ }
64
+ return uniforms;
65
+ };
66
+ export default {
67
+ name: 'mask',
68
+ dependencies: [project],
69
+ vs,
70
+ fs,
71
+ inject,
72
+ getUniforms: getMaskUniforms
73
+ };
@@ -0,0 +1,66 @@
1
+ import { LayerExtension } from '@deck.gl/core/typed';
2
+ import type { Layer, LayerContext, Accessor, UpdateParameters } from '@deck.gl/core/typed';
3
+ export declare type PathStyleExtensionProps<DataT = any> = {
4
+ /**
5
+ * Accessor for the dash array to draw each path with: `[dashSize, gapSize]` relative to the width of the path.
6
+ * Requires the `dash` option to be on.
7
+ */
8
+ getDashArray?: Accessor<DataT, [number, number]>;
9
+ /**
10
+ * Accessor for the offset to draw each path with, relative to the width of the path.
11
+ * Negative offset is to the left hand side, and positive offset is to the right hand side.
12
+ * @default 0
13
+ */
14
+ getOffset?: Accessor<DataT, number>;
15
+ /**
16
+ * If `true`, adjust gaps for the dashes to align at both ends.
17
+ * @default false
18
+ */
19
+ dashJustified?: boolean;
20
+ /**
21
+ * If `true`, gaps between solid strokes are pickable. If `false`, only the solid strokes are pickable.
22
+ * @default false
23
+ */
24
+ dashGapPickable?: boolean;
25
+ };
26
+ declare type PathStyleExtensionOptions = {
27
+ /**
28
+ * Add capability to render dashed lines.
29
+ * @default false
30
+ */
31
+ dash: boolean;
32
+ /**
33
+ * Add capability to offset lines.
34
+ * @default false
35
+ */
36
+ offset: boolean;
37
+ /**
38
+ * Improve dash rendering quality in certain circumstances. Note that this option introduces additional performance overhead.
39
+ * @default false
40
+ */
41
+ highPrecisionDash: boolean;
42
+ };
43
+ /** Adds selected features to the `PathLayer` and composite layers that render the `PathLayer`. */
44
+ export default class PathStyleExtension extends LayerExtension<PathStyleExtensionOptions> {
45
+ static defaultProps: {
46
+ getDashArray: {
47
+ type: string;
48
+ value: number[];
49
+ };
50
+ getOffset: {
51
+ type: string;
52
+ value: number;
53
+ };
54
+ dashJustified: boolean;
55
+ dashGapPickable: boolean;
56
+ };
57
+ static extensionName: string;
58
+ constructor({ dash, offset, highPrecisionDash }?: Partial<PathStyleExtensionOptions>);
59
+ isEnabled(layer: Layer<PathStyleExtensionProps>): boolean;
60
+ getShaders(this: Layer<PathStyleExtensionProps>, extension: this): any;
61
+ initializeState(this: Layer<PathStyleExtensionProps>, context: LayerContext, extension: this): void;
62
+ updateState(this: Layer<PathStyleExtensionProps>, params: UpdateParameters<Layer<PathStyleExtensionProps>>, extension: this): void;
63
+ getDashOffsets(this: Layer<PathStyleExtensionProps>, path: number[] | number[][]): number[];
64
+ }
65
+ export {};
66
+ //# sourceMappingURL=path-style-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-style-extension.d.ts","sourceRoot":"","sources":["../../src/path-style/path-style-extension.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,cAAc,EAAgC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AgB,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,EACxD,SAAS,EAAE,IAAI;IAgBjB,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE;CAoB5F"}
@@ -0,0 +1,107 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { LayerExtension, _mergeShaders as mergeShaders } from '@deck.gl/core';
21
+ import { dashShaders, offsetShaders } from './shaders.glsl';
22
+ import { dist } from 'gl-matrix/vec3';
23
+ const defaultProps = {
24
+ getDashArray: { type: 'accessor', value: [0, 0] },
25
+ getOffset: { type: 'accessor', value: 0 },
26
+ dashJustified: false,
27
+ dashGapPickable: false
28
+ };
29
+ export default class PathStyleExtension extends LayerExtension {
30
+ constructor({ dash = false, offset = false, highPrecisionDash = false } = {}) {
31
+ super({ dash: dash || highPrecisionDash, offset, highPrecisionDash });
32
+ }
33
+ isEnabled(layer) {
34
+ return layer.state.pathTesselator;
35
+ }
36
+ getShaders(extension) {
37
+ if (!extension.isEnabled(this)) {
38
+ return null;
39
+ }
40
+ // Merge shader injection
41
+ let result = {};
42
+ if (extension.opts.dash) {
43
+ result = mergeShaders(result, dashShaders);
44
+ }
45
+ if (extension.opts.offset) {
46
+ result = mergeShaders(result, offsetShaders);
47
+ }
48
+ return result;
49
+ }
50
+ initializeState(context, extension) {
51
+ const attributeManager = this.getAttributeManager();
52
+ if (!attributeManager || !extension.isEnabled(this)) {
53
+ // This extension only works with the PathLayer
54
+ return;
55
+ }
56
+ extension.enabled = true;
57
+ if (extension.opts.dash) {
58
+ attributeManager.addInstanced({
59
+ instanceDashArrays: { size: 2, accessor: 'getDashArray' }
60
+ });
61
+ }
62
+ if (extension.opts.highPrecisionDash) {
63
+ attributeManager.addInstanced({
64
+ instanceDashOffsets: {
65
+ size: 1,
66
+ accessor: 'getPath',
67
+ transform: extension.getDashOffsets.bind(this)
68
+ }
69
+ });
70
+ }
71
+ if (extension.opts.offset) {
72
+ attributeManager.addInstanced({
73
+ instanceOffsets: { size: 1, accessor: 'getOffset' }
74
+ });
75
+ }
76
+ }
77
+ updateState(params, extension) {
78
+ if (!extension.isEnabled(this)) {
79
+ return;
80
+ }
81
+ const uniforms = {};
82
+ if (extension.opts.dash) {
83
+ uniforms.dashAlignMode = this.props.dashJustified ? 1 : 0;
84
+ uniforms.dashGapPickable = Boolean(this.props.dashGapPickable);
85
+ }
86
+ this.state.model.setUniforms(uniforms);
87
+ }
88
+ getDashOffsets(path) {
89
+ const result = [0];
90
+ const positionSize = this.props.positionFormat === 'XY' ? 2 : 3;
91
+ const isNested = Array.isArray(path[0]);
92
+ const geometrySize = isNested ? path.length : path.length / positionSize;
93
+ let p;
94
+ let prevP;
95
+ for (let i = 0; i < geometrySize - 1; i++) {
96
+ p = isNested ? path[i] : path.slice(i * positionSize, i * positionSize + positionSize);
97
+ p = this.projectPosition(p);
98
+ if (i > 0) {
99
+ result[i] = result[i - 1] + dist(prevP, p);
100
+ }
101
+ prevP = p;
102
+ }
103
+ return result;
104
+ }
105
+ }
106
+ PathStyleExtension.extensionName = 'PathStyleExtension';
107
+ PathStyleExtension.defaultProps = defaultProps;