@deck.gl/extensions 9.0.0-beta.1 → 9.0.0-beta.3

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 (232) hide show
  1. package/dist/brushing/brushing-extension.js +80 -0
  2. package/dist/{esm/brushing → brushing}/shader-module.js +24 -30
  3. package/dist/clip/clip-extension.js +117 -0
  4. package/{typed → dist}/collision-filter/collision-filter-effect.d.ts.map +1 -1
  5. package/dist/collision-filter/collision-filter-effect.js +193 -0
  6. package/dist/collision-filter/collision-filter-extension.js +49 -0
  7. package/{typed → dist}/collision-filter/collision-filter-pass.d.ts.map +1 -1
  8. package/dist/collision-filter/collision-filter-pass.js +25 -0
  9. package/dist/{esm/collision-filter → collision-filter}/shader-module.js +17 -24
  10. package/dist/data-filter/aggregator.js +104 -0
  11. package/{typed → dist}/data-filter/data-filter-extension.d.ts.map +1 -1
  12. package/dist/data-filter/data-filter-extension.js +162 -0
  13. package/dist/data-filter/shader-module.js +159 -0
  14. package/dist/dist.dev.js +1519 -9832
  15. package/dist/fill-style/fill-style-extension.js +118 -0
  16. package/dist/{esm/fill-style → fill-style}/shaders.glsl.js +37 -43
  17. package/dist/fp64/fp64-extension.js +35 -0
  18. package/dist/{esm/fp64 → fp64}/project64.glsl.js +19 -1
  19. package/dist/fp64/project64.js +50 -0
  20. package/dist/index.cjs +2724 -0
  21. package/dist/index.cjs.map +7 -0
  22. package/dist/index.js +11 -0
  23. package/{typed → dist}/mask/mask-effect.d.ts.map +1 -1
  24. package/dist/mask/mask-effect.js +194 -0
  25. package/dist/mask/mask-extension.js +57 -0
  26. package/{typed → dist}/mask/mask-pass.d.ts.map +1 -1
  27. package/dist/mask/mask-pass.js +44 -0
  28. package/dist/{esm/mask → mask}/shader-module.js +18 -21
  29. package/dist/path-style/path-style-extension.js +111 -0
  30. package/dist/{esm/path-style → path-style}/shaders.glsl.js +20 -13
  31. package/dist/terrain/height-map-builder.js +104 -0
  32. package/dist/terrain/shader-module.js +139 -0
  33. package/dist/terrain/terrain-cover.js +187 -0
  34. package/{typed → dist}/terrain/terrain-effect.d.ts.map +1 -1
  35. package/dist/terrain/terrain-effect.js +184 -0
  36. package/dist/terrain/terrain-extension.js +44 -0
  37. package/{typed → dist}/terrain/terrain-pass.d.ts.map +1 -1
  38. package/dist/terrain/terrain-pass.js +61 -0
  39. package/{typed → dist}/terrain/terrain-picking-pass.d.ts.map +1 -1
  40. package/dist/terrain/terrain-picking-pass.js +66 -0
  41. package/dist/terrain/utils.js +21 -0
  42. package/{typed → dist}/utils/debug.d.ts.map +1 -1
  43. package/dist/utils/debug.js +50 -0
  44. package/dist/utils/projection-utils.js +153 -0
  45. package/dist.min.js +72 -201
  46. package/package.json +19 -12
  47. package/src/collision-filter/collision-filter-effect.ts +12 -8
  48. package/src/collision-filter/collision-filter-pass.ts +1 -3
  49. package/src/data-filter/data-filter-extension.ts +3 -5
  50. package/src/mask/mask-effect.ts +0 -1
  51. package/src/mask/mask-pass.ts +1 -3
  52. package/src/terrain/terrain-effect.ts +8 -2
  53. package/src/terrain/terrain-pass.ts +2 -5
  54. package/src/terrain/terrain-picking-pass.ts +1 -3
  55. package/src/utils/debug.ts +1 -2
  56. package/dist/es5/brushing/brushing-extension.js +0 -108
  57. package/dist/es5/brushing/brushing-extension.js.map +0 -1
  58. package/dist/es5/brushing/shader-module.js +0 -50
  59. package/dist/es5/brushing/shader-module.js.map +0 -1
  60. package/dist/es5/clip/clip-extension.js +0 -98
  61. package/dist/es5/clip/clip-extension.js.map +0 -1
  62. package/dist/es5/collision-filter/collision-filter-effect.js +0 -294
  63. package/dist/es5/collision-filter/collision-filter-effect.js.map +0 -1
  64. package/dist/es5/collision-filter/collision-filter-extension.js +0 -109
  65. package/dist/es5/collision-filter/collision-filter-extension.js.map +0 -1
  66. package/dist/es5/collision-filter/collision-filter-pass.js +0 -79
  67. package/dist/es5/collision-filter/collision-filter-pass.js.map +0 -1
  68. package/dist/es5/collision-filter/shader-module.js +0 -39
  69. package/dist/es5/collision-filter/shader-module.js.map +0 -1
  70. package/dist/es5/data-filter/aggregator.js +0 -79
  71. package/dist/es5/data-filter/aggregator.js.map +0 -1
  72. package/dist/es5/data-filter/data-filter-extension.js +0 -236
  73. package/dist/es5/data-filter/data-filter-extension.js.map +0 -1
  74. package/dist/es5/data-filter/shader-module.js +0 -122
  75. package/dist/es5/data-filter/shader-module.js.map +0 -1
  76. package/dist/es5/fill-style/fill-style-extension.js +0 -190
  77. package/dist/es5/fill-style/fill-style-extension.js.map +0 -1
  78. package/dist/es5/fill-style/shaders.glsl.js +0 -59
  79. package/dist/es5/fill-style/shaders.glsl.js.map +0 -1
  80. package/dist/es5/fp64/fp64-extension.js +0 -55
  81. package/dist/es5/fp64/fp64-extension.js.map +0 -1
  82. package/dist/es5/fp64/project64.glsl.js +0 -9
  83. package/dist/es5/fp64/project64.glsl.js.map +0 -1
  84. package/dist/es5/fp64/project64.js +0 -52
  85. package/dist/es5/fp64/project64.js.map +0 -1
  86. package/dist/es5/index.js +0 -88
  87. package/dist/es5/index.js.map +0 -1
  88. package/dist/es5/mask/mask-effect.js +0 -279
  89. package/dist/es5/mask/mask-effect.js.map +0 -1
  90. package/dist/es5/mask/mask-extension.js +0 -113
  91. package/dist/es5/mask/mask-extension.js.map +0 -1
  92. package/dist/es5/mask/mask-pass.js +0 -106
  93. package/dist/es5/mask/mask-pass.js.map +0 -1
  94. package/dist/es5/mask/shader-module.js +0 -38
  95. package/dist/es5/mask/shader-module.js.map +0 -1
  96. package/dist/es5/path-style/path-style-extension.js +0 -169
  97. package/dist/es5/path-style/path-style-extension.js.map +0 -1
  98. package/dist/es5/path-style/shaders.glsl.js +0 -25
  99. package/dist/es5/path-style/shaders.glsl.js.map +0 -1
  100. package/dist/es5/terrain/height-map-builder.js +0 -111
  101. package/dist/es5/terrain/height-map-builder.js.map +0 -1
  102. package/dist/es5/terrain/shader-module.js +0 -86
  103. package/dist/es5/terrain/shader-module.js.map +0 -1
  104. package/dist/es5/terrain/terrain-cover.js +0 -256
  105. package/dist/es5/terrain/terrain-cover.js.map +0 -1
  106. package/dist/es5/terrain/terrain-effect.js +0 -326
  107. package/dist/es5/terrain/terrain-effect.js.map +0 -1
  108. package/dist/es5/terrain/terrain-extension.js +0 -94
  109. package/dist/es5/terrain/terrain-extension.js.map +0 -1
  110. package/dist/es5/terrain/terrain-pass.js +0 -121
  111. package/dist/es5/terrain/terrain-pass.js.map +0 -1
  112. package/dist/es5/terrain/terrain-picking-pass.js +0 -124
  113. package/dist/es5/terrain/terrain-picking-pass.js.map +0 -1
  114. package/dist/es5/terrain/utils.js +0 -35
  115. package/dist/es5/terrain/utils.js.map +0 -1
  116. package/dist/es5/utils/debug.js +0 -71
  117. package/dist/es5/utils/debug.js.map +0 -1
  118. package/dist/es5/utils/projection-utils.js +0 -168
  119. package/dist/es5/utils/projection-utils.js.map +0 -1
  120. package/dist/esm/brushing/brushing-extension.js +0 -68
  121. package/dist/esm/brushing/brushing-extension.js.map +0 -1
  122. package/dist/esm/brushing/shader-module.js.map +0 -1
  123. package/dist/esm/clip/clip-extension.js +0 -86
  124. package/dist/esm/clip/clip-extension.js.map +0 -1
  125. package/dist/esm/collision-filter/collision-filter-effect.js +0 -246
  126. package/dist/esm/collision-filter/collision-filter-effect.js.map +0 -1
  127. package/dist/esm/collision-filter/collision-filter-extension.js +0 -75
  128. package/dist/esm/collision-filter/collision-filter-extension.js.map +0 -1
  129. package/dist/esm/collision-filter/collision-filter-pass.js +0 -32
  130. package/dist/esm/collision-filter/collision-filter-pass.js.map +0 -1
  131. package/dist/esm/collision-filter/shader-module.js.map +0 -1
  132. package/dist/esm/data-filter/aggregator.js +0 -102
  133. package/dist/esm/data-filter/aggregator.js.map +0 -1
  134. package/dist/esm/data-filter/data-filter-extension.js +0 -189
  135. package/dist/esm/data-filter/data-filter-extension.js.map +0 -1
  136. package/dist/esm/data-filter/shader-module.js +0 -164
  137. package/dist/esm/data-filter/shader-module.js.map +0 -1
  138. package/dist/esm/fill-style/fill-style-extension.js +0 -156
  139. package/dist/esm/fill-style/fill-style-extension.js.map +0 -1
  140. package/dist/esm/fill-style/shaders.glsl.js.map +0 -1
  141. package/dist/esm/fp64/fp64-extension.js +0 -20
  142. package/dist/esm/fp64/fp64-extension.js.map +0 -1
  143. package/dist/esm/fp64/project64.glsl.js.map +0 -1
  144. package/dist/esm/fp64/project64.js +0 -43
  145. package/dist/esm/fp64/project64.js.map +0 -1
  146. package/dist/esm/index.js +0 -11
  147. package/dist/esm/index.js.map +0 -1
  148. package/dist/esm/mask/mask-effect.js +0 -228
  149. package/dist/esm/mask/mask-effect.js.map +0 -1
  150. package/dist/esm/mask/mask-extension.js +0 -83
  151. package/dist/esm/mask/mask-extension.js.map +0 -1
  152. package/dist/esm/mask/mask-pass.js +0 -58
  153. package/dist/esm/mask/mask-pass.js.map +0 -1
  154. package/dist/esm/mask/shader-module.js.map +0 -1
  155. package/dist/esm/path-style/path-style-extension.js +0 -130
  156. package/dist/esm/path-style/path-style-extension.js.map +0 -1
  157. package/dist/esm/path-style/shaders.glsl.js.map +0 -1
  158. package/dist/esm/terrain/height-map-builder.js +0 -86
  159. package/dist/esm/terrain/height-map-builder.js.map +0 -1
  160. package/dist/esm/terrain/shader-module.js +0 -127
  161. package/dist/esm/terrain/shader-module.js.map +0 -1
  162. package/dist/esm/terrain/terrain-cover.js +0 -212
  163. package/dist/esm/terrain/terrain-cover.js.map +0 -1
  164. package/dist/esm/terrain/terrain-effect.js +0 -219
  165. package/dist/esm/terrain/terrain-effect.js.map +0 -1
  166. package/dist/esm/terrain/terrain-extension.js +0 -59
  167. package/dist/esm/terrain/terrain-extension.js.map +0 -1
  168. package/dist/esm/terrain/terrain-pass.js +0 -71
  169. package/dist/esm/terrain/terrain-pass.js.map +0 -1
  170. package/dist/esm/terrain/terrain-picking-pass.js +0 -73
  171. package/dist/esm/terrain/terrain-picking-pass.js.map +0 -1
  172. package/dist/esm/terrain/utils.js +0 -19
  173. package/dist/esm/terrain/utils.js.map +0 -1
  174. package/dist/esm/utils/debug.js +0 -61
  175. package/dist/esm/utils/debug.js.map +0 -1
  176. package/dist/esm/utils/projection-utils.js +0 -134
  177. package/dist/esm/utils/projection-utils.js.map +0 -1
  178. /package/{typed → dist}/brushing/brushing-extension.d.ts +0 -0
  179. /package/{typed → dist}/brushing/brushing-extension.d.ts.map +0 -0
  180. /package/{typed → dist}/brushing/shader-module.d.ts +0 -0
  181. /package/{typed → dist}/brushing/shader-module.d.ts.map +0 -0
  182. /package/{typed → dist}/clip/clip-extension.d.ts +0 -0
  183. /package/{typed → dist}/clip/clip-extension.d.ts.map +0 -0
  184. /package/{typed → dist}/collision-filter/collision-filter-effect.d.ts +0 -0
  185. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts +0 -0
  186. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts.map +0 -0
  187. /package/{typed → dist}/collision-filter/collision-filter-pass.d.ts +0 -0
  188. /package/{typed → dist}/collision-filter/shader-module.d.ts +0 -0
  189. /package/{typed → dist}/collision-filter/shader-module.d.ts.map +0 -0
  190. /package/{typed → dist}/data-filter/aggregator.d.ts +0 -0
  191. /package/{typed → dist}/data-filter/aggregator.d.ts.map +0 -0
  192. /package/{typed → dist}/data-filter/data-filter-extension.d.ts +0 -0
  193. /package/{typed → dist}/data-filter/shader-module.d.ts +0 -0
  194. /package/{typed → dist}/data-filter/shader-module.d.ts.map +0 -0
  195. /package/{typed → dist}/fill-style/fill-style-extension.d.ts +0 -0
  196. /package/{typed → dist}/fill-style/fill-style-extension.d.ts.map +0 -0
  197. /package/{typed → dist}/fill-style/shaders.glsl.d.ts +0 -0
  198. /package/{typed → dist}/fill-style/shaders.glsl.d.ts.map +0 -0
  199. /package/{typed → dist}/fp64/fp64-extension.d.ts +0 -0
  200. /package/{typed → dist}/fp64/fp64-extension.d.ts.map +0 -0
  201. /package/{typed → dist}/fp64/project64.d.ts +0 -0
  202. /package/{typed → dist}/fp64/project64.d.ts.map +0 -0
  203. /package/{typed → dist}/fp64/project64.glsl.d.ts +0 -0
  204. /package/{typed → dist}/fp64/project64.glsl.d.ts.map +0 -0
  205. /package/{typed → dist}/index.d.ts +0 -0
  206. /package/{typed → dist}/index.d.ts.map +0 -0
  207. /package/{typed → dist}/mask/mask-effect.d.ts +0 -0
  208. /package/{typed → dist}/mask/mask-extension.d.ts +0 -0
  209. /package/{typed → dist}/mask/mask-extension.d.ts.map +0 -0
  210. /package/{typed → dist}/mask/mask-pass.d.ts +0 -0
  211. /package/{typed → dist}/mask/shader-module.d.ts +0 -0
  212. /package/{typed → dist}/mask/shader-module.d.ts.map +0 -0
  213. /package/{typed → dist}/path-style/path-style-extension.d.ts +0 -0
  214. /package/{typed → dist}/path-style/path-style-extension.d.ts.map +0 -0
  215. /package/{typed → dist}/path-style/shaders.glsl.d.ts +0 -0
  216. /package/{typed → dist}/path-style/shaders.glsl.d.ts.map +0 -0
  217. /package/{typed → dist}/terrain/height-map-builder.d.ts +0 -0
  218. /package/{typed → dist}/terrain/height-map-builder.d.ts.map +0 -0
  219. /package/{typed → dist}/terrain/shader-module.d.ts +0 -0
  220. /package/{typed → dist}/terrain/shader-module.d.ts.map +0 -0
  221. /package/{typed → dist}/terrain/terrain-cover.d.ts +0 -0
  222. /package/{typed → dist}/terrain/terrain-cover.d.ts.map +0 -0
  223. /package/{typed → dist}/terrain/terrain-effect.d.ts +0 -0
  224. /package/{typed → dist}/terrain/terrain-extension.d.ts +0 -0
  225. /package/{typed → dist}/terrain/terrain-extension.d.ts.map +0 -0
  226. /package/{typed → dist}/terrain/terrain-pass.d.ts +0 -0
  227. /package/{typed → dist}/terrain/terrain-picking-pass.d.ts +0 -0
  228. /package/{typed → dist}/terrain/utils.d.ts +0 -0
  229. /package/{typed → dist}/terrain/utils.d.ts.map +0 -0
  230. /package/{typed → dist}/utils/debug.d.ts +0 -0
  231. /package/{typed → dist}/utils/projection-utils.d.ts +0 -0
  232. /package/{typed → dist}/utils/projection-utils.d.ts.map +0 -0
@@ -0,0 +1,118 @@
1
+ import { LayerExtension } from '@deck.gl/core';
2
+ import { patternShaders } from "./shaders.glsl.js";
3
+ const defaultProps = {
4
+ fillPatternEnabled: true,
5
+ fillPatternAtlas: {
6
+ type: 'image',
7
+ value: null,
8
+ async: true,
9
+ parameters: {
10
+ minFilter: 'linear'
11
+ }
12
+ },
13
+ fillPatternMapping: { type: 'object', value: {}, async: true },
14
+ fillPatternMask: true,
15
+ getFillPattern: { type: 'accessor', value: d => d.pattern },
16
+ getFillPatternScale: { type: 'accessor', value: 1 },
17
+ getFillPatternOffset: { type: 'accessor', value: [0, 0] }
18
+ };
19
+ /** Adds selected features to layers that render a "fill", such as the `PolygonLayer` and `ScatterplotLayer`. */
20
+ export default class FillStyleExtension extends LayerExtension {
21
+ static { this.defaultProps = defaultProps; }
22
+ static { this.extensionName = 'FillStyleExtension'; }
23
+ constructor({ pattern = false } = {}) {
24
+ super({ pattern });
25
+ }
26
+ isEnabled(layer) {
27
+ return layer.getAttributeManager() !== null && !('pathTesselator' in layer.state);
28
+ }
29
+ getShaders(extension) {
30
+ if (!extension.isEnabled(this)) {
31
+ return null;
32
+ }
33
+ return {
34
+ modules: [extension.opts.pattern && patternShaders].filter(Boolean)
35
+ };
36
+ }
37
+ initializeState(context, extension) {
38
+ if (!extension.isEnabled(this)) {
39
+ return;
40
+ }
41
+ const attributeManager = this.getAttributeManager();
42
+ if (extension.opts.pattern) {
43
+ attributeManager.add({
44
+ fillPatternFrames: {
45
+ size: 4,
46
+ accessor: 'getFillPattern',
47
+ transform: extension.getPatternFrame.bind(this),
48
+ shaderAttributes: {
49
+ fillPatternFrames: {
50
+ divisor: 0
51
+ },
52
+ instanceFillPatternFrames: {
53
+ divisor: 1
54
+ }
55
+ }
56
+ },
57
+ fillPatternScales: {
58
+ size: 1,
59
+ accessor: 'getFillPatternScale',
60
+ defaultValue: 1,
61
+ shaderAttributes: {
62
+ fillPatternScales: {
63
+ divisor: 0
64
+ },
65
+ instanceFillPatternScales: {
66
+ divisor: 1
67
+ }
68
+ }
69
+ },
70
+ fillPatternOffsets: {
71
+ size: 2,
72
+ accessor: 'getFillPatternOffset',
73
+ shaderAttributes: {
74
+ fillPatternOffsets: {
75
+ divisor: 0
76
+ },
77
+ instanceFillPatternOffsets: {
78
+ divisor: 1
79
+ }
80
+ }
81
+ }
82
+ });
83
+ }
84
+ this.setState({
85
+ emptyTexture: this.context.device.createTexture({
86
+ data: new Uint8Array(4),
87
+ width: 1,
88
+ height: 1
89
+ })
90
+ });
91
+ }
92
+ updateState({ props, oldProps }, extension) {
93
+ if (!extension.isEnabled(this)) {
94
+ return;
95
+ }
96
+ if (props.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) {
97
+ this.getAttributeManager().invalidate('getFillPattern');
98
+ }
99
+ }
100
+ draw(params, extension) {
101
+ if (!extension.isEnabled(this)) {
102
+ return;
103
+ }
104
+ const { fillPatternAtlas } = this.props;
105
+ this.setModuleParameters({
106
+ fillPatternTexture: fillPatternAtlas || this.state.emptyTexture
107
+ });
108
+ }
109
+ finalizeState() {
110
+ const emptyTexture = this.state.emptyTexture;
111
+ emptyTexture?.delete();
112
+ }
113
+ getPatternFrame(name) {
114
+ const { fillPatternMapping } = this.getCurrentLayer().props;
115
+ const def = fillPatternMapping && fillPatternMapping[name];
116
+ return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0];
117
+ }
118
+ }
@@ -1,4 +1,7 @@
1
1
  import { project, fp64LowPart } from '@deck.gl/core';
2
+ /*
3
+ * fill pattern shader module
4
+ */
2
5
  const patternVs = `
3
6
  #ifdef NON_INSTANCED_MODEL
4
7
  #define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
@@ -35,17 +38,17 @@ in vec2 fill_uv;
35
38
  const float FILL_UV_SCALE = 512.0 / 40000000.0;
36
39
  `;
37
40
  const inject = {
38
- 'vs:DECKGL_FILTER_GL_POSITION': `
41
+ 'vs:DECKGL_FILTER_GL_POSITION': `
39
42
  fill_uv = geometry.position.xy;
40
43
  `,
41
- 'vs:DECKGL_FILTER_COLOR': `
44
+ 'vs:DECKGL_FILTER_COLOR': `
42
45
  if (fill_patternEnabled) {
43
46
  fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
44
47
  fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
45
48
  fill_patternPlacement.zw = FILL_PATTERN_SCALE_ATTRIB * FILL_PATTERN_FRAME_ATTRIB.zw;
46
49
  }
47
50
  `,
48
- 'fs:DECKGL_FILTER_COLOR': `
51
+ 'fs:DECKGL_FILTER_COLOR': `
49
52
  if (fill_patternEnabled) {
50
53
  vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw;
51
54
  vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale;
@@ -61,48 +64,39 @@ const inject = {
61
64
  }
62
65
  `
63
66
  };
64
-
67
+ /* eslint-disable camelcase */
65
68
  function getPatternUniforms(opts, uniforms) {
66
- if (!opts) {
69
+ if (!opts) {
70
+ return {};
71
+ }
72
+ if ('fillPatternTexture' in opts) {
73
+ const { fillPatternTexture } = opts;
74
+ return {
75
+ fill_patternTexture: fillPatternTexture,
76
+ fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height]
77
+ };
78
+ }
79
+ if ('viewport' in opts) {
80
+ const { fillPatternMask = true, fillPatternEnabled = true } = opts;
81
+ const { project_uCommonOrigin: coordinateOriginCommon } = uniforms;
82
+ const coordinateOriginCommon64Low = [
83
+ fp64LowPart(coordinateOriginCommon[0]),
84
+ fp64LowPart(coordinateOriginCommon[1])
85
+ ];
86
+ return {
87
+ fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2),
88
+ fill_uvCoordinateOrigin64Low: coordinateOriginCommon64Low,
89
+ fill_patternMask: fillPatternMask,
90
+ fill_patternEnabled: fillPatternEnabled
91
+ };
92
+ }
67
93
  return {};
68
- }
69
-
70
- if ('fillPatternTexture' in opts) {
71
- const {
72
- fillPatternTexture
73
- } = opts;
74
- return {
75
- fill_patternTexture: fillPatternTexture,
76
- fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height]
77
- };
78
- }
79
-
80
- if ('viewport' in opts) {
81
- const {
82
- fillPatternMask = true,
83
- fillPatternEnabled = true
84
- } = opts;
85
- const {
86
- project_uCommonOrigin: coordinateOriginCommon
87
- } = uniforms;
88
- const coordinateOriginCommon64Low = [fp64LowPart(coordinateOriginCommon[0]), fp64LowPart(coordinateOriginCommon[1])];
89
- return {
90
- fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2),
91
- fill_uvCoordinateOrigin64Low: coordinateOriginCommon64Low,
92
- fill_patternMask: fillPatternMask,
93
- fill_patternEnabled: fillPatternEnabled
94
- };
95
- }
96
-
97
- return {};
98
94
  }
99
-
100
95
  export const patternShaders = {
101
- name: 'fill-pattern',
102
- vs: patternVs,
103
- fs: patternFs,
104
- inject,
105
- dependencies: [project],
106
- getUniforms: getPatternUniforms
96
+ name: 'fill-pattern',
97
+ vs: patternVs,
98
+ fs: patternFs,
99
+ inject,
100
+ dependencies: [project],
101
+ getUniforms: getPatternUniforms
107
102
  };
108
- //# sourceMappingURL=shaders.glsl.js.map
@@ -0,0 +1,35 @@
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.js";
22
+ /** @deprecated Adds the legacy 64-bit precision to geospatial layers. */
23
+ export default class Fp64Extension extends LayerExtension {
24
+ static { this.extensionName = 'Fp64Extension'; }
25
+ getShaders() {
26
+ const { coordinateSystem } = this.props;
27
+ if (coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&
28
+ coordinateSystem !== COORDINATE_SYSTEM.DEFAULT) {
29
+ throw new Error('fp64: coordinateSystem must be LNGLAT');
30
+ }
31
+ return {
32
+ modules: [project64]
33
+ };
34
+ }
35
+ }
@@ -1,3 +1,22 @@
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.
1
20
  export default `\
2
21
 
3
22
  const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
@@ -79,4 +98,3 @@ vec4 project_position_to_clipspace(
79
98
  );
80
99
  }
81
100
  `;
82
- //# sourceMappingURL=project64.glsl.js.map
@@ -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
+ /* eslint-disable camelcase */
21
+ import { fp64 } from '@luma.gl/shadertools';
22
+ const { fp64ify, fp64ifyMatrix4 } = fp64;
23
+ import { project, _memoize as memoize } from '@deck.gl/core';
24
+ import project64Shader from "./project64.glsl.js";
25
+ export default {
26
+ name: 'project64',
27
+ dependencies: [project, fp64],
28
+ vs: project64Shader,
29
+ getUniforms
30
+ };
31
+ // TODO - this module should calculate the 64 bit uniforms
32
+ // It is currently done by project to minimize duplicated work
33
+ const getMemoizedUniforms = memoize(calculateUniforms);
34
+ function getUniforms(opts) {
35
+ if (opts && 'viewport' in opts) {
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
+ }