@antv/l7-layers 2.18.3 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/es/citybuliding/models/build.js +1 -1
  2. package/es/citybuliding/shaders/build_vert.glsl +0 -1
  3. package/es/core/BaseLayer.js +3 -2
  4. package/es/core/BaseModel.js +4 -2
  5. package/es/core/CommonStyleAttribute.js +20 -0
  6. package/es/core/interface.d.ts +4 -0
  7. package/es/{Geometry → geometry}/models/billboard.js +1 -1
  8. package/es/{Geometry → geometry}/models/plane.js +1 -1
  9. package/es/{Geometry → geometry}/models/sprite.js +1 -1
  10. package/{lib/Geometry → es/geometry}/shaders/billboard_vert.glsl +1 -8
  11. package/es/geometry/shaders/plane_vert.glsl +31 -0
  12. package/es/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
  13. package/es/heatmap/models/grid.js +1 -1
  14. package/es/heatmap/models/grid3d.js +1 -1
  15. package/es/heatmap/models/heatmap.js +1 -1
  16. package/es/heatmap/models/hexagon.js +1 -1
  17. package/es/heatmap/shaders/grid_vert.glsl +1 -1
  18. package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
  19. package/es/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
  20. package/es/heatmap/shaders/hexagon_vert.glsl +1 -1
  21. package/es/image/models/image.js +1 -1
  22. package/es/image/shaders/image_vert.glsl +3 -7
  23. package/es/index.d.ts +1 -1
  24. package/es/index.js +1 -1
  25. package/es/line/models/arc.js +3 -3
  26. package/es/line/models/arc_3d.js +2 -2
  27. package/es/line/models/earthArc_3d.js +2 -2
  28. package/es/line/models/flow.js +1 -1
  29. package/es/line/models/great_circle.js +1 -1
  30. package/es/line/models/line.js +2 -2
  31. package/es/line/models/linearline.js +1 -1
  32. package/es/line/models/simpleLine.js +1 -1
  33. package/es/line/models/wall.js +1 -1
  34. package/es/line/shaders/dash/arc_dash_vert.glsl +3 -6
  35. package/es/line/shaders/dash/line_dash_vert.glsl +2 -1
  36. package/es/line/shaders/flow/flow_line_vert.glsl +2 -7
  37. package/es/line/shaders/line_arc2d_vert.glsl +1 -1
  38. package/es/line/shaders/line_arc_3d_vert.glsl +3 -8
  39. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -6
  40. package/es/line/shaders/line_arc_vert.glsl +3 -9
  41. package/es/line/shaders/line_bezier_vert.glsl +1 -1
  42. package/es/line/shaders/line_vert.glsl +1 -1
  43. package/es/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
  44. package/es/line/shaders/linear/arc_linear_vert.glsl +3 -6
  45. package/es/line/shaders/linearLine/line_linear_vert.glsl +1 -1
  46. package/es/line/shaders/simple/simpleline_vert.glsl +1 -1
  47. package/es/line/shaders/wall/wall_vert.glsl +1 -1
  48. package/es/mask/models/fill.js +1 -1
  49. package/es/mask/shaders/mask_vert.glsl +1 -1
  50. package/es/plugins/FeatureScalePlugin.js +3 -0
  51. package/es/point/models/billboard_point.js +1 -1
  52. package/es/point/models/earthExtrude.js +1 -1
  53. package/es/point/models/earthFill.js +1 -1
  54. package/es/point/models/extrude.js +1 -1
  55. package/es/point/models/fill.js +1 -1
  56. package/es/point/models/fillmage.js +1 -1
  57. package/es/point/models/image.js +1 -1
  58. package/es/point/models/normal.js +1 -1
  59. package/es/point/models/radar.js +2 -2
  60. package/es/point/models/text.js +1 -1
  61. package/es/point/shaders/billboard_point_vert.glsl +2 -2
  62. package/es/point/shaders/earth/extrude_vert.glsl +1 -1
  63. package/es/point/shaders/earth/fill_vert.glsl +1 -1
  64. package/es/point/shaders/extrude/extrude_vert.glsl +2 -6
  65. package/es/point/shaders/fill_vert.glsl +3 -10
  66. package/es/point/shaders/image/fillImage_vert.glsl +2 -8
  67. package/es/point/shaders/image_vert.glsl +3 -6
  68. package/es/point/shaders/normal_vert.glsl +1 -1
  69. package/es/point/shaders/radar/radar_frag.glsl +0 -6
  70. package/es/point/shaders/radar/radar_vert.glsl +2 -9
  71. package/es/point/shaders/text_vert.glsl +2 -7
  72. package/es/polygon/index.js +5 -1
  73. package/es/polygon/models/extrude.js +3 -3
  74. package/es/polygon/models/extrusion.d.ts +17 -0
  75. package/es/polygon/models/extrusion.js +137 -0
  76. package/es/polygon/models/fill.js +2 -2
  77. package/es/polygon/models/index.d.ts +1 -1
  78. package/es/polygon/models/index.js +3 -1
  79. package/es/polygon/models/ocean.js +1 -1
  80. package/es/polygon/models/water.js +1 -1
  81. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
  82. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
  83. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
  84. package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
  85. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +33 -0
  86. package/es/polygon/shaders/polygon_linear_vert.glsl +2 -7
  87. package/es/polygon/shaders/polygon_vert.glsl +3 -6
  88. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
  89. package/es/polygon/shaders/water/polygon_water_vert.glsl +2 -6
  90. package/es/raster/models/raster.js +1 -1
  91. package/es/raster/models/rasterRgb.js +1 -1
  92. package/es/raster/models/rasterTerrainRgb.js +1 -1
  93. package/es/raster/shaders/raster_2d_vert.glsl +2 -6
  94. package/es/raster/shaders/raster_vert.glsl +2 -12
  95. package/es/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
  96. package/es/wind/models/wind.js +1 -1
  97. package/es/wind/shaders/wind_vert.glsl +3 -7
  98. package/lib/citybuliding/models/build.js +1 -1
  99. package/lib/citybuliding/shaders/build_vert.glsl +0 -1
  100. package/lib/core/BaseLayer.js +3 -2
  101. package/lib/core/BaseModel.js +4 -2
  102. package/lib/core/CommonStyleAttribute.js +20 -0
  103. package/lib/{Geometry → geometry}/models/billboard.js +1 -1
  104. package/lib/{Geometry → geometry}/models/plane.js +1 -1
  105. package/lib/{Geometry → geometry}/models/sprite.js +1 -1
  106. package/{es/Geometry → lib/geometry}/shaders/billboard_vert.glsl +1 -8
  107. package/lib/geometry/shaders/plane_vert.glsl +31 -0
  108. package/lib/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
  109. package/lib/heatmap/models/grid.js +1 -1
  110. package/lib/heatmap/models/grid3d.js +1 -1
  111. package/lib/heatmap/models/heatmap.js +1 -1
  112. package/lib/heatmap/models/hexagon.js +1 -1
  113. package/lib/heatmap/shaders/grid_vert.glsl +1 -1
  114. package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
  115. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
  116. package/lib/heatmap/shaders/hexagon_vert.glsl +1 -1
  117. package/lib/image/models/image.js +1 -1
  118. package/lib/image/shaders/image_vert.glsl +3 -7
  119. package/lib/index.js +2 -2
  120. package/lib/line/models/arc.js +3 -3
  121. package/lib/line/models/arc_3d.js +2 -2
  122. package/lib/line/models/earthArc_3d.js +2 -2
  123. package/lib/line/models/flow.js +1 -1
  124. package/lib/line/models/great_circle.js +1 -1
  125. package/lib/line/models/line.js +2 -2
  126. package/lib/line/models/linearline.js +1 -1
  127. package/lib/line/models/simpleLine.js +1 -1
  128. package/lib/line/models/wall.js +1 -1
  129. package/lib/line/shaders/dash/arc_dash_vert.glsl +3 -6
  130. package/lib/line/shaders/dash/line_dash_vert.glsl +2 -1
  131. package/lib/line/shaders/flow/flow_line_vert.glsl +2 -7
  132. package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
  133. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -8
  134. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -6
  135. package/lib/line/shaders/line_arc_vert.glsl +3 -9
  136. package/lib/line/shaders/line_bezier_vert.glsl +1 -1
  137. package/lib/line/shaders/line_vert.glsl +1 -1
  138. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
  139. package/lib/line/shaders/linear/arc_linear_vert.glsl +3 -6
  140. package/lib/line/shaders/linearLine/line_linear_vert.glsl +1 -1
  141. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -1
  142. package/lib/line/shaders/wall/wall_vert.glsl +1 -1
  143. package/lib/mask/models/fill.js +1 -1
  144. package/lib/mask/shaders/mask_vert.glsl +1 -1
  145. package/lib/plugins/FeatureScalePlugin.js +3 -0
  146. package/lib/point/models/billboard_point.js +1 -1
  147. package/lib/point/models/earthExtrude.js +1 -1
  148. package/lib/point/models/earthFill.js +1 -1
  149. package/lib/point/models/extrude.js +1 -1
  150. package/lib/point/models/fill.js +1 -1
  151. package/lib/point/models/fillmage.js +1 -1
  152. package/lib/point/models/image.js +1 -1
  153. package/lib/point/models/normal.js +1 -1
  154. package/lib/point/models/radar.js +2 -2
  155. package/lib/point/models/text.js +1 -1
  156. package/lib/point/shaders/billboard_point_vert.glsl +2 -2
  157. package/lib/point/shaders/earth/extrude_vert.glsl +1 -1
  158. package/lib/point/shaders/earth/fill_vert.glsl +1 -1
  159. package/lib/point/shaders/extrude/extrude_vert.glsl +2 -6
  160. package/lib/point/shaders/fill_vert.glsl +3 -10
  161. package/lib/point/shaders/image/fillImage_vert.glsl +2 -8
  162. package/lib/point/shaders/image_vert.glsl +3 -6
  163. package/lib/point/shaders/normal_vert.glsl +1 -1
  164. package/lib/point/shaders/radar/radar_frag.glsl +0 -6
  165. package/lib/point/shaders/radar/radar_vert.glsl +2 -9
  166. package/lib/point/shaders/text_vert.glsl +2 -7
  167. package/lib/polygon/index.js +5 -1
  168. package/lib/polygon/models/extrude.js +3 -3
  169. package/lib/polygon/models/extrusion.js +144 -0
  170. package/lib/polygon/models/fill.js +2 -2
  171. package/lib/polygon/models/index.js +3 -1
  172. package/lib/polygon/models/ocean.js +1 -1
  173. package/lib/polygon/models/water.js +1 -1
  174. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
  175. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
  176. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
  177. package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
  178. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +33 -0
  179. package/lib/polygon/shaders/polygon_linear_vert.glsl +2 -7
  180. package/lib/polygon/shaders/polygon_vert.glsl +3 -6
  181. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
  182. package/lib/polygon/shaders/water/polygon_water_vert.glsl +2 -6
  183. package/lib/raster/models/raster.js +1 -1
  184. package/lib/raster/models/rasterRgb.js +1 -1
  185. package/lib/raster/models/rasterTerrainRgb.js +1 -1
  186. package/lib/raster/shaders/raster_2d_vert.glsl +2 -6
  187. package/lib/raster/shaders/raster_vert.glsl +2 -12
  188. package/lib/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
  189. package/lib/wind/models/wind.js +1 -1
  190. package/lib/wind/shaders/wind_vert.glsl +3 -7
  191. package/package.json +7 -7
  192. package/es/Geometry/shaders/plane_vert.glsl +0 -53
  193. package/lib/Geometry/shaders/plane_vert.glsl +0 -53
  194. /package/es/{Geometry → geometry}/index.d.ts +0 -0
  195. /package/es/{Geometry → geometry}/index.js +0 -0
  196. /package/es/{Geometry → geometry}/models/billboard.d.ts +0 -0
  197. /package/es/{Geometry → geometry}/models/index.d.ts +0 -0
  198. /package/es/{Geometry → geometry}/models/index.js +0 -0
  199. /package/es/{Geometry → geometry}/models/plane.d.ts +0 -0
  200. /package/es/{Geometry → geometry}/models/sprite.d.ts +0 -0
  201. /package/es/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
  202. /package/es/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
  203. /package/es/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
  204. /package/lib/{Geometry → geometry}/index.js +0 -0
  205. /package/lib/{Geometry → geometry}/models/index.js +0 -0
  206. /package/lib/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
  207. /package/lib/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
  208. /package/lib/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
