@antv/l7-layers 2.20.5 → 2.20.8

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 (447) hide show
  1. package/es/canvas/index.d.ts +3 -3
  2. package/es/citybuliding/models/build.d.ts +7 -12
  3. package/es/citybuliding/models/build.js +22 -11
  4. package/es/citybuliding/shaders/build_frag.glsl +26 -23
  5. package/es/citybuliding/shaders/build_vert.glsl +24 -16
  6. package/es/core/BaseLayer.d.ts +14 -2
  7. package/es/core/BaseLayer.js +53 -9
  8. package/es/core/BaseModel.d.ts +1 -1
  9. package/es/core/BaseModel.js +41 -15
  10. package/es/core/CommonStyleAttribute.d.ts +4 -2
  11. package/es/core/CommonStyleAttribute.js +3 -0
  12. package/es/core/LayerPickService.d.ts +1 -1
  13. package/es/core/TextureService.d.ts +2 -2
  14. package/es/core/interface.d.ts +7 -3
  15. package/es/core/interface.js +0 -1
  16. package/es/core/line_trangluation.d.ts +1 -1
  17. package/es/core/shape/arrow.d.ts +1 -1
  18. package/es/core/shape/extrude.d.ts +1 -1
  19. package/es/core/triangulation.d.ts +1 -1
  20. package/es/core/triangulation.js +13 -7
  21. package/es/core/utils.js +1 -1
  22. package/es/earth/index.d.ts +1 -1
  23. package/es/earth/models/atmosphere.d.ts +8 -2
  24. package/es/earth/models/atmosphere.js +15 -8
  25. package/es/earth/models/base.d.ts +8 -2
  26. package/es/earth/models/base.js +21 -12
  27. package/es/earth/models/bloomsphere.d.ts +8 -2
  28. package/es/earth/models/bloomsphere.js +15 -8
  29. package/es/earth/shaders/{atmosphere_frag.glsl → atmosphere/atmosphere_frag.glsl} +9 -6
  30. package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +22 -0
  31. package/es/earth/shaders/base/base_frag.glsl +11 -0
  32. package/es/earth/shaders/base/base_vert.glsl +52 -0
  33. package/es/earth/shaders/bloomshpere/bloomsphere_frag.glsl +16 -0
  34. package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +19 -0
  35. package/es/geometry/index.d.ts +2 -2
  36. package/es/geometry/models/billboard.d.ts +8 -1
  37. package/es/geometry/models/billboard.js +26 -11
  38. package/es/geometry/models/plane.d.ts +8 -1
  39. package/es/geometry/models/plane.js +23 -6
  40. package/es/geometry/models/sprite.d.ts +12 -2
  41. package/es/geometry/models/sprite.js +44 -18
  42. package/es/geometry/shaders/billboard_frag.glsl +11 -6
  43. package/es/geometry/shaders/billboard_vert.glsl +12 -15
  44. package/es/geometry/shaders/plane_frag.glsl +14 -10
  45. package/es/geometry/shaders/plane_vert.glsl +11 -10
  46. package/es/geometry/shaders/sprite_frag.glsl +11 -7
  47. package/es/geometry/shaders/sprite_vert.glsl +10 -9
  48. package/es/heatmap/index.d.ts +3 -3
  49. package/es/heatmap/models/grid.d.ts +8 -1
  50. package/es/heatmap/models/grid.js +25 -12
  51. package/es/heatmap/models/grid3d.d.ts +8 -1
  52. package/es/heatmap/models/grid3d.js +29 -13
  53. package/es/heatmap/models/heatmap.d.ts +6 -4
  54. package/es/heatmap/models/heatmap.js +123 -75
  55. package/es/heatmap/models/hexagon.d.ts +8 -1
  56. package/es/heatmap/models/hexagon.js +25 -12
  57. package/es/heatmap/shaders/grid/grid_frag.glsl +8 -0
  58. package/es/heatmap/shaders/{grid_vert.glsl → grid/grid_vert.glsl} +15 -15
  59. package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +8 -0
  60. package/{lib/heatmap/shaders/hexagon_3d_vert.glsl → es/heatmap/shaders/grid3d/grid_3d_vert.glsl} +13 -16
  61. package/es/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +24 -0
  62. package/es/heatmap/shaders/{heatmap_3d_vert.glsl → heatmap/heatmap_3d_vert.glsl} +19 -9
  63. package/es/heatmap/shaders/heatmap/heatmap_frag.glsl +52 -0
  64. package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +16 -0
  65. package/{lib/heatmap/shaders → es/heatmap/shaders/heatmap}/heatmap_framebuffer_vert.glsl +14 -9
  66. package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +19 -0
  67. package/es/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
  68. package/es/heatmap/shaders/{hexagon_vert.glsl → hexagon/hexagon_vert.glsl} +12 -13
  69. package/es/image/index.d.ts +2 -2
  70. package/es/image/models/image.d.ts +9 -2
  71. package/es/image/models/image.js +83 -44
  72. package/es/image/shaders/image_frag.glsl +34 -7
  73. package/es/image/shaders/image_vert.glsl +11 -5
  74. package/es/line/index.d.ts +4 -4
  75. package/es/line/index.js +2 -1
  76. package/es/line/models/arc.d.ts +8 -3
  77. package/es/line/models/arc.js +57 -76
  78. package/es/line/models/arc_3d.d.ts +8 -3
  79. package/es/line/models/arc_3d.js +46 -57
  80. package/es/line/models/flow.d.ts +8 -2
  81. package/es/line/models/flow.js +14 -12
  82. package/es/line/models/great_circle.d.ts +8 -3
  83. package/es/line/models/great_circle.js +40 -29
  84. package/es/line/models/index.d.ts +1 -1
  85. package/es/line/models/index.js +3 -6
  86. package/es/line/models/line.d.ts +8 -3
  87. package/es/line/models/line.js +67 -140
  88. package/es/line/models/{simpleLine.d.ts → simple_line.d.ts} +8 -2
  89. package/es/line/models/simple_line.js +204 -0
  90. package/es/line/models/wall.d.ts +8 -3
  91. package/es/line/models/wall.js +35 -27
  92. package/es/line/shaders/{line_arc_frag.glsl → arc/line_arc_frag.glsl} +36 -26
  93. package/es/line/shaders/{line_arc_vert.glsl → arc/line_arc_vert.glsl} +52 -22
  94. package/es/line/shaders/{line_arc_3d_frag.glsl → arc3d/line_arc_3d_frag.glsl} +32 -24
  95. package/{lib/line/shaders → es/line/shaders/arc3d}/line_arc_3d_vert.glsl +37 -27
  96. package/es/line/shaders/flow/flow_line_frag.glsl +5 -4
  97. package/es/line/shaders/flow/flow_line_vert.glsl +17 -18
  98. package/es/line/shaders/{line_arc_great_circle_frag.glsl → greatCircle/line_arc_great_circle_frag.glsl} +30 -30
  99. package/{lib/line/shaders → es/line/shaders/greatCircle}/line_arc_great_circle_vert.glsl +43 -40
  100. package/es/line/shaders/{line_frag.glsl → line/line_frag.glsl} +55 -28
  101. package/es/line/shaders/line/line_vert.glsl +114 -0
  102. package/es/line/shaders/simple/simpleline_frag.glsl +27 -3
  103. package/es/line/shaders/simple/simpleline_vert.glsl +20 -20
  104. package/es/line/shaders/wall/wall_frag.glsl +31 -26
  105. package/es/line/shaders/wall/wall_vert.glsl +29 -22
  106. package/es/mask/index.d.ts +2 -2
  107. package/es/mask/models/fill.d.ts +1 -1
  108. package/es/plugins/DataMappingPlugin.d.ts +1 -1
  109. package/es/plugins/DataMappingPlugin.js +1 -3
  110. package/es/plugins/DataSourcePlugin.d.ts +1 -1
  111. package/es/plugins/FeatureScalePlugin.d.ts +1 -1
  112. package/es/plugins/FeatureScalePlugin.js +14 -3
  113. package/es/plugins/LayerAnimateStylePlugin.d.ts +1 -1
  114. package/es/plugins/LayerMaskPlugin.d.ts +1 -1
  115. package/es/plugins/LayerModelPlugin.d.ts +1 -1
  116. package/es/plugins/LayerStylePlugin.d.ts +1 -1
  117. package/es/plugins/LightingPlugin.d.ts +1 -1
  118. package/es/plugins/MultiPassRendererPlugin.d.ts +1 -1
  119. package/es/plugins/PixelPickingPlugin.d.ts +6 -2
  120. package/es/plugins/PixelPickingPlugin.js +36 -49
  121. package/es/plugins/RegisterStyleAttributePlugin.d.ts +1 -1
  122. package/es/plugins/ShaderUniformPlugin.d.ts +1 -1
  123. package/es/plugins/ShaderUniformPlugin.js +11 -6
  124. package/es/plugins/UpdateModelPlugin.d.ts +1 -1
  125. package/es/plugins/UpdateStyleAttributePlugin.d.ts +1 -1
  126. package/es/point/index.d.ts +2 -2
  127. package/es/point/index.js +1 -0
  128. package/es/point/models/billboard_point.d.ts +9 -3
  129. package/es/point/models/billboard_point.js +18 -18
  130. package/es/point/models/earthExtrude.d.ts +7 -12
  131. package/es/point/models/earthExtrude.js +21 -13
  132. package/es/point/models/earthFill.d.ts +8 -3
  133. package/es/point/models/earthFill.js +18 -30
  134. package/es/point/models/extrude.d.ts +1 -4
  135. package/es/point/models/extrude.js +2 -11
  136. package/es/point/models/fill.d.ts +8 -2
  137. package/es/point/models/fill.js +33 -84
  138. package/es/point/models/{fillmage.d.ts → fillImage.d.ts} +8 -2
  139. package/es/point/models/{fillmage.js → fillImage.js} +23 -15
  140. package/es/point/models/image.d.ts +8 -1
  141. package/es/point/models/image.js +31 -17
  142. package/es/point/models/index.js +1 -1
  143. package/es/point/models/normal.d.ts +9 -3
  144. package/es/point/models/normal.js +13 -30
  145. package/es/point/models/radar.d.ts +8 -2
  146. package/es/point/models/radar.js +23 -45
  147. package/es/point/models/text.d.ts +9 -2
  148. package/es/point/models/text.js +31 -32
  149. package/{lib/point/shaders → es/point/shaders/billboard}/billboard_point_frag.glsl +17 -13
  150. package/{lib/point/shaders → es/point/shaders/billboard}/billboard_point_vert.glsl +13 -14
  151. package/es/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
  152. package/{lib/point/shaders/earth/extrude_vert.glsl → es/point/shaders/earthExtrude/earthExtrude_vert.glsl} +25 -22
  153. package/{lib/point/shaders/earth/fill_frag.glsl → es/point/shaders/earthFill/earthFill_frag.glsl} +20 -18
  154. package/{lib/point/shaders/earth/fill_vert.glsl → es/point/shaders/earthFill/earthFill_vert.glsl} +17 -22
  155. package/es/point/shaders/extrude/extrude_vert.glsl +0 -3
  156. package/{lib/point/shaders → es/point/shaders/fill}/fill_frag.glsl +18 -1
  157. package/es/point/shaders/{fill_vert.glsl → fill/fill_vert.glsl} +5 -4
  158. package/es/point/shaders/fillImage/fillImage_frag.glsl +24 -0
  159. package/{lib/point/shaders/image → es/point/shaders/fillImage}/fillImage_vert.glsl +15 -17
  160. package/es/point/shaders/image/image_frag.glsl +42 -0
  161. package/{lib/point/shaders → es/point/shaders/image}/image_vert.glsl +14 -13
  162. package/es/point/shaders/radar/radar_frag.glsl +19 -14
  163. package/es/point/shaders/radar/radar_vert.glsl +21 -24
  164. package/es/point/shaders/text/text_frag.glsl +44 -0
  165. package/es/point/shaders/{text_vert.glsl → text/text_vert.glsl} +19 -17
  166. package/es/point/shape/extrude.d.ts +1 -1
  167. package/es/polygon/index.d.ts +2 -2
  168. package/es/polygon/models/extrude.d.ts +9 -9
  169. package/es/polygon/models/extrude.js +38 -15
  170. package/es/polygon/models/extrusion.d.ts +8 -1
  171. package/es/polygon/models/extrusion.js +24 -7
  172. package/es/polygon/models/fill.d.ts +9 -4
  173. package/es/polygon/models/fill.js +26 -13
  174. package/es/polygon/models/ocean.d.ts +9 -7
  175. package/es/polygon/models/ocean.js +30 -14
  176. package/es/polygon/models/water.d.ts +9 -4
  177. package/es/polygon/models/water.js +26 -10
  178. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +14 -14
  179. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +17 -15
  180. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +18 -18
  181. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +18 -24
  182. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +19 -15
  183. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +20 -24
  184. package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +4 -8
  185. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +7 -16
  186. package/es/polygon/shaders/fill/fill_frag.glsl +7 -0
  187. package/es/polygon/shaders/fill/fill_linear_frag.glsl +20 -0
  188. package/{lib/polygon/shaders/polygon_linear_vert.glsl → es/polygon/shaders/fill/fill_linear_vert.glsl} +12 -11
  189. package/es/polygon/shaders/{polygon_vert.glsl → fill/fill_vert.glsl} +6 -6
  190. package/es/polygon/shaders/{water/polygon_ocean_frag.glsl → ocean/ocean_frag.glsl} +13 -13
  191. package/es/polygon/shaders/ocean/ocean_vert.glsl +22 -0
  192. package/es/polygon/shaders/water/polygon_water_frag.glsl +14 -12
  193. package/es/polygon/shaders/water/polygon_water_vert.glsl +10 -10
  194. package/es/raster/buffers/triangulation.d.ts +1 -1
  195. package/es/raster/index.d.ts +2 -2
  196. package/es/raster/models/raster.d.ts +9 -8
  197. package/es/raster/models/raster.js +54 -38
  198. package/es/raster/models/rasterRgb.d.ts +9 -7
  199. package/es/raster/models/rasterRgb.js +36 -19
  200. package/es/raster/models/rasterTerrainRgb.d.ts +1 -1
  201. package/es/raster/models/rasterTerrainRgb.js +2 -2
  202. package/es/raster/shaders/raster/raster_2d_frag.glsl +34 -0
  203. package/es/raster/shaders/raster/raster_2d_vert.glsl +21 -0
  204. package/es/raster/shaders/rgb/raster_rgb_frag.glsl +26 -0
  205. package/es/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
  206. package/es/tile/core/BaseLayer.d.ts +2 -2
  207. package/es/tile/core/TileDebugLayer.d.ts +1 -1
  208. package/es/tile/interaction/getRasterData.d.ts +2 -2
  209. package/es/tile/interaction/utils.d.ts +1 -1
  210. package/es/tile/interface.d.ts +2 -2
  211. package/es/tile/service/TileLayerService.d.ts +2 -2
  212. package/es/tile/service/TilePickService.d.ts +2 -2
  213. package/es/tile/service/TileSourceService.d.ts +1 -1
  214. package/es/tile/tile/Tile.d.ts +2 -3
  215. package/es/tile/tile/VectorTile.d.ts +1 -1
  216. package/es/tile/tile/index.d.ts +1 -1
  217. package/es/tile/utils/constants.js +1 -1
  218. package/es/tile/utils/utils.d.ts +1 -1
  219. package/es/utils/blend.d.ts +1 -1
  220. package/es/utils/multiPassRender.d.ts +1 -1
  221. package/es/utils/stencil.d.ts +1 -1
  222. package/es/wind/index.d.ts +3 -3
  223. package/es/wind/models/wind.d.ts +1 -1
  224. package/lib/citybuliding/models/build.js +22 -11
  225. package/lib/citybuliding/shaders/build_frag.glsl +26 -23
  226. package/lib/citybuliding/shaders/build_vert.glsl +24 -16
  227. package/lib/core/BaseLayer.js +53 -9
  228. package/lib/core/BaseModel.js +41 -15
  229. package/lib/core/CommonStyleAttribute.js +3 -0
  230. package/lib/core/triangulation.js +12 -6
  231. package/lib/core/utils.js +1 -1
  232. package/lib/earth/models/atmosphere.js +15 -8
  233. package/lib/earth/models/base.js +21 -12
  234. package/lib/earth/models/bloomsphere.js +15 -8
  235. package/lib/earth/shaders/{atmosphere_frag.glsl → atmosphere/atmosphere_frag.glsl} +9 -6
  236. package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +22 -0
  237. package/lib/earth/shaders/base/base_frag.glsl +11 -0
  238. package/lib/earth/shaders/base/base_vert.glsl +52 -0
  239. package/lib/earth/shaders/bloomshpere/bloomsphere_frag.glsl +16 -0
  240. package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +19 -0
  241. package/lib/geometry/models/billboard.js +26 -11
  242. package/lib/geometry/models/plane.js +23 -6
  243. package/lib/geometry/models/sprite.js +44 -18
  244. package/lib/geometry/shaders/billboard_frag.glsl +11 -6
  245. package/lib/geometry/shaders/billboard_vert.glsl +12 -15
  246. package/lib/geometry/shaders/plane_frag.glsl +14 -10
  247. package/lib/geometry/shaders/plane_vert.glsl +11 -10
  248. package/lib/geometry/shaders/sprite_frag.glsl +11 -7
  249. package/lib/geometry/shaders/sprite_vert.glsl +10 -9
  250. package/lib/heatmap/models/grid.js +25 -12
  251. package/lib/heatmap/models/grid3d.js +29 -13
  252. package/lib/heatmap/models/heatmap.js +122 -74
  253. package/lib/heatmap/models/hexagon.js +25 -12
  254. package/lib/heatmap/shaders/grid/grid_frag.glsl +8 -0
  255. package/lib/heatmap/shaders/{grid_vert.glsl → grid/grid_vert.glsl} +15 -15
  256. package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +8 -0
  257. package/{es/heatmap/shaders/hexagon_3d_vert.glsl → lib/heatmap/shaders/grid3d/grid_3d_vert.glsl} +13 -16
  258. package/lib/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +24 -0
  259. package/lib/heatmap/shaders/{heatmap_3d_vert.glsl → heatmap/heatmap_3d_vert.glsl} +19 -9
  260. package/lib/heatmap/shaders/heatmap/heatmap_frag.glsl +52 -0
  261. package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +16 -0
  262. package/{es/heatmap/shaders → lib/heatmap/shaders/heatmap}/heatmap_framebuffer_vert.glsl +14 -9
  263. package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +19 -0
  264. package/lib/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
  265. package/lib/heatmap/shaders/{hexagon_vert.glsl → hexagon/hexagon_vert.glsl} +12 -13
  266. package/lib/image/models/image.js +83 -44
  267. package/lib/image/shaders/image_frag.glsl +34 -7
  268. package/lib/image/shaders/image_vert.glsl +11 -5
  269. package/lib/line/index.js +2 -1
  270. package/lib/line/models/arc.js +57 -76
  271. package/lib/line/models/arc_3d.js +47 -59
  272. package/lib/line/models/flow.js +14 -12
  273. package/lib/line/models/great_circle.js +40 -29
  274. package/lib/line/models/index.js +4 -7
  275. package/lib/line/models/line.js +67 -142
  276. package/lib/line/models/{simpleLine.js → simple_line.js} +84 -74
  277. package/lib/line/models/wall.js +35 -27
  278. package/lib/line/shaders/{line_arc_frag.glsl → arc/line_arc_frag.glsl} +36 -26
  279. package/lib/line/shaders/{line_arc_vert.glsl → arc/line_arc_vert.glsl} +52 -22
  280. package/lib/line/shaders/{line_arc_3d_frag.glsl → arc3d/line_arc_3d_frag.glsl} +32 -24
  281. package/{es/line/shaders → lib/line/shaders/arc3d}/line_arc_3d_vert.glsl +37 -27
  282. package/lib/line/shaders/flow/flow_line_frag.glsl +5 -4
  283. package/lib/line/shaders/flow/flow_line_vert.glsl +17 -18
  284. package/lib/line/shaders/{line_arc_great_circle_frag.glsl → greatCircle/line_arc_great_circle_frag.glsl} +30 -30
  285. package/{es/line/shaders → lib/line/shaders/greatCircle}/line_arc_great_circle_vert.glsl +43 -40
  286. package/lib/line/shaders/{line_frag.glsl → line/line_frag.glsl} +55 -28
  287. package/lib/line/shaders/line/line_vert.glsl +114 -0
  288. package/lib/line/shaders/simple/simpleline_frag.glsl +27 -3
  289. package/lib/line/shaders/simple/simpleline_vert.glsl +20 -20
  290. package/lib/line/shaders/wall/wall_frag.glsl +31 -26
  291. package/lib/line/shaders/wall/wall_vert.glsl +29 -22
  292. package/lib/plugins/DataMappingPlugin.js +1 -3
  293. package/lib/plugins/FeatureScalePlugin.js +14 -3
  294. package/lib/plugins/PixelPickingPlugin.js +35 -48
  295. package/lib/plugins/ShaderUniformPlugin.js +11 -6
  296. package/lib/point/index.js +1 -0
  297. package/lib/point/models/billboard_point.js +18 -18
  298. package/lib/point/models/earthExtrude.js +21 -13
  299. package/lib/point/models/earthFill.js +18 -30
  300. package/lib/point/models/extrude.js +2 -11
  301. package/lib/point/models/fill.js +33 -84
  302. package/lib/point/models/{fillmage.js → fillImage.js} +24 -17
  303. package/lib/point/models/image.js +31 -17
  304. package/lib/point/models/index.js +2 -2
  305. package/lib/point/models/normal.js +13 -30
  306. package/lib/point/models/radar.js +23 -45
  307. package/lib/point/models/text.js +31 -32
  308. package/{es/point/shaders → lib/point/shaders/billboard}/billboard_point_frag.glsl +17 -13
  309. package/{es/point/shaders → lib/point/shaders/billboard}/billboard_point_vert.glsl +13 -14
  310. package/lib/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
  311. package/{es/point/shaders/earth/extrude_vert.glsl → lib/point/shaders/earthExtrude/earthExtrude_vert.glsl} +25 -22
  312. package/{es/point/shaders/earth/fill_frag.glsl → lib/point/shaders/earthFill/earthFill_frag.glsl} +20 -18
  313. package/{es/point/shaders/earth/fill_vert.glsl → lib/point/shaders/earthFill/earthFill_vert.glsl} +17 -22
  314. package/lib/point/shaders/extrude/extrude_vert.glsl +0 -3
  315. package/{es/point/shaders → lib/point/shaders/fill}/fill_frag.glsl +18 -1
  316. package/lib/point/shaders/{fill_vert.glsl → fill/fill_vert.glsl} +5 -4
  317. package/lib/point/shaders/fillImage/fillImage_frag.glsl +24 -0
  318. package/{es/point/shaders/image → lib/point/shaders/fillImage}/fillImage_vert.glsl +15 -17
  319. package/lib/point/shaders/image/image_frag.glsl +42 -0
  320. package/{es/point/shaders → lib/point/shaders/image}/image_vert.glsl +14 -13
  321. package/lib/point/shaders/radar/radar_frag.glsl +19 -14
  322. package/lib/point/shaders/radar/radar_vert.glsl +21 -24
  323. package/lib/point/shaders/text/text_frag.glsl +44 -0
  324. package/lib/point/shaders/{text_vert.glsl → text/text_vert.glsl} +19 -17
  325. package/lib/polygon/models/extrude.js +38 -15
  326. package/lib/polygon/models/extrusion.js +24 -7
  327. package/lib/polygon/models/fill.js +26 -13
  328. package/lib/polygon/models/ocean.js +30 -14
  329. package/lib/polygon/models/water.js +26 -10
  330. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +14 -14
  331. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +17 -15
  332. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +18 -18
  333. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +18 -24
  334. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +19 -15
  335. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +20 -24
  336. package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +4 -8
  337. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +7 -16
  338. package/lib/polygon/shaders/fill/fill_frag.glsl +7 -0
  339. package/lib/polygon/shaders/fill/fill_linear_frag.glsl +20 -0
  340. package/{es/polygon/shaders/polygon_linear_vert.glsl → lib/polygon/shaders/fill/fill_linear_vert.glsl} +12 -11
  341. package/lib/polygon/shaders/{polygon_vert.glsl → fill/fill_vert.glsl} +6 -6
  342. package/lib/polygon/shaders/{water/polygon_ocean_frag.glsl → ocean/ocean_frag.glsl} +13 -13
  343. package/lib/polygon/shaders/ocean/ocean_vert.glsl +22 -0
  344. package/lib/polygon/shaders/water/polygon_water_frag.glsl +14 -12
  345. package/lib/polygon/shaders/water/polygon_water_vert.glsl +10 -10
  346. package/lib/raster/models/raster.js +54 -38
  347. package/lib/raster/models/rasterRgb.js +36 -19
  348. package/lib/raster/models/rasterTerrainRgb.js +2 -2
  349. package/lib/raster/shaders/raster/raster_2d_frag.glsl +34 -0
  350. package/lib/raster/shaders/raster/raster_2d_vert.glsl +21 -0
  351. package/lib/raster/shaders/rgb/raster_rgb_frag.glsl +26 -0
  352. package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
  353. package/lib/tile/utils/constants.js +1 -1
  354. package/package.json +7 -7
  355. package/es/earth/shaders/atmosphere_vert.glsl +0 -26
  356. package/es/earth/shaders/base_frag.glsl +0 -13
  357. package/es/earth/shaders/base_vert.glsl +0 -52
  358. package/es/earth/shaders/bloomsphere_frag.glsl +0 -15
  359. package/es/earth/shaders/bloomsphere_vert.glsl +0 -20
  360. package/es/heatmap/shaders/heatmap_3d_frag.glsl +0 -14
  361. package/es/heatmap/shaders/heatmap_frag.glsl +0 -47
  362. package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +0 -10
  363. package/es/heatmap/shaders/heatmap_vert.glsl +0 -10
  364. package/es/heatmap/shaders/hexagon_frag.glsl +0 -12
  365. package/es/line/models/earthArc_3d.d.ts +0 -17
  366. package/es/line/models/earthArc_3d.js +0 -285
  367. package/es/line/models/linearline.d.ts +0 -11
  368. package/es/line/models/linearline.js +0 -241
  369. package/es/line/models/simpleLine.js +0 -194
  370. package/es/line/shaders/arc_chunks.vert.glsl +0 -21
  371. package/es/line/shaders/dash/arc_dash_frag.glsl +0 -21
  372. package/es/line/shaders/dash/arc_dash_vert.glsl +0 -102
  373. package/es/line/shaders/dash/line_dash_frag.glsl +0 -27
  374. package/es/line/shaders/dash/line_dash_vert.glsl +0 -82
  375. package/es/line/shaders/line_arc2d_vert.glsl +0 -114
  376. package/es/line/shaders/line_bezier_vert.glsl +0 -85
  377. package/es/line/shaders/line_vert.glsl +0 -165
  378. package/es/line/shaders/linear/arc3d_linear_frag.glsl +0 -32
  379. package/es/line/shaders/linear/arc3d_linear_vert.glsl +0 -161
  380. package/es/line/shaders/linear/arc_linear_frag.glsl +0 -10
  381. package/es/line/shaders/linear/arc_linear_vert.glsl +0 -98
  382. package/es/line/shaders/linear/line_linear_frag.glsl +0 -25
  383. package/es/line/shaders/linearLine/line_linear_frag.glsl +0 -8
  384. package/es/line/shaders/linearLine/line_linear_vert.glsl +0 -93
  385. package/es/line/shaders/simple/simpleline_linear_frag.glsl +0 -8
  386. package/es/point/shaders/animate/wave_frag.glsl +0 -55
  387. package/es/point/shaders/earth/extrude_frag.glsl +0 -32
  388. package/es/point/shaders/image/fillImage_frag.glsl +0 -18
  389. package/es/point/shaders/image_frag.glsl +0 -37
  390. package/es/point/shaders/text_frag.glsl +0 -39
  391. package/es/polygon/shaders/polygon_frag.glsl +0 -7
  392. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -15
  393. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -16
  394. package/es/raster/shaders/raster_2d_frag.glsl +0 -32
  395. package/es/raster/shaders/raster_2d_vert.glsl +0 -13
  396. package/es/raster/shaders/raster_frag.glsl +0 -11
  397. package/es/raster/shaders/raster_rgb_frag.glsl +0 -20
  398. package/es/raster/shaders/raster_vert.glsl +0 -34
  399. package/lib/earth/shaders/atmosphere_vert.glsl +0 -26
  400. package/lib/earth/shaders/base_frag.glsl +0 -13
  401. package/lib/earth/shaders/base_vert.glsl +0 -52
  402. package/lib/earth/shaders/bloomsphere_frag.glsl +0 -15
  403. package/lib/earth/shaders/bloomsphere_vert.glsl +0 -20
  404. package/lib/heatmap/shaders/heatmap_3d_frag.glsl +0 -14
  405. package/lib/heatmap/shaders/heatmap_frag.glsl +0 -47
  406. package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +0 -10
  407. package/lib/heatmap/shaders/heatmap_vert.glsl +0 -10
  408. package/lib/heatmap/shaders/hexagon_frag.glsl +0 -12
  409. package/lib/line/models/earthArc_3d.js +0 -291
  410. package/lib/line/models/linearline.js +0 -247
  411. package/lib/line/shaders/arc_chunks.vert.glsl +0 -21
  412. package/lib/line/shaders/dash/arc_dash_frag.glsl +0 -21
  413. package/lib/line/shaders/dash/arc_dash_vert.glsl +0 -102
  414. package/lib/line/shaders/dash/line_dash_frag.glsl +0 -27
  415. package/lib/line/shaders/dash/line_dash_vert.glsl +0 -82
  416. package/lib/line/shaders/line_arc2d_vert.glsl +0 -114
  417. package/lib/line/shaders/line_bezier_vert.glsl +0 -85
  418. package/lib/line/shaders/line_vert.glsl +0 -165
  419. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +0 -32
  420. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +0 -161
  421. package/lib/line/shaders/linear/arc_linear_frag.glsl +0 -10
  422. package/lib/line/shaders/linear/arc_linear_vert.glsl +0 -98
  423. package/lib/line/shaders/linear/line_linear_frag.glsl +0 -25
  424. package/lib/line/shaders/linearLine/line_linear_frag.glsl +0 -8
  425. package/lib/line/shaders/linearLine/line_linear_vert.glsl +0 -93
  426. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +0 -8
  427. package/lib/point/shaders/animate/wave_frag.glsl +0 -55
  428. package/lib/point/shaders/earth/extrude_frag.glsl +0 -32
  429. package/lib/point/shaders/image/fillImage_frag.glsl +0 -18
  430. package/lib/point/shaders/image_frag.glsl +0 -37
  431. package/lib/point/shaders/text_frag.glsl +0 -39
  432. package/lib/polygon/shaders/polygon_frag.glsl +0 -7
  433. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -15
  434. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -16
  435. package/lib/raster/shaders/raster_2d_frag.glsl +0 -32
  436. package/lib/raster/shaders/raster_2d_vert.glsl +0 -13
  437. package/lib/raster/shaders/raster_frag.glsl +0 -11
  438. package/lib/raster/shaders/raster_rgb_frag.glsl +0 -20
  439. package/lib/raster/shaders/raster_vert.glsl +0 -34
  440. /package/es/point/shaders/{normal_frag.glsl → normal/normal_frag.glsl} +0 -0
  441. /package/es/point/shaders/{normal_vert.glsl → normal/normal_vert.glsl} +0 -0
  442. /package/es/raster/shaders/{raster_terrain_rgb_frag.glsl → terrain/terrain_rgb_frag.glsl} +0 -0
  443. /package/es/raster/shaders/{rater_terrain_rgb_vert.glsl → terrain/terrain_rgb_vert.glsl} +0 -0
  444. /package/lib/point/shaders/{normal_frag.glsl → normal/normal_frag.glsl} +0 -0
  445. /package/lib/point/shaders/{normal_vert.glsl → normal/normal_vert.glsl} +0 -0
  446. /package/lib/raster/shaders/{raster_terrain_rgb_frag.glsl → terrain/terrain_rgb_frag.glsl} +0 -0
  447. /package/lib/raster/shaders/{rater_terrain_rgb_vert.glsl → terrain/terrain_rgb_vert.glsl} +0 -0
