@deck.gl/aggregation-layers 9.0.40 → 9.1.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 (372) hide show
  1. package/dist/common/aggregation-layer.d.ts +30 -0
  2. package/dist/common/aggregation-layer.d.ts.map +1 -0
  3. package/dist/common/aggregation-layer.js +70 -0
  4. package/dist/common/aggregation-layer.js.map +1 -0
  5. package/dist/common/aggregator/aggregator.d.ts +76 -0
  6. package/dist/common/aggregator/aggregator.d.ts.map +1 -0
  7. package/dist/common/aggregator/aggregator.js +5 -0
  8. package/dist/common/aggregator/aggregator.js.map +1 -0
  9. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
  10. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
  11. package/dist/common/aggregator/cpu-aggregator/aggregate.js +67 -0
  12. package/dist/common/aggregator/cpu-aggregator/aggregate.js.map +1 -0
  13. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
  14. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
  15. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +140 -0
  16. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -0
  17. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
  18. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
  19. package/dist/common/aggregator/cpu-aggregator/sort-bins.js +44 -0
  20. package/dist/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -0
  21. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
  22. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
  23. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +56 -0
  24. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -0
  25. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
  26. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
  27. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +21 -0
  28. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -0
  29. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
  30. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
  31. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +18 -0
  32. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -0
  33. package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
  34. package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
  35. package/dist/common/aggregator/gpu-aggregator/utils.js +25 -0
  36. package/dist/common/aggregator/gpu-aggregator/utils.js.map +1 -0
  37. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
  38. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
  39. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +216 -0
  40. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -0
  41. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
  42. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
  43. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +202 -0
  44. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -0
  45. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
  46. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
  47. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +224 -0
  48. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -0
  49. package/dist/common/aggregator/index.d.ts +6 -0
  50. package/dist/common/aggregator/index.d.ts.map +1 -0
  51. package/dist/common/aggregator/index.js +6 -0
  52. package/dist/common/aggregator/index.js.map +1 -0
  53. package/dist/common/types.d.ts +11 -0
  54. package/dist/common/types.d.ts.map +1 -0
  55. package/dist/common/types.js +5 -0
  56. package/dist/common/types.js.map +1 -0
  57. package/dist/common/utils/bounds-utils.d.ts +10 -0
  58. package/dist/common/utils/bounds-utils.d.ts.map +1 -0
  59. package/dist/common/utils/bounds-utils.js +21 -0
  60. package/dist/common/utils/bounds-utils.js.map +1 -0
  61. package/dist/common/utils/color-utils.d.ts +10 -0
  62. package/dist/common/utils/color-utils.d.ts.map +1 -0
  63. package/dist/common/utils/color-utils.js +66 -0
  64. package/dist/common/utils/color-utils.js.map +1 -0
  65. package/dist/common/utils/prop-utils.d.ts.map +1 -0
  66. package/dist/common/utils/prop-utils.js +13 -0
  67. package/dist/common/utils/prop-utils.js.map +1 -0
  68. package/dist/common/utils/scale-utils.d.ts +46 -0
  69. package/dist/common/utils/scale-utils.d.ts.map +1 -0
  70. package/dist/common/utils/scale-utils.js +181 -0
  71. package/dist/common/utils/scale-utils.js.map +1 -0
  72. package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
  73. package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
  74. package/dist/contour-layer/bin-options-uniforms.js +18 -0
  75. package/dist/contour-layer/bin-options-uniforms.js.map +1 -0
  76. package/dist/contour-layer/contour-layer.d.ts +42 -50
  77. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  78. package/dist/contour-layer/contour-layer.js +233 -192
  79. package/dist/contour-layer/contour-layer.js.map +1 -0
  80. package/dist/contour-layer/contour-utils.d.ts +36 -15
  81. package/dist/contour-layer/contour-utils.d.ts.map +1 -1
  82. package/dist/contour-layer/contour-utils.js +25 -29
  83. package/dist/contour-layer/contour-utils.js.map +1 -0
  84. package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
  85. package/dist/contour-layer/marching-squares-codes.js +4 -0
  86. package/dist/contour-layer/marching-squares-codes.js.map +1 -0
  87. package/dist/contour-layer/marching-squares.d.ts +22 -6
  88. package/dist/contour-layer/marching-squares.d.ts.map +1 -1
  89. package/dist/contour-layer/marching-squares.js +72 -68
  90. package/dist/contour-layer/marching-squares.js.map +1 -0
  91. package/dist/contour-layer/value-reader.d.ts +10 -0
  92. package/dist/contour-layer/value-reader.d.ts.map +1 -0
  93. package/dist/contour-layer/value-reader.js +47 -0
  94. package/dist/contour-layer/value-reader.js.map +1 -0
  95. package/dist/dist.dev.js +4844 -4083
  96. package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
  97. package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
  98. package/dist/grid-layer/bin-options-uniforms.js +18 -0
  99. package/dist/grid-layer/bin-options-uniforms.js.map +1 -0
  100. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
  101. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  102. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +52 -0
  103. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -0
  104. package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
  105. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
  106. package/dist/grid-layer/grid-cell-layer.js +94 -0
  107. package/dist/grid-layer/grid-cell-layer.js.map +1 -0
  108. package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
  109. package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
  110. package/dist/grid-layer/grid-layer-uniforms.js +24 -0
  111. package/dist/grid-layer/grid-layer-uniforms.js.map +1 -0
  112. package/dist/grid-layer/grid-layer.d.ts +176 -14
  113. package/dist/grid-layer/grid-layer.d.ts.map +1 -1
  114. package/dist/grid-layer/grid-layer.js +343 -46
  115. package/dist/grid-layer/grid-layer.js.map +1 -0
  116. package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
  117. package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
  118. package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +7 -21
  119. package/dist/heatmap-layer/aggregation-layer.js.map +1 -0
  120. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
  121. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
  122. package/dist/heatmap-layer/heatmap-layer-uniforms.js +33 -0
  123. package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -0
  124. package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
  125. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  126. package/dist/heatmap-layer/heatmap-layer-utils.js +4 -0
  127. package/dist/heatmap-layer/heatmap-layer-utils.js.map +1 -0
  128. package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
  129. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  130. package/dist/heatmap-layer/heatmap-layer.js +44 -33
  131. package/dist/heatmap-layer/heatmap-layer.js.map +1 -0
  132. package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
  133. package/dist/heatmap-layer/max-fs.glsl.js +4 -0
  134. package/dist/heatmap-layer/max-fs.glsl.js.map +1 -0
  135. package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
  136. package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  137. package/dist/heatmap-layer/max-vs.glsl.js +7 -4
  138. package/dist/heatmap-layer/max-vs.glsl.js.map +1 -0
  139. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  140. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
  141. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +6 -23
  142. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
  143. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
  144. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
  145. package/dist/heatmap-layer/triangle-layer-uniforms.js +23 -0
  146. package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -0
  147. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
  148. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
  149. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -30
  150. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
  151. package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
  152. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  153. package/dist/heatmap-layer/triangle-layer.js +18 -30
  154. package/dist/heatmap-layer/triangle-layer.js.map +1 -0
  155. package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
  156. package/dist/heatmap-layer/weights-fs.glsl.js +4 -0
  157. package/dist/heatmap-layer/weights-fs.glsl.js.map +1 -0
  158. package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  159. package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  160. package/dist/heatmap-layer/weights-vs.glsl.js +7 -7
  161. package/dist/heatmap-layer/weights-vs.glsl.js.map +1 -0
  162. package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
  163. package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
  164. package/dist/hexagon-layer/bin-options-uniforms.js +18 -0
  165. package/dist/hexagon-layer/bin-options-uniforms.js.map +1 -0
  166. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
  167. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
  168. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +56 -0
  169. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -0
  170. package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
  171. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
  172. package/dist/hexagon-layer/hexagon-cell-layer.js +95 -0
  173. package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -0
  174. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
  175. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
  176. package/dist/hexagon-layer/hexagon-layer-uniforms.js +22 -0
  177. package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -0
  178. package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
  179. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  180. package/dist/hexagon-layer/hexagon-layer.js +308 -123
  181. package/dist/hexagon-layer/hexagon-layer.js.map +1 -0
  182. package/dist/hexagon-layer/hexbin.d.ts +17 -0
  183. package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
  184. package/dist/hexagon-layer/hexbin.js +70 -0
  185. package/dist/hexagon-layer/hexbin.js.map +1 -0
  186. package/dist/index.cjs +3026 -2947
  187. package/dist/index.cjs.map +4 -4
  188. package/dist/index.d.ts +7 -13
  189. package/dist/index.d.ts.map +1 -1
  190. package/dist/index.js +6 -27
  191. package/dist/index.js.map +1 -0
  192. package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
  193. package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
  194. package/dist/screen-grid-layer/bin-options-uniforms.js +16 -0
  195. package/dist/screen-grid-layer/bin-options-uniforms.js.map +1 -0
  196. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
  197. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  198. package/dist/screen-grid-layer/screen-grid-cell-layer.js +53 -134
  199. package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
  200. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
  201. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
  202. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -24
  203. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
  204. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
  205. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
  206. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +20 -0
  207. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -0
  208. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
  209. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
  210. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +22 -62
  211. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
  212. package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
  213. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  214. package/dist/screen-grid-layer/screen-grid-layer.js +158 -174
  215. package/dist/screen-grid-layer/screen-grid-layer.js.map +1 -0
  216. package/dist.min.js +401 -382
  217. package/package.json +10 -9
  218. package/src/common/aggregation-layer.ts +107 -0
  219. package/src/common/aggregator/aggregator.ts +88 -0
  220. package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
  221. package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
  222. package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
  223. package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
  224. package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
  225. package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
  226. package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
  227. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
  228. package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
  229. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
  230. package/src/common/aggregator/index.ts +10 -0
  231. package/src/{types.ts → common/types.ts} +10 -4
  232. package/src/common/utils/bounds-utils.ts +34 -0
  233. package/src/common/utils/color-utils.ts +86 -0
  234. package/src/common/utils/prop-utils.ts +13 -0
  235. package/src/common/utils/scale-utils.ts +236 -0
  236. package/src/contour-layer/bin-options-uniforms.ts +26 -0
  237. package/src/contour-layer/contour-layer.ts +300 -265
  238. package/src/contour-layer/contour-utils.ts +68 -39
  239. package/src/contour-layer/marching-squares-codes.ts +4 -0
  240. package/src/contour-layer/marching-squares.ts +93 -82
  241. package/src/contour-layer/value-reader.ts +65 -0
  242. package/src/grid-layer/bin-options-uniforms.ts +26 -0
  243. package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
  244. package/src/grid-layer/grid-cell-layer.ts +141 -0
  245. package/src/grid-layer/grid-layer-uniforms.ts +37 -0
  246. package/src/grid-layer/grid-layer.ts +614 -73
  247. package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
  248. package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
  249. package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
  250. package/src/heatmap-layer/heatmap-layer.ts +59 -36
  251. package/src/heatmap-layer/max-fs.glsl.ts +4 -0
  252. package/src/heatmap-layer/max-vs.glsl.ts +7 -4
  253. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
  254. package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
  255. package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
  256. package/src/heatmap-layer/triangle-layer.ts +26 -31
  257. package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
  258. package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
  259. package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
  260. package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
  261. package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
  262. package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
  263. package/src/hexagon-layer/hexagon-layer.ts +454 -186
  264. package/src/hexagon-layer/hexbin.ts +79 -0
  265. package/src/index.ts +21 -34
  266. package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
  267. package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
  268. package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
  269. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
  270. package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
  271. package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
  272. package/dist/aggregation-layer.d.ts.map +0 -1
  273. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
  274. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  275. package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
  276. package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
  277. package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
  278. package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
  279. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
  280. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
  281. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
  282. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
  283. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
  284. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
  285. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
  286. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  287. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
  288. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
  289. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  290. package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
  291. package/dist/grid-aggregation-layer.d.ts +0 -67
  292. package/dist/grid-aggregation-layer.d.ts.map +0 -1
  293. package/dist/grid-aggregation-layer.js +0 -173
  294. package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
  295. package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
  296. package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
  297. package/dist/types.d.ts +0 -12
  298. package/dist/types.d.ts.map +0 -1
  299. package/dist/types.js +0 -1
  300. package/dist/utils/aggregation-operation-utils.d.ts +0 -19
  301. package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
  302. package/dist/utils/aggregation-operation-utils.js +0 -94
  303. package/dist/utils/bin-sorter.d.ts +0 -52
  304. package/dist/utils/bin-sorter.d.ts.map +0 -1
  305. package/dist/utils/bin-sorter.js +0 -167
  306. package/dist/utils/color-utils.d.ts +0 -3
  307. package/dist/utils/color-utils.d.ts.map +0 -1
  308. package/dist/utils/color-utils.js +0 -53
  309. package/dist/utils/cpu-aggregator.d.ts +0 -169
  310. package/dist/utils/cpu-aggregator.d.ts.map +0 -1
  311. package/dist/utils/cpu-aggregator.js +0 -421
  312. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
  313. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
  314. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
  315. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
  316. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
  317. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
  318. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
  319. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
  320. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
  321. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
  322. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
  323. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
  324. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
  325. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
  326. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
  327. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
  328. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
  329. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
  330. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
  331. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
  332. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
  333. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
  334. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
  335. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
  336. package/dist/utils/grid-aggregation-utils.d.ts +0 -30
  337. package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
  338. package/dist/utils/grid-aggregation-utils.js +0 -114
  339. package/dist/utils/prop-utils.d.ts.map +0 -1
  340. package/dist/utils/prop-utils.js +0 -28
  341. package/dist/utils/resource-utils.d.ts +0 -14
  342. package/dist/utils/resource-utils.d.ts.map +0 -1
  343. package/dist/utils/resource-utils.js +0 -38
  344. package/dist/utils/scale-utils.d.ts +0 -15
  345. package/dist/utils/scale-utils.d.ts.map +0 -1
  346. package/dist/utils/scale-utils.js +0 -184
  347. package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
  348. package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
  349. package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
  350. package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
  351. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
  352. package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
  353. package/src/grid-aggregation-layer.ts +0 -243
  354. package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
  355. package/src/utils/aggregation-operation-utils.ts +0 -118
  356. package/src/utils/bin-sorter.ts +0 -218
  357. package/src/utils/color-utils.ts +0 -57
  358. package/src/utils/cpu-aggregator.ts +0 -503
  359. package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
  360. package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
  361. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
  362. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
  363. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
  364. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
  365. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  366. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
  367. package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
  368. package/src/utils/grid-aggregation-utils.ts +0 -147
  369. package/src/utils/prop-utils.ts +0 -29
  370. package/src/utils/resource-utils.ts +0 -53
  371. package/src/utils/scale-utils.js +0 -219
  372. /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
