@deck.gl/aggregation-layers 9.0.34 → 9.1.0-beta.1

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 (318) 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 +69 -0
  4. package/dist/common/aggregator/aggregator.d.ts +76 -0
  5. package/dist/common/aggregator/aggregator.d.ts.map +1 -0
  6. package/dist/common/aggregator/aggregator.js +4 -0
  7. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
  8. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
  9. package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
  10. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
  11. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
  12. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
  13. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
  14. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
  15. package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
  16. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
  17. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
  18. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
  19. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
  20. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
  21. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
  22. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
  23. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
  24. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
  25. package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
  26. package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
  27. package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
  28. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
  29. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
  30. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
  31. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
  32. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
  33. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
  34. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
  35. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
  36. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
  37. package/dist/common/aggregator/index.d.ts +6 -0
  38. package/dist/common/aggregator/index.d.ts.map +1 -0
  39. package/dist/common/aggregator/index.js +5 -0
  40. package/dist/common/types.d.ts +11 -0
  41. package/dist/common/types.d.ts.map +1 -0
  42. package/dist/common/types.js +4 -0
  43. package/dist/common/utils/bounds-utils.d.ts +10 -0
  44. package/dist/common/utils/bounds-utils.d.ts.map +1 -0
  45. package/dist/common/utils/bounds-utils.js +20 -0
  46. package/dist/common/utils/color-utils.d.ts +10 -0
  47. package/dist/common/utils/color-utils.d.ts.map +1 -0
  48. package/dist/common/utils/color-utils.js +65 -0
  49. package/dist/common/utils/prop-utils.d.ts.map +1 -0
  50. package/dist/common/utils/prop-utils.js +12 -0
  51. package/dist/common/utils/scale-utils.d.ts +46 -0
  52. package/dist/common/utils/scale-utils.d.ts.map +1 -0
  53. package/dist/common/utils/scale-utils.js +180 -0
  54. package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
  55. package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
  56. package/dist/contour-layer/bin-options-uniforms.js +17 -0
  57. package/dist/contour-layer/contour-layer.d.ts +42 -50
  58. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  59. package/dist/contour-layer/contour-layer.js +232 -192
  60. package/dist/contour-layer/contour-utils.d.ts +36 -15
  61. package/dist/contour-layer/contour-utils.d.ts.map +1 -1
  62. package/dist/contour-layer/contour-utils.js +24 -29
  63. package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
  64. package/dist/contour-layer/marching-squares-codes.js +3 -0
  65. package/dist/contour-layer/marching-squares.d.ts +22 -6
  66. package/dist/contour-layer/marching-squares.d.ts.map +1 -1
  67. package/dist/contour-layer/marching-squares.js +71 -68
  68. package/dist/contour-layer/value-reader.d.ts +10 -0
  69. package/dist/contour-layer/value-reader.d.ts.map +1 -0
  70. package/dist/contour-layer/value-reader.js +46 -0
  71. package/dist/dist.dev.js +4842 -4081
  72. package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
  73. package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
  74. package/dist/grid-layer/bin-options-uniforms.js +17 -0
  75. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
  76. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  77. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
  78. package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
  79. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
  80. package/dist/grid-layer/grid-cell-layer.js +93 -0
  81. package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
  82. package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
  83. package/dist/grid-layer/grid-layer-uniforms.js +23 -0
  84. package/dist/grid-layer/grid-layer.d.ts +175 -13
  85. package/dist/grid-layer/grid-layer.d.ts.map +1 -1
  86. package/dist/grid-layer/grid-layer.js +342 -46
  87. package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
  88. package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
  89. package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
  90. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
  91. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
  92. package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
  93. package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
  94. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  95. package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
  96. package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
  97. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  98. package/dist/heatmap-layer/heatmap-layer.js +43 -33
  99. package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
  100. package/dist/heatmap-layer/max-fs.glsl.js +3 -0
  101. package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
  102. package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  103. package/dist/heatmap-layer/max-vs.glsl.js +6 -4
  104. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  105. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
  106. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
  107. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
  108. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
  109. package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
  110. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
  111. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
  112. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
  113. package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
  114. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  115. package/dist/heatmap-layer/triangle-layer.js +17 -30
  116. package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
  117. package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
  118. package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  119. package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  120. package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
  121. package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
  122. package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
  123. package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
  124. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
  125. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
  126. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
  127. package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
  128. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
  129. package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
  130. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
  131. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
  132. package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
  133. package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
  134. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  135. package/dist/hexagon-layer/hexagon-layer.js +307 -123
  136. package/dist/hexagon-layer/hexbin.d.ts +17 -0
  137. package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
  138. package/dist/hexagon-layer/hexbin.js +69 -0
  139. package/dist/index.cjs +3025 -2946
  140. package/dist/index.cjs.map +4 -4
  141. package/dist/index.d.ts +7 -13
  142. package/dist/index.d.ts.map +1 -1
  143. package/dist/index.js +5 -27
  144. package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
  145. package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
  146. package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
  147. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
  148. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  149. package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
  150. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
  151. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
  152. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
  153. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
  154. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
  155. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
  156. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
  157. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
  158. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
  159. package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
  160. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  161. package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
  162. package/dist.min.js +401 -382
  163. package/package.json +10 -9
  164. package/src/common/aggregation-layer.ts +107 -0
  165. package/src/common/aggregator/aggregator.ts +88 -0
  166. package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
  167. package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
  168. package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
  169. package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
  170. package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
  171. package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
  172. package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
  173. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
  174. package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
  175. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
  176. package/src/common/aggregator/index.ts +10 -0
  177. package/src/{types.ts → common/types.ts} +10 -4
  178. package/src/common/utils/bounds-utils.ts +34 -0
  179. package/src/common/utils/color-utils.ts +86 -0
  180. package/src/common/utils/prop-utils.ts +13 -0
  181. package/src/common/utils/scale-utils.ts +236 -0
  182. package/src/contour-layer/bin-options-uniforms.ts +26 -0
  183. package/src/contour-layer/contour-layer.ts +300 -265
  184. package/src/contour-layer/contour-utils.ts +68 -39
  185. package/src/contour-layer/marching-squares-codes.ts +4 -0
  186. package/src/contour-layer/marching-squares.ts +93 -82
  187. package/src/contour-layer/value-reader.ts +65 -0
  188. package/src/grid-layer/bin-options-uniforms.ts +26 -0
  189. package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
  190. package/src/grid-layer/grid-cell-layer.ts +141 -0
  191. package/src/grid-layer/grid-layer-uniforms.ts +37 -0
  192. package/src/grid-layer/grid-layer.ts +614 -73
  193. package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
  194. package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
  195. package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
  196. package/src/heatmap-layer/heatmap-layer.ts +59 -36
  197. package/src/heatmap-layer/max-fs.glsl.ts +4 -0
  198. package/src/heatmap-layer/max-vs.glsl.ts +7 -4
  199. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
  200. package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
  201. package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
  202. package/src/heatmap-layer/triangle-layer.ts +26 -31
  203. package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
  204. package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
  205. package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
  206. package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
  207. package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
  208. package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
  209. package/src/hexagon-layer/hexagon-layer.ts +454 -186
  210. package/src/hexagon-layer/hexbin.ts +79 -0
  211. package/src/index.ts +21 -34
  212. package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
  213. package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
  214. package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
  215. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
  216. package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
  217. package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
  218. package/dist/aggregation-layer.d.ts.map +0 -1
  219. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
  220. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  221. package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
  222. package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
  223. package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
  224. package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
  225. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
  226. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
  227. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
  228. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
  229. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
  230. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
  231. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
  232. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  233. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
  234. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
  235. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  236. package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
  237. package/dist/grid-aggregation-layer.d.ts +0 -67
  238. package/dist/grid-aggregation-layer.d.ts.map +0 -1
  239. package/dist/grid-aggregation-layer.js +0 -173
  240. package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
  241. package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
  242. package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
  243. package/dist/types.d.ts +0 -12
  244. package/dist/types.d.ts.map +0 -1
  245. package/dist/types.js +0 -1
  246. package/dist/utils/aggregation-operation-utils.d.ts +0 -19
  247. package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
  248. package/dist/utils/aggregation-operation-utils.js +0 -94
  249. package/dist/utils/bin-sorter.d.ts +0 -52
  250. package/dist/utils/bin-sorter.d.ts.map +0 -1
  251. package/dist/utils/bin-sorter.js +0 -167
  252. package/dist/utils/color-utils.d.ts +0 -3
  253. package/dist/utils/color-utils.d.ts.map +0 -1
  254. package/dist/utils/color-utils.js +0 -53
  255. package/dist/utils/cpu-aggregator.d.ts +0 -169
  256. package/dist/utils/cpu-aggregator.d.ts.map +0 -1
  257. package/dist/utils/cpu-aggregator.js +0 -421
  258. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
  259. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
  260. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
  261. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
  262. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
  263. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
  264. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
  265. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
  266. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
  267. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
  268. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
  269. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
  270. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
  271. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
  272. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
  273. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
  274. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
  275. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
  276. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
  277. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
  278. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
  279. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
  280. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
  281. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
  282. package/dist/utils/grid-aggregation-utils.d.ts +0 -30
  283. package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
  284. package/dist/utils/grid-aggregation-utils.js +0 -114
  285. package/dist/utils/prop-utils.d.ts.map +0 -1
  286. package/dist/utils/prop-utils.js +0 -28
  287. package/dist/utils/resource-utils.d.ts +0 -14
  288. package/dist/utils/resource-utils.d.ts.map +0 -1
  289. package/dist/utils/resource-utils.js +0 -38
  290. package/dist/utils/scale-utils.d.ts +0 -15
  291. package/dist/utils/scale-utils.d.ts.map +0 -1
  292. package/dist/utils/scale-utils.js +0 -184
  293. package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
  294. package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
  295. package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
  296. package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
  297. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
  298. package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
  299. package/src/grid-aggregation-layer.ts +0 -243
  300. package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
  301. package/src/utils/aggregation-operation-utils.ts +0 -118
  302. package/src/utils/bin-sorter.ts +0 -218
  303. package/src/utils/color-utils.ts +0 -57
  304. package/src/utils/cpu-aggregator.ts +0 -503
  305. package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
  306. package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
  307. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
  308. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
  309. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
  310. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
  311. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  312. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
  313. package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
  314. package/src/utils/grid-aggregation-utils.ts +0 -147
  315. package/src/utils/prop-utils.ts +0 -29
  316. package/src/utils/resource-utils.ts +0 -53
  317. package/src/utils/scale-utils.js +0 -219
  318. /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
