@deck.gl/aggregation-layers 9.0.0-beta.2 → 9.0.0-beta.4

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 (335) hide show
  1. package/dist/aggregation-layer.js +153 -0
  2. package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
  3. package/dist/contour-layer/contour-layer.d.ts.map +1 -0
  4. package/dist/contour-layer/contour-layer.js +241 -0
  5. package/dist/contour-layer/contour-utils.js +64 -0
  6. package/dist/contour-layer/marching-squares-codes.js +337 -0
  7. package/dist/contour-layer/marching-squares.js +147 -0
  8. package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
  9. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  10. package/dist/cpu-grid-layer/cpu-grid-layer.js +130 -0
  11. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  12. package/dist/dist.dev.js +1296 -13614
  13. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
  14. package/dist/{esm/gpu-grid-layer → gpu-grid-layer}/gpu-grid-cell-layer-vertex.glsl.js +20 -1
  15. package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
  16. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  17. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  18. package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +3 -3
  19. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  20. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  21. package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
  22. package/dist/grid-aggregation-layer.d.ts.map +1 -0
  23. package/dist/grid-aggregation-layer.js +172 -0
  24. package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
  25. package/dist/grid-layer/grid-layer.d.ts.map +1 -0
  26. package/dist/grid-layer/grid-layer.js +63 -0
  27. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  28. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +1 -1
  29. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  30. package/dist/heatmap-layer/heatmap-layer.js +471 -0
  31. package/dist/{esm/heatmap-layer → heatmap-layer}/max-fs.glsl.js +0 -1
  32. package/dist/{esm/heatmap-layer → heatmap-layer}/max-vs.glsl.js +0 -1
  33. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +61 -0
  34. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +52 -0
  35. package/dist/heatmap-layer/triangle-layer.js +59 -0
  36. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-fs.glsl.js +0 -1
  37. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-vs.glsl.js +0 -1
  38. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  39. package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +3 -3
  40. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  41. package/dist/hexagon-layer/hexagon-layer.js +174 -0
  42. package/dist/index.cjs +4494 -0
  43. package/dist/index.cjs.map +7 -0
  44. package/dist/index.d.ts +20 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +32 -0
  47. package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -1
  48. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  49. package/dist/screen-grid-layer/screen-grid-cell-layer.js +166 -0
  50. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +40 -0
  51. package/dist/{esm/screen-grid-layer → screen-grid-layer}/screen-grid-layer-vertex.glsl.js +19 -1
  52. package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -1
  53. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  54. package/dist/screen-grid-layer/screen-grid-layer.js +216 -0
  55. package/dist/types.js +1 -0
  56. package/dist/utils/aggregation-operation-utils.js +94 -0
  57. package/dist/utils/bin-sorter.js +167 -0
  58. package/dist/utils/color-utils.js +53 -0
  59. package/dist/utils/cpu-aggregator.js +421 -0
  60. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
  61. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
  62. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +34 -0
  63. package/dist/{esm/utils → utils}/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +19 -1
  64. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  65. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  66. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  67. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +566 -0
  68. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +37 -0
  69. package/dist/utils/grid-aggregation-utils.js +114 -0
  70. package/dist/utils/prop-utils.js +28 -0
  71. package/dist/utils/resource-utils.js +38 -0
  72. package/dist/utils/scale-utils.js +184 -0
  73. package/dist.min.js +60 -174
  74. package/package.json +18 -11
  75. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +10 -13
  76. package/dist/es5/aggregation-layer.js +0 -215
  77. package/dist/es5/aggregation-layer.js.map +0 -1
  78. package/dist/es5/contour-layer/contour-layer.js +0 -353
  79. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  80. package/dist/es5/contour-layer/contour-utils.js +0 -110
  81. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  82. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  83. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  84. package/dist/es5/contour-layer/marching-squares.js +0 -168
  85. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  86. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  87. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  88. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  89. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  90. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  91. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  92. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  93. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  94. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  95. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  96. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  97. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  98. package/dist/es5/grid-aggregation-layer.js +0 -280
  99. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  100. package/dist/es5/grid-layer/grid-layer.js +0 -125
  101. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  102. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -107
  103. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  104. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -678
  105. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  106. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  107. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  108. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  109. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  110. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  111. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  112. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  113. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  114. package/dist/es5/heatmap-layer/triangle-layer.js +0 -121
  115. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  116. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  117. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  118. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  119. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  120. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  121. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  122. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  123. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  124. package/dist/es5/index.js +0 -104
  125. package/dist/es5/index.js.map +0 -1
  126. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  127. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  128. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  129. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  130. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  131. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  132. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  133. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  134. package/dist/es5/types.js +0 -2
  135. package/dist/es5/types.js.map +0 -1
  136. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  137. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  138. package/dist/es5/utils/bin-sorter.js +0 -248
  139. package/dist/es5/utils/bin-sorter.js.map +0 -1
  140. package/dist/es5/utils/color-utils.js +0 -39
  141. package/dist/es5/utils/color-utils.js.map +0 -1
  142. package/dist/es5/utils/cpu-aggregator.js +0 -496
  143. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  144. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  145. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  146. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  147. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  148. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  149. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  150. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  151. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  152. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  153. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  154. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  155. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  156. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  157. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  158. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  159. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  160. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  161. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  162. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  163. package/dist/es5/utils/prop-utils.js +0 -19
  164. package/dist/es5/utils/prop-utils.js.map +0 -1
  165. package/dist/es5/utils/resource-utils.js +0 -59
  166. package/dist/es5/utils/resource-utils.js.map +0 -1
  167. package/dist/es5/utils/scale-utils.js +0 -254
  168. package/dist/es5/utils/scale-utils.js.map +0 -1
  169. package/dist/esm/aggregation-layer.js +0 -156
  170. package/dist/esm/aggregation-layer.js.map +0 -1
  171. package/dist/esm/contour-layer/contour-layer.js +0 -316
  172. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  173. package/dist/esm/contour-layer/contour-utils.js +0 -81
  174. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  175. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  176. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  177. package/dist/esm/contour-layer/marching-squares.js +0 -151
  178. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  179. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  180. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  181. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  182. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  183. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  184. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  185. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  186. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  187. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  188. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  189. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  190. package/dist/esm/grid-aggregation-layer.js +0 -240
  191. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  192. package/dist/esm/grid-layer/grid-layer.js +0 -80
  193. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  194. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -55
  195. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  196. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -638
  197. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  198. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  199. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  200. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  201. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  202. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  203. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  204. package/dist/esm/heatmap-layer/triangle-layer.js +0 -78
  205. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  206. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  207. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  208. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  209. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  210. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  211. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  212. package/dist/esm/index.js +0 -13
  213. package/dist/esm/index.js.map +0 -1
  214. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  215. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  216. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  217. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  218. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  219. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  220. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  221. package/dist/esm/types.js +0 -2
  222. package/dist/esm/types.js.map +0 -1
  223. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  224. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  225. package/dist/esm/utils/bin-sorter.js +0 -165
  226. package/dist/esm/utils/bin-sorter.js.map +0 -1
  227. package/dist/esm/utils/color-utils.js +0 -28
  228. package/dist/esm/utils/color-utils.js.map +0 -1
  229. package/dist/esm/utils/cpu-aggregator.js +0 -487
  230. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  231. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  232. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  233. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  234. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  235. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  236. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  237. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  238. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  239. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  240. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  241. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  242. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  243. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  244. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  245. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  246. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  247. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  248. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  249. package/dist/esm/utils/prop-utils.js +0 -12
  250. package/dist/esm/utils/prop-utils.js.map +0 -1
  251. package/dist/esm/utils/resource-utils.js +0 -44
  252. package/dist/esm/utils/resource-utils.js.map +0 -1
  253. package/dist/esm/utils/scale-utils.js +0 -192
  254. package/dist/esm/utils/scale-utils.js.map +0 -1
  255. package/typed/contour-layer/contour-layer.d.ts.map +0 -1
  256. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  257. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  258. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  259. package/typed/grid-aggregation-layer.d.ts.map +0 -1
  260. package/typed/grid-layer/grid-layer.d.ts.map +0 -1
  261. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  262. package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
  263. package/typed/index.d.ts +0 -20
  264. package/typed/index.d.ts.map +0 -1
  265. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
  266. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
  267. /package/{typed → dist}/aggregation-layer.d.ts +0 -0
  268. /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
  269. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  270. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  271. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  272. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  273. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  274. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  275. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  276. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  277. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  278. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  279. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  280. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  281. /package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -0
  282. /package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -0
  283. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  284. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  285. /package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts +0 -0
  286. /package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +0 -0
  287. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -0
  288. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  289. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  290. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  291. /package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +0 -0
  292. /package/{typed → dist}/heatmap-layer/triangle-layer.d.ts.map +0 -0
  293. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  294. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  295. /package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts +0 -0
  296. /package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +0 -0
  297. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  298. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  299. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  300. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  301. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  302. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  303. /package/{typed → dist}/types.d.ts +0 -0
  304. /package/{typed → dist}/types.d.ts.map +0 -0
  305. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  306. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  307. /package/{typed → dist}/utils/bin-sorter.d.ts +0 -0
  308. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  309. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  310. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  311. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  312. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  313. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  314. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  315. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  316. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  317. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  318. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  319. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  320. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  321. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  322. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  323. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  324. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  325. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  326. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  327. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  328. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  329. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  330. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  331. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  332. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  333. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  334. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  335. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