@@ -305,7 +305,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
305
305
  // @ts-ignore
306
306
  attributeValues,
307
307
  // @ts-ignore
308
- _this3.getLayerConfig()[attributeName]))
308
+ attributeField ? undefined : _this3.getLayerConfig()[attributeName] // 设置了字段不需要设置默认值
309
+ ))
309
310
  },
310
311
  // @ts-ignore
311
312
  updateOptions);
@@ -1481,7 +1482,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1481
1482
  key: "splitValuesAndCallbackInAttribute",
1482
1483
  value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
1483
1484
  return {
1484
- values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1485
+ values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback,
1485
1486
  callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
1486
1487
  };
1487
1488
  }
@@ -219,7 +219,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
219
219
  stroke: 'vec4',
220
220
  offsets: 'vec2',
221
221
  textOffset: 'vec2',
222
- rotation: 'float'
222
+ rotation: 'float',
223
+ extrusionBase: 'float'
223
224
  };
224
225
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
225
226
  if (encodeStyleAttribute[key]) {
@@ -249,7 +250,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
249
250
  opacity: 1,
250
251
  stroke: [1, 0, 0, 1],
251
252
  offsets: [0, 0],
252
- rotation: 0
253
+ rotation: 0,
254
+ extrusionBase: 0
253
255
  };
254
256
  this.layer.enableShaderEncodeStyles.forEach(function (key) {
255
257
  if (!_this.layer.encodeStyleAttribute[key]) {
@@ -67,6 +67,26 @@ function getCommonStyleAttributeOptions(name) {
67
67
  }
68
68
  }
69
69
  };
70
+ case 'extrusionBase':
71
+ return {
72
+ name: 'extrusionBase',
73
+ type: _l7Core.AttributeType.Attribute,
74
+ descriptor: {
75
+ name: 'a_ExtrusionBase',
76
+ buffer: {
77
+ // give the WebGL driver a hint that this buffer may change
78
+ usage: _l7Core.gl.STATIC_DRAW,
79
+ data: [],
80
+ type: _l7Core.gl.FLOAT
81
+ },
82
+ size: 1,
83
+ update: function update(feature) {
84
+ var _feature$extrusionBas = feature.extrusionBase,
85
+ op = _feature$extrusionBas === void 0 ? 0 : _feature$extrusionBas;
86
+ return [op];
87
+ }
88
+ }
89
+ };
70
90
  case 'offsets':
71
91
  return {
72
92
  name: 'offsets',
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  /* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
23
23
  var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"picking\"\nvoid main() {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  /* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
25
- var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform float u_raisingHeight: 0.0;\nuniform mat4 u_Mvp;\nuniform float u_opacity;\nuniform vec2 u_size: [1.0, 1.0];\nuniform mat2 u_RotateMatrix;\n\nattribute vec3 a_Extrude;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_Color = a_Color;\n v_uv = a_Uv;\n\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(u_RotateMatrix * vec2(extrude.x * u_size.x, 0.0));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));\n gl_Position = u_Mvp * (vec4(x, y, z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(x , y, z , 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
25
+ var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity;\nuniform vec2 u_size: [1.0, 1.0];\nuniform mat2 u_RotateMatrix;\n\nattribute vec3 a_Extrude;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_Color = a_Color;\n v_uv = a_Uv;\n\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(u_RotateMatrix * vec2(extrude.x * u_size.x, 0.0));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
26
26
  var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(BillBoardModel, _BaseModel);
28
28
  var _super = _createSuper(BillBoardModel);
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  /* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
25
25
  var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_mapFlag;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n gl_FragColor = vec4(v_Color, u_opacity);\n }\n gl_FragColor.a *= v_clip;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
26
26
  /* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
27
- var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nuniform mat4 u_Mvp;\nuniform float u_opacity;\nuniform float u_terrainClipHeight;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n\n // float x = 1.0;\n // float y = 0.0;\n // float z = 0.0;\n // mat3 translateMatrix = mat3(\n // 1.0, 0.0, 0.0 \n // 0.0, 1.0, 0.0\n // -project_pos.x, -project_pos.y, 1.0\n // );\n // mat4 translateMatrix = mat4(\n // 1.0, 0.0, 0.0, 0.0 ,\n // 0.0, 1.0, 0.0, 0.0,\n // 0.0, 0.0, 1.0, 0.0,\n // 1.0, 0.0, 0.0, 1.0\n // );\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
27
+ var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nuniform float u_opacity;\nuniform float u_terrainClipHeight;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
28
28
  var PlaneModel = /*#__PURE__*/function (_BaseModel) {
29
29
  (0, _inherits2.default)(PlaneModel, _BaseModel);
30
30
  var _super = _createSuper(PlaneModel);
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  /* babel-plugin-inline-import '../shaders/sprite_frag.glsl' */
25
25
  var spriteFrag = "\nuniform sampler2D u_texture;\nuniform float u_mapFlag;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying float v_d;\n\nvoid main() {\n\n if(v_d < 0.0) {\n discard;\n }\n\n if(u_mapFlag > 0.0) {\n gl_FragColor = texture2D(u_texture, gl_PointCoord);\n gl_FragColor.a *= u_opacity;\n } else {\n gl_FragColor = vec4(v_Color, u_opacity);\n }\n}\n";
26
26
  /* babel-plugin-inline-import '../shaders/sprite_vert.glsl' */
27
- var spriteVert = "precision highp float;\n\nattribute vec3 a_Position;\nattribute vec3 a_Color;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_opacity;\nuniform float u_Scale;\nvarying vec3 v_Color;\nvarying float v_d;\n\n#pragma include \"projection\"\nvoid main() {\n v_Color = a_Color;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_d = a_Position.z;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n }\n\n gl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;\n}\n";
27
+ var spriteVert = "precision highp float;\n\nattribute vec3 a_Position;\nattribute vec3 a_Color;\n\nuniform mat4 u_ModelMatrix;\nuniform float u_opacity;\nuniform float u_Scale;\nvarying vec3 v_Color;\nvarying float v_d;\n\n#pragma include \"projection\"\nvoid main() {\n v_Color = a_Color;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_d = a_Position.z;\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\ngl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;\n}\n";
28
28
  var SPRITE_ANIMATE_DIR = /*#__PURE__*/function (SPRITE_ANIMATE_DIR) {
29
29
  SPRITE_ANIMATE_DIR["UP"] = "up";
30
30
  SPRITE_ANIMATE_DIR["DOWN"] = "down";
@@ -1,7 +1,6 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
3
  uniform float u_raisingHeight: 0.0;
4
- uniform mat4 u_Mvp;
5
4
  uniform float u_opacity;
6
5
  uniform vec2 u_size: [1.0, 1.0];
7
6
  uniform mat2 u_RotateMatrix;
@@ -38,13 +37,7 @@ void main() {
38
37
  // z 轴不参与旋转
39
38
  float z = project_pixel(extrude.y * u_size.y + raiseHeight);
40
39
 
41
-
42
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
43
- // gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));
44
- gl_Position = u_Mvp * (vec4(x, y, z, 1.0));
45
- } else {
46
- gl_Position = project_common_position_to_clipspace(vec4(x , y, z , 1.0));
47
- }
40
+ gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));
48
41
 
49
42
  setPickingColor(a_PickingColor);
50
43
  }
@@ -0,0 +1,31 @@
1
+ precision highp float;
2
+ uniform mat4 u_ModelMatrix;
3
+
4
+ uniform float u_opacity;
5
+ uniform float u_terrainClipHeight;
6
+
7
+ attribute vec3 a_Position;
8
+ attribute vec2 a_Uv;
9
+ attribute vec3 a_Color;
10
+
11
+ varying vec3 v_Color;
12
+ varying vec2 v_uv;
13
+ varying float v_clip;
14
+
15
+ #pragma include "projection"
16
+ #pragma include "picking"
17
+ void main() {
18
+ v_Color = a_Color;
19
+ v_uv = a_Uv;
20
+
21
+ vec4 project_pos = project_position(vec4(a_Position, 1.0));
22
+
23
+ v_clip = 1.0;
24
+ if(a_Position.z < u_terrainClipHeight) {
25
+ v_clip = 0.0;
26
+ }
27
+
28
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));
29
+
30
+ setPickingColor(a_PickingColor);
31
+ }
@@ -4,7 +4,6 @@ attribute vec3 a_Position;
4
4
  attribute vec3 a_Color;
5
5
 
6
6
  uniform mat4 u_ModelMatrix;
7
- uniform mat4 u_Mvp;
8
7
  uniform float u_opacity;
9
8
  uniform float u_Scale;
10
9
  varying vec3 v_Color;
@@ -18,11 +17,6 @@ void main() {
18
17
 
19
18
  v_d = a_Position.z;
20
19
 
21
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
22
- gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));
23
- } else {
24
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
25
- }
26
-
27
- gl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;
20
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));
21
+ gl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;
28
22
  }
@@ -18,7 +18,7 @@ var _triangulation = require("../../core/triangulation");
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
19
  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; } }
20
20
  /* babel-plugin-inline-import '../shaders/grid_vert.glsl' */
21
- var heatmapGridVert = "precision highp float;\r\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\r\nattribute vec3 a_Position;\r\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\r\nattribute vec3 a_Pos;\r\nattribute float a_Size;\r\nattribute vec4 a_Color;\r\nuniform vec2 u_radius;\r\nuniform float u_coverage: 0.9;\r\nuniform float u_angle: 0;\r\nuniform mat4 u_ModelMatrix;\r\nuniform mat4 u_Mvp;\r\nvarying vec4 v_color;\r\n\r\nuniform vec2 u_sceneCenterMercator;\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
21
+ var heatmapGridVert = "precision highp float;\r\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\r\nattribute vec3 a_Position;\r\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\r\nattribute vec3 a_Pos;\r\nattribute float a_Size;\r\nattribute vec4 a_Color;\r\nuniform vec2 u_radius;\r\nuniform float u_coverage: 0.9;\r\nuniform float u_angle: 0;\r\nuniform mat4 u_ModelMatrix;\r\n\r\nvarying vec4 v_color;\r\n\r\nuniform vec2 u_sceneCenterMercator;\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
22
22
  /* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
23
23
  var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  var GridModel = /*#__PURE__*/function (_BaseModel) {
@@ -18,7 +18,7 @@ var _triangulation = require("../../core/triangulation");
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
19
  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; } }
20
20
  /* babel-plugin-inline-import '../shaders/hexagon_3d_vert.glsl' */
21
- var heatmapGrid3dVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\n\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
21
+ var heatmapGrid3dVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\n\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\n\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
22
22
  /* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
23
23
  var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
@@ -36,7 +36,7 @@ var heatmapColorVert = "precision highp float;\nattribute vec3 a_Position;\nattr
36
36
  /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_frag.glsl' */
37
37
  var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;\nvarying float v_weight;\nvarying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n gl_FragColor = vec4(val, 1., 1., 1.);\n}\n";
38
38
  /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
39
- var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
39
+ var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\n\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
40
40
  var isEqual = _l7Utils.lodashUtil.isEqual;
41
41
  var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
42
42
  (0, _inherits2.default)(HeatMapModel, _BaseModel);
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
20
20
  /* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
21
21
  var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
22
22
  /* babel-plugin-inline-import '../shaders/hexagon_vert.glsl' */
23
- var heatmapGridVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n \n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n \n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));\n // gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\n gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
23
+ var heatmapGridVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\n\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n \n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n \n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));\n // gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\n gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
24
24
  var HexagonModel = /*#__PURE__*/function (_BaseModel) {
25
25
  (0, _inherits2.default)(HexagonModel, _BaseModel);
26
26
  var _super = _createSuper(HexagonModel);
@@ -9,7 +9,7 @@ uniform vec2 u_radius;
9
9
  uniform float u_coverage: 0.9;
10
10
  uniform float u_angle: 0;
11
11
  uniform mat4 u_ModelMatrix;
12
- uniform mat4 u_Mvp;
12
+
13
13
  varying vec4 v_color;
14
14
 
15
15
  uniform vec2 u_sceneCenterMercator;
@@ -7,7 +7,7 @@ uniform float u_radius;
7
7
  varying vec2 v_extrude;
8
8
  varying float v_weight;
9
9
  uniform mat4 u_ModelMatrix;
10
- uniform mat4 u_Mvp;
10
+
11
11
 
12
12
  #define GAUSS_COEF 0.3989422804014327
13
13
 
@@ -11,7 +11,7 @@ uniform vec2 u_radius;
11
11
  uniform float u_coverage: 0.9;
12
12
  uniform float u_angle: 0;
13
13
  uniform mat4 u_ModelMatrix;
14
- uniform mat4 u_Mvp;
14
+
15
15
  varying vec4 v_color;
16
16
 
17
17
  uniform vec2 u_sceneCenterMercator;
@@ -9,7 +9,7 @@ uniform vec2 u_radius;
9
9
  uniform float u_coverage: 0.9;
10
10
  uniform float u_angle: 0;
11
11
  uniform mat4 u_ModelMatrix;
12
- uniform mat4 u_Mvp;
12
+
13
13
  varying vec4 v_color;
14
14
 
15
15
  uniform vec2 u_sceneCenterMercator;
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
20
20
  /* babel-plugin-inline-import '../shaders/image_frag.glsl' */
21
21
  var ImageFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n if(gl_FragColor.a < 0.01)\n discard;\n}\n";
22
22
  /* babel-plugin-inline-import '../shaders/image_vert.glsl' */
23
- var ImageVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
23
+ var ImageVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n \n}\n";
24
24
  var ImageModel = /*#__PURE__*/function (_BaseModel) {
25
25
  (0, _inherits2.default)(ImageModel, _BaseModel);
26
26
  var _super = _createSuper(ImageModel);
@@ -1,6 +1,6 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
- uniform mat4 u_Mvp;
3
+
4
4
  attribute vec3 a_Position;
5
5
  attribute vec2 a_Uv;
6
6
  varying vec2 v_texCoord;
@@ -8,10 +8,6 @@ varying vec2 v_texCoord;
8
8
  void main() {
9
9
  v_texCoord = a_Uv;
10
10
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
12
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
13
- gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
14
- } else {
15
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
16
- }
11
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
12
+
17
13
  }
package/lib/index.js CHANGED
@@ -54,7 +54,7 @@ Object.defineProperty(exports, "EarthLayer", {
54
54
  Object.defineProperty(exports, "GeometryLayer", {
55
55
  enumerable: true,
56
56
  get: function get() {
57
- return _Geometry.default;
57
+ return _geometry.default;
58
58
  }
59
59
  });
60
60
  Object.defineProperty(exports, "HeatmapLayer", {
@@ -116,7 +116,7 @@ var _canvas = _interopRequireDefault(require("./canvas"));
116
116
  var _building = _interopRequireDefault(require("./citybuliding/building"));
117
117
  var _BaseLayer = _interopRequireDefault(require("./core/BaseLayer"));
118
118
  var _BaseModel = _interopRequireDefault(require("./core/BaseModel"));
119
- var _Geometry = _interopRequireDefault(require("./Geometry"));
119
+ var _geometry = _interopRequireDefault(require("./geometry"));
120
120
  var _heatmap = _interopRequireDefault(require("./heatmap"));
121
121
  var _image = _interopRequireDefault(require("./image"));
122
122
  var _index = _interopRequireDefault(require("./line/index"));
@@ -24,15 +24,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  // arc dash line
25
25
  var arc_dash_frag = "\nuniform float u_opacity;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying float v_distance_ratio;\n\nuniform float segmentNumber;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n\n\n float flag = 0.;\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n };\n gl_FragColor.a *=flag;\n \n gl_FragColor = filterColor(gl_FragColor);\n}";
26
26
  /* babel-plugin-inline-import '../shaders/dash/arc_dash_vert.glsl' */
27
- var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\nvarying float v_distance_ratio;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n\n v_distance_ratio = segmentIndex / segmentNumber;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n \n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n gl_PointSize = 5.0;\n setPickingColor(a_PickingColor);\n}\n"; // arc normal line
27
+ var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\nvarying float v_distance_ratio;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n\n v_distance_ratio = segmentIndex / segmentNumber;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n \n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n gl_PointSize = 5.0;\n setPickingColor(a_PickingColor);\n}\n"; // arc normal line
28
28
  /* babel-plugin-inline-import '../shaders/line_arc_frag.glsl' */
29
29
  var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_lineData;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n gl_FragColor = v_color;\n \n gl_FragColor.a *= u_opacity;\n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = v_lineData.g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = v_lineData.a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= u_opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n \n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}";
30
30
  /* babel-plugin-inline-import '../shaders/line_arc_vert.glsl' */
31
- var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_lineData;\nvarying vec2 v_distance_ratio;\n\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n v_lineData.b = d_distance_ratio;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_lineData.r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n v_lineData.g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n v_lineData.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n"; // arc linear line
31
+ var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_lineData;\nvarying vec2 v_distance_ratio;\n\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n v_lineData.b = d_distance_ratio;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_lineData.r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n v_lineData.g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n v_lineData.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n"; // arc linear line
32
32
  /* babel-plugin-inline-import '../shaders/linear/arc_linear_frag.glsl' */
33
33
  var arc_linear_frag = "varying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n// \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n gl_FragColor = v_color;\n gl_FragColor = filterColor(gl_FragColor);\n}";
34
34
  /* babel-plugin-inline-import '../shaders/linear/arc_linear_vert.glsl' */
35
- var arc_linear_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\nvarying float v_segmentIndex;\n\nuniform float u_lineDir: 1.0;\nuniform float u_opacity: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n v_color.a *= u_opacity;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
35
+ var arc_linear_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\nvarying float v_segmentIndex;\n\nuniform float u_lineDir: 1.0;\nuniform float u_opacity: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n v_color.a *= u_opacity;\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
36
36
  var lineStyleObj = {
37
37
  solid: 0.0,
38
38
  dash: 1.0
@@ -26,11 +26,11 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
26
26
  // arc3d line layer
27
27
  var arc3d_line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying vec4 v_line_data;\n\nuniform float u_line_texture: 0.0;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nvarying float v_segmentIndex;\nuniform float segmentNumber;\nuniform float u_opacity;\n\nvarying vec2 v_iconMapUV;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_line_data.g; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n\n gl_FragColor.a *= opacity;\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n }\n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n\n // u_animate \n // x enable\n // y duration\n // z interval\n // w trailLength\n }\n\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));\n float arcRadio = v_segmentIndex / (segmentNumber - 1.0);\n float count = v_line_data.b; // // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n\n float v = v_line_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n discard;\n } else {\n gl_FragColor = filterColor(pattern);\n }\n }\n\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
28
28
  /* babel-plugin-inline-import '../shaders/line_arc_3d_vert.glsl' */
29
- var arc3d_line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nvarying vec4 v_dash_array;\n\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_segmentIndex;\n\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_line_data;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n }\n v_line_data.g = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n\n\n v_segmentIndex = a_Position.x;\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F \n\n float arcDistrance = length(source - target);\n float pixelLen = project_pixel_texture(u_icon_step);\n v_line_data.b = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n vec2 projectOffset = project_pixel(offset);\n float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n }\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n"; // arc3d linear layer
29
+ var arc3d_line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nvarying vec4 v_dash_array;\n\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_segmentIndex;\n\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_line_data;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n }\n v_line_data.g = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n\n\n v_segmentIndex = a_Position.x;\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F \n\n float arcDistrance = length(source - target);\n float pixelLen = project_pixel_texture(u_icon_step);\n v_line_data.b = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n vec2 projectOffset = project_pixel(offset);\n float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n"; // arc3d linear layer
30
30
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_frag.glsl' */
31
31
  var arc3d_linear_frag = "\n#define Animate 0.0\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_Color;\n\nvarying float v_distance_ratio;\n#pragma include \"picking\"\n\nvoid main() {\n\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n gl_FragColor = v_Color;\n\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n\n // u_animate \n // x enable\n // y duration\n // z interval\n // w trailLength\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
32
32
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_vert.glsl' */
33
- var arc3d_linear_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute vec2 a_iconMapUV;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_distance_ratio;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n // float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n v_distance_ratio = segmentIndex / segmentNumber;\n }\n\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n v_Color = mix(u_sourceColor, u_targetColor, a_Position.x/segmentNumber);\n\n v_Color.a *= opacity;\n\n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n }\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n";
33
+ var arc3d_linear_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute vec2 a_iconMapUV;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_distance_ratio;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n // float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n v_distance_ratio = segmentIndex / segmentNumber;\n }\n\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n v_Color = mix(u_sourceColor, u_targetColor, a_Position.x/segmentNumber);\n\n v_Color.a *= opacity;\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n";
34
34
  var lineStyleObj = {
35
35
  solid: 0.0,
36
36
  dash: 1.0