@@ -1,22 +1,6 @@
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
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  import {
22
6
  CompositeLayer,
@@ -27,12 +11,13 @@ import {
27
11
  CompositeLayerProps,
28
12
  Attribute
29
13
  } from '@deck.gl/core';
30
- import {filterProps} from './utils/prop-utils';
14
+ import {filterProps} from '../common/utils/prop-utils';
31
15
 
32
16
  export type AggregationLayerProps<DataT> = CompositeLayerProps & {
33
17
  data: LayerDataSource<DataT>;
34
18
  };
35
19
 
20
+ /** Legacy AggregationLayer, to be removed in v9.1 */
36
21
  export default abstract class AggregationLayer<
37
22
  DataT,
38
23
  ExtraPropsT extends {} = {}
@@ -83,7 +68,7 @@ export default abstract class AggregationLayer<
83
68
  getModuleSettings() {
84
69
  // For regular layer draw this happens during draw cycle (_drawLayersInViewport) not during update cycle
85
70
  // For aggregation layers this is called during updateState to update aggregation data
86
- // NOTE: it is similar to LayerPass._getModuleParameters() but doesn't inlcude `effects` it is not needed for aggregation
71
+ // NOTE: it is similar to LayerPass._getShaderModuleProps() but doesn't inlcude `effects` it is not needed for aggregation
87
72
  const {viewport, mousePosition, device} = this.context;
88
73
  const moduleSettings = Object.assign(Object.create(this.props), {
89
74
  viewport,
@@ -0,0 +1,50 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {Texture} from '@luma.gl/core';
6
+ import type {ShaderModule} from '@luma.gl/shadertools';
7
+
8
+ const uniformBlock = `\
9
+ uniform weightUniforms {
10
+ vec4 commonBounds;
11
+ float radiusPixels;
12
+ float textureWidth;
13
+ float weightsScale;
14
+ } weight;
15
+ `;
16
+ export type WeightProps = {
17
+ commonBounds: [number, number, number, number];
18
+ radiusPixels: number;
19
+ textureWidth: number;
20
+ weightsScale: number;
21
+ weightsTexture: Texture;
22
+ };
23
+
24
+ export const weightUniforms = {
25
+ name: 'weight',
26
+ vs: uniformBlock,
27
+ uniformTypes: {
28
+ commonBounds: 'vec4<f32>',
29
+ radiusPixels: 'f32',
30
+ textureWidth: 'f32',
31
+ weightsScale: 'f32'
32
+ }
33
+ } as const satisfies ShaderModule<WeightProps>;
34
+
35
+ export type MaxWeightProps = {
36
+ inTexture: Texture;
37
+ textureSize: number;
38
+ };
39
+
40
+ export const maxWeightUniforms = {
41
+ name: 'maxWeight',
42
+ vs: `\
43
+ uniform maxWeightUniforms {
44
+ float textureSize;
45
+ } maxWeight;
46
+ `,
47
+ uniformTypes: {
48
+ textureSize: 'f32'
49
+ }
50
+ } as const satisfies ShaderModule<MaxWeightProps>;
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  export function getBounds(points: number[][]): number[] {
2
6
  // Now build bounding box in world space (aligned to world coordiante system)
3
7
  const x = points.map(p => p[0]);
@@ -38,7 +42,11 @@ export function packVertices(points: number[][], dimensions: number = 2): Float3
38
42
  }
39
43
 
40
44
  // Expands boundingBox:[xMin, yMin, xMax, yMax] to match aspect ratio of given width and height
41
- export function scaleToAspectRatio(boundingBox: number[], width: number, height: number): number[] {
45
+ export function scaleToAspectRatio(
46
+ boundingBox: [number, number, number, number],
47
+ width: number,
48
+ height: number
49
+ ): [number, number, number, number] {
42
50
  const [xMin, yMin, xMax, yMax] = boundingBox;
43
51
 
44
52
  const currentWidth = xMax - xMin;
@@ -1,22 +1,6 @@
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.
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  /* global setTimeout clearTimeout */
22
6
  import {
@@ -41,15 +25,22 @@ import {
41
25
  log,
42
26
  Position,
43
27
  UpdateParameters,
44
- DefaultProps
28
+ DefaultProps,
29
+ project32
45
30
  } from '@deck.gl/core';
46
31
  import TriangleLayer from './triangle-layer';
47
- import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';
48
- import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
32
+ import AggregationLayer, {AggregationLayerProps} from './aggregation-layer';
33
+ import {defaultColorRange, colorRangeToFlatArray} from '../common/utils/color-utils';
49
34
  import weightsVs from './weights-vs.glsl';
50
35
  import weightsFs from './weights-fs.glsl';
51
36
  import maxVs from './max-vs.glsl';
52
37
  import maxFs from './max-fs.glsl';
38
+ import {
39
+ MaxWeightProps,
40
+ maxWeightUniforms,
41
+ WeightProps,
42
+ weightUniforms
43
+ } from './heatmap-layer-uniforms';
53
44
 
54
45
  const RESOLUTION = 2; // (number of common space pixels) / (number texels)
55
46
  const TEXTURE_PROPS: TextureProps = {
@@ -201,6 +192,15 @@ export default class HeatmapLayer<
201
192
  viewportCorners: number[][];
202
193
  };
203
194
 
195
+ getShaders(shaders: any) {
196
+ let modules = [project32];
197
+ if (shaders.modules) {
198
+ modules = [...modules, ...shaders.modules];
199
+ }
200
+
201
+ return super.getShaders({...shaders, modules});
202
+ }
203
+
204
204
  initializeState() {
205
205
  super.initializeAggregationLayer(DIMENSIONS);
206
206
  this.setState({colorDomain: DEFAULT_COLOR_DOMAIN});
@@ -391,7 +391,7 @@ export default class HeatmapLayer<
391
391
  }
392
392
  }
393
393
 
394
- _createWeightsTransform(shaders: {vs: string; fs?: string}) {
394
+ _createWeightsTransform(shaders: {vs: string; fs?: string; modules: any[]}) {
395
395
  let {weightsTransform} = this.state;
396
396
  const {weightsTexture} = this.state;
397
397
  const attributeManager = this.getAttributeManager()!;
@@ -411,7 +411,8 @@ export default class HeatmapLayer<
411
411
  blendAlphaDstFactor: 'one'
412
412
  },
413
413
  topology: 'point-list',
414
- ...shaders
414
+ ...shaders,
415
+ modules: [...shaders.modules, weightUniforms]
415
416
  } as TextureTransformProps);
416
417
 
417
418
  this.setState({weightsTransform});
@@ -428,12 +429,14 @@ export default class HeatmapLayer<
428
429
  });
429
430
  this._createWeightsTransform(weightsTransformShaders);
430
431
 
431
- const maxWeightsTransformShaders = this.getShaders({vs: maxVs, fs: maxFs});
432
+ const maxWeightsTransformShaders = this.getShaders({
433
+ vs: maxVs,
434
+ fs: maxFs,
435
+ modules: [maxWeightUniforms]
436
+ });
432
437
  const maxWeightTransform = new TextureTransform(device, {
433
438
  id: `${this.id}-max-weights-transform`,
434
- bindings: {inTexture: weightsTexture},
435
- uniforms: {textureSize},
436
- targetTexture: maxWeightsTexture,
439
+ targetTexture: maxWeightsTexture!,
437
440
  ...maxWeightsTransformShaders,
438
441
  vertexCount: textureSize * textureSize,
439
442
  topology: 'point-list',
@@ -448,6 +451,11 @@ export default class HeatmapLayer<
448
451
  }
449
452
  });
450
453
 
454
+ const maxWeightProps: MaxWeightProps = {inTexture: weightsTexture!, textureSize};
455
+ maxWeightTransform.model.shaderInputs.setProps({
456
+ maxWeight: maxWeightProps
457
+ });
458
+
451
459
  this.setState({
452
460
  weightsTexture,
453
461
  maxWeightsTexture,
@@ -486,8 +494,8 @@ export default class HeatmapLayer<
486
494
  const viewportCorners = [
487
495
  viewport.unproject([0, 0]),
488
496
  viewport.unproject([viewport.width, 0]),
489
- viewport.unproject([viewport.width, viewport.height]),
490
- viewport.unproject([0, viewport.height])
497
+ viewport.unproject([0, viewport.height]),
498
+ viewport.unproject([viewport.width, viewport.height])
491
499
  ].map(p => p.map(Math.fround));
492
500
 
493
501
  // #1: get world bounds for current viewport extends
@@ -550,9 +558,10 @@ export default class HeatmapLayer<
550
558
 
551
559
  if (colorTexture && colorTexture?.width === colorRange.length) {
552
560
  // TODO(v9): Unclear whether `setSubImageData` is a public API, or what to use if not.
553
- (colorTexture as any).setSubImageData({data: colors});
561
+ (colorTexture as any).setTexture2DData({data: colors});
554
562
  } else {
555
563
  colorTexture?.destroy();
564
+ // @ts-expect-error TODO(ib) - texture API change
556
565
  colorTexture = this.context.device.createTexture({
557
566
  ...TEXTURE_PROPS,
558
567
  data: colors,
@@ -565,7 +574,7 @@ export default class HeatmapLayer<
565
574
 
566
575
  _updateWeightmap() {
567
576
  const {radiusPixels, colorDomain, aggregation} = this.props;
568
- const {worldBounds, textureSize, weightsScale} = this.state;
577
+ const {worldBounds, textureSize, weightsScale, weightsTexture} = this.state;
569
578
  const weightsTransform = this.state.weightsTransform!;
570
579
  this.state.isWeightMapDirty = false;
571
580
 
@@ -588,11 +597,22 @@ export default class HeatmapLayer<
588
597
  const attributeManager = this.getAttributeManager()!;
589
598
  const attributes = attributeManager.getAttributes();
590
599
  const moduleSettings = this.getModuleSettings();
591
- const uniforms = {radiusPixels, commonBounds, textureWidth: textureSize, weightsScale};
592
600
  this._setModelAttributes(weightsTransform.model, attributes);
593
601
  weightsTransform.model.setVertexCount(this.getNumInstances());
594
- weightsTransform.model.setUniforms(uniforms);
595
- weightsTransform.model.updateModuleSettings(moduleSettings);
602
+
603
+ const weightProps: WeightProps = {
604
+ radiusPixels,
605
+ commonBounds,
606
+ textureWidth: textureSize,
607
+ weightsScale,
608
+ weightsTexture: weightsTexture!
609
+ };
610
+ const {viewport, devicePixelRatio, coordinateSystem, coordinateOrigin} = moduleSettings;
611
+ const {modelMatrix} = this.props;
612
+ weightsTransform.model.shaderInputs.setProps({
613
+ project: {viewport, devicePixelRatio, modelMatrix, coordinateSystem, coordinateOrigin},
614
+ weight: weightProps
615
+ });
596
616
  weightsTransform.run({
597
617
  parameters: {viewport: [0, 0, textureSize, textureSize]},
598
618
  clearColor: [0, 0, 0, 0]
@@ -623,7 +643,10 @@ export default class HeatmapLayer<
623
643
  // input: worldBounds: [minLong, minLat, maxLong, maxLat]
624
644
  // input: opts.useLayerCoordinateSystem : layers coordiante system is used
625
645
  // optput: commonBounds: [minX, minY, maxX, maxY] scaled to fit the current texture
626
- _worldToCommonBounds(worldBounds, opts: {useLayerCoordinateSystem?: boolean} = {}) {
646
+ _worldToCommonBounds(
647
+ worldBounds,
648
+ opts: {useLayerCoordinateSystem?: boolean} = {}
649
+ ): [number, number, number, number] {
627
650
  const {useLayerCoordinateSystem = false} = opts;
628
651
  const [minLong, minLat, maxLong, maxLat] = worldBounds;
629
652
  const {viewport} = this.context;
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  export default `\
2
6
  #version 300 es
3
7
  in vec4 outTexture;
@@ -1,15 +1,18 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  export default `\
2
6
  #version 300 es
3
7
  uniform sampler2D inTexture;
4
- uniform float textureSize;
5
8
  out vec4 outTexture;
6
9
 
7
10
  void main()
8
11
  {
9
12
  // Sample every pixel in texture
10
- int yIndex = gl_VertexID / int(textureSize);
11
- int xIndex = gl_VertexID - (yIndex * int(textureSize));
12
- vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
13
+ int yIndex = gl_VertexID / int(maxWeight.textureSize);
14
+ int xIndex = gl_VertexID - (yIndex * int(maxWeight.textureSize));
15
+ vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / maxWeight.textureSize;
13
16
  outTexture = texture(inTexture, uv);
14
17
 
15
18
  gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
@@ -1,22 +1,6 @@
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
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  export default `\
22
6
  #version 300 es
@@ -24,10 +8,8 @@ export default `\
24
8
 
25
9
  precision highp float;
26
10
 
27
- uniform float opacity;
28
11
  uniform sampler2D weightsTexture;
29
12
  uniform sampler2D colorTexture;
30
- uniform float aggregationMode;
31
13
 
32
14
  in vec2 vTexCoords;
33
15
  in float vIntensityMin;
@@ -46,7 +28,7 @@ void main(void) {
46
28
  vec4 weights = texture(weightsTexture, vTexCoords);
47
29
  float weight = weights.r;
48
30
 
49
- if (aggregationMode > 0.5) {
31
+ if (triangle.aggregationMode > 0.5) {
50
32
  weight /= max(1.0, weights.a);
51
33
  }
52
34
 
@@ -56,7 +38,7 @@ void main(void) {
56
38
  }
57
39
 
58
40
  vec4 linearColor = getLinearColor(weight);
59
- linearColor.a *= opacity;
41
+ linearColor.a *= layer.opacity;
60
42
  fragColor = linearColor;
61
43
  }
62
44
  `;
@@ -0,0 +1,37 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {Texture} from '@luma.gl/core';
6
+ import type {ShaderModule} from '@luma.gl/shadertools';
7
+
8
+ const uniformBlock = `\
9
+ uniform triangleUniforms {
10
+ float aggregationMode;
11
+ vec2 colorDomain;
12
+ float intensity;
13
+ float threshold;
14
+ } triangle;
15
+ `;
16
+
17
+ export type TriangleProps = {
18
+ aggregationMode: number;
19
+ colorDomain: [number, number];
20
+ intensity: number;
21
+ threshold: number;
22
+ colorTexture: Texture;
23
+ maxTexture: Texture;
24
+ weightsTexture: Texture;
25
+ };
26
+
27
+ export const triangleUniforms = {
28
+ name: 'triangle',
29
+ vs: uniformBlock,
30
+ fs: uniformBlock,
31
+ uniformTypes: {
32
+ aggregationMode: 'f32',
33
+ colorDomain: 'vec2<f32>',
34
+ intensity: 'f32',
35
+ threshold: 'f32'
36
+ }
37
+ } as const satisfies ShaderModule<TriangleProps>;
@@ -1,22 +1,6 @@
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
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  // Inspired by screen-grid-layer vertex shader in deck.gl
22
6
 
@@ -25,10 +9,6 @@ export default `\
25
9
  #define SHADER_NAME heatp-map-layer-vertex-shader
26
10
 
27
11
  uniform sampler2D maxTexture;
28
- uniform float intensity;
29
- uniform vec2 colorDomain;
30
- uniform float threshold;
31
- uniform float aggregationMode;
32
12
 
33
13
  in vec3 positions;
34
14
  in vec2 texCoords;
@@ -41,14 +21,14 @@ void main(void) {
41
21
  gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
42
22
  vTexCoords = texCoords;
43
23
  vec4 maxTexture = texture(maxTexture, vec2(0.5));
44
- float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
45
- float minValue = maxValue * threshold;
46
- if (colorDomain[1] > 0.) {
24
+ float maxValue = triangle.aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
25
+ float minValue = maxValue * triangle.threshold;
26
+ if (triangle.colorDomain[1] > 0.) {
47
27
  // if user specified custom domain use it.
48
- maxValue = colorDomain[1];
49
- minValue = colorDomain[0];
28
+ maxValue = triangle.colorDomain[1];
29
+ minValue = triangle.colorDomain[0];
50
30
  }
51
- vIntensityMax = intensity / maxValue;
52
- vIntensityMin = intensity / minValue;
31
+ vIntensityMax = triangle.intensity / maxValue;
32
+ vIntensityMin = triangle.intensity / minValue;
53
33
  }
54
34
  `;
@@ -1,33 +1,18 @@
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.
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  import type {Buffer, Device, Texture} from '@luma.gl/core';
22
6
  import {Model} from '@luma.gl/engine';
23
7
  import {Layer, LayerContext, project32} from '@deck.gl/core';
24
8
  import vs from './triangle-layer-vertex.glsl';
25
9
  import fs from './triangle-layer-fragment.glsl';
10
+ import {TriangleProps, triangleUniforms} from './triangle-layer-uniforms';
26
11
 
27
12
  type _TriangleLayerProps = {
28
13
  data: {attributes: {positions: Buffer; texCoords: Buffer}};
29
- colorDomain: number[];
30
- aggregationMode: string;
14
+ colorDomain: [number, number];
15
+ aggregationMode: number;
31
16
  threshold: number;
32
17
  intensity: number;
33
18
  vertexCount: number;
@@ -46,7 +31,7 @@ export default class TriangleLayer extends Layer<_TriangleLayerProps> {
46
31
  };
47
32
 
48
33
  getShaders() {
49
- return {vs, fs, modules: [project32]};
34
+ return super.getShaders({vs, fs, modules: [project32, triangleUniforms]});
50
35
  }
51
36
 
52
37
  initializeState({device}: LayerContext): void {
@@ -54,32 +39,42 @@ export default class TriangleLayer extends Layer<_TriangleLayerProps> {
54
39
  }
55
40
 
56
41
  _getModel(device: Device): Model {
57
- const {vertexCount, data, weightsTexture, maxTexture, colorTexture} = this.props;
42
+ const {vertexCount, data} = this.props;
58
43
 
59
44
  return new Model(device, {
60
45
  ...this.getShaders(),
61
46
  id: this.props.id,
62
- bindings: {weightsTexture, maxTexture, colorTexture},
63
47
  attributes: data.attributes,
64
48
  bufferLayout: [
65
49
  {name: 'positions', format: 'float32x3'},
66
50
  {name: 'texCoords', format: 'float32x2'}
67
51
  ],
68
- topology: 'triangle-fan-webgl',
52
+ topology: 'triangle-strip',
69
53
  vertexCount
70
54
  });
71
55
  }
72
56
 
73
- draw({uniforms}): void {
57
+ draw(): void {
74
58
  const {model} = this.state;
75
- const {intensity, threshold, aggregationMode, colorDomain} = this.props;
76
- model.setUniforms({
77
- ...uniforms,
59
+ const {
60
+ aggregationMode,
61
+ colorDomain,
78
62
  intensity,
79
63
  threshold,
64
+ colorTexture,
65
+ maxTexture,
66
+ weightsTexture
67
+ } = this.props;
68
+ const triangleProps: TriangleProps = {
80
69
  aggregationMode,
81
- colorDomain
82
- });
70
+ colorDomain,
71
+ intensity,
72
+ threshold,
73
+ colorTexture,
74
+ maxTexture,
75
+ weightsTexture
76
+ };
77
+ model.shaderInputs.setProps({triangle: triangleProps});
83
78
  model.draw(this.context.renderPass);
84
79
  }
85
80
  }
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  export default `\
2
6
  #version 300 es
3
7
  in vec4 weightsTexture;
@@ -1,25 +1,25 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  export default `\
2
6
  #version 300 es
3
7
  in vec3 positions;
4
8
  in vec3 positions64Low;
5
9
  in float weights;
6
10
  out vec4 weightsTexture;
7
- uniform float radiusPixels;
8
- uniform float textureWidth;
9
- uniform vec4 commonBounds;
10
- uniform float weightsScale;
11
11
 
12
12
  void main()
13
13
  {
14
- weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
14
+ weightsTexture = vec4(weights * weight.weightsScale, 0., 0., 1.);
15
15
 
16
- float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
16
+ float radiusTexels = project_pixel_size(weight.radiusPixels) * weight.textureWidth / (weight.commonBounds.z - weight.commonBounds.x);
17
17
  gl_PointSize = radiusTexels * 2.;
18
18
 
19
19
  vec3 commonPosition = project_position(positions, positions64Low);
20
20
 
21
21
  // // map xy from commonBounds to [-1, 1]
22
- gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
22
+ gl_Position.xy = (commonPosition.xy - weight.commonBounds.xy) / (weight.commonBounds.zw - weight.commonBounds.xy) ;
23
23
  gl_Position.xy = (gl_Position.xy * 2.) - (1.);
24
24
  gl_Position.w = 1.0;
25
25
  }
@@ -0,0 +1,27 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderModule} from '@luma.gl/shadertools';
6
+ import {NumberArray2} from '@math.gl/core';
7
+
8
+ const uniformBlock = /* glsl */ `\
9
+ uniform binOptionsUniforms {
10
+ vec2 hexOriginCommon;
11
+ float radiusCommon;
12
+ } binOptions;
13
+ `;
14
+
15
+ export type BinOptions = {
16
+ hexOriginCommon: NumberArray2;
17
+ radiusCommon: number;
18
+ };
19
+
20
+ export const binOptionsUniforms = {
21
+ name: 'binOptions',
22
+ vs: uniformBlock,
23
+ uniformTypes: {
24
+ hexOriginCommon: 'vec2<f32>',
25
+ radiusCommon: 'f32'
26
+ }
27
+ } as const satisfies ShaderModule<BinOptions>;