@@ -1,7 +1,7 @@
1
- import { ILayer } from '@antv/l7-core';
1
+ import type { ILayer } from '@antv/l7-core';
2
2
  import BaseLayer from '../core/BaseLayer';
3
- import { ICanvasLayerStyleOptions } from '../core/interface';
4
- import { CanvasModelType } from './models/index';
3
+ import type { ICanvasLayerStyleOptions } from '../core/interface';
4
+ import type { CanvasModelType } from './models/index';
5
5
  export default class CanvasLayer extends BaseLayer<ICanvasLayerStyleOptions> {
6
6
  type: string;
7
7
  forceRender: boolean;
@@ -1,19 +1,14 @@
1
- import { IModel } from '@antv/l7-core';
1
+ import type { IModel } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class CityBuildModel extends BaseModel {
4
4
  private cityCenter;
5
5
  private cityMinSize;
6
- getUninforms(): {
7
- u_cityCenter: [number, number];
8
- u_cityMinSize: number;
9
- u_circleSweep: number;
10
- u_circleSweepColor: number[];
11
- u_circleSweepSpeed: number;
12
- u_opacity: number;
13
- u_baseColor: number[];
14
- u_brightColor: number[];
15
- u_windowColor: number[];
16
- u_time: number;
6
+ protected getCommonUniformsInfo(): {
7
+ uniformsArray: number[];
8
+ uniformsLength: number;
9
+ uniformsOption: {
10
+ [key: string]: any;
11
+ };
17
12
  };
18
13
  calCityGeo(): void;
19
14
  initModels(): Promise<IModel[]>;
@@ -1,5 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
6
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -13,9 +14,10 @@ import { rgb2arr } from '@antv/l7-utils';
13
14
  import BaseModel from "../../core/BaseModel";
14
15
  import { PolygonExtrudeTriangulation } from "../../core/triangulation";
15
16
  /* babel-plugin-inline-import '../shaders/build_frag.glsl' */
16
- var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\nuniform float u_circleSweep;\nuniform float u_cityMinSize;\nuniform vec3 u_circleSweepColor;\nuniform float u_circleSweepSpeed;\n\nvarying float v_worldDis;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n gl_FragColor.rgb += r * r * u_circleSweepColor;\n }\n \n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
17
+ var buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near : 0;\n float u_far : 1;\n float u_time;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n \n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
17
18
  /* babel-plugin-inline-import '../shaders/build_vert.glsl' */
18
- var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
19
+ var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near : 0;\n float u_far : 1;\n float u_time;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
20
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
19
21
  var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
20
22
  _inherits(CityBuildModel, _BaseModel);
21
23
  var _super = _createSuper(CityBuildModel);
@@ -24,8 +26,8 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
24
26
  return _super.apply(this, arguments);
25
27
  }
26
28
  _createClass(CityBuildModel, [{
27
- key: "getUninforms",
28
- value: function getUninforms() {
29
+ key: "getCommonUniformsInfo",
30
+ value: function getCommonUniformsInfo() {
29
31
  var _ref = this.layer.getLayerConfig(),
30
32
  _ref$opacity = _ref.opacity,
31
33
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
@@ -45,18 +47,22 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
45
47
  sweepSpeed: 0.4,
46
48
  sweepCenter: this.cityCenter
47
49
  } : _ref$sweep;
48
- return {
50
+ var commonOptions = {
51
+ u_baseColor: rgb2arr(baseColor),
52
+ u_brightColor: rgb2arr(brightColor),
53
+ u_windowColor: rgb2arr(windowColor),
54
+ u_circleSweepColor: [].concat(_toConsumableArray(rgb2arr(sweep.sweepColor).slice(0, 3)), [1.0]),
49
55
  u_cityCenter: sweep.sweepCenter || this.cityCenter,
50
- u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
51
56
  u_circleSweep: sweep.enable ? 1.0 : 0.0,
52
- u_circleSweepColor: rgb2arr(sweep.sweepColor).slice(0, 3),
57
+ u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
53
58
  u_circleSweepSpeed: sweep.sweepSpeed,
54
59
  u_opacity: opacity,
55
- u_baseColor: rgb2arr(baseColor),
56
- u_brightColor: rgb2arr(brightColor),
57
- u_windowColor: rgb2arr(windowColor),
60
+ u_near: 0,
61
+ u_far: 1,
58
62
  u_time: this.layer.getLayerAnimateTime() || time
59
63
  };
64
+ var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
65
+ return commonBufferInfo;
60
66
  }
61
67
  }, {
62
68
  key: "calCityGeo",
@@ -90,9 +96,10 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
90
96
  while (1) switch (_context.prev = _context.next) {
91
97
  case 0:
92
98
  this.calCityGeo();
99
+ this.initUniformsBuffer();
93
100
  this.startModelAnimate();
94
101
  return _context.abrupt("return", this.buildModels());
95
- case 3:
102
+ case 4:
96
103
  case "end":
97
104
  return _context.stop();
98
105
  }
@@ -120,6 +127,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
120
127
  depth: {
121
128
  enable: true
122
129
  },
130
+ inject: this.getInject(),
123
131
  cull: {
124
132
  enable: true,
125
133
  face: gl.BACK
@@ -148,6 +156,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
148
156
  type: AttributeType.Attribute,
149
157
  descriptor: {
150
158
  name: 'a_Normal',
159
+ shaderLocation: ShaderLocation.NORMAL,
151
160
  buffer: {
152
161
  // give the WebGL driver a hint that this buffer may change
153
162
  usage: gl.STATIC_DRAW,
@@ -165,6 +174,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
165
174
  type: AttributeType.Attribute,
166
175
  descriptor: {
167
176
  name: 'a_Size',
177
+ shaderLocation: ShaderLocation.SIZE,
168
178
  buffer: {
169
179
  // give the WebGL driver a hint that this buffer may change
170
180
  usage: gl.DYNAMIC_DRAW,
@@ -184,6 +194,7 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
184
194
  type: AttributeType.Attribute,
185
195
  descriptor: {
186
196
  name: 'a_Uv',
197
+ shaderLocation: ShaderLocation.UV,
187
198
  buffer: {
188
199
  // give the WebGL driver a hint that this buffer may change
189
200
  usage: gl.DYNAMIC_DRAW,
@@ -1,22 +1,25 @@
1
- uniform float u_opacity: 1.0;
2
- uniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];
3
- uniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];
4
- uniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];
5
- uniform float u_near : 0;
6
- uniform float u_far : 1;
7
- varying vec4 v_Color;
8
- varying vec2 v_texCoord;
9
- uniform float u_Zoom : 1;
10
- uniform float u_time;
11
-
12
- uniform float u_circleSweep;
13
- uniform float u_cityMinSize;
14
- uniform vec3 u_circleSweepColor;
15
- uniform float u_circleSweepSpeed;
16
-
17
- varying float v_worldDis;
1
+ precision highp float;
2
+ layout(std140) uniform commonUniforms {
3
+ vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];
4
+ vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];
5
+ vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];
6
+ vec4 u_circleSweepColor;
7
+ vec2 u_cityCenter;
8
+ float u_circleSweep;
9
+ float u_cityMinSize;
10
+ float u_circleSweepSpeed;
11
+ float u_opacity: 1.0;
12
+ float u_near : 0;
13
+ float u_far : 1;
14
+ float u_time;
15
+ };
16
+ in vec4 v_Color;
17
+ in vec2 v_texCoord;
18
+ in float v_worldDis;
19
+ out vec4 outputColor;
18
20
 
19
21
  #pragma include "picking"
22
+ #pragma include "scene_uniforms"
20
23
 
21
24
  vec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {
22
25
  float s = step(hot, n);
@@ -48,7 +51,7 @@ float sdRect(vec2 p, vec2 sz) {
48
51
  }
49
52
 
50
53
  void main() {
51
- gl_FragColor = v_Color;
54
+ outputColor = v_Color;
52
55
  vec3 baseColor = u_baseColor.xyz;
53
56
  vec3 brightColor = u_brightColor.xyz;
54
57
  vec3 windowColor = u_windowColor.xyz;
@@ -57,7 +60,7 @@ void main() {
57
60
  vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);
58
61
  if(v_texCoord.x < 0.) { //顶部颜色
59
62
  vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);
60
- gl_FragColor = vec4( foggedColor, v_Color.w);
63
+ outputColor = vec4( foggedColor, v_Color.w);
61
64
  }else { // 侧面颜色
62
65
  vec2 st = v_texCoord;
63
66
  vec2 UvScale = v_texCoord;
@@ -103,15 +106,15 @@ void main() {
103
106
 
104
107
  vec3 foggedColor = fog(color,fogColor,depth);
105
108
 
106
- gl_FragColor = vec4(foggedColor,1.0);
109
+ outputColor = vec4(foggedColor,1.0);
107
110
  }
108
111
 
109
112
 
110
113
  if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {
111
114
  float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);
112
- gl_FragColor.rgb += r * r * u_circleSweepColor;
115
+ outputColor.rgb += r * r * u_circleSweepColor.rgb;
113
116
  }
114
117
 
115
- gl_FragColor.a *= u_opacity;
116
- gl_FragColor = filterColor(gl_FragColor);
118
+ outputColor.a *= u_opacity;
119
+ outputColor = filterColor(outputColor);
117
120
  }
@@ -4,22 +4,30 @@ precision highp float;
4
4
  #define diffuseRatio 0.3
5
5
  #define specularRatio 0.2
6
6
 
7
- attribute vec4 a_Color;
8
- attribute vec3 a_Position;
9
- attribute vec3 a_Normal;
10
- attribute float a_Size;
11
- uniform mat4 u_ModelMatrix;
12
-
13
- attribute vec2 a_Uv;
14
- varying vec2 v_texCoord;
15
-
16
- varying vec4 v_Color;
17
-
18
- uniform float u_circleSweep;
19
- uniform vec2 u_cityCenter;
20
-
21
- varying float v_worldDis;
22
-
7
+ layout(location = 0) in vec3 a_Position;
8
+ layout(location = 1) in vec4 a_Color;
9
+ layout(location = 9) in float a_Size;
10
+ layout(location = 13) in vec3 a_Normal;
11
+ layout(location = 14) in vec2 a_Uv;
12
+
13
+ out vec2 v_texCoord;
14
+ out vec4 v_Color;
15
+ out float v_worldDis;
16
+
17
+ layout(std140) uniform commonUniforms {
18
+ vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];
19
+ vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];
20
+ vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];
21
+ vec4 u_circleSweepColor;
22
+ vec2 u_cityCenter;
23
+ float u_circleSweep;
24
+ float u_cityMinSize;
25
+ float u_circleSweepSpeed;
26
+ float u_opacity: 1.0;
27
+ float u_near : 0;
28
+ float u_far : 1;
29
+ float u_time;
30
+ };
23
31
  #pragma include "projection"
24
32
  #pragma include "light"
25
33
  #pragma include "picking"
@@ -1,8 +1,9 @@
1
1
  import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
2
- import { BlendType, IActiveOption, IAnimateOption, IAttributeAndElements, ICameraService, ICoordinateSystemService, IDataState, IDebugService, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, IInteractionService, ILayer, ILayerAttributesOption, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPickService, ILayerPlugin, ILayerService, ILegend, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IParseDataItem, IPass, IPickingService, IPostProcessingPass, IRenderOptions, IRendererService, IScale, IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, ITextureService, LayerEventType, LegendItems, StyleAttributeField, StyleAttributeOption, Triangulation } from '@antv/l7-core';
2
+ import type { IActiveOption, IAnimateOption, IAttributeAndElements, IBuffer, ICameraService, ICoordinateSystemService, IDataState, IDebugService, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, IInteractionService, ILayer, ILayerAttributesOption, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPickService, ILayerPlugin, ILayerService, ILegend, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IParseDataItem, IPass, IPickingService, IPostProcessingPass, IRenderOptions, IRendererService, IScale, IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, ITextureService, LayerEventType, LegendItems, StyleAttributeField, StyleAttributeOption, Triangulation } from '@antv/l7-core';
3
+ import { BlendType } from '@antv/l7-core';
3
4
  import Source from '@antv/l7-source';
4
5
  import { EventEmitter } from 'eventemitter3';
5
- import { Container } from 'inversify';
6
+ import type { Container } from 'inversify';
6
7
  export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter<LayerEventType> implements ILayer {
7
8
  id: string;
8
9
  name: string;
@@ -105,12 +106,21 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
105
106
  private animateStartTime;
106
107
  private animateStatus;
107
108
  private isDestroyed;
109
+ private uniformBuffers;
108
110
  constructor(config?: Partial<ILayerConfig & ChildLayerStyleOptions>);
109
111
  addMask(layer: ILayer): void;
110
112
  removeMask(layer: ILayer): void;
111
113
  disableMask(): void;
112
114
  enableMask(): void;
115
+ /**
116
+ * 将废弃
117
+ * @deprecated
118
+ */
113
119
  addMaskLayer(maskLayer: ILayer): void;
120
+ /**
121
+ * 将废弃
122
+ * @deprecated
123
+ */
114
124
  removeMaskLayer(maskLayer: ILayer): void;
115
125
  getAttribute(name: string): import("@antv/l7-core").IStyleAttribute | undefined;
116
126
  getLayerConfig<T = any>(): Partial<ILayerConfig & import("@antv/l7-core").ISceneConfig & ChildLayerStyleOptions & T>;
@@ -228,6 +238,8 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
228
238
  protected getDefaultConfig(): {};
229
239
  protected sourceEvent: () => void;
230
240
  protected initLayerModels(): Promise<void>;
241
+ getLayerUniformBuffer(): IBuffer;
242
+ getPickingUniformBuffer(): IBuffer;
231
243
  protected reRender(): void;
232
244
  protected splitValuesAndCallbackInAttribute(valuesOrCallback?: unknown[]): {
233
245
  values: unknown[] | undefined;
@@ -44,8 +44,6 @@ var layerIdCounter = 0;
44
44
  var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
45
45
  _inherits(BaseLayer, _ref);
46
46
  var _super = _createSuper(BaseLayer);
47
- // private pickingPassRender: IPass<'pixelPicking'>;
48
-
49
47
  function BaseLayer() {
50
48
  var _this;
51
49
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -117,6 +115,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
117
115
  _defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
118
116
  _defineProperty(_assertThisInitialized(_this), "animateStatus", false);
119
117
  _defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
118
+ // private pickingPassRender: IPass<'pixelPicking'>;
119
+ _defineProperty(_assertThisInitialized(_this), "uniformBuffers", []);
120
120
  _defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
121
121
  _defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
122
122
  _this.dataState.dataSourceNeedUpdate = true;
@@ -140,6 +140,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
140
140
  key: "addMask",
141
141
  value: function addMask(layer) {
142
142
  this.masks.push(layer);
143
+ this.updateLayerConfig({
144
+ maskLayers: this.masks
145
+ });
143
146
  this.enableMask();
144
147
  }
145
148
  }, {
@@ -149,6 +152,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
149
152
  if (layerIndex > -1) {
150
153
  this.masks.splice(layerIndex, 1);
151
154
  }
155
+ this.updateLayerConfig({
156
+ maskLayers: this.masks
157
+ });
152
158
  }
153
159
  }, {
154
160
  key: "disableMask",
@@ -164,13 +170,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
164
170
  enableMask: true
165
171
  });
166
172
  }
167
- // 将废弃
173
+
174
+ /**
175
+ * 将废弃
176
+ * @deprecated
177
+ */
168
178
  }, {
169
179
  key: "addMaskLayer",
170
180
  value: function addMaskLayer(maskLayer) {
171
181
  this.masks.push(maskLayer);
172
182
  }
173
- // 将废弃
183
+
184
+ /**
185
+ * 将废弃
186
+ * @deprecated
187
+ */
174
188
  }, {
175
189
  key: "removeMaskLayer",
176
190
  value: function removeMaskLayer(maskLayer) {
@@ -1189,7 +1203,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1189
1203
  vs: vs,
1190
1204
  elements: elements,
1191
1205
  blend: BlendTypes[BlendType.normal],
1192
- uniformBuffers: [].concat(_toConsumableArray(_this10.layerModel.uniformBuffers), _toConsumableArray(_this10.rendererService.uniformBuffers)),
1206
+ uniformBuffers: [].concat(_toConsumableArray(_this10.layerModel.uniformBuffers), _toConsumableArray(_this10.rendererService.uniformBuffers), [_this10.getLayerUniformBuffer(), _this10.getPickingUniformBuffer()]),
1193
1207
  textures: _this10.layerModel.textures
1194
1208
  }, rest);
1195
1209
  if (count) {
@@ -1339,7 +1353,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1339
1353
  model.draw({
1340
1354
  uniforms: _this11.layerModel.getUninforms(),
1341
1355
  blend: _this11.layerModel.getBlend(),
1342
- stencil: _this11.layerModel.getStencil(options)
1356
+ stencil: _this11.layerModel.getStencil(options),
1357
+ textures: _this11.layerModel.textures
1343
1358
  }, (options === null || options === void 0 ? void 0 : options.ispick) || false);
1344
1359
  });