@@ -0,0 +1,20 @@
1
+ export { default as ScreenGridLayer } from "./screen-grid-layer/screen-grid-layer.js";
2
+ export { default as CPUGridLayer } from "./cpu-grid-layer/cpu-grid-layer.js";
3
+ export { default as HexagonLayer } from "./hexagon-layer/hexagon-layer.js";
4
+ export { default as ContourLayer } from "./contour-layer/contour-layer.js";
5
+ export { default as GridLayer } from "./grid-layer/grid-layer.js";
6
+ export { default as GPUGridLayer } from "./gpu-grid-layer/gpu-grid-layer.js";
7
+ export { AGGREGATION_OPERATION } from "./utils/aggregation-operation-utils.js";
8
+ export { default as HeatmapLayer } from "./heatmap-layer/heatmap-layer.js";
9
+ export { default as _GPUGridAggregator } from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
10
+ export { default as _CPUAggregator } from "./utils/cpu-aggregator.js";
11
+ export { default as _AggregationLayer } from "./aggregation-layer.js";
12
+ export { default as _BinSorter } from "./utils/bin-sorter.js";
13
+ export type { ContourLayerProps } from "./contour-layer/contour-layer.js";
14
+ export type { HeatmapLayerProps } from "./heatmap-layer/heatmap-layer.js";
15
+ export type { HexagonLayerProps } from "./hexagon-layer/hexagon-layer.js";
16
+ export type { CPUGridLayerProps } from "./cpu-grid-layer/cpu-grid-layer.js";
17
+ export type { GridLayerProps } from "./grid-layer/grid-layer.js";
18
+ export type { GPUGridLayerProps } from "./gpu-grid-layer/gpu-grid-layer.js";
19
+ export type { ScreenGridLayerProps } from "./screen-grid-layer/screen-grid-layer.js";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,iDAA8C;AACjF,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,2CAAwC;AACxE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,mCAAgC;AAC7D,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,2CAAwC;AACxE,OAAO,EAAC,qBAAqB,EAAC,+CAA4C;AAG1E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,4DAAyD;AAC/F,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,kCAA+B;AACjE,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,+BAA4B;AACjE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,8BAA2B;AAGzD,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,2CAAwC;AACvE,YAAY,EAAC,cAAc,EAAC,mCAAgC;AAC5D,YAAY,EAAC,iBAAiB,EAAC,2CAAwC;AACvE,YAAY,EAAC,oBAAoB,EAAC,iDAA8C"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
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 as ScreenGridLayer } from "./screen-grid-layer/screen-grid-layer.js";
21
+ export { default as CPUGridLayer } from "./cpu-grid-layer/cpu-grid-layer.js";
22
+ export { default as HexagonLayer } from "./hexagon-layer/hexagon-layer.js";
23
+ export { default as ContourLayer } from "./contour-layer/contour-layer.js";
24
+ export { default as GridLayer } from "./grid-layer/grid-layer.js";
25
+ export { default as GPUGridLayer } from "./gpu-grid-layer/gpu-grid-layer.js";
26
+ export { AGGREGATION_OPERATION } from "./utils/aggregation-operation-utils.js";
27
+ // experimental export
28
+ export { default as HeatmapLayer } from "./heatmap-layer/heatmap-layer.js";
29
+ export { default as _GPUGridAggregator } from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
30
+ export { default as _CPUAggregator } from "./utils/cpu-aggregator.js";
31
+ export { default as _AggregationLayer } from "./aggregation-layer.js";
32
+ export { default as _BinSorter } from "./utils/bin-sorter.js";
@@ -1,7 +1,7 @@
1
1
  import { Device, Texture } from '@luma.gl/core';