@@ -1,56 +1,87 @@
1
- import {getCode, getVertices, CONTOUR_TYPE} from './marching-squares';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Color} from '@deck.gl/core';
6
+ import {getCode, getLines, getPolygons} from './marching-squares';
7
+
8
+ export type Contour = {
9
+ /**
10
+ * Isolines: `threshold` value must be a single `Number`, Isolines are generated based on this threshold value.
11
+ *
12
+ * Isobands: `threshold` value must be an Array of two `Number`s. Isobands are generated using `[threshold[0], threshold[1])` as threshold range, i.e area that has values `>= threshold[0]` and `< threshold[1]` are rendered with corresponding color. NOTE: `threshold[0]` is inclusive and `threshold[1]` is not inclusive.
13
+ */
14
+ threshold: number | number[];
15
+
16
+ /**
17
+ * RGBA color array to be used to render the contour.
18
+ * @default [255, 255, 255, 255]
19
+ */
20
+ color?: Color;
21
+
22
+ /**
23
+ * Applicable for `Isoline`s only, width of the Isoline in pixels.
24
+ * @default 1
25
+ */
26
+ strokeWidth?: number;
27
+
28
+ /** Defines z order of the contour. */
29
+ zIndex?: number;
30
+ };
31
+
32
+ export type ContourLine = {
33
+ vertices: number[][];
34
+ contour: Contour;
35
+ };
36
+
37
+ export type ContourPolygon = {
38
+ vertices: number[][];
39
+ contour: Contour;
40
+ };
2
41
 