1345
1360
  this.hooks.afterRender.call();
@@ -1433,6 +1448,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1433
1448
  key: "initLayerModels",
1434
1449
  value: function () {
1435
1450
  var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
1451
+ var layerUniforms, pickingUniforms;
1436
1452
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
1437
1453
  while (1) switch (_context7.prev = _context7.next) {
1438
1454
  case 0:
@@ -1440,11 +1456,29 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1440
1456
  return model.destroy();
1441
1457
  });
1442
1458
  this.models = [];
1443
- _context7.next = 4;
1459
+ this.uniformBuffers.forEach(function (buffer) {
1460
+ buffer.destroy();
1461
+ });
1462
+ this.uniformBuffers = [];
1463
+ // Layer Uniform
1464
+ layerUniforms = this.rendererService.createBuffer({
1465
+ data: new Float32Array(16 + 4).fill(0),
1466
+ // u_Mvp
1467
+ isUBO: true
1468
+ });
1469
+ this.uniformBuffers.push(layerUniforms);
1470
+
1471
+ // Picking Uniform
1472
+ pickingUniforms = this.rendererService.createBuffer({
1473
+ data: new Float32Array(20).fill(0),
1474
+ isUBO: true
1475
+ });
1476
+ this.uniformBuffers.push(pickingUniforms);
1477
+ _context7.next = 10;
1444
1478
  return this.layerModel.initModels();