2
2
  import { Model } from '@luma.gl/engine';
3
3
  import { Layer, LayerProps, UpdateParameters, DefaultProps } from '@deck.gl/core';
4
- import type { _ScreenGridLayerProps } from './screen-grid-layer';
4
+ import type { _ScreenGridLayerProps } from "./screen-grid-layer.js";
5
5
  import { ShaderModule } from '@luma.gl/shadertools';
6
6
  /** All properties supported by ScreenGridCellLayer. */
7
7
  export type ScreenGridCellLayerProps<DataT = unknown> = _ScreenGridCellLayerProps<DataT> & LayerProps;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-grid-cell-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-cell-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAW,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAE,UAAU,EAAgB,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAI9F,OAAO,KAAK,EAAC,qBAAqB,EAAC,+BAA4B;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAclD,uDAAuD;AACvD,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,GACtF,UAAU,CAAC;AAEb,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAC5E,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBAAmB,CAAC,KAAK,GAAG,GAAG,EAAE,WAAW,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,KAAK,CAC9F,WAAW,GAAG,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CACzD;IACC,MAAM,CAAC,SAAS,SAAyB;IACzC,MAAM,CAAC,YAAY,kDAAgB;IAEnC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM;IAIjC,KAAK,EAAG;QACN,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IAEF,UAAU,IAAI;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,EAAE,CAAA;KAAC;IAI/D,eAAe;IAYf,iBAAiB,CAAC,EAAC,WAAW,EAAC;;KAAA;IAK/B,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAe1C,IAAI,CAAC,EAAC,QAAQ,EAAC;;KAAA;IA2Bf,0BAA0B,CAAC,SAAS,KAAA,EAAE,EAAC,YAAY,EAAC;;KAAA;IAkBpD,SAAS,IAAI,KAAK;IAsBlB,gBAAgB,IAAI,OAAO;IAe3B,eAAe,CAAC,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,WAAW,KAAA,GAAG,IAAI;CA2BpD"}
@@ -0,0 +1,166 @@
1
+ // Copyright (c) 2015 - 2019 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 { Model, Geometry } from '@luma.gl/engine';
21
+ import { Layer, log, picking } from '@deck.gl/core';
22
+ import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
23
+ import vs from "./screen-grid-layer-vertex.glsl.js";
24
+ import fs from "./screen-grid-layer-fragment.glsl.js";
25
+ const DEFAULT_MINCOLOR = [0, 0, 0, 0];
26
+ const DEFAULT_MAXCOLOR = [0, 255, 0, 255];
27
+ const COLOR_PROPS = ['minColor', 'maxColor', 'colorRange', 'colorDomain'];
28
+ const defaultProps = {
29
+ cellSizePixels: { type: 'number', value: 100, min: 1 },
30
+ cellMarginPixels: { type: 'number', value: 2, min: 0, max: 5 },
31
+ colorDomain: null,
32
+ colorRange: defaultColorRange
33
+ };
34
+ export default class ScreenGridCellLayer extends Layer {
35
+ static { this.layerName = 'ScreenGridCellLayer'; }
36
+ static { this.defaultProps = defaultProps; }
37
+ static isSupported(device) {
38
+ return device.features.has('texture-formats-float32-webgl1');
39
+ }
40
+ getShaders() {
41
+ return { vs, fs, modules: [picking] };
42
+ }
43
+ initializeState() {
44
+ const attributeManager = this.getAttributeManager();
45
+ attributeManager.addInstanced({
46
+ // eslint-disable-next-line @typescript-eslint/unbound-method
47
+ instancePositions: { size: 3, update: this.calculateInstancePositions },
48
+ instanceCounts: { size: 4, noAlloc: true }
49
+ });
50
+ this.setState({
51
+ model: this._getModel()
52
+ });
53
+ }
54
+ shouldUpdateState({ changeFlags }) {
55
+ // 'instanceCounts' buffer contetns change on viewport change.
56
+ return changeFlags.somethingChanged;
57
+ }
58
+ updateState(params) {
59
+ super.updateState(params);
60
+ const { oldProps, props, changeFlags } = params;
61
+ const attributeManager = this.getAttributeManager();
62
+ if (props.numInstances !== oldProps.numInstances) {
63
+ attributeManager.invalidateAll();
64
+ }
65
+ else if (oldProps.cellSizePixels !== props.cellSizePixels) {
66
+ attributeManager.invalidate('instancePositions');
67
+ }
68
+ this._updateUniforms(oldProps, props, changeFlags);
69
+ }
70
+ draw({ uniforms }) {
71
+ const { parameters, maxTexture } = this.props;
72
+ const minColor = this.props.minColor || DEFAULT_MINCOLOR;
73
+ const maxColor = this.props.maxColor || DEFAULT_MAXCOLOR;
74
+ // If colorDomain not specified we use default domain [1, maxCount]
75
+ // maxCount value will be sampled form maxTexture in vertex shader.
76
+ const colorDomain = this.props.colorDomain || [1, 0];
77
+ const model = this.state.model;
78
+ model.setUniforms(uniforms);
79
+ model.setBindings({
80
+ maxTexture
81
+ });
82
+ model.setUniforms({
83
+ minColor,
84
+ maxColor,
85
+ colorDomain
86
+ });
87
+ model.setParameters({
88
+ depthWriteEnabled: false,
89
+ // How to specify depth mask in WebGPU?
90
+ // depthMask: false,
91
+ ...parameters
92
+ });
93
+ model.draw(this.context.renderPass);
94
+ }
95
+ calculateInstancePositions(attribute, { numInstances }) {
96
+ const { width, height } = this.context.viewport;
97
+ const { cellSizePixels } = this.props;
98
+ const numCol = Math.ceil(width / cellSizePixels);
99
+ const { value, size } = attribute;
100
+ for (let i = 0; i < numInstances; i++) {
101
+ const x = i % numCol;
102
+ const y = Math.floor(i / numCol);
103
+ value[i * size + 0] = ((x * cellSizePixels) / width) * 2 - 1;
104
+ value[i * size + 1] = 1 - ((y * cellSizePixels) / height) * 2;
105
+ value[i * size + 2] = 0;
106
+ }
107
+ }
108
+ // Private Methods
109
+ _getModel() {
110
+ return new Model(this.context.device, {
111
+ ...this.getShaders(),
112
+ id: this.props.id,
113
+ bufferLayout: this.getAttributeManager().getBufferLayouts(),
114
+ geometry: new Geometry({
115
+ topology: 'triangle-list',
116
+ attributes: {
117
+ // prettier-ignore
118
+ positions: new Float32Array([
119
+ 0, 0, 0,
120
+ 1, 0, 0,
121
+ 1, 1, 0,
122
+ 0, 0, 0,
123
+ 1, 1, 0,
124
+ 0, 1, 0,
125
+ ])
126
+ }
127
+ })
128
+ });
129
+ }
130
+ _shouldUseMinMax() {
131
+ const { minColor, maxColor, colorDomain, colorRange } = this.props;
132
+ if (minColor || maxColor) {
133
+ log.deprecated('ScreenGridLayer props: minColor and maxColor', 'colorRange, colorDomain')();
134
+ return true;
135
+ }
136
+ // minColor and maxColor not supplied, check if colorRange or colorDomain supplied.
137
+ // NOTE: colorDomain and colorRange are experimental features, use them only when supplied.
138
+ if (colorDomain || colorRange) {
139
+ return false;
140
+ }
141
+ // None specified, use default minColor and maxColor
142
+ return true;
143
+ }
144
+ _updateUniforms(oldProps, props, changeFlags) {
145
+ const model = this.state.model;
146
+ if (COLOR_PROPS.some(key => oldProps[key] !== props[key])) {
147
+ model.setUniforms({ shouldUseMinMax: this._shouldUseMinMax() });
148
+ }
149
+ if (oldProps.colorRange !== props.colorRange) {
150
+ model.setUniforms({ colorRange: colorRangeToFlatArray(props.colorRange) });
151
+ }
152
+ if (oldProps.cellMarginPixels !== props.cellMarginPixels ||
153
+ oldProps.cellSizePixels !== props.cellSizePixels ||
154
+ changeFlags.viewportChanged) {
155
+ const { width, height } = this.context.viewport;
156
+ const { cellSizePixels, cellMarginPixels } = this.props;
157
+ const margin = cellSizePixels > cellMarginPixels ? cellMarginPixels : 0;
158
+ const cellScale = new Float32Array([
159
+ ((cellSizePixels - margin) / width) * 2,
160
+ (-(cellSizePixels - margin) / height) * 2,
161
+ 1
162
+ ]);
163
+ model.setUniforms({ cellScale });
164
+ }
165
+ }
166
+ }
@@ -0,0 +1,40 @@
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
+ /* fragment shader for the grid-layer */
21
+ export default `\
22
+ #version 300 es
23
+ #define SHADER_NAME screen-grid-layer-fragment-shader
24
+
25
+ precision highp float;
26
+
27
+ in vec4 vColor;
28
+ in float vSampleCount;
29
+
30
+ out vec4 fragColor;
31
+
32
+ void main(void) {
33
+ if (vSampleCount <= 0.0) {
34
+ discard;
35
+ }
36
+ fragColor = vColor;
37
+
38
+ DECKGL_FILTER_COLOR(fragColor, geometry);
39
+ }
40
+ `;
@@ -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
  #version 300 es
3
22
  #define SHADER_NAME screen-grid-layer-vertex-shader
@@ -63,4 +82,3 @@ void main(void) {
63
82
  gl_Position = vec4(instancePositions + positions * cellScale, 1.);
64
83
  }
65
84
  `;
66
- //# sourceMappingURL=screen-grid-layer-vertex.glsl.js.map
@@ -1,6 +1,6 @@
1
1
  import { Accessor, Color, GetPickingInfoParams, Layer, LayerContext, LayersList, PickingInfo, Position, UpdateParameters, DefaultProps } from '@deck.gl/core';
2
2
  import type { Buffer, Texture } from '@luma.gl/core';
3
- import GridAggregationLayer, { GridAggregationLayerProps } from '../grid-aggregation-layer';
3
+ import GridAggregationLayer, { GridAggregationLayerProps } from "../grid-aggregation-layer.js";
4
4
  /** All properties supported by ScreenGridLayer. */
5
5
  export type ScreenGridLayerProps<DataT = unknown> = _ScreenGridLayerProps<DataT> & GridAggregationLayerProps<DataT>;
6
6
  /** Properties added by ScreenGridLayer. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-grid-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,oBAAoB,EACpB,KAAK,EACL,YAAY,EACZ,UAAU,EAEV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAKnD,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,qCAAkC;AAuB1F,mDAAmD;AACnD,MAAM,MAAM,oBAAoB,CAAC,KAAK,GAAG,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAC9E,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IAErB;;;;OAIG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAExC;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEpC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC9C,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,OAAO,OAAO,eAAe,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,EAAE,GAAG,EAAE,CAC1B,SAAQ,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxF,MAAM,CAAC,SAAS,SAAqB;IACrC,MAAM,CAAC,YAAY,8CAAgB;IAEnC,KAAK,EAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QAC7C,SAAS,EAAE,OAAO,CAAC;QACnB,iBAAiB,CAAC,EAAE,GAAG,CAAC;QACxB,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,eAAe;IA2Cf,iBAAiB,CAAC,EAAC,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAIvD,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAIxC,YAAY,IAAI,UAAU,GAAG,KAAK;IAuBlC,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAU1C,cAAc,CAAC,EAAC,IAAI,EAAC,EAAE,oBAAoB,GAAG,WAAW;IAsBzD,aAAa,CAAC,EAAC,eAAe,EAAE,OAAO,EAAC;;;KAAA;IASxC,sBAAsB,CAAC,IAAI,KAAA;IAiE3B,gBAAgB,CAAC,IAAI,KAAA;IAUrB,aAAa;CAMd"}
@@ -0,0 +1,216 @@
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 { log } from '@deck.gl/core';
21
+ import { GL } from '@luma.gl/constants';
22
+ import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
23
+ import { AGGREGATION_OPERATION, getValueFunc } from "../utils/aggregation-operation-utils.js";
24
+ import ScreenGridCellLayer from "./screen-grid-cell-layer.js";
25
+ import GridAggregationLayer from "../grid-aggregation-layer.js";
26
+ import { getFloatTexture } from "../utils/resource-utils.js";
27
+ const defaultProps = {
28
+ ...ScreenGridCellLayer.defaultProps,
29
+ getPosition: { type: 'accessor', value: (d) => d.position },
30
+ getWeight: { type: 'accessor', value: 1 },
31
+ gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
32
+ aggregation: 'SUM'
33
+ };
34
+ const POSITION_ATTRIBUTE_NAME = 'positions';
35
+ const DIMENSIONS = {
36
+ data: {
37
+ props: ['cellSizePixels']
38
+ },
39
+ weights: {
40
+ props: ['aggregation'],
41
+ accessors: ['getWeight']
42
+ }
43
+ };
44
+ /** Aggregates data into histogram bins and renders them as a grid. */
45
+ export default class ScreenGridLayer extends GridAggregationLayer {
46
+ static { this.layerName = 'ScreenGridLayer'; }
47
+ static { this.defaultProps = defaultProps; }
48
+ initializeState() {
49
+ if (!ScreenGridCellLayer.isSupported(this.context.device)) {
50
+ // max aggregated value is sampled from a float texture
51
+ this.setState({ supported: false });
52
+ log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
53
+ return;
54
+ }
55
+ super.initializeAggregationLayer({
56
+ dimensions: DIMENSIONS,
57
+ // @ts-expect-error
58
+ getCellSize: props => props.cellSizePixels // TODO
59
+ });
60
+ const weights = {
61
+ count: {
62
+ size: 1,
63
+ operation: AGGREGATION_OPERATION.SUM,
64
+ needMax: true,
65
+ maxTexture: getFloatTexture(this.context.device, { id: `${this.id}-max-texture` })
66
+ }
67
+ };
68
+ this.setState({
69
+ supported: true,
70
+ projectPoints: true, // aggregation in screen space
71
+ weights,
72
+ subLayerData: { attributes: {} },
73
+ maxTexture: weights.count.maxTexture,
74
+ positionAttributeName: 'positions',
75
+ posOffset: [0, 0],
76
+ translation: [1, -1]
77
+ });
78
+ const attributeManager = this.getAttributeManager();
79
+ attributeManager.add({
80
+ [POSITION_ATTRIBUTE_NAME]: {
81
+ size: 3,
82
+ accessor: 'getPosition',
83
+ type: GL.DOUBLE,
84
+ fp64: this.use64bitPositions()
85
+ },
86
+ // this attribute is used in gpu aggregation path only
87
+ count: { size: 3, accessor: 'getWeight' }
88
+ });
89
+ }
90
+ shouldUpdateState({ changeFlags }) {
91
+ return this.state.supported && changeFlags.somethingChanged;
92
+ }
93
+ updateState(opts) {
94
+ super.updateState(opts);
95
+ }
96
+ renderLayers() {
97
+ if (!this.state.supported) {
98
+ return [];
99
+ }
100
+ const { maxTexture, numRow, numCol, weights } = this.state;
101
+ const { updateTriggers } = this.props;
102
+ const { aggregationBuffer } = weights.count;
103
+ const CellLayerClass = this.getSubLayerClass('cells', ScreenGridCellLayer);
104
+ return new CellLayerClass(this.props, this.getSubLayerProps({
105
+ id: 'cell-layer',
106
+ updateTriggers
107
+ }), {
108
+ data: { attributes: { instanceCounts: aggregationBuffer } },
109
+ maxTexture,
110
+ numInstances: numRow * numCol
111
+ });
112
+ }
113
+ finalizeState(context) {
114
+ super.finalizeState(context);
115
+ const { aggregationBuffer, maxBuffer, maxTexture } = this.state;
116
+ aggregationBuffer?.delete();
117
+ maxBuffer?.delete();
118
+ maxTexture?.delete();
119
+ }
120
+ getPickingInfo({ info }) {
121
+ const { index } = info;
122
+ if (index >= 0) {
123
+ const { gpuGridAggregator, gpuAggregation, weights } = this.state;
124
+ // Get count aggregation results
125
+ const aggregationResults = gpuAggregation
126
+ ? gpuGridAggregator.getData('count')
127
+ : weights.count;
128
+ // Each instance (one cell) is aggregated into single pixel,
129
+ // Get current instance's aggregation details.
130
+ info.object = GPUGridAggregator.getAggregationData({
131
+ pixelIndex: index,
132
+ ...aggregationResults
133
+ });
134
+ }
135
+ return info;
136
+ }
137
+ // Aggregation Overrides
138
+ updateResults({ aggregationData, maxData }) {
139
+ const { count } = this.state.weights;
140
+ count.aggregationData = aggregationData;
141
+ count.aggregationBuffer.write(aggregationData);
142
+ count.maxData = maxData;
143
+ count.maxTexture.setImageData({ data: maxData });
144
+ }
145
+ /* eslint-disable complexity, max-statements */
146
+ updateAggregationState(opts) {
147
+ const cellSize = opts.props.cellSizePixels;
148
+ const cellSizeChanged = opts.oldProps.cellSizePixels !== cellSize;
149
+ const { viewportChanged } = opts.changeFlags;
150
+ let gpuAggregation = opts.props.gpuAggregation;
151
+ if (this.state.gpuAggregation !== opts.props.gpuAggregation) {
152
+ if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
153
+ log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
154
+ gpuAggregation = false;
155
+ }
156
+ }
157
+ const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
158
+ this.setState({
159
+ gpuAggregation
160
+ });
161
+ const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
162
+ const { dimensions } = this.state;
163
+ const { data, weights } = dimensions;
164
+ const aggregationDataDirty = positionsChanged ||
165
+ gpuAggregationChanged ||
166
+ viewportChanged ||
167
+ this.isAggregationDirty(opts, {
168
+ compareAll: gpuAggregation, // check for all (including extentions props) when using gpu aggregation
169
+ dimension: data
170
+ });
171
+ const aggregationWeightsDirty = this.isAggregationDirty(opts, { dimension: weights });
172
+ this.setState({
173
+ aggregationDataDirty,
174
+ aggregationWeightsDirty
175
+ });
176
+ const { viewport } = this.context;
177
+ if (viewportChanged || cellSizeChanged) {
178
+ const { width, height } = viewport;
179
+ const numCol = Math.ceil(width / cellSize);
180
+ const numRow = Math.ceil(height / cellSize);
181
+ this.allocateResources(numRow, numCol);
182
+ this.setState({
183
+ // transformation from clipspace to screen(pixel) space
184
+ scaling: [width / 2, -height / 2, 1],
185
+ gridOffset: { xOffset: cellSize, yOffset: cellSize },
186
+ width,
187
+ height,
188
+ numCol,
189
+ numRow
190
+ });
191
+ }
192
+ if (aggregationWeightsDirty) {
193
+ this._updateAccessors(opts);
194
+ }
195
+ if (aggregationDataDirty || aggregationWeightsDirty) {
196
+ this._resetResults();
197
+ }
198
+ }
199
+ /* eslint-enable complexity, max-statements */
200
+ // Private
201
+ _updateAccessors(opts) {
202
+ const { getWeight, aggregation, data } = opts.props;
203
+ const { count } = this.state.weights;
204
+ if (count) {
205
+ count.getWeight = getWeight;
206
+ count.operation = AGGREGATION_OPERATION[aggregation];
207
+ }
208
+ this.setState({ getValue: getValueFunc(aggregation, getWeight, { data }) });
209
+ }
210
+ _resetResults() {
211
+ const { count } = this.state.weights;
212
+ if (count) {
213
+ count.aggregationData = null;
214
+ }
215
+ }
216
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,94 @@
1
+ // Copyright (c) 2015 - 2019 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 const AGGREGATION_OPERATION = {
21
+ SUM: 1,
22
+ MEAN: 2,
23
+ MIN: 3,
24
+ MAX: 4
25
+ };
26
+ function sumReducer(accu, cur) {
27
+ return accu + cur;
28
+ }
29
+ function maxReducer(accu, cur) {
30
+ return cur > accu ? cur : accu;
31
+ }
32
+ function minReducer(accu, cur) {
33
+ return cur < accu ? cur : accu;
34
+ }
35
+ export function getMean(pts, accessor) {
36
+ if (Number.isFinite(accessor)) {
37
+ return pts.length ? accessor : null;
38
+ }
39
+ const filtered = pts.map(accessor).filter(Number.isFinite);
40
+ return filtered.length ? filtered.reduce(sumReducer, 0) / filtered.length : null;
41
+ }
42
+ export function getSum(pts, accessor) {
43
+ if (Number.isFinite(accessor)) {
44
+ return pts.length ? pts.length * accessor : null;
45
+ }
46
+ const filtered = pts.map(accessor).filter(Number.isFinite);
47
+ return filtered.length ? filtered.reduce(sumReducer, 0) : null;
48
+ }
49
+ export function getMax(pts, accessor) {
50
+ if (Number.isFinite(accessor)) {
51
+ return pts.length ? accessor : null;
52
+ }
53
+ const filtered = pts.map(accessor).filter(Number.isFinite);
54
+ return filtered.length ? filtered.reduce(maxReducer, -Infinity) : null;
55
+ }
56
+ export function getMin(pts, accessor) {
57
+ if (Number.isFinite(accessor)) {
58
+ return pts.length ? accessor : null;
59
+ }
60
+ const filtered = pts.map(accessor).filter(Number.isFinite);
61
+ return filtered.length ? filtered.reduce(minReducer, Infinity) : null;
62
+ }
63
+ // Function to convert from aggregation/accessor props (like colorAggregation and getColorWeight) to getValue prop (like getColorValue)
64
+ export function getValueFunc(aggregation, accessor, context) {
65
+ const op = AGGREGATION_OPERATION[aggregation] || AGGREGATION_OPERATION.SUM;
66
+ accessor = wrapAccessor(accessor, context);
67
+ switch (op) {
68
+ case AGGREGATION_OPERATION.MIN:
69
+ return pts => getMin(pts, accessor);
70
+ case AGGREGATION_OPERATION.SUM:
71
+ return pts => getSum(pts, accessor);
72
+ case AGGREGATION_OPERATION.MEAN:
73
+ return pts => getMean(pts, accessor);
74
+ case AGGREGATION_OPERATION.MAX:
75
+ return pts => getMax(pts, accessor);
76
+ default:
77
+ return null;
78
+ }
79
+ }
80
+ function wrapAccessor(accessor, context = {}) {
81
+ if (Number.isFinite(accessor)) {
82
+ return accessor;
83
+ }
84
+ return pt => {
85
+ context.index = pt.index;
86
+ return accessor(pt.source, context);
87
+ };
88
+ }
89
+ export function wrapGetValueFunc(getValue, context = {}) {
90
+ return pts => {
91
+ context.indices = pts.map(pt => pt.index);
92
+ return getValue(pts.map(pt => pt.source), context);
93
+ };
94
+ }