@antv/l7-layers 2.9.21 → 2.9.23

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 (707) hide show
  1. package/es/Geometry/index.js +4 -5
  2. package/es/Geometry/models/billboard.js +23 -9
  3. package/es/Geometry/models/index.js +4 -5
  4. package/es/Geometry/models/plane.js +25 -13
  5. package/es/Geometry/models/sprite.js +11 -21
  6. package/es/Geometry/shaders/billboard_frag.glsl +13 -0
  7. package/es/Geometry/shaders/billboard_vert.glsl +50 -0
  8. package/es/Geometry/shaders/plane_frag.glsl +22 -0
  9. package/es/Geometry/shaders/plane_vert.glsl +53 -0
  10. package/es/Geometry/shaders/sprite_frag.glsl +21 -0
  11. package/es/Geometry/shaders/sprite_vert.glsl +28 -0
  12. package/es/canvas/index.js +4 -5
  13. package/es/canvas/models/canvas.js +6 -12
  14. package/es/canvas/models/index.js +2 -3
  15. package/es/citybuliding/building.js +4 -5
  16. package/es/citybuliding/models/build.js +19 -22
  17. package/es/citybuliding/shaders/build_frag.glsl +117 -0
  18. package/es/citybuliding/shaders/build_vert.glsl +54 -0
  19. package/es/core/BaseLayer.js +205 -157
  20. package/es/core/BaseModel.js +135 -76
  21. package/es/core/interface.js +1 -2
  22. package/es/core/schema.js +4 -2
  23. package/es/core/shape/Path.js +8 -3
  24. package/es/core/shape/extrude.js +9 -4
  25. package/es/core/triangulation.js +89 -17
  26. package/es/earth/index.js +11 -7
  27. package/es/earth/models/atmosphere.js +15 -7
  28. package/es/earth/models/base.js +19 -7
  29. package/es/earth/models/bloomsphere.js +15 -7
  30. package/es/earth/shaders/atmosphere_frag.glsl +17 -0
  31. package/es/earth/shaders/atmosphere_vert.glsl +26 -0
  32. package/es/earth/shaders/base_frag.glsl +13 -0
  33. package/es/earth/shaders/base_vert.glsl +52 -0
  34. package/es/earth/shaders/bloomsphere_frag.glsl +15 -0
  35. package/es/earth/shaders/bloomsphere_vert.glsl +20 -0
  36. package/es/earth/utils.js +28 -5
  37. package/es/heatmap/index.js +8 -7
  38. package/es/heatmap/models/grid.js +11 -5
  39. package/es/heatmap/models/grid3d.js +18 -7
  40. package/es/heatmap/models/heatmap.js +45 -44
  41. package/es/heatmap/models/hexagon.js +14 -6
  42. package/es/heatmap/models/index.js +5 -6
  43. package/es/heatmap/shaders/grid_vert.glsl +42 -0
  44. package/es/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
  45. package/es/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
  46. package/es/heatmap/shaders/heatmap_frag.glsl +47 -0
  47. package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
  48. package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
  49. package/es/heatmap/shaders/heatmap_vert.glsl +10 -0
  50. package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  51. package/es/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
  52. package/es/heatmap/shaders/hexagon_frag.glsl +12 -0
  53. package/es/heatmap/shaders/hexagon_vert.glsl +41 -0
  54. package/es/heatmap/triangulation.js +2 -2
  55. package/es/image/index.js +4 -5
  56. package/es/image/models/dataImage.js +21 -31
  57. package/es/image/models/image.js +19 -25
  58. package/es/image/models/index.js +3 -4
  59. package/es/image/shaders/dataImage_frag.glsl +38 -0
  60. package/es/image/shaders/image_frag.glsl +9 -0
  61. package/es/image/shaders/image_vert.glsl +17 -0
  62. package/es/index.d.ts +2 -2
  63. package/es/index.js +92 -30
  64. package/es/line/index.js +4 -5
  65. package/es/line/models/arc.js +38 -15
  66. package/es/line/models/arc_3d.js +33 -14
  67. package/es/line/models/earthArc_3d.js +33 -14
  68. package/es/line/models/great_circle.js +25 -13
  69. package/es/line/models/half.js +33 -12
  70. package/es/line/models/index.js +12 -13
  71. package/es/line/models/line.js +48 -15
  72. package/es/line/models/linearline.js +26 -12
  73. package/es/line/models/simpleLine.js +26 -11
  74. package/es/line/models/tile.js +28 -10
  75. package/es/line/models/wall.js +30 -13
  76. package/es/line/shaders/arc_chunks.vert.glsl +21 -0
  77. package/es/line/shaders/dash/arc_dash_frag.glsl +28 -0
  78. package/es/line/shaders/dash/arc_dash_vert.glsl +148 -0
  79. package/es/line/shaders/dash/line_dash_frag.glsl +31 -0
  80. package/es/line/shaders/dash/line_dash_vert.glsl +93 -0
  81. package/es/line/shaders/half/line_half_frag.glsl +53 -0
  82. package/es/line/shaders/half/line_half_vert.glsl +169 -0
  83. package/es/line/shaders/line_arc2d_vert.glsl +114 -0
  84. package/es/line/shaders/line_arc_3d_frag.glsl +103 -0
  85. package/es/line/shaders/line_arc_3d_vert.glsl +207 -0
  86. package/es/line/shaders/line_arc_frag.glsl +89 -0
  87. package/es/line/shaders/line_arc_great_circle_frag.glsl +101 -0
  88. package/es/line/shaders/line_arc_great_circle_vert.glsl +215 -0
  89. package/es/line/shaders/line_arc_vert.glsl +174 -0
  90. package/es/line/shaders/line_bezier_vert.glsl +85 -0
  91. package/es/line/shaders/line_frag.glsl +100 -0
  92. package/es/line/shaders/line_vert.glsl +192 -0
  93. package/es/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
  94. package/es/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
  95. package/es/line/shaders/linear/arc_linear_frag.glsl +38 -0
  96. package/es/line/shaders/linear/arc_linear_vert.glsl +138 -0
  97. package/es/line/shaders/linear/line_linear_frag.glsl +27 -0
  98. package/es/line/shaders/linearLine/line_linear_frag.glsl +20 -0
  99. package/es/line/shaders/linearLine/line_linear_vert.glsl +112 -0
  100. package/es/line/shaders/simple/simpleline_frag.glsl +10 -0
  101. package/es/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
  102. package/es/line/shaders/simple/simpleline_vert.glsl +78 -0
  103. package/es/line/shaders/tile/line_tile_frag.glsl +79 -0
  104. package/es/line/shaders/tile/line_tile_vert.glsl +210 -0
  105. package/es/line/shaders/wall_frag.glsl +93 -0
  106. package/es/line/shaders/wall_vert.glsl +111 -0
  107. package/es/mask/index.js +4 -5
  108. package/es/mask/models/fill.js +11 -8
  109. package/es/mask/models/index.js +2 -3
  110. package/es/mask/shaders/mask_frag.glsl +7 -0
  111. package/es/mask/shaders/mask_vert.glsl +22 -0
  112. package/es/plugins/DataMappingPlugin.js +71 -34
  113. package/es/plugins/DataSourcePlugin.js +12 -10
  114. package/es/plugins/FeatureScalePlugin.js +44 -24
  115. package/es/plugins/LayerAnimateStylePlugin.js +6 -7
  116. package/es/plugins/LayerModelPlugin.js +16 -7
  117. package/es/plugins/LayerStylePlugin.js +7 -3
  118. package/es/plugins/LightingPlugin.js +21 -13
  119. package/es/plugins/MultiPassRendererPlugin.js +21 -8
  120. package/es/plugins/PixelPickingPlugin.js +33 -11
  121. package/es/plugins/RegisterStyleAttributePlugin.js +10 -3
  122. package/es/plugins/ShaderUniformPlugin.js +24 -10
  123. package/es/plugins/UpdateModelPlugin.js +7 -3
  124. package/es/plugins/UpdateStyleAttributePlugin.js +20 -7
  125. package/es/point/index.js +12 -6
  126. package/es/point/models/earthExtrude.js +30 -12
  127. package/es/point/models/earthFill.js +25 -13
  128. package/es/point/models/extrude.js +30 -12
  129. package/es/point/models/fill.js +50 -15
  130. package/es/point/models/fillmage.js +46 -17
  131. package/es/point/models/image.js +20 -12
  132. package/es/point/models/index.js +14 -14
  133. package/es/point/models/normal.js +15 -7
  134. package/es/point/models/radar.js +33 -13
  135. package/es/point/models/simplePoint.js +17 -9
  136. package/es/point/models/text.js +77 -30
  137. package/es/point/models/tile.js +33 -12
  138. package/es/point/shaders/animate/wave_frag.glsl +65 -0
  139. package/es/point/shaders/earth/extrude_frag.glsl +44 -0
  140. package/es/point/shaders/earth/extrude_vert.glsl +140 -0
  141. package/es/point/shaders/earth/fill_frag.glsl +86 -0
  142. package/es/point/shaders/earth/fill_vert.glsl +126 -0
  143. package/es/point/shaders/extrude/extrude_frag.glsl +44 -0
  144. package/es/point/shaders/extrude/extrude_vert.glsl +121 -0
  145. package/es/point/shaders/fill_frag.glsl +84 -0
  146. package/es/point/shaders/fill_vert.glsl +182 -0
  147. package/es/point/shaders/image/fillImage_frag.glsl +20 -0
  148. package/es/point/shaders/image/fillImage_vert.glsl +108 -0
  149. package/es/point/shaders/image_frag.glsl +39 -0
  150. package/es/point/shaders/image_vert.glsl +81 -0
  151. package/es/point/shaders/normal_frag.glsl +15 -0
  152. package/es/point/shaders/normal_vert.glsl +79 -0
  153. package/es/point/shaders/radar/radar_frag.glsl +64 -0
  154. package/es/point/shaders/radar/radar_vert.glsl +120 -0
  155. package/es/point/shaders/simplePoint_frag.glsl +53 -0
  156. package/es/point/shaders/simplePoint_vert.glsl +79 -0
  157. package/es/point/shaders/text_frag.glsl +48 -0
  158. package/es/point/shaders/text_vert.glsl +131 -0
  159. package/es/point/shaders/tile/fill_tile_frag.glsl +83 -0
  160. package/es/point/shaders/tile/fill_tile_vert.glsl +181 -0
  161. package/es/point/shape/extrude.js +8 -3
  162. package/es/polygon/index.js +6 -5
  163. package/es/polygon/models/extrude.js +40 -31
  164. package/es/polygon/models/fill.js +19 -8
  165. package/es/polygon/models/index.js +14 -14
  166. package/es/polygon/models/ocean.js +25 -33
  167. package/es/polygon/models/tile.js +13 -7
  168. package/es/polygon/models/water.js +21 -25
  169. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
  170. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
  171. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
  172. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
  173. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
  174. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
  175. package/es/polygon/shaders/polygon_frag.glsl +12 -0
  176. package/es/polygon/shaders/polygon_linear_frag.glsl +22 -0
  177. package/es/polygon/shaders/polygon_linear_vert.glsl +74 -0
  178. package/es/polygon/shaders/polygon_vert.glsl +66 -0
  179. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
  180. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
  181. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
  182. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
  183. package/es/polygon/shaders/water/polygon_water_frag.glsl +73 -0
  184. package/es/polygon/shaders/water/polygon_water_vert.glsl +55 -0
  185. package/es/raster/buffers/triangulation.js +2 -2
  186. package/es/raster/index.js +7 -6
  187. package/es/raster/models/index.js +3 -4
  188. package/es/raster/models/raster.js +15 -25
  189. package/es/raster/raster.js +9 -13
  190. package/es/raster/shaders/raster_2d_frag.glsl +28 -0
  191. package/es/raster/shaders/raster_2d_vert.glsl +18 -0
  192. package/es/raster/shaders/raster_frag.glsl +9 -0
  193. package/es/raster/shaders/raster_vert.glsl +44 -0
  194. package/es/tile/interface.js +1 -2
  195. package/es/tile/manager/tileConfigManager.js +6 -8
  196. package/es/tile/manager/tileLayerManager.js +19 -30
  197. package/es/tile/manager/tilePickerManager.js +14 -14
  198. package/es/tile/models/tileModel.js +6 -6
  199. package/es/tile/tileFactory/base.js +26 -32
  200. package/es/tile/tileFactory/index.js +6 -7
  201. package/es/tile/tileFactory/line.js +3 -9
  202. package/es/tile/tileFactory/point.js +3 -9
  203. package/es/tile/tileFactory/polygon.js +3 -9
  204. package/es/tile/tileFactory/raster.js +4 -10
  205. package/es/tile/tileFactory/rasterData.js +5 -11
  206. package/es/tile/tileFactory/rasterDataLayer.js +4 -5
  207. package/es/tile/tileFactory/vectorLayer.js +8 -9
  208. package/es/tile/tileLayer/baseTileLayer.js +67 -39
  209. package/es/tile/tmsTileLayer.js +5 -4
  210. package/es/tile/utils.js +5 -3
  211. package/es/utils/blend.js +1 -2
  212. package/es/utils/collision-index.js +36 -21
  213. package/es/utils/dataMappingStyle.js +71 -15
  214. package/es/utils/extrude_polyline.js +90 -48
  215. package/es/utils/grid-index.js +7 -21
  216. package/es/utils/layerData.js +41 -17
  217. package/es/utils/multiPassRender.js +21 -5
  218. package/es/utils/polylineNormal.js +40 -20
  219. package/es/utils/simpleLine.js +4 -6
  220. package/es/utils/symbol-layout.js +49 -10
  221. package/es/utils/updateShape.js +6 -3
  222. package/es/wind/index.js +5 -6
  223. package/es/wind/models/index.js +2 -3
  224. package/es/wind/models/utils.js +50 -26
  225. package/es/wind/models/wind.js +15 -18
  226. package/es/wind/models/windRender.js +89 -78
  227. package/es/wind/models/windShader.d.ts +6 -6
  228. package/es/wind/models/windShader.js +12 -7
  229. package/es/wind/shaders/wind_frag.glsl +9 -0
  230. package/es/wind/shaders/wind_vert.glsl +17 -0
  231. package/lib/Geometry/index.js +77 -115
  232. package/lib/Geometry/models/billboard.js +181 -218
  233. package/lib/Geometry/models/index.js +34 -19
  234. package/lib/Geometry/models/plane.js +278 -394
  235. package/lib/Geometry/models/sprite.js +189 -294
  236. package/lib/Geometry/shaders/billboard_frag.glsl +13 -0
  237. package/lib/Geometry/shaders/billboard_vert.glsl +50 -0
  238. package/lib/Geometry/shaders/plane_frag.glsl +22 -0
  239. package/lib/Geometry/shaders/plane_vert.glsl +53 -0
  240. package/lib/Geometry/shaders/sprite_frag.glsl +21 -0
  241. package/lib/Geometry/shaders/sprite_vert.glsl +28 -0
  242. package/lib/canvas/index.js +66 -102
  243. package/lib/canvas/models/canvas.js +140 -210
  244. package/lib/canvas/models/index.js +30 -13
  245. package/lib/citybuliding/building.js +63 -99
  246. package/lib/citybuliding/models/build.js +146 -196
  247. package/lib/citybuliding/shaders/build_frag.glsl +117 -0
  248. package/lib/citybuliding/shaders/build_vert.glsl +54 -0
  249. package/lib/core/BaseLayer.js +807 -1245
  250. package/lib/core/BaseModel.js +275 -375
  251. package/lib/core/interface.js +53 -37
  252. package/lib/core/schema.js +39 -18
  253. package/lib/core/shape/Path.js +78 -60
  254. package/lib/core/shape/extrude.js +90 -127
  255. package/lib/core/triangulation.js +191 -304
  256. package/lib/earth/index.js +62 -96
  257. package/lib/earth/models/atmosphere.js +112 -139
  258. package/lib/earth/models/base.js +150 -198
  259. package/lib/earth/models/bloomsphere.js +112 -139
  260. package/lib/earth/shaders/atmosphere_frag.glsl +17 -0
  261. package/lib/earth/shaders/atmosphere_vert.glsl +26 -0
  262. package/lib/earth/shaders/base_frag.glsl +13 -0
  263. package/lib/earth/shaders/base_vert.glsl +52 -0
  264. package/lib/earth/shaders/bloomsphere_frag.glsl +15 -0
  265. package/lib/earth/shaders/bloomsphere_vert.glsl +20 -0
  266. package/lib/earth/utils.js +89 -85
  267. package/lib/heatmap/index.js +92 -148
  268. package/lib/heatmap/models/grid.js +91 -113
  269. package/lib/heatmap/models/grid3d.js +123 -145
  270. package/lib/heatmap/models/heatmap.js +338 -470
  271. package/lib/heatmap/models/hexagon.js +92 -114
  272. package/lib/heatmap/models/index.js +37 -23
  273. package/lib/heatmap/shaders/grid_vert.glsl +42 -0
  274. package/lib/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
  275. package/lib/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
  276. package/lib/heatmap/shaders/heatmap_frag.glsl +47 -0
  277. package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
  278. package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
  279. package/lib/heatmap/shaders/heatmap_vert.glsl +10 -0
  280. package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  281. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
  282. package/lib/heatmap/shaders/hexagon_frag.glsl +12 -0
  283. package/lib/heatmap/shaders/hexagon_vert.glsl +41 -0
  284. package/lib/heatmap/triangulation.js +46 -30
  285. package/lib/image/index.js +74 -112
  286. package/lib/image/models/dataImage.js +173 -241
  287. package/lib/image/models/image.js +123 -177
  288. package/lib/image/models/index.js +32 -16
  289. package/lib/image/shaders/dataImage_frag.glsl +38 -0
  290. package/lib/image/shaders/image_frag.glsl +9 -0
  291. package/lib/image/shaders/image_vert.glsl +17 -0
  292. package/lib/index.js +96 -193
  293. package/lib/line/index.js +83 -128
  294. package/lib/line/models/arc.js +237 -328
  295. package/lib/line/models/arc_3d.js +228 -314
  296. package/lib/line/models/earthArc_3d.js +228 -316
  297. package/lib/line/models/great_circle.js +200 -279
  298. package/lib/line/models/half.js +201 -266
  299. package/lib/line/models/index.js +50 -43
  300. package/lib/line/models/line.js +299 -394
  301. package/lib/line/models/linearline.js +203 -263
  302. package/lib/line/models/simpleLine.js +175 -225
  303. package/lib/line/models/tile.js +237 -330
  304. package/lib/line/models/wall.js +235 -310
  305. package/lib/line/shaders/arc_chunks.vert.glsl +21 -0
  306. package/lib/line/shaders/dash/arc_dash_frag.glsl +28 -0
  307. package/lib/line/shaders/dash/arc_dash_vert.glsl +148 -0
  308. package/lib/line/shaders/dash/line_dash_frag.glsl +31 -0
  309. package/lib/line/shaders/dash/line_dash_vert.glsl +93 -0
  310. package/lib/line/shaders/half/line_half_frag.glsl +53 -0
  311. package/lib/line/shaders/half/line_half_vert.glsl +169 -0
  312. package/lib/line/shaders/line_arc2d_vert.glsl +114 -0
  313. package/lib/line/shaders/line_arc_3d_frag.glsl +103 -0
  314. package/lib/line/shaders/line_arc_3d_vert.glsl +207 -0
  315. package/lib/line/shaders/line_arc_frag.glsl +89 -0
  316. package/lib/line/shaders/line_arc_great_circle_frag.glsl +101 -0
  317. package/lib/line/shaders/line_arc_great_circle_vert.glsl +215 -0
  318. package/lib/line/shaders/line_arc_vert.glsl +174 -0
  319. package/lib/line/shaders/line_bezier_vert.glsl +85 -0
  320. package/lib/line/shaders/line_frag.glsl +100 -0
  321. package/lib/line/shaders/line_vert.glsl +192 -0
  322. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
  323. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
  324. package/lib/line/shaders/linear/arc_linear_frag.glsl +38 -0
  325. package/lib/line/shaders/linear/arc_linear_vert.glsl +138 -0
  326. package/lib/line/shaders/linear/line_linear_frag.glsl +27 -0
  327. package/lib/line/shaders/linearLine/line_linear_frag.glsl +20 -0
  328. package/lib/line/shaders/linearLine/line_linear_vert.glsl +112 -0
  329. package/lib/line/shaders/simple/simpleline_frag.glsl +10 -0
  330. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
  331. package/lib/line/shaders/simple/simpleline_vert.glsl +78 -0
  332. package/lib/line/shaders/tile/line_tile_frag.glsl +79 -0
  333. package/lib/line/shaders/tile/line_tile_vert.glsl +210 -0
  334. package/lib/line/shaders/wall_frag.glsl +93 -0
  335. package/lib/line/shaders/wall_vert.glsl +111 -0
  336. package/lib/mask/index.js +59 -93
  337. package/lib/mask/models/fill.js +82 -132
  338. package/lib/mask/models/index.js +30 -13
  339. package/lib/mask/shaders/mask_frag.glsl +7 -0
  340. package/lib/mask/shaders/mask_vert.glsl +22 -0
  341. package/lib/plugins/DataMappingPlugin.js +222 -304
  342. package/lib/plugins/DataSourcePlugin.js +87 -100
  343. package/lib/plugins/FeatureScalePlugin.js +239 -310
  344. package/lib/plugins/LayerAnimateStylePlugin.js +55 -61
  345. package/lib/plugins/LayerModelPlugin.js +72 -70
  346. package/lib/plugins/LayerStylePlugin.js +51 -44
  347. package/lib/plugins/LightingPlugin.js +68 -72
  348. package/lib/plugins/MultiPassRendererPlugin.js +65 -77
  349. package/lib/plugins/PixelPickingPlugin.js +109 -128
  350. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -103
  351. package/lib/plugins/ShaderUniformPlugin.js +98 -103
  352. package/lib/plugins/UpdateModelPlugin.js +47 -36
  353. package/lib/plugins/UpdateStyleAttributePlugin.js +75 -80
  354. package/lib/point/index.js +147 -216
  355. package/lib/point/models/earthExtrude.js +201 -262
  356. package/lib/point/models/earthFill.js +202 -276
  357. package/lib/point/models/extrude.js +203 -282
  358. package/lib/point/models/fill.js +273 -369
  359. package/lib/point/models/fillmage.js +250 -327
  360. package/lib/point/models/image.js +163 -226
  361. package/lib/point/models/index.js +52 -46
  362. package/lib/point/models/normal.js +134 -176
  363. package/lib/point/models/radar.js +212 -286
  364. package/lib/point/models/simplePoint.js +142 -187
  365. package/lib/point/models/text.js +385 -559
  366. package/lib/point/models/tile.js +223 -294
  367. package/lib/point/shaders/animate/wave_frag.glsl +65 -0
  368. package/lib/point/shaders/earth/extrude_frag.glsl +44 -0
  369. package/lib/point/shaders/earth/extrude_vert.glsl +140 -0
  370. package/lib/point/shaders/earth/fill_frag.glsl +86 -0
  371. package/lib/point/shaders/earth/fill_vert.glsl +126 -0
  372. package/lib/point/shaders/extrude/extrude_frag.glsl +44 -0
  373. package/lib/point/shaders/extrude/extrude_vert.glsl +121 -0
  374. package/lib/point/shaders/fill_frag.glsl +84 -0
  375. package/lib/point/shaders/fill_vert.glsl +182 -0
  376. package/lib/point/shaders/image/fillImage_frag.glsl +20 -0
  377. package/lib/point/shaders/image/fillImage_vert.glsl +108 -0
  378. package/lib/point/shaders/image_frag.glsl +39 -0
  379. package/lib/point/shaders/image_vert.glsl +81 -0
  380. package/lib/point/shaders/normal_frag.glsl +15 -0
  381. package/lib/point/shaders/normal_vert.glsl +79 -0
  382. package/lib/point/shaders/radar/radar_frag.glsl +64 -0
  383. package/lib/point/shaders/radar/radar_vert.glsl +120 -0
  384. package/lib/point/shaders/simplePoint_frag.glsl +53 -0
  385. package/lib/point/shaders/simplePoint_vert.glsl +79 -0
  386. package/lib/point/shaders/text_frag.glsl +48 -0
  387. package/lib/point/shaders/text_vert.glsl +131 -0
  388. package/lib/point/shaders/tile/fill_tile_frag.glsl +83 -0
  389. package/lib/point/shaders/tile/fill_tile_vert.glsl +181 -0
  390. package/lib/point/shape/extrude.js +51 -51
  391. package/lib/polygon/index.js +100 -149
  392. package/lib/polygon/models/extrude.js +222 -303
  393. package/lib/polygon/models/fill.js +153 -205
  394. package/lib/polygon/models/index.js +52 -46
  395. package/lib/polygon/models/ocean.js +172 -251
  396. package/lib/polygon/models/tile.js +100 -139
  397. package/lib/polygon/models/water.js +152 -227
  398. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
  399. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
  400. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
  401. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
  402. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
  403. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
  404. package/lib/polygon/shaders/polygon_frag.glsl +12 -0
  405. package/lib/polygon/shaders/polygon_linear_frag.glsl +22 -0
  406. package/lib/polygon/shaders/polygon_linear_vert.glsl +74 -0
  407. package/lib/polygon/shaders/polygon_vert.glsl +66 -0
  408. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
  409. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
  410. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
  411. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
  412. package/lib/polygon/shaders/water/polygon_water_frag.glsl +73 -0
  413. package/lib/polygon/shaders/water/polygon_water_vert.glsl +55 -0
  414. package/lib/raster/buffers/triangulation.js +39 -26
  415. package/lib/raster/index.js +73 -111
  416. package/lib/raster/models/index.js +33 -17
  417. package/lib/raster/models/raster.js +134 -187
  418. package/lib/raster/raster.js +132 -189
  419. package/lib/raster/shaders/raster_2d_frag.glsl +28 -0
  420. package/lib/raster/shaders/raster_2d_vert.glsl +18 -0
  421. package/lib/raster/shaders/raster_frag.glsl +9 -0
  422. package/lib/raster/shaders/raster_vert.glsl +44 -0
  423. package/lib/tile/interface.js +17 -2
  424. package/lib/tile/manager/tileConfigManager.js +86 -126
  425. package/lib/tile/manager/tileLayerManager.js +227 -312
  426. package/lib/tile/manager/tilePickerManager.js +123 -187
  427. package/lib/tile/models/tileModel.js +51 -70
  428. package/lib/tile/tileFactory/base.js +292 -403
  429. package/lib/tile/tileFactory/index.js +48 -51
  430. package/lib/tile/tileFactory/line.js +50 -71
  431. package/lib/tile/tileFactory/point.js +50 -71
  432. package/lib/tile/tileFactory/polygon.js +50 -71
  433. package/lib/tile/tileFactory/raster.js +54 -72
  434. package/lib/tile/tileFactory/rasterData.js +76 -94
  435. package/lib/tile/tileFactory/rasterDataLayer.js +62 -98
  436. package/lib/tile/tileFactory/vectorLayer.js +95 -148
  437. package/lib/tile/tileLayer/baseTileLayer.js +220 -380
  438. package/lib/tile/tmsTileLayer.js +67 -109
  439. package/lib/tile/utils.js +86 -101
  440. package/lib/utils/blend.js +79 -60
  441. package/lib/utils/collision-index.js +63 -83
  442. package/lib/utils/dataMappingStyle.js +59 -56
  443. package/lib/utils/extrude_polyline.js +397 -554
  444. package/lib/utils/grid-index.js +111 -168
  445. package/lib/utils/layerData.js +88 -95
  446. package/lib/utils/multiPassRender.js +38 -31
  447. package/lib/utils/polylineNormal.js +86 -118
  448. package/lib/utils/simpleLine.js +85 -101
  449. package/lib/utils/symbol-layout.js +109 -173
  450. package/lib/utils/updateShape.js +40 -11
  451. package/lib/wind/index.js +71 -110
  452. package/lib/wind/models/index.js +30 -13
  453. package/lib/wind/models/utils.js +89 -104
  454. package/lib/wind/models/wind.js +224 -332
  455. package/lib/wind/models/windRender.js +215 -293
  456. package/lib/wind/models/windShader.js +181 -17
  457. package/lib/wind/shaders/wind_frag.glsl +9 -0
  458. package/lib/wind/shaders/wind_vert.glsl +17 -0
  459. package/package.json +11 -9
  460. package/es/Geometry/index.js.map +0 -1
  461. package/es/Geometry/models/billboard.js.map +0 -1
  462. package/es/Geometry/models/index.js.map +0 -1
  463. package/es/Geometry/models/plane.js.map +0 -1
  464. package/es/Geometry/models/sprite.js.map +0 -1
  465. package/es/canvas/index.js.map +0 -1
  466. package/es/canvas/models/canvas.js.map +0 -1
  467. package/es/canvas/models/index.js.map +0 -1
  468. package/es/citybuliding/building.js.map +0 -1
  469. package/es/citybuliding/models/build.js.map +0 -1
  470. package/es/core/BaseLayer.js.map +0 -1
  471. package/es/core/BaseModel.js.map +0 -1
  472. package/es/core/interface.js.map +0 -1
  473. package/es/core/schema.js.map +0 -1
  474. package/es/core/shape/Path.js.map +0 -1
  475. package/es/core/shape/extrude.js.map +0 -1
  476. package/es/core/triangulation.js.map +0 -1
  477. package/es/earth/index.js.map +0 -1
  478. package/es/earth/models/atmosphere.js.map +0 -1
  479. package/es/earth/models/base.js.map +0 -1
  480. package/es/earth/models/bloomsphere.js.map +0 -1
  481. package/es/earth/utils.js.map +0 -1
  482. package/es/glsl.d.js +0 -2
  483. package/es/glsl.d.js.map +0 -1
  484. package/es/heatmap/index.js.map +0 -1
  485. package/es/heatmap/models/grid.js.map +0 -1
  486. package/es/heatmap/models/grid3d.js.map +0 -1
  487. package/es/heatmap/models/heatmap.js.map +0 -1
  488. package/es/heatmap/models/hexagon.js.map +0 -1
  489. package/es/heatmap/models/index.js.map +0 -1
  490. package/es/heatmap/triangulation.js.map +0 -1
  491. package/es/image/index.js.map +0 -1
  492. package/es/image/models/dataImage.js.map +0 -1
  493. package/es/image/models/image.js.map +0 -1
  494. package/es/image/models/index.js.map +0 -1
  495. package/es/index.js.map +0 -1
  496. package/es/line/index.js.map +0 -1
  497. package/es/line/models/arc.js.map +0 -1
  498. package/es/line/models/arc_3d.js.map +0 -1
  499. package/es/line/models/earthArc_3d.js.map +0 -1
  500. package/es/line/models/great_circle.js.map +0 -1
  501. package/es/line/models/half.js.map +0 -1
  502. package/es/line/models/index.js.map +0 -1
  503. package/es/line/models/line.js.map +0 -1
  504. package/es/line/models/linearline.js.map +0 -1
  505. package/es/line/models/simpleLine.js.map +0 -1
  506. package/es/line/models/tile.js.map +0 -1
  507. package/es/line/models/wall.js.map +0 -1
  508. package/es/mask/index.js.map +0 -1
  509. package/es/mask/models/fill.js.map +0 -1
  510. package/es/mask/models/index.js.map +0 -1
  511. package/es/plugins/DataMappingPlugin.js.map +0 -1
  512. package/es/plugins/DataSourcePlugin.js.map +0 -1
  513. package/es/plugins/FeatureScalePlugin.js.map +0 -1
  514. package/es/plugins/LayerAnimateStylePlugin.js.map +0 -1
  515. package/es/plugins/LayerModelPlugin.js.map +0 -1
  516. package/es/plugins/LayerStylePlugin.js.map +0 -1
  517. package/es/plugins/LightingPlugin.js.map +0 -1
  518. package/es/plugins/MultiPassRendererPlugin.js.map +0 -1
  519. package/es/plugins/PixelPickingPlugin.js.map +0 -1
  520. package/es/plugins/RegisterStyleAttributePlugin.js.map +0 -1
  521. package/es/plugins/ShaderUniformPlugin.js.map +0 -1
  522. package/es/plugins/UpdateModelPlugin.js.map +0 -1
  523. package/es/plugins/UpdateStyleAttributePlugin.js.map +0 -1
  524. package/es/point/index.js.map +0 -1
  525. package/es/point/models/earthExtrude.js.map +0 -1
  526. package/es/point/models/earthFill.js.map +0 -1
  527. package/es/point/models/extrude.js.map +0 -1
  528. package/es/point/models/fill.js.map +0 -1
  529. package/es/point/models/fillmage.js.map +0 -1
  530. package/es/point/models/image.js.map +0 -1
  531. package/es/point/models/index.js.map +0 -1
  532. package/es/point/models/normal.js.map +0 -1
  533. package/es/point/models/radar.js.map +0 -1
  534. package/es/point/models/simplePoint.js.map +0 -1
  535. package/es/point/models/text.js.map +0 -1
  536. package/es/point/models/tile.js.map +0 -1
  537. package/es/point/shape/extrude.js.map +0 -1
  538. package/es/polygon/index.js.map +0 -1
  539. package/es/polygon/models/extrude.js.map +0 -1
  540. package/es/polygon/models/fill.js.map +0 -1
  541. package/es/polygon/models/index.js.map +0 -1
  542. package/es/polygon/models/ocean.js.map +0 -1
  543. package/es/polygon/models/tile.js.map +0 -1
  544. package/es/polygon/models/water.js.map +0 -1
  545. package/es/raster/buffers/triangulation.js.map +0 -1
  546. package/es/raster/index.js.map +0 -1
  547. package/es/raster/models/index.js.map +0 -1
  548. package/es/raster/models/raster.js.map +0 -1
  549. package/es/raster/raster.js.map +0 -1
  550. package/es/tile/interface.js.map +0 -1
  551. package/es/tile/manager/tileConfigManager.js.map +0 -1
  552. package/es/tile/manager/tileLayerManager.js.map +0 -1
  553. package/es/tile/manager/tilePickerManager.js.map +0 -1
  554. package/es/tile/models/tileModel.js.map +0 -1
  555. package/es/tile/tileFactory/base.js.map +0 -1
  556. package/es/tile/tileFactory/index.js.map +0 -1
  557. package/es/tile/tileFactory/line.js.map +0 -1
  558. package/es/tile/tileFactory/point.js.map +0 -1
  559. package/es/tile/tileFactory/polygon.js.map +0 -1
  560. package/es/tile/tileFactory/raster.js.map +0 -1
  561. package/es/tile/tileFactory/rasterData.js.map +0 -1
  562. package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
  563. package/es/tile/tileFactory/vectorLayer.js.map +0 -1
  564. package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
  565. package/es/tile/tmsTileLayer.js.map +0 -1
  566. package/es/tile/utils.js.map +0 -1
  567. package/es/utils/blend.js.map +0 -1
  568. package/es/utils/collision-index.js.map +0 -1
  569. package/es/utils/dataMappingStyle.js.map +0 -1
  570. package/es/utils/extrude_polyline.js.map +0 -1
  571. package/es/utils/grid-index.js.map +0 -1
  572. package/es/utils/layerData.js.map +0 -1
  573. package/es/utils/multiPassRender.js.map +0 -1
  574. package/es/utils/polylineNormal.js.map +0 -1
  575. package/es/utils/simpleLine.js.map +0 -1
  576. package/es/utils/symbol-layout.js.map +0 -1
  577. package/es/utils/updateShape.js.map +0 -1
  578. package/es/wind/index.js.map +0 -1
  579. package/es/wind/models/index.js.map +0 -1
  580. package/es/wind/models/utils.js.map +0 -1
  581. package/es/wind/models/wind.js.map +0 -1
  582. package/es/wind/models/windRender.js.map +0 -1
  583. package/es/wind/models/windShader.js.map +0 -1
  584. package/lib/Geometry/index.js.map +0 -1
  585. package/lib/Geometry/models/billboard.js.map +0 -1
  586. package/lib/Geometry/models/index.js.map +0 -1
  587. package/lib/Geometry/models/plane.js.map +0 -1
  588. package/lib/Geometry/models/sprite.js.map +0 -1
  589. package/lib/canvas/index.js.map +0 -1
  590. package/lib/canvas/models/canvas.js.map +0 -1
  591. package/lib/canvas/models/index.js.map +0 -1
  592. package/lib/citybuliding/building.js.map +0 -1
  593. package/lib/citybuliding/models/build.js.map +0 -1
  594. package/lib/core/BaseLayer.js.map +0 -1
  595. package/lib/core/BaseModel.js.map +0 -1
  596. package/lib/core/interface.js.map +0 -1
  597. package/lib/core/schema.js.map +0 -1
  598. package/lib/core/shape/Path.js.map +0 -1
  599. package/lib/core/shape/extrude.js.map +0 -1
  600. package/lib/core/triangulation.js.map +0 -1
  601. package/lib/earth/index.js.map +0 -1
  602. package/lib/earth/models/atmosphere.js.map +0 -1
  603. package/lib/earth/models/base.js.map +0 -1
  604. package/lib/earth/models/bloomsphere.js.map +0 -1
  605. package/lib/earth/utils.js.map +0 -1
  606. package/lib/glsl.d.js +0 -2
  607. package/lib/glsl.d.js.map +0 -1
  608. package/lib/heatmap/index.js.map +0 -1
  609. package/lib/heatmap/models/grid.js.map +0 -1
  610. package/lib/heatmap/models/grid3d.js.map +0 -1
  611. package/lib/heatmap/models/heatmap.js.map +0 -1
  612. package/lib/heatmap/models/hexagon.js.map +0 -1
  613. package/lib/heatmap/models/index.js.map +0 -1
  614. package/lib/heatmap/triangulation.js.map +0 -1
  615. package/lib/image/index.js.map +0 -1
  616. package/lib/image/models/dataImage.js.map +0 -1
  617. package/lib/image/models/image.js.map +0 -1
  618. package/lib/image/models/index.js.map +0 -1
  619. package/lib/index.js.map +0 -1
  620. package/lib/line/index.js.map +0 -1
  621. package/lib/line/models/arc.js.map +0 -1
  622. package/lib/line/models/arc_3d.js.map +0 -1
  623. package/lib/line/models/earthArc_3d.js.map +0 -1
  624. package/lib/line/models/great_circle.js.map +0 -1
  625. package/lib/line/models/half.js.map +0 -1
  626. package/lib/line/models/index.js.map +0 -1
  627. package/lib/line/models/line.js.map +0 -1
  628. package/lib/line/models/linearline.js.map +0 -1
  629. package/lib/line/models/simpleLine.js.map +0 -1
  630. package/lib/line/models/tile.js.map +0 -1
  631. package/lib/line/models/wall.js.map +0 -1
  632. package/lib/mask/index.js.map +0 -1
  633. package/lib/mask/models/fill.js.map +0 -1
  634. package/lib/mask/models/index.js.map +0 -1
  635. package/lib/plugins/DataMappingPlugin.js.map +0 -1
  636. package/lib/plugins/DataSourcePlugin.js.map +0 -1
  637. package/lib/plugins/FeatureScalePlugin.js.map +0 -1
  638. package/lib/plugins/LayerAnimateStylePlugin.js.map +0 -1
  639. package/lib/plugins/LayerModelPlugin.js.map +0 -1
  640. package/lib/plugins/LayerStylePlugin.js.map +0 -1
  641. package/lib/plugins/LightingPlugin.js.map +0 -1
  642. package/lib/plugins/MultiPassRendererPlugin.js.map +0 -1
  643. package/lib/plugins/PixelPickingPlugin.js.map +0 -1
  644. package/lib/plugins/RegisterStyleAttributePlugin.js.map +0 -1
  645. package/lib/plugins/ShaderUniformPlugin.js.map +0 -1
  646. package/lib/plugins/UpdateModelPlugin.js.map +0 -1
  647. package/lib/plugins/UpdateStyleAttributePlugin.js.map +0 -1
  648. package/lib/point/index.js.map +0 -1
  649. package/lib/point/models/earthExtrude.js.map +0 -1
  650. package/lib/point/models/earthFill.js.map +0 -1
  651. package/lib/point/models/extrude.js.map +0 -1
  652. package/lib/point/models/fill.js.map +0 -1
  653. package/lib/point/models/fillmage.js.map +0 -1
  654. package/lib/point/models/image.js.map +0 -1
  655. package/lib/point/models/index.js.map +0 -1
  656. package/lib/point/models/normal.js.map +0 -1
  657. package/lib/point/models/radar.js.map +0 -1
  658. package/lib/point/models/simplePoint.js.map +0 -1
  659. package/lib/point/models/text.js.map +0 -1
  660. package/lib/point/models/tile.js.map +0 -1
  661. package/lib/point/shape/extrude.js.map +0 -1
  662. package/lib/polygon/index.js.map +0 -1
  663. package/lib/polygon/models/extrude.js.map +0 -1
  664. package/lib/polygon/models/fill.js.map +0 -1
  665. package/lib/polygon/models/index.js.map +0 -1
  666. package/lib/polygon/models/ocean.js.map +0 -1
  667. package/lib/polygon/models/tile.js.map +0 -1
  668. package/lib/polygon/models/water.js.map +0 -1
  669. package/lib/raster/buffers/triangulation.js.map +0 -1
  670. package/lib/raster/index.js.map +0 -1
  671. package/lib/raster/models/index.js.map +0 -1
  672. package/lib/raster/models/raster.js.map +0 -1
  673. package/lib/raster/raster.js.map +0 -1
  674. package/lib/tile/interface.js.map +0 -1
  675. package/lib/tile/manager/tileConfigManager.js.map +0 -1
  676. package/lib/tile/manager/tileLayerManager.js.map +0 -1
  677. package/lib/tile/manager/tilePickerManager.js.map +0 -1
  678. package/lib/tile/models/tileModel.js.map +0 -1
  679. package/lib/tile/tileFactory/base.js.map +0 -1
  680. package/lib/tile/tileFactory/index.js.map +0 -1
  681. package/lib/tile/tileFactory/line.js.map +0 -1
  682. package/lib/tile/tileFactory/point.js.map +0 -1
  683. package/lib/tile/tileFactory/polygon.js.map +0 -1
  684. package/lib/tile/tileFactory/raster.js.map +0 -1
  685. package/lib/tile/tileFactory/rasterData.js.map +0 -1
  686. package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
  687. package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
  688. package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
  689. package/lib/tile/tmsTileLayer.js.map +0 -1
  690. package/lib/tile/utils.js.map +0 -1
  691. package/lib/utils/blend.js.map +0 -1
  692. package/lib/utils/collision-index.js.map +0 -1
  693. package/lib/utils/dataMappingStyle.js.map +0 -1
  694. package/lib/utils/extrude_polyline.js.map +0 -1
  695. package/lib/utils/grid-index.js.map +0 -1
  696. package/lib/utils/layerData.js.map +0 -1
  697. package/lib/utils/multiPassRender.js.map +0 -1
  698. package/lib/utils/polylineNormal.js.map +0 -1
  699. package/lib/utils/simpleLine.js.map +0 -1
  700. package/lib/utils/symbol-layout.js.map +0 -1
  701. package/lib/utils/updateShape.js.map +0 -1
  702. package/lib/wind/index.js.map +0 -1
  703. package/lib/wind/models/index.js.map +0 -1
  704. package/lib/wind/models/utils.js.map +0 -1
  705. package/lib/wind/models/wind.js.map +0 -1
  706. package/lib/wind/models/windRender.js.map +0 -1
  707. package/lib/wind/models/windShader.js.map +0 -1
@@ -1,5 +1,11 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import earcut from 'earcut';
3
+
4
+ /**
5
+ * 拉伸多边形顶点,返回拉伸后的顶点信息
6
+ * @param paths 路径数据组
7
+ * @param extrude 是否拉伸
8
+ */
3
9
  export default function extrudePolygon(path) {
4
10
  var p1 = path[0][0];
5
11
  var p2 = path[0][path[0].length - 1];
@@ -12,7 +18,7 @@ export default function extrudePolygon(path) {
12
18
  var flattengeo = earcut.flatten(path);
13
19
  var positions = [];
14
20
  var indexArray = [];
15
- var normals = [];
21
+ var normals = []; // 设置顶部z值
16
22
 
17
23
  for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
18
24
  flattengeo.vertices[j * 3 + 2] = 1;
@@ -54,5 +60,4 @@ export function fillPolygon(points) {
54
60
  positions: flattengeo.vertices,
55
61
  index: triangles
56
62
  };
57
- }
58
- //# sourceMappingURL=extrude.js.map
63
+ }
@@ -10,10 +10,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
 
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
 
13
- import BaseLayer from '../core/BaseLayer';
14
- import PolygonModels from './models/';
13
+ import BaseLayer from "../core/BaseLayer";
14
+ import PolygonModels from "./models/";
15
15
 
16
- var PolygonLayer = function (_BaseLayer) {
16
+ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
17
17
  _inherits(PolygonLayer, _BaseLayer);
18
18
 
19
19
  var _super = _createSuper(PolygonLayer);
@@ -100,6 +100,8 @@ var PolygonLayer = function (_BaseLayer) {
100
100
  }, {
101
101
  key: "getPointModelType",
102
102
  value: function getPointModelType() {
103
+ // pointlayer
104
+ // 2D、 3d、 shape、image、text、normal、
103
105
  var layerData = this.getEncodedData();
104
106
 
105
107
  var _this$getLayerConfig = this.getLayerConfig(),
@@ -140,5 +142,4 @@ var PolygonLayer = function (_BaseLayer) {
140
142
  return PolygonLayer;
141
143
  }(BaseLayer);
142
144
 
143
- export { PolygonLayer as default };
144
- //# sourceMappingURL=index.js.map
145
+ export { PolygonLayer as default };
@@ -1,12 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _isNumber from "lodash/isNumber";
10
7
 
11
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
9
 
@@ -14,34 +11,37 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
14
11
 
15
12
  import { AttributeType, gl } from '@antv/l7-core';
16
13
  import { getMask, rgb2arr } from '@antv/l7-utils';
17
- import BaseModel from '../../core/BaseModel';
18
- import { PolygonExtrudeTriangulation } from '../../core/triangulation';
19
- var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
14
+ import { isNumber } from 'lodash';
15
+ import BaseModel from "../../core/BaseModel";
16
+ import { PolygonExtrudeTriangulation } from "../../core/triangulation";
17
+
18
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
19
+ var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // extrude
20
+
21
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
20
22
  var polygonExtrudeVert = "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;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\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 styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
21
- var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float lightWeight = styleMappingMat[3][1];\n float topU = styleMappingMat[2][2];\n float topV = styleMappingMat[2][3];\n\n float sidey = styleMappingMat[3][0];\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
22
- var polygonExtrudeTexVert = "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;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n v_Color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n \n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[2][2] = a_uvs[0];\n styleMappingMat[2][3] = 1.0 - a_uvs[1];\n styleMappingMat[3][0] = a_uvs[2];\n\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\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 styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
23
+
24
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
25
+ var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float lightWeight = styleMappingMat[3][1];\n float topU = styleMappingMat[2][2];\n float topV = styleMappingMat[2][3];\n\n float sidey = styleMappingMat[3][0];\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
26
+
27
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
28
+ var polygonExtrudeTexVert = "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;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n v_Color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n \n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[2][2] = a_uvs[0];\n styleMappingMat[2][3] = 1.0 - a_uvs[1];\n styleMappingMat[3][0] = a_uvs[2];\n\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\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 styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
29
+
30
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
23
31
  var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
32
+
33
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
24
34
  var polygonExtrudePickLightVert = "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;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\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 styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
25
35
 
26
- var ExtrudeModel = function (_BaseModel) {
36
+ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
27
37
  _inherits(ExtrudeModel, _BaseModel);
28
38
 
29
39
  var _super = _createSuper(ExtrudeModel);
30
40
 
31
41
  function ExtrudeModel() {
32
- var _this;
33
-
34
42
  _classCallCheck(this, ExtrudeModel);
35
43
 
36
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
- args[_key] = arguments[_key];
38
- }
39
-
40
- _this = _super.call.apply(_super, [this].concat(args));
41
-
42
- _defineProperty(_assertThisInitialized(_this), "texture", void 0);
43
-
44
- return _this;
44
+ return _super.apply(this, arguments);
45
45
  }
46
46
 
47
47
  _createClass(ExtrudeModel, [{
@@ -74,7 +74,8 @@ var ExtrudeModel = function (_BaseModel) {
74
74
  width = _this$calDataFrame.width,
75
75
  height = _this$calDataFrame.height;
76
76
 
77
- this.rowCount = height;
77
+ this.rowCount = height; // 当前数据纹理有多少行
78
+
78
79
  this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
79
80
  flipY: true,
80
81
  data: data,
@@ -90,9 +91,11 @@ var ExtrudeModel = function (_BaseModel) {
90
91
  width: 1,
91
92
  height: 1
92
93
  });
93
- }
94
+ } // 转化渐变色
95
+
96
+
97
+ var useLinearColor = 0; // 默认不生效
94
98
 
95
- var useLinearColor = 0;
96
99
  var sourceColorArr = [1, 1, 1, 1];
97
100
  var targetColorArr = [1, 1, 1, 1];
98
101
 
@@ -103,13 +106,16 @@ var ExtrudeModel = function (_BaseModel) {
103
106
  }
104
107
 
105
108
  return {
109
+ // 控制侧面和顶面的显示隐藏
106
110
  u_topsurface: Number(topsurface),
107
111
  u_sidesurface: Number(sidesurface),
108
112
  u_heightfixed: Number(heightfixed),
109
113
  u_dataTexture: this.dataTexture,
114
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
110
115
  u_cellTypeLayout: this.getCellTypeLayout(),
111
116
  u_raisingHeight: Number(raisingHeight),
112
- u_opacity: _isNumber(opacity) ? opacity : 1.0,
117
+ u_opacity: isNumber(opacity) ? opacity : 1.0,
118
+ // 渐变色支持参数
113
119
  u_linearColor: useLinearColor,
114
120
  u_sourceColor: sourceColorArr,
115
121
  u_targetColor: targetColorArr,
@@ -205,6 +211,7 @@ var ExtrudeModel = function (_BaseModel) {
205
211
  descriptor: {
206
212
  name: 'a_uvs',
207
213
  buffer: {
214
+ // give the WebGL driver a hint that this buffer may change
208
215
  usage: gl.STATIC_DRAW,
209
216
  data: [],
210
217
  type: gl.FLOAT
@@ -216,13 +223,15 @@ var ExtrudeModel = function (_BaseModel) {
216
223
  return [(lng - minLng) / lngLen, (lat - minLat) / latLen, vertex[4]];
217
224
  }
218
225
  }
219
- });
226
+ }); // point layer size;
227
+
220
228
  this.styleAttributeService.registerStyleAttribute({
221
229
  name: 'normal',
222
230
  type: AttributeType.Attribute,
223
231
  descriptor: {
224
232
  name: 'a_Normal',
225
233
  buffer: {
234
+ // give the WebGL driver a hint that this buffer may change
226
235
  usage: gl.STATIC_DRAW,
227
236
  data: [],
228
237
  type: gl.FLOAT
@@ -239,6 +248,7 @@ var ExtrudeModel = function (_BaseModel) {
239
248
  descriptor: {
240
249
  name: 'a_Size',
241
250
  buffer: {
251
+ // give the WebGL driver a hint that this buffer may change
242
252
  usage: gl.DYNAMIC_DRAW,
243
253
  data: [],
244
254
  type: gl.FLOAT
@@ -255,7 +265,7 @@ var ExtrudeModel = function (_BaseModel) {
255
265
  }, {
256
266
  key: "loadTexture",
257
267
  value: function loadTexture() {
258
- var _this2 = this;
268
+ var _this = this;
259
269
 
260
270
  var _ref4 = this.layer.getLayerConfig(),
261
271
  mapTexture = _ref4.mapTexture;
@@ -272,7 +282,7 @@ var ExtrudeModel = function (_BaseModel) {
272
282
  image.src = mapTexture;
273
283
 
274
284
  image.onload = function () {
275
- _this2.texture = createTexture2D({
285
+ _this.texture = createTexture2D({
276
286
  data: image,
277
287
  width: image.width,
278
288
  height: image.height,
@@ -282,9 +292,9 @@ var ExtrudeModel = function (_BaseModel) {
282
292
  mag: gl.LINEAR
283
293
  });
284
294
 
285
- _this2.layerService.updateLayerRenderList();
295
+ _this.layerService.updateLayerRenderList();
286
296
 
287
- _this2.layerService.renderLayers();
297
+ _this.layerService.renderLayers();
288
298
  };
289
299
  }
290
300
  }
@@ -293,5 +303,4 @@ var ExtrudeModel = function (_BaseModel) {
293
303
  return ExtrudeModel;
294
304
  }(BaseModel);
295
305
 
296
- export { ExtrudeModel as default };
297
- //# sourceMappingURL=extrude.js.map
306
+ export { ExtrudeModel as default };
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _isNumber from "lodash/isNumber";
7
6
 
8
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
8
 
@@ -11,14 +10,23 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
11
10
 
12
11
  import { AttributeType, gl } from '@antv/l7-core';
13
12
  import { getMask, polygonFillTriangulation } from '@antv/l7-utils';
14
- import BaseModel from '../../core/BaseModel';
15
- import { polygonTriangulationWithCenter } from '../../core/triangulation';
13
+ import { isNumber } from 'lodash';
14
+ import BaseModel from "../../core/BaseModel";
15
+ import { polygonTriangulationWithCenter } from "../../core/triangulation";
16
+
17
+ /* babel-plugin-inline-import '../shaders/polygon_frag.glsl' */
16
18
  var polygon_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
+
20
+ /* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
17
21
  var polygon_linear_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n \n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
22
+
23
+ /* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
18
24
  var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n \n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\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 setPickingColor(a_PickingColor);\n}";
25
+
26
+ /* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
19
27
  var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\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 setPickingColor(a_PickingColor);\n}\n\n";
20
28
 
21
- var FillModel = function (_BaseModel) {
29
+ var FillModel = /*#__PURE__*/function (_BaseModel) {
22
30
  _inherits(FillModel, _BaseModel);
23
31
 
24
32
  var _super = _createSuper(FillModel);
@@ -56,7 +64,8 @@ var FillModel = function (_BaseModel) {
56
64
  width = _this$calDataFrame.width,
57
65
  height = _this$calDataFrame.height;
58
66
 
59
- this.rowCount = height;
67
+ this.rowCount = height; // 当前数据纹理有多少行
68
+
60
69
  this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
61
70
  flipY: true,
62
71
  data: data,
@@ -76,9 +85,10 @@ var FillModel = function (_BaseModel) {
76
85
 
77
86
  return {
78
87
  u_dataTexture: this.dataTexture,
88
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
79
89
  u_cellTypeLayout: this.getCellTypeLayout(),
80
90
  u_raisingHeight: Number(raisingHeight),
81
- u_opacity: _isNumber(opacity) ? opacity : 1.0,
91
+ u_opacity: isNumber(opacity) ? opacity : 1.0,
82
92
  u_opacitylinear: Number(opacityLinear.enable),
83
93
  u_dir: opacityLinear.dir === 'in' ? 1.0 : 0.0
84
94
  };
@@ -154,12 +164,14 @@ var FillModel = function (_BaseModel) {
154
164
  descriptor: {
155
165
  name: 'a_linear',
156
166
  buffer: {
167
+ // give the WebGL driver a hint that this buffer may change
157
168
  usage: gl.STATIC_DRAW,
158
169
  data: [],
159
170
  type: gl.FLOAT
160
171
  },
161
172
  size: 3,
162
173
  update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
174
+ // center[0] center[1] radius
163
175
  return [vertex[3], vertex[4], vertex[5]];
164
176
  }
165
177
  }
@@ -196,5 +208,4 @@ var FillModel = function (_BaseModel) {
196
208
  return FillModel;
197
209
  }(BaseModel);
198
210
 
199
- export { FillModel as default };
200
- //# sourceMappingURL=fill.js.map
211
+ export { FillModel as default };
@@ -1,15 +1,15 @@
1
- import LineModel from '../../line/models/line';
2
- import PointExtrudeModel from '../../point/models/extrude';
3
- import PointFillModel from '../../point/models/fill';
4
- import IMageModel from '../../point/models/image';
5
- import NormalModel from '../../point/models/normal';
6
- import TextModel from '../../point/models/text';
7
- import PolygonTileModel from '../../tile/models/tileModel';
8
- import ExtrudeModel from './extrude';
9
- import FillModel from './fill';
10
- import Ocean from './ocean';
11
- import TilePolygonModel from './tile';
12
- import Water from './water';
1
+ import LineModel from "../../line/models/line";
2
+ import PointExtrudeModel from "../../point/models/extrude";
3
+ import PointFillModel from "../../point/models/fill";
4
+ import IMageModel from "../../point/models/image";
5
+ import NormalModel from "../../point/models/normal";
6
+ import TextModel from "../../point/models/text";
7
+ import PolygonTileModel from "../../tile/models/tileModel";
8
+ import ExtrudeModel from "./extrude";
9
+ import FillModel from "./fill";
10
+ import Ocean from "./ocean";
11
+ import TilePolygonModel from "./tile";
12
+ import Water from "./water";
13
13
  var PolygonModels = {
14
14
  fill: FillModel,
15
15
  line: LineModel,
@@ -21,8 +21,8 @@ var PolygonModels = {
21
21
  point_extrude: PointExtrudeModel,
22
22
  water: Water,
23
23
  ocean: Ocean,
24
+ // point_fill: PointModels.fill,
24
25
  vectorpolygon: PolygonTileModel,
25
26
  tile: TilePolygonModel
26
27
  };
27
- export default PolygonModels;
28
- //# sourceMappingURL=index.js.map
28
+ export default PolygonModels;
@@ -1,12 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _isNumber from "lodash/isNumber";
10
7
 
11
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
9
 
@@ -14,34 +11,25 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
14
11
 
15
12
  import { AttributeType, gl } from '@antv/l7-core';
16
13
  import { getMask, rgb2arr } from '@antv/l7-utils';
17
- import BaseModel from '../../core/BaseModel';
18
- import { polygonTriangulation } from '../../core/triangulation';
14
+ import { isNumber } from 'lodash';
15
+ import BaseModel from "../../core/BaseModel";
16
+ import { polygonTriangulation } from "../../core/triangulation";
17
+
18
+ /* babel-plugin-inline-import '../shaders/water/polygon_ocean_frag.glsl' */
19
19
  var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nfloat coast2water_fadedepth = 0.10;\nfloat large_waveheight = .750; // change to adjust the \"heavy\" waves\nfloat large_wavesize = 3.4; // factor to adjust the large wave size\nfloat small_waveheight = 0.6; // change to adjust the small random waves\nfloat small_wavesize = 0.5; // factor to ajust the small wave size\nfloat water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)\nfloat water_glossylight_fact= 120.; // range [1..200]\nfloat particle_amount = 70.;\n// vec3 watercolor = vec3(0.43, 0.60, 0.66); // 'transparent' low-water color (RGB)\n// vec3 watercolor2 = vec3(0.06, 0.07, 0.11); // deep-water color (RGB, should be darker than the low-water color)\nuniform vec4 u_watercolor;\nuniform vec4 u_watercolor2;\nvec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights\n#define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun\n\nuniform sampler2D u_texture1;\nuniform sampler2D u_texture2;\nuniform sampler2D u_texture3;\n\n \n\nfloat hash( float n ) {\n return fract(sin(n)*43758.5453123);\n}\n\n// 2d noise function\nfloat noise1( in vec2 x ) {\n vec2 p = floor(x);\n vec2 f = smoothstep(0.0, 1.0, fract(x));\n float n = p.x + p.y*57.0;\n return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),\n mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);\n}\n\nfloat noise(vec2 p) {\n return texture2D(u_texture2,p*vec2(1./256.)).x;\n}\n\nvec4 highness(vec2 p) {\n vec4 t = texture2D(u_texture1,fract(p));\n float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;\n return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);\n}\n\nfloat height_map( vec2 p ) {\n vec4 height=highness(p);\n /*\n height = -0.5+\n 0.5*smoothstep(-100.,0.,-height)+\n 2.75*smoothstep(0.,2.,height)+\n 1.75*smoothstep(2.,4.,height)+\n 2.75*smoothstep(4.,16.,height)+\n 1.5*smoothstep(16.,1000.,height);\n */\n\n mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );\n //p = p*6.;\n float f = 0.6000*noise1( p ); p = m*p*1.1*6.;\n f += 0.2500*noise( p ); p = m*p*1.32;\n f += 0.1666*noise( p ); p = m*p*1.11;\n f += 0.0834*noise( p ); p = m*p*1.12;\n f += 0.0634*noise( p ); p = m*p*1.13;\n f += 0.0444*noise( p ); p = m*p*1.14;\n f += 0.0274*noise( p ); p = m*p*1.15;\n f += 0.0134*noise( p ); p = m*p*1.16;\n f += 0.0104*noise( p ); p = m*p*1.17;\n f += 0.0084*noise( p );\n f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;\n const float FLAT_LEVEL = 0.92525;\n //f = f*0.25+height*0.75;\n if (f<FLAT_LEVEL)\n f = f;\n else\n f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase\n return clamp(f, 0., 10.);\n}\n\nvec3 plasma_quintic( float x ) {\n x = clamp( x, 0.0, 1.0);\n vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3\n vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7\n return vec3(\n dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),\n dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),\n dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );\n}\n\nvec4 color(vec2 p){\n vec4 c1 = vec4(1.7,1.6,.9,1);\n vec4 c2 = vec4(.2,.94,.1,1);\n vec4 c3 = vec4(.3,.2,.0,1);\n vec4 c4 = vec4(.99,.99,1.6,1);\n vec4 v = highness(p);\n float los = smoothstep(0.1,1.1,v.b);\n float his = smoothstep(3.5,6.5,v.b);\n float ces = smoothstep(1.,5.,v.a);\n vec4 lo = mix(c1,c2,los);\n vec4 hi = mix(c3,c4,his);\n vec4 ce = mix(lo,hi,ces);\n\n return vec4(plasma_quintic(ces),1).ragb;\n}\n\nvec3 terrain_map( vec2 p )\n{\n return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture2D(u_texture3, fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'\n}\n\nconst mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );\n\nfloat water_map( vec2 p, float height ) {\n vec2 p2 = p*large_wavesize;\n vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );\n vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );\n\n // coarse crossing 'ocean' waves...\n float f = 0.6000*noise( p );\n f += 0.2500*noise( p*m );\n f += 0.1666*noise( p*m*m );\n float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;\n\n p *= small_wavesize;\n f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<9; i++)\n { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }\n \n return wave+f*small_waveheight;\n}\n\nfloat nautic(vec2 p) {\n p *= 18.;\n float f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }\n return pow(1.-f, 5.);\n}\n\nfloat particles(vec2 p) {\n p *= 200.;\n float f = 0.;\n float amp = 1.0, s = 1.5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }\n return pow(f*.35, 7.)*particle_amount;\n}\n\nfloat test_shadow( vec2 xy, float height) {\n vec3 r0 = vec3(xy, height);\n vec3 rd = normalize( light - r0 );\n \n float hit = 1.0;\n float t = 0.001;\n for (int j=1; j<25; j++)\n {\n vec3 p = r0 + t*rd;\n float h = height_map( p.xy );\n float height_diff = p.z - h;\n if (height_diff<0.0)\n {\n return 0.0;\n }\n t += 0.01+height_diff*.02;\n hit = min(hit, 2.*height_diff/t); // soft shaddow \n }\n return hit;\n}\n\nvec3 CalcTerrain(vec2 uv, float height) {\n vec3 col = terrain_map( uv );\n vec2 iResolution = vec2(512.);\n float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);\n float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);\n float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);\n float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);\n vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));\n vec3 r0 = vec3(uv, height);\n vec3 rd = normalize( light - r0 );\n float grad = dot(norm, rd);\n col *= grad+pow(grad, 8.);\n float terrainshade = test_shadow( uv, height );\n col = mix(col*.25, col, terrainshade);\n return col;\n}\n\n\nvoid main() {\n vec3 watercolor = u_watercolor.rgb;\n vec3 watercolor2 = u_watercolor2.rgb;\n vec2 uv = v_uv;\n float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)\n float deepwater_fadedepth = 0.4 + coast2water_fadedepth;\n float height = height_map( uv );\n vec3 col;\n\n float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);\n float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);\n if (height > level)\n {\n col = CalcTerrain(uv, height);\n }\n if (height <= level)\n {\n vec2 dif = vec2(.0, .01);\n vec2 pos = uv*15. + vec2(u_time*.01);\n float h1 = water_map(pos-dif,waveheight);\n float h2 = water_map(pos+dif,waveheight);\n float h3 = water_map(pos-dif.yx,waveheight);\n float h4 = water_map(pos+dif.yx,waveheight);\n vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane\n uv += normwater.xy*.002*(level-height);\n \n col = CalcTerrain(uv, height);\n\n float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);\n float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);\n float intensity = col.r*.2126+col.g*.7152+col.b*.0722;\n watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));\n\n vec3 r0 = vec3(uv, WATER_LEVEL);\n vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position\n float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction\n float specular = pow(grad, water_softlight_fact); // used for soft highlights \n float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights\n float gradpos = dot(vec3(0., 0., 1.), rd);\n float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...) \n float watershade = test_shadow( uv, level );\n watercolor *= 2.2+watershade;\n watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;\n watercolor /= (1.+specular1*1.25);\n watercolor += watershade*specular2*water_specularcolor;\n watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));\n \n col = mix(col, watercolor, coastfade);\n }\n \n\n float opacity = styleMappingMat[0][0];\n gl_FragColor = vec4(col, opacity); \n}\n";
20
+
21
+ /* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
20
22
  var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\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\n";
21
23
 
22
- var OceanModel = function (_BaseModel) {
24
+ var OceanModel = /*#__PURE__*/function (_BaseModel) {
23
25
  _inherits(OceanModel, _BaseModel);
24
26
 
25
27
  var _super = _createSuper(OceanModel);
26
28
 
27
29
  function OceanModel() {
28
- var _this;
29
-
30
30
  _classCallCheck(this, OceanModel);
31
31
 
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
-
36
- _this = _super.call.apply(_super, [this].concat(args));
37
-
38
- _defineProperty(_assertThisInitialized(_this), "texture1", void 0);
39
-
40
- _defineProperty(_assertThisInitialized(_this), "texture2", void 0);
41
-
42
- _defineProperty(_assertThisInitialized(_this), "texture3", void 0);
43
-
44
- return _this;
32
+ return _super.apply(this, arguments);
45
33
  }
46
34
 
47
35
  _createClass(OceanModel, [{
@@ -68,7 +56,8 @@ var OceanModel = function (_BaseModel) {
68
56
  width = _this$calDataFrame.width,
69
57
  height = _this$calDataFrame.height;
70
58
 
71
- this.rowCount = height;
59
+ this.rowCount = height; // 当前数据纹理有多少行
60
+
72
61
  this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
73
62
  flipY: true,
74
63
  data: data,
@@ -93,8 +82,9 @@ var OceanModel = function (_BaseModel) {
93
82
  u_watercolor: rgb2arr(watercolor),
94
83
  u_watercolor2: rgb2arr(watercolor2),
95
84
  u_dataTexture: this.dataTexture,
85
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
96
86
  u_cellTypeLayout: this.getCellTypeLayout(),
97
- u_opacity: _isNumber(opacity) ? opacity : 1.0
87
+ u_opacity: isNumber(opacity) ? opacity : 1.0
98
88
  };
99
89
  }
100
90
  }, {
@@ -165,6 +155,7 @@ var OceanModel = function (_BaseModel) {
165
155
  descriptor: {
166
156
  name: 'a_uv',
167
157
  buffer: {
158
+ // give the WebGL driver a hint that this buffer may change
168
159
  usage: gl.STATIC_DRAW,
169
160
  data: [],
170
161
  type: gl.FLOAT
@@ -183,24 +174,26 @@ var OceanModel = function (_BaseModel) {
183
174
  }, {
184
175
  key: "loadTexture",
185
176
  value: function loadTexture() {
186
- var _this2 = this;
177
+ var _this = this;
187
178
 
188
179
  var createTexture2D = this.rendererService.createTexture2D;
189
180
  var defaultTextureOptions = {
190
181
  height: 0,
191
182
  width: 0
192
- };
183
+ }; // 默认索引为 undefined,所以单独赋值
184
+
193
185
  this.texture1 = createTexture2D(defaultTextureOptions);
194
186
  this.texture2 = createTexture2D(defaultTextureOptions);
195
- this.texture3 = createTexture2D(defaultTextureOptions);
187
+ this.texture3 = createTexture2D(defaultTextureOptions); // 加载完 image 后单独给 texture f赋值
188
+
196
189
  initImage(function (images) {
197
- _this2.texture1 = initTex(images[0]);
198
- _this2.texture2 = initTex(images[1]);
199
- _this2.texture3 = initTex(images[2]);
190
+ _this.texture1 = initTex(images[0]);
191
+ _this.texture2 = initTex(images[1]);
192
+ _this.texture3 = initTex(images[2]);
200
193
 
201
- _this2.layerService.updateLayerRenderList();
194
+ _this.layerService.updateLayerRenderList();
202
195
 
203
- _this2.layerService.renderLayers();
196
+ _this.layerService.renderLayers();
204
197
  });
205
198
 
206
199
  function initImage(callback) {
@@ -240,5 +233,4 @@ var OceanModel = function (_BaseModel) {
240
233
  return OceanModel;
241
234
  }(BaseModel);
242
235
 
243
- export { OceanModel as default };
244
- //# sourceMappingURL=ocean.js.map
236
+ export { OceanModel as default };
@@ -10,12 +10,16 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
 
11
11
  import { gl } from '@antv/l7-core';
12
12
  import { getMask } from '@antv/l7-utils';
13
- import BaseModel from '../../core/BaseModel';
14
- import { polygonTriangulation } from '../../core/triangulation';
13
+ import BaseModel from "../../core/BaseModel";
14
+ import { polygonTriangulation } from "../../core/triangulation";
15
+
16
+ /* babel-plugin-inline-import '../shaders/tile/polygon_tile_frag.glsl' */
15
17
  var polygon_tile_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
18
+
19
+ /* babel-plugin-inline-import '../shaders/tile/polygon_tile_vert.glsl' */
16
20
  var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n }\n\nif(u_coord > 0.0) {\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} else {\n vec2 pointPos = a_Position.xy;\n vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n world.xy += pointOffset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n world.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n}\n\n";
17
21
 
18
- var FillModel = function (_BaseModel) {
22
+ var FillModel = /*#__PURE__*/function (_BaseModel) {
19
23
  _inherits(FillModel, _BaseModel);
20
24
 
21
25
  var _super = _createSuper(FillModel);
@@ -49,7 +53,8 @@ var FillModel = function (_BaseModel) {
49
53
  width = _this$calDataFrame.width,
50
54
  height = _this$calDataFrame.height;
51
55
 
52
- this.rowCount = height;
56
+ this.rowCount = height; // 当前数据纹理有多少行
57
+
53
58
  this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
54
59
  flipY: true,
55
60
  data: data,
@@ -71,6 +76,7 @@ var FillModel = function (_BaseModel) {
71
76
  u_tileOrigin: tileOrigin || [0, 0],
72
77
  u_coord: coord === 'lnglat' ? 1.0 : 0.0,
73
78
  u_dataTexture: this.dataTexture,
79
+ // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
74
80
  u_cellTypeLayout: this.getCellTypeLayout(),
75
81
  u_opacity: opacity
76
82
  };
@@ -117,11 +123,11 @@ var FillModel = function (_BaseModel) {
117
123
  }
118
124
  }, {
119
125
  key: "registerBuiltinAttributes",
120
- value: function registerBuiltinAttributes() {}
126
+ value: function registerBuiltinAttributes() {//
127
+ }
121
128
  }]);
122
129
 
123
130
  return FillModel;
124
131
  }(BaseModel);
125
132
 
126
- export { FillModel as default };
127
- //# sourceMappingURL=tile.js.map
133
+ export { FillModel as default };