1445
- case 4:
1479
+ case 10:
1446
1480
  this.models = _context7.sent;
1447
- case 5:
1481
+ case 11:
1448
1482
  case "end":
1449
1483
  return _context7.stop();
1450
1484
  }
@@ -1455,6 +1489,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1455
1489
  }
1456
1490
  return initLayerModels;
1457
1491
  }()
1492
+ }, {
1493
+ key: "getLayerUniformBuffer",
1494
+ value: function getLayerUniformBuffer() {
1495
+ return this.uniformBuffers[0];
1496
+ }
1497
+ }, {
1498
+ key: "getPickingUniformBuffer",
1499
+ value: function getPickingUniformBuffer() {
1500
+ return this.uniformBuffers[1];
1501
+ }
1458
1502
  }, {
1459
1503
  key: "reRender",
1460
1504
  value: function reRender() {
@@ -1,4 +1,4 @@
1
- import { IAnimateOption, IAttribute, IBlendOptions, IBuffer, ICameraService, IElements, IFontService, IGlobalConfigService, IIconService, IInject, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IRenderOptions, IShaderModuleService, IStencilOptions, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
1
+ import type { IAnimateOption, IAttribute, IBlendOptions, IBuffer, ICameraService, IElements, IFontService, IGlobalConfigService, IIconService, IInject, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IRenderOptions, IShaderModuleService, IStencilOptions, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
2
2
  export type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
3
3
  export type styleOffset = string | [number, number] | [string, (single: any) => number];
4
4
  export type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
@@ -21,7 +21,8 @@ var shaderLocationMap = {
21
21
  stroke: ShaderLocation.STROKE,
22
22
  offsets: ShaderLocation.OFFSETS,
23
23
  rotation: ShaderLocation.ROTATION,
24
- extrusionBase: ShaderLocation.EXTRUSION_BASE
24
+ extrusionBase: ShaderLocation.EXTRUSION_BASE,
25
+ thetaOffset: 15
25
26
  };
26
27
 
27
28
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -114,10 +115,21 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
114
115
  value: function getDefaultStyle() {
115
116
  return {};
116
117
  }
118
+ // public getUninforms(): IModelUniform {
119
+ // throw new Error('Method not implemented.');
120
+ // }
117
121
  }, {
118
122
  key: "getUninforms",
119
123
  value: function getUninforms() {
120
- throw new Error('Method not implemented.');
124
+ var commoninfo = this.getCommonUniformsInfo();
125
+ var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
126
+ this.updateStyleUnifoms();
127
+ var result = _objectSpread(_objectSpread({}, attributeInfo.uniformsOption), commoninfo.uniformsOption);
128
+ //如果是regl渲染 需要在uniform中带上u_texture 暂时用this.rendererService.device判断
129
+ if (!this.rendererService.hasOwnProperty('device') && this.textures && this.textures.length === 1) {
130
+ result['u_texture'] = this.textures[0];
131
+ }
132
+ return result;
121
133
  }
122
134
  }, {
123
135
  key: "getAnimateUniforms",
@@ -237,6 +249,10 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
237
249
  } else {
238
250
  uniforms.push(" ".concat(DefaultUniformStyleType[key], " u_").concat(key, ";"));
239
251
  }
252
+ var location = shaderLocationMap[key];
253
+ if (!location && key === 'THETA_OFFSET') {
254
+ location = 15;
255
+ }
240
256
  str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n layout(location = ").concat(shaderLocationMap[key], ") in ").concat(DefaultUniformStyleType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #endif\n\n ");
241
257
  });