3
42
  // Given all the cell weights, generates contours for each threshold.
4
43
  /* eslint-disable max-depth */
5
44
  export function generateContours({
6
- thresholdData,
7
- cellWeights,
8
- gridSize,
9
- gridOrigin,
10
- cellSize
45
+ contours,
46
+ getValue,
47
+ xRange,
48
+ yRange
11
49
  }: {
12
- thresholdData: any;
13
- cellWeights: Float32Array;
14
- gridSize: number[];
15
- gridOrigin: number[];
16
- cellSize: number[];
50
+ contours: Contour[];
51
+ getValue: (x: number, y: number) => number;
52
+ xRange: [number, number];
53
+ yRange: [number, number];
17
54
  }) {
18
- const contourSegments: {start: number[]; end: number[]; contour: any}[] = [];
19
- const contourPolygons: {vertices: number[][]; contour: any}[] = [];
20
- const width = gridSize[0];
21
- const height = gridSize[1];
55
+ const contourLines: ContourLine[] = [];
56
+ const contourPolygons: ContourPolygon[] = [];
22
57
  let segmentIndex = 0;
23
58
  let polygonIndex = 0;
24
59
 
25
- for (const data of thresholdData) {
26
- const {contour} = data;
60
+ for (let i = 0; i < contours.length; i++) {
61
+ const contour = contours[i];
62
+ const z = contour.zIndex ?? i;
27
63
  const {threshold} = contour;
28
- for (let x = -1; x < width; x++) {
29
- for (let y = -1; y < height; y++) {
64
+ for (let x = xRange[0] - 1; x < xRange[1]; x++) {
65
+ for (let y = yRange[0] - 1; y < yRange[1]; y++) {
30
66
  // Get the MarchingSquares code based on neighbor cell weights.
31
67
  const {code, meanCode} = getCode({
32
- cellWeights,
68
+ getValue,
33
69
  threshold,
34
70
  x,
35
71
  y,
36
- width,
37
- height
72
+ xRange,
73
+ yRange
38
74
  });
39
75
  const opts = {
40
- type: CONTOUR_TYPE.ISO_BANDS,
41
- gridOrigin,
42
- cellSize,
43
76
  x,
44
77
  y,
45
- width,
46
- height,
78
+ z,
47
79
  code,
48
- meanCode,
49
- thresholdData: data
80
+ meanCode
50
81
  };
51
82
  if (Array.isArray(threshold)) {
52
- opts.type = CONTOUR_TYPE.ISO_BANDS;
53
- const polygons = getVertices(opts) as number[][][];
83
+ // ISO bands
84
+ const polygons = getPolygons(opts);
54
85
  for (const polygon of polygons) {
55
86
  contourPolygons[polygonIndex++] = {
56
87
  vertices: polygon,
@@ -58,13 +89,11 @@ export function generateContours({
58
89
  };
59
90
  }
60
91
  } else {
61
- // Get the intersection vertices based on MarchingSquares code.
62
- opts.type = CONTOUR_TYPE.ISO_LINES;
63
- const vertices = getVertices(opts) as number[][];
64
- for (let i = 0; i < vertices.length; i += 2) {
65
- contourSegments[segmentIndex++] = {
66
- start: vertices[i],
67
- end: vertices[i + 1],
92
+ // ISO lines
93
+ const path = getLines(opts);
94
+ if (path.length > 0) {
95
+ contourLines[segmentIndex++] = {
96
+ vertices: path,
68
97
  contour
69
98
  };
70
99
  }
@@ -72,6 +101,6 @@ export function generateContours({
72
101
  }
73
102
  }
74
103
  }
75
- return {contourSegments, contourPolygons};
104
+ return {lines: contourLines, polygons: contourPolygons};
76
105
  }
77
106
  /* eslint-enable max-depth */
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // Code to Offsets Map needed to implement Marching Squares algorithm
2
6
  // Ref: https://en.wikipedia.org/wiki/Marching_squares
3
7
 
@@ -1,24 +1,19 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // All utility methods needed to implement Marching Squares algorithm
2
6
  // Ref: https://en.wikipedia.org/wiki/Marching_squares
3
7
 
4
- import {log} from '@deck.gl/core';
5
8
  import {ISOLINES_CODE_OFFSET_MAP, ISOBANDS_CODE_OFFSET_MAP} from './marching-squares-codes';
6
9
 
7
- export const CONTOUR_TYPE = {
8
- ISO_LINES: 1,
9
- ISO_BANDS: 2
10
- };
11
-
12
- const DEFAULT_THRESHOLD_DATA = {
13
- zIndex: 0,
14
- zOffset: 0.005
15
- };
16
-
17
10
  // Utility methods
18
11
 
19
12
  function getVertexCode(weight: number, threshold: number | number[]): number {
20
13
  // threshold must be a single value or a range (array of size 2)
21
-
14
+ if (Number.isNaN(weight)) {
15
+ return 0;
16
+ }
22
17
  // Iso-bands
23
18
  if (Array.isArray(threshold)) {
24
19
  if (weight < threshold[0]) {
@@ -32,60 +27,71 @@ function getVertexCode(weight: number, threshold: number | number[]): number {
32
27
 
33
28
  // Returns marching square code for given cell
34
29
  /* eslint-disable complexity, max-statements*/
35
- export function getCode(opts) {
30
+ export function getCode(opts: {
31
+ getValue: (x: number, y: number) => number;
32
+ threshold: number | number[];
33
+ x: number;
34
+ xRange: [number, number];
35
+ y: number;
36
+ yRange: [number, number];
37
+ }): {
38
+ code: number;
39
+ meanCode: number;
40
+ } {
36
41
  // Assumptions
37
42
  // Origin is on bottom-left , and X increase to right, Y to top
38
43
  // When processing one cell, we process 4 cells, by extending row to top and on column to right
39
44
  // to create a 2X2 cell grid
40
- const {cellWeights, x, y, width, height} = opts;
41
- let threshold = opts.threshold;
42
- if (opts.thresholdValue) {
43
- log.deprecated('thresholdValue', 'threshold')();
44
- threshold = opts.thresholdValue;
45
- }
45
+ const {x, y, xRange, yRange, getValue, threshold} = opts;
46
46
 
47
- const isLeftBoundary = x < 0;
48
- const isRightBoundary = x >= width - 1;
49
- const isBottomBoundary = y < 0;
50
- const isTopBoundary = y >= height - 1;
47
+ const isLeftBoundary = x < xRange[0];
48
+ const isRightBoundary = x >= xRange[1] - 1;
49
+ const isBottomBoundary = y < yRange[0];
50
+ const isTopBoundary = y >= yRange[1] - 1;
51
51
  const isBoundary = isLeftBoundary || isRightBoundary || isBottomBoundary || isTopBoundary;
52
52
 
53
- const weights: Record<string, number> = {};
54
- const codes: Record<string, number> = {};
53
+ let weights: number = 0;
54
+ let current: number;
55
+ let right: number;
56
+ let top: number;
57
+ let topRight: number;
55
58
 
56
59
  // TOP
57
60
  if (isLeftBoundary || isTopBoundary) {
58
- codes.top = 0;
61
+ top = 0;
59
62
  } else {
60
- weights.top = cellWeights[(y + 1) * width + x];
61
- codes.top = getVertexCode(weights.top, threshold);
63
+ const w = getValue(x, y + 1);
64
+ top = getVertexCode(w, threshold);
65
+ weights += w;
62
66
  }
63
67
 
64
68
  // TOP-RIGHT
65
69
  if (isRightBoundary || isTopBoundary) {
66
- codes.topRight = 0;
70
+ topRight = 0;
67
71
  } else {
68
- weights.topRight = cellWeights[(y + 1) * width + x + 1];
69
- codes.topRight = getVertexCode(weights.topRight, threshold);
72
+ const w = getValue(x + 1, y + 1);
73
+ topRight = getVertexCode(w, threshold);
74
+ weights += w;
70
75
  }
71
76
 
72
77
  // RIGHT
73
78
  if (isRightBoundary || isBottomBoundary) {
74
- codes.right = 0;
79
+ right = 0;
75
80
  } else {
76
- weights.right = cellWeights[y * width + x + 1];
77
- codes.right = getVertexCode(weights.right, threshold);
81
+ const w = getValue(x + 1, y);
82
+ right = getVertexCode(w, threshold);
83
+ weights += w;
78
84
  }
79
85
 
80
86
  // CURRENT
81
87
  if (isLeftBoundary || isBottomBoundary) {
82
- codes.current = 0;
88
+ current = 0;
83
89
  } else {
84
- weights.current = cellWeights[y * width + x];
85
- codes.current = getVertexCode(weights.current, threshold);
90
+ const w = getValue(x, y);
91
+ current = getVertexCode(w, threshold);
92
+ weights += w;
86
93
  }
87
94
 
88
- const {top, topRight, right, current} = codes;
89
95
  let code = -1;
90
96
  if (Number.isFinite(threshold)) {
91
97
  code = (top << 3) | (topRight << 2) | (right << 1) | current;
@@ -99,10 +105,7 @@ export function getCode(opts) {
99
105
  // only occur when we are not processing a cell on boundary
100
106
  // because when on a boundary either, bottom-row, top-row, left-column or right-column will have both 0 codes
101
107
  if (!isBoundary) {
102
- meanCode = getVertexCode(
103
- (weights.top + weights.topRight + weights.right + weights.current) / 4,
104
- threshold
105
- );
108
+ meanCode = getVertexCode(weights / 4, threshold);
106
109
  }
107
110
  return {code, meanCode};
108
111
  }
@@ -110,13 +113,15 @@ export function getCode(opts) {
110
113
 
111
114
  // Returns intersection vertices for given cellindex
112
115
  // [x, y] refers current marching cell, reference vertex is always top-right corner
113
- export function getVertices(opts) {
114
- const {gridOrigin, cellSize, x, y, code, meanCode, type = CONTOUR_TYPE.ISO_LINES} = opts;
115
- const thresholdData = {...DEFAULT_THRESHOLD_DATA, ...opts.thresholdData};
116
- let offsets =
117
- type === CONTOUR_TYPE.ISO_BANDS
118
- ? ISOBANDS_CODE_OFFSET_MAP[code]
119
- : ISOLINES_CODE_OFFSET_MAP[code];
116
+ export function getPolygons(opts: {
117
+ x: number;
118
+ y: number;
119
+ z: number;
120
+ code: number;
121
+ meanCode: number;
122
+ }) {
123
+ const {x, y, z, code, meanCode} = opts;
124
+ let offsets: any = ISOBANDS_CODE_OFFSET_MAP[code];
120
125
 
121
126
  // handle saddle cases
122
127
  if (!Array.isArray(offsets)) {
@@ -124,49 +129,55 @@ export function getVertices(opts) {
124
129
  }
125
130
 
126
131
  // Reference vertex is at top-right move to top-right corner
127
-
128
- const vZ = thresholdData.zIndex * thresholdData.zOffset;
129
- const rX = (x + 1) * cellSize[0];
130
- const rY = (y + 1) * cellSize[1];
131
-
132
- const refVertexX = gridOrigin[0] + rX;
133
- const refVertexY = gridOrigin[1] + rY;
132
+ const rX = x + 1;
133
+ const rY = y + 1;
134
134
 
135
135
  // offsets format
136
- // ISO_LINES: [[1A, 1B], [2A, 2B]],
137
- // ISO_BANDS: [[1A, 1B, 1C, ...], [2A, 2B, 2C, ...]],
138
-
136
+ // [[1A, 1B, 1C, ...], [2A, 2B, 2C, ...]],
139
137
  // vertices format
140
-
141
- // ISO_LINES: [[x1A, y1A], [x1B, y1B], [x2A, x2B], ...],
142
-
143
- // ISO_BANDS: => confirms to SolidPolygonLayer's simple polygon format
144
- // [
145
- // [[x1A, y1A], [x1B, y1B], [x1C, y1C] ... ],
138
+ // [
139
+ // [[x1A, y1A], [x1B, y1B], [x1C, y1C] ... ],
146
140
  // ...
147
- // ]
148
-
149
- if (type === CONTOUR_TYPE.ISO_BANDS) {
150
- const polygons: number[][][] = [];
151
- offsets.forEach(polygonOffsets => {
152
- const polygon: number[][] = [];
153
- polygonOffsets.forEach(xyOffset => {
154
- const vX = refVertexX + xyOffset[0] * cellSize[0];
155
- const vY = refVertexY + xyOffset[1] * cellSize[1];
156
- polygon.push([vX, vY, vZ]);
157
- });
158
- polygons.push(polygon);
141
+ // ]
142
+
143
+ const polygons: number[][][] = [];
144
+ offsets.forEach(polygonOffsets => {
145
+ const polygon: number[][] = [];
146
+ polygonOffsets.forEach(xyOffset => {
147
+ const vX = rX + xyOffset[0];
148
+ const vY = rY + xyOffset[1];
149
+ polygon.push([vX, vY, z]);
159
150
  });
160
- return polygons;
151
+ polygons.push(polygon);
152
+ });
153
+ return polygons;
154
+ }
155
+
156
+ // Returns intersection vertices for given cellindex
157
+ // [x, y] refers current marching cell, reference vertex is always top-right corner
158
+ export function getLines(opts: {x: number; y: number; z: number; code: number; meanCode: number}) {
159
+ const {x, y, z, code, meanCode} = opts;
160
+ let offsets = ISOLINES_CODE_OFFSET_MAP[code];
161
+
162
+ // handle saddle cases
163
+ if (!Array.isArray(offsets)) {
164
+ offsets = offsets[meanCode];
161
165
  }
162
166
 
163
- // default case is ISO_LINES
167
+ // Reference vertex is at top-right move to top-right corner
168
+ const rX = x + 1;
169
+ const rY = y + 1;
170
+
171
+ // offsets format
172
+ // [[1A, 1B], [2A, 2B]],
173
+ // vertices format
174
+ // [[x1A, y1A], [x1B, y1B], [x2A, x2B], ...],
164
175
  const lines: number[][] = [];
165
176
  offsets.forEach(xyOffsets => {
166
177
  xyOffsets.forEach(offset => {
167
- const vX = refVertexX + offset[0] * cellSize[0];
168
- const vY = refVertexY + offset[1] * cellSize[1];
169
- lines.push([vX, vY, vZ]);
178
+ const vX = rX + offset[0];
179
+ const vY = rY + offset[1];
180
+ lines.push([vX, vY, z]);
170
181
  });
171
182
  });
172
183
  return lines;
@@ -0,0 +1,65 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {Aggregator, CPUAggregator, WebGLAggregator} from '../common/aggregator/index';
6
+ import type {TypedArray} from '@luma.gl/core';
7
+
8
+ type ValueReader = (x: number, y: number) => number;
9
+
10
+ /** Returns an accessor to the aggregated values from bin id */
11
+ export function getAggregatorValueReader(opts: {
12
+ aggregator: Aggregator;
13
+ binIdRange: [number, number][];
14
+ channel: 0 | 1 | 2;
15
+ }): ValueReader | null {
16
+ const {aggregator, binIdRange, channel} = opts;
17
+
18
+ if (aggregator instanceof WebGLAggregator) {
19
+ const buffer = aggregator.getResult(channel)?.buffer;
20
+ if (buffer) {
21
+ const values = new Float32Array(buffer.readSyncWebGL().buffer);
22
+ return getWebGLAggregatorValueReader(values, binIdRange);
23
+ }
24
+ }
25
+ if (aggregator instanceof CPUAggregator) {
26
+ const values = aggregator.getResult(channel)?.value;
27
+ const ids = aggregator.getBins()?.value;
28
+ if (ids && values) {
29
+ return getCPUAggregatorValueReader(values, ids, aggregator.binCount);
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+
35
+ function getWebGLAggregatorValueReader(
36
+ values: Float32Array,
37
+ binIdRange: [number, number][]
38
+ ): ValueReader {
39
+ const [[minX, maxX], [minY, maxY]] = binIdRange;
40
+ const width = maxX - minX;
41
+ const height = maxY - minY;
42
+ return (x: number, y: number) => {
43
+ x -= minX;
44
+ y -= minY;
45
+ if (x < 0 || x >= width || y < 0 || y >= height) {
46
+ return NaN;
47
+ }
48
+ return values[y * width + x];
49
+ };
50
+ }
51
+
52
+ function getCPUAggregatorValueReader(
53
+ values: TypedArray,
54
+ ids: TypedArray,
55
+ count: number
56
+ ): ValueReader {
57
+ const idMap: Record<string, Record<string, number>> = {};
58
+ for (let i = 0; i < count; i++) {
59
+ const x = ids[i * 2];
60
+ const y = ids[i * 2 + 1];
61
+ idMap[x] = idMap[x] || {};
62
+ idMap[x][y] = values[i];
63
+ }
64
+ return (x: number, y: number) => idMap[x]?.[y] ?? NaN;
65
+ }
@@ -0,0 +1,26 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderModule} from '@luma.gl/shadertools';
6
+
7
+ const uniformBlock = /* glsl */ `\
8
+ uniform binOptionsUniforms {
9
+ vec2 cellOriginCommon;
10
+ vec2 cellSizeCommon;
11
+ } binOptions;
12
+ `;
13
+
14
+ export type BinOptions = {
15
+ cellOriginCommon: [number, number];
16
+ cellSizeCommon: [number, number];
17
+ };
18
+
19
+ export const binOptionsUniforms = {
20
+ name: 'binOptions',
21
+ vs: uniformBlock,
22
+ uniformTypes: {
23
+ cellOriginCommon: 'vec2<f32>',
24
+ cellSizeCommon: 'vec2<f32>'
25
+ }
26
+ } as const satisfies ShaderModule<BinOptions>;
@@ -0,0 +1,68 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export default /* glsl */ `#version 300 es
6
+
7
+ #define SHADER_NAME grid-cell-layer-vertex-shader
8
+
9
+ in vec3 positions;
10
+ in vec3 normals;
11
+
12
+ in vec2 instancePositions;
13
+ in float instanceElevationValues;
14
+ in float instanceColorValues;
15
+ in vec3 instancePickingColors;
16
+
17
+ uniform sampler2D colorRange;
18
+
19
+ // Result
20
+ out vec4 vColor;
21
+
22
+ float interp(float value, vec2 domain, vec2 range) {
23
+ float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.);
24
+ return mix(range.x, range.y, r);
25
+ }
26
+
27
+ vec4 interp(float value, vec2 domain, sampler2D range) {
28
+ float r = (value - domain.x) / (domain.y - domain.x);
29
+ return texture(range, vec2(r, 0.5));
30
+ }
31
+
32
+ void main(void) {
33
+ geometry.pickingColor = instancePickingColors;
34
+
35
+ if (isnan(instanceColorValues) ||
36
+ instanceColorValues < grid.colorDomain.z ||
37
+ instanceColorValues > grid.colorDomain.w ||
38
+ instanceElevationValues < grid.elevationDomain.z ||
39
+ instanceElevationValues > grid.elevationDomain.w
40
+ ) {
41
+ gl_Position = vec4(0.);
42
+ return;
43
+ }
44
+
45
+ vec2 commonPosition = (instancePositions + (positions.xy + 1.0) / 2.0 * column.coverage) * grid.sizeCommon + grid.originCommon - project.commonOrigin.xy;
46
+ geometry.position = vec4(commonPosition, 0.0, 1.0);
47
+ geometry.normal = project_normal(normals);
48
+
49
+ // calculate z, if 3d not enabled set to 0
50
+ float elevation = 0.0;
51
+ if (column.extruded) {
52
+ elevation = interp(instanceElevationValues, grid.elevationDomain.xy, grid.elevationRange);
53
+ elevation = project_size(elevation);
54
+ // cylindar gemoetry height are between -1.0 to 1.0, transform it to between 0, 1
55
+ geometry.position.z = (positions.z + 1.0) / 2.0 * elevation;
56
+ }
57
+
58
+ gl_Position = project_common_position_to_clipspace(geometry.position);
59
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
60
+
61
+ vColor = interp(instanceColorValues, grid.colorDomain.xy, colorRange);
62
+ vColor.a *= layer.opacity;
63
+ if (column.extruded) {
64
+ vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
65
+ }
66
+ DECKGL_FILTER_COLOR(vColor, geometry);
67
+ }
68
+ `;