242
258
  var attributeUniforms = uniforms.length ? "\nlayout(std140) uniform AttributeUniforms {\n".concat(uniforms.join('\n'), "\n};\n ") : '';
@@ -298,16 +314,21 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
298
314
  value: function initUniformsBuffer() {
299
315
  var attrUniforms = this.getUniformsBufferInfo(this.getStyleAttribute());
300
316
  var commonUniforms = this.getCommonUniformsInfo();
301
- this.attributeUnifoms = this.rendererService.createBuffer({
302
- data: new Float32Array(MultipleOfFourNumber(attrUniforms.uniformsLength)),
303
- // 长度需要大于等于 4
304
- isUBO: true
305
- });
306
- this.commonUnifoms = this.rendererService.createBuffer({
307
- data: new Float32Array(MultipleOfFourNumber(commonUniforms.uniformsLength)),
308
- isUBO: true
309
- });
310
- this.uniformBuffers = [this.attributeUnifoms, this.commonUnifoms];
317
+ if (attrUniforms.uniformsLength !== 0) {
318
+ this.attributeUnifoms = this.rendererService.createBuffer({
319
+ data: new Float32Array(MultipleOfFourNumber(attrUniforms.uniformsLength)).fill(0),
320
+ // 长度需要大于等于 4
321
+ isUBO: true
322
+ });
323
+ this.uniformBuffers.push(this.attributeUnifoms);
324
+ }
325
+ if (commonUniforms.uniformsLength !== 0) {
326
+ this.commonUnifoms = this.rendererService.createBuffer({
327
+ data: new Float32Array(MultipleOfFourNumber(commonUniforms.uniformsLength)).fill(0),
328
+ isUBO: true
329
+ });
330
+ this.uniformBuffers.push(this.commonUnifoms);
331
+ }
311
332
  }
312
333
  // 获取数据映射 uniform 信息
313
334
  }, {
@@ -319,9 +340,13 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
319
340
  if (Array.isArray(value)) {
320
341
  uniformsArray.push.apply(uniformsArray, _toConsumableArray(value));
321
342
  uniformsLength += value.length;
322
- } else {
343
+ } else if (typeof value === 'number') {
344
+ // 排除纹理
323
345
  uniformsArray.push(value);
324
346
  uniformsLength += 1;
347
+ } else if (typeof value === 'boolean') {
348
+ uniformsArray.push(Number(value));
349
+ uniformsLength += 1;
325
350
  }
326
351
  });
327
352
  return {
@@ -344,15 +369,16 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
344
369
  }, {
345
370
  key: "updateStyleUnifoms",
346
371
  value: function updateStyleUnifoms() {
372
+ var _this$attributeUnifom, _this$commonUnifoms;
347
373
  var _this$getUniformsBuff = this.getUniformsBufferInfo(this.getStyleAttribute()),
348
374
  uniformsArray = _this$getUniformsBuff.uniformsArray;
349
375
  var _this$getCommonUnifor = this.getCommonUniformsInfo(),
350
376
  commonUniformsArray = _this$getCommonUnifor.uniformsArray;
351
- this.attributeUnifoms.subData({
377
+ (_this$attributeUnifom = this.attributeUnifoms) === null || _this$attributeUnifom === void 0 || _this$attributeUnifom.subData({
352
378
  offset: 0,
353
379
  data: new Uint8Array(new Float32Array(uniformsArray).buffer)
354
380
  });
355
- this.commonUnifoms.subData({
381
+ (_this$commonUnifoms = this.commonUnifoms) === null || _this$commonUnifoms === void 0 || _this$commonUnifoms.subData({
356
382
  offset: 0,
357
383
  data: new Uint8Array(new Float32Array(commonUniformsArray).buffer)
358
384
  });
@@ -1,4 +1,4 @@
1
- import { IStyleAttribute } from '@antv/l7-core';
1
+ import type { IStyleAttribute } from '@antv/l7-core';
2
2
  export declare enum ShaderLocation {
3
3
  POSITION = 0,
4
4
  COLOR = 1,
@@ -13,6 +13,8 @@ export declare enum ShaderLocation {
13
13
  SHAPE = 10,
14
14
  EXTRUDE = 11,
15
15
  MAX = 12,
16
- NORMAL = 13
16
+ NORMAL = 13,
17
+ UV = 14,
18
+ LINEAR = 15
17
19
  }
18
20
  export declare function getCommonStyleAttributeOptions(name: string): Partial<IStyleAttribute> | undefined;
@@ -14,6 +14,8 @@ export var ShaderLocation = /*#__PURE__*/function (ShaderLocation) {
14
14
  ShaderLocation[ShaderLocation["EXTRUDE"] = 11] = "EXTRUDE";
15
15
  ShaderLocation[ShaderLocation["MAX"] = 12] = "MAX";
16
16
  ShaderLocation[ShaderLocation["NORMAL"] = 13] = "NORMAL";
17
+ ShaderLocation[ShaderLocation["UV"] = 14] = "UV";
18
+ ShaderLocation[ShaderLocation["LINEAR"] = 15] = "LINEAR";
17
19
  return ShaderLocation;
18
20
  }({});
19
21
  export function getCommonStyleAttributeOptions(name) {
@@ -128,6 +130,7 @@ export function getCommonStyleAttributeOptions(name) {
128
130
  type: AttributeType.Attribute,
129
131
  descriptor: {
130
132
  name: 'a_ThetaOffset',
133
+ shaderLocation: 15,
131
134
  buffer: {
132
135
  // give the WebGL driver a hint that this buffer may change
133
136
  usage: gl.STATIC_DRAW,
@@ -1,4 +1,4 @@
1
- import { IInteractionTarget, ILayer, ILayerPickService, IMapService } from '@antv/l7-core';
1
+ import type { IInteractionTarget, ILayer, ILayerPickService, IMapService } from '@antv/l7-core';
2
2
  export default class BaseLayerPickService implements ILayerPickService {
3
3
  private layer;
4
4
  constructor(layer: ILayer);
@@ -1,5 +1,5 @@
1
- import { ILayer, ITexture2D, ITextureService } from '@antv/l7-core';
2
- import { IColorRamp } from '@antv/l7-utils';
1
+ import type { ILayer, ITexture2D, ITextureService } from '@antv/l7-core';
2
+ import type { IColorRamp } from '@antv/l7-utils';
3
3
  export default class TextureService implements ITextureService {
4
4
  private layer;
5
5
  private rendererService;