@antv/l7-layers 2.19.11 → 2.20.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 (173) hide show
  1. package/es/canvas/models/canvas.js +2 -2
  2. package/es/core/BaseLayer.d.ts +1 -1
  3. package/es/core/BaseLayer.js +18 -11
  4. package/es/core/BaseModel.d.ts +3 -1
  5. package/es/core/BaseModel.js +28 -4
  6. package/es/core/CommonStyleAttribute.d.ts +15 -0
  7. package/es/core/CommonStyleAttribute.js +21 -0
  8. package/es/core/TextureService.js +2 -2
  9. package/es/earth/index.js +1 -1
  10. package/es/geometry/index.js +1 -1
  11. package/es/geometry/models/billboard.js +1 -1
  12. package/es/geometry/models/plane.js +2 -2
  13. package/es/geometry/models/sprite.js +2 -2
  14. package/es/heatmap/index.js +1 -1
  15. package/es/heatmap/models/heatmap.js +4 -4
  16. package/es/image/models/image.js +1 -1
  17. package/es/line/index.js +1 -1
  18. package/es/line/models/arc.js +1 -1
  19. package/es/line/models/arc_3d.js +1 -1
  20. package/es/line/models/earthArc_3d.js +1 -1
  21. package/es/line/models/great_circle.js +1 -1
  22. package/es/line/models/line.js +1 -1
  23. package/es/line/models/linearline.js +1 -1
  24. package/es/line/models/wall.js +1 -1
  25. package/es/plugins/DataMappingPlugin.js +1 -1
  26. package/es/plugins/PixelPickingPlugin.d.ts +4 -1
  27. package/es/plugins/PixelPickingPlugin.js +91 -22
  28. package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  29. package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
  30. package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
  31. package/es/plugins/ShaderUniformPlugin.js +74 -6
  32. package/es/point/index.js +1 -1
  33. package/es/point/models/fill.js +31 -7
  34. package/es/point/models/fillmage.js +1 -1
  35. package/es/point/models/image.js +1 -1
  36. package/es/point/models/normal.js +30 -12
  37. package/es/point/models/text.js +1 -1
  38. package/es/point/shaders/fill_frag.glsl +20 -14
  39. package/es/point/shaders/fill_vert.glsl +19 -18
  40. package/es/point/shaders/normal_frag.glsl +4 -3
  41. package/es/point/shaders/normal_vert.glsl +12 -11
  42. package/es/polygon/index.js +1 -1
  43. package/es/polygon/models/extrude.js +1 -1
  44. package/es/polygon/models/extrusion.js +1 -1
  45. package/es/polygon/models/ocean.js +3 -3
  46. package/es/polygon/models/water.js +1 -1
  47. package/es/raster/models/raster.js +2 -2
  48. package/es/raster/models/rasterRgb.js +1 -1
  49. package/es/raster/models/rasterTerrainRgb.js +1 -1
  50. package/es/tile/core/BaseLayer.js +4 -4
  51. package/es/tile/interaction/getRasterData.js +4 -4
  52. package/es/tile/service/TileLayerService.js +4 -4
  53. package/es/tile/service/TilePickService.js +3 -3
  54. package/es/tile/tile/Tile.d.ts +3 -0
  55. package/es/tile/tile/Tile.js +2 -2
  56. package/es/wind/models/wind.js +5 -6
  57. package/lib/canvas/index.js +2 -3
  58. package/lib/canvas/models/canvas.js +4 -5
  59. package/lib/canvas/models/index.js +1 -2
  60. package/lib/citybuliding/building.js +2 -3
  61. package/lib/citybuliding/models/build.js +2 -3
  62. package/lib/core/BaseLayer.js +19 -13
  63. package/lib/core/BaseModel.js +30 -7
  64. package/lib/core/CommonStyleAttribute.js +22 -0
  65. package/lib/core/LayerPickService.js +2 -3
  66. package/lib/core/TextureService.js +4 -5
  67. package/lib/core/constant.js +3 -5
  68. package/lib/core/interface.js +6 -11
  69. package/lib/core/schema.js +2 -3
  70. package/lib/core/shape/Path.js +3 -6
  71. package/lib/core/triangulation.js +2 -2
  72. package/lib/earth/index.js +3 -4
  73. package/lib/earth/models/atmosphere.js +2 -3
  74. package/lib/earth/models/base.js +2 -3
  75. package/lib/earth/models/bloomsphere.js +2 -3
  76. package/lib/earth/utils.js +3 -6
  77. package/lib/geometry/index.js +3 -4
  78. package/lib/geometry/models/billboard.js +3 -4
  79. package/lib/geometry/models/index.js +1 -2
  80. package/lib/geometry/models/plane.js +4 -5
  81. package/lib/geometry/models/sprite.js +4 -5
  82. package/lib/heatmap/index.js +3 -4
  83. package/lib/heatmap/models/grid.js +2 -3
  84. package/lib/heatmap/models/grid3d.js +2 -3
  85. package/lib/heatmap/models/heatmap.js +6 -7
  86. package/lib/heatmap/models/hexagon.js +2 -3
  87. package/lib/heatmap/models/index.js +1 -2
  88. package/lib/image/index.js +2 -3
  89. package/lib/image/models/image.js +3 -4
  90. package/lib/image/models/index.js +1 -2
  91. package/lib/line/index.js +3 -4
  92. package/lib/line/models/arc.js +3 -4
  93. package/lib/line/models/arc_3d.js +3 -4
  94. package/lib/line/models/earthArc_3d.js +3 -4
  95. package/lib/line/models/flow.js +2 -3
  96. package/lib/line/models/great_circle.js +3 -4
  97. package/lib/line/models/index.js +1 -2
  98. package/lib/line/models/line.js +3 -4
  99. package/lib/line/models/linearline.js +3 -4
  100. package/lib/line/models/simpleLine.js +2 -3
  101. package/lib/line/models/wall.js +3 -4
  102. package/lib/mask/index.js +2 -3
  103. package/lib/mask/models/fill.js +2 -3
  104. package/lib/mask/models/index.js +1 -2
  105. package/lib/plugins/DataMappingPlugin.js +3 -4
  106. package/lib/plugins/DataSourcePlugin.js +2 -3
  107. package/lib/plugins/FeatureScalePlugin.js +4 -5
  108. package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
  109. package/lib/plugins/LayerMaskPlugin.js +2 -3
  110. package/lib/plugins/LayerModelPlugin.js +2 -3
  111. package/lib/plugins/LayerStylePlugin.js +2 -3
  112. package/lib/plugins/LightingPlugin.js +2 -3
  113. package/lib/plugins/MultiPassRendererPlugin.js +2 -3
  114. package/lib/plugins/PixelPickingPlugin.js +93 -25
  115. package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
  116. package/lib/plugins/ShaderUniformPlugin.js +75 -8
  117. package/lib/plugins/UpdateModelPlugin.js +2 -3
  118. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
  119. package/lib/point/index.js +3 -4
  120. package/lib/point/models/billboard_point.js +2 -3
  121. package/lib/point/models/earthExtrude.js +2 -3
  122. package/lib/point/models/earthFill.js +2 -3
  123. package/lib/point/models/extrude.js +2 -3
  124. package/lib/point/models/fill.js +33 -10
  125. package/lib/point/models/fillmage.js +3 -4
  126. package/lib/point/models/image.js +3 -4
  127. package/lib/point/models/index.js +1 -2
  128. package/lib/point/models/normal.js +32 -15
  129. package/lib/point/models/radar.js +2 -3
  130. package/lib/point/models/text.js +3 -4
  131. package/lib/point/shaders/fill_frag.glsl +20 -14
  132. package/lib/point/shaders/fill_vert.glsl +19 -18
  133. package/lib/point/shaders/normal_frag.glsl +4 -3
  134. package/lib/point/shaders/normal_vert.glsl +12 -11
  135. package/lib/polygon/index.js +3 -4
  136. package/lib/polygon/models/extrude.js +3 -4
  137. package/lib/polygon/models/extrusion.js +3 -4
  138. package/lib/polygon/models/fill.js +2 -3
  139. package/lib/polygon/models/index.js +1 -2
  140. package/lib/polygon/models/ocean.js +5 -6
  141. package/lib/polygon/models/water.js +3 -4
  142. package/lib/raster/index.js +2 -3
  143. package/lib/raster/models/index.js +1 -2
  144. package/lib/raster/models/raster.js +4 -5
  145. package/lib/raster/models/rasterRgb.js +3 -4
  146. package/lib/raster/models/rasterTerrainRgb.js +3 -4
  147. package/lib/tile/core/BaseLayer.js +6 -7
  148. package/lib/tile/core/TileDebugLayer.js +2 -3
  149. package/lib/tile/interaction/getRasterData.js +4 -4
  150. package/lib/tile/service/TileLayerService.js +6 -7
  151. package/lib/tile/service/TilePickService.js +5 -6
  152. package/lib/tile/service/TileSourceService.js +4 -5
  153. package/lib/tile/tile/DebugTile.js +2 -3
  154. package/lib/tile/tile/ImageTile.js +2 -3
  155. package/lib/tile/tile/MaskTile.js +2 -3
  156. package/lib/tile/tile/RasterRGBTile.js +2 -3
  157. package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
  158. package/lib/tile/tile/RasterTile.js +2 -3
  159. package/lib/tile/tile/Tile.js +4 -5
  160. package/lib/tile/tile/VectorTile.js +2 -3
  161. package/lib/tile/utils/constants.js +2 -3
  162. package/lib/tile/utils/utils.js +1 -2
  163. package/lib/utils/blend.js +2 -3
  164. package/lib/utils/collision-index.js +2 -3
  165. package/lib/utils/extrude_polyline.js +2 -3
  166. package/lib/utils/grid-index.js +1 -2
  167. package/lib/utils/simpleLine.js +2 -3
  168. package/lib/wind/index.js +2 -3
  169. package/lib/wind/models/index.js +1 -2
  170. package/lib/wind/models/wind.js +7 -9
  171. package/lib/wind/models/windRender.js +4 -5
  172. package/lib/wind/models/windShader.js +6 -12
  173. package/package.json +7 -7
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -16,6 +17,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
16
17
  var _l7Core = require("@antv/l7-core");
17
18
  var _l7Utils = require("@antv/l7-utils");
18
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
20
+ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
19
21
  var _interface = require("../../core/interface");
20
22
  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); }; }
21
23
  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; } }
@@ -23,10 +25,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
23
25
  // animate pointLayer shader - support animate
24
26
  var waveFillFrag = "\nuniform float u_additive;\n\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = v_color;\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n \n // \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n"; // static pointLayer shader - not support animate
25
27
  /* babel-plugin-inline-import '../shaders/fill_frag.glsl' */
26
- var pointFillFrag = "uniform float u_additive;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec4 v_stroke;\n\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n gl_FragColor = v_color;\n } else {\n gl_FragColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if(gl_FragColor.a < 0.01) {\n discard;\n } \n}\n";
28
+ var pointFillFrag = "\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\nin vec4 v_data;\nin float v_radius;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n outputColor = v_color;\n } else {\n outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n outputColor = filterColorAlpha(outputColor, outputColor.a);\n } else {\n outputColor.a *= opacity_t;\n outputColor = filterColor(outputColor);\n }\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if(outputColor.a < 0.01) {\n discard;\n } \n}\n";
27
29
  /* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
28
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\nuniform mat4 u_ModelMatrix;\n\nuniform int u_size_unit;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec4 v_stroke;\nuniform float u_stroke_width: 2;\nuniform vec3 u_blur_height_fixed: [0, 0, 0];\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\n\nvoid main() {\n // \u900F\u660E\u5EA6\u8BA1\u7B97\n v_stroke = stroke; \n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n\n\n // unpack color(vec2)\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if(u_size_unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n offset = rotate_matrix(offset,rotation);\n \n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_blur_height_fixed.y;\n\n if(u_blur_height_fixed.z < 1.0) { // false\n raisingHeight = project_pixel(u_blur_height_fixed.y);\n } else {\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 raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;\n }\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
29
- var FillModel = /*#__PURE__*/function (_BaseModel) {
30
+ var pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 11) in vec3 a_Extrude;\nlayout(location = 10) in float a_Shape;\n\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n};\n\nout vec4 v_color;\nout vec4 v_stroke;\nout vec4 v_data;\nout float v_radius;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // \u900F\u660E\u5EA6\u8BA1\u7B97\n v_stroke = stroke; \n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n\n\n // unpack color(vec2)\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if(u_size_unit == 1.0) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n offset = rotate_matrix(offset,rotation);\n \n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_blur_height_fixed.y;\n\n if(u_blur_height_fixed.z < 1.0) { // false\n raisingHeight = project_pixel(u_blur_height_fixed.y);\n } else {\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 raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;\n }\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
31
+ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
30
32
  (0, _inherits2.default)(FillModel, _BaseModel);
31
33
  var _super = _createSuper(FillModel);
32
34
  function FillModel() {
@@ -50,13 +52,23 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
50
52
  heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
51
53
  _ref$unit = _ref.unit,
52
54
  unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
53
- return (0, _objectSpread2.default)({
55
+ var commonIniform = (0, _objectSpread2.default)({
54
56
  u_blur_height_fixed: [blur, Number(raisingHeight), Number(heightfixed)],
55
57
  u_additive: blend === 'additive' ? 1.0 : 0.0,
56
58
  u_stroke_opacity: strokeOpacity,
57
59
  u_stroke_width: strokeWidth,
58
60
  u_size_unit: _interface.SizeUnitType[unit]
59
61
  }, this.getStyleAttribute());
62
+ var attributes = this.getStyleAttribute();
63
+ this.uniformBuffers[0].subData({
64
+ offset: 0,
65
+ data: new Uint8Array(new Float32Array([].concat((0, _toConsumableArray2.default)(attributes.u_stroke), (0, _toConsumableArray2.default)(attributes.u_offsets), [attributes.u_opacity, attributes.u_rotation])).buffer)
66
+ });
67
+ this.uniformBuffers[1].subData({
68
+ offset: 0,
69
+ data: new Uint8Array(new Float32Array([].concat((0, _toConsumableArray2.default)(commonIniform.u_blur_height_fixed), [commonIniform.u_stroke_width, commonIniform.u_stroke_opacity, commonIniform.u_additive, commonIniform.u_size_unit])).buffer)
70
+ });
71
+ return commonIniform;
60
72
  }
61
73
  }, {
62
74
  key: "getAnimateUniforms",
@@ -99,7 +111,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
99
111
  key: "buildModels",
100
112
  value: function () {
101
113
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
102
- var _ref3, _ref3$animateOption, animateOption, _this$getShaders, frag, vert, type, model;
114
+ var _ref3, _ref3$animateOption, animateOption, _this$getShaders, frag, vert, type, attributeUniformBuffer, commonUniforms, model;
103
115
  return _regenerator.default.wrap(function _callee2$(_context2) {
104
116
  while (1) switch (_context2.prev = _context2.next) {
105
117
  case 0:
@@ -108,7 +120,16 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
108
120
  } : _ref3$animateOption;
109
121
  _this$getShaders = this.getShaders(animateOption), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
110
122
  this.layer.triangulation = _l7Utils.PointFillTriangulation;
111
- _context2.next = 5;
123
+ attributeUniformBuffer = this.rendererService.createBuffer({
124
+ data: new Float32Array(4 + 2 + 1 + 1),
125
+ isUBO: true
126
+ });
127
+ commonUniforms = this.rendererService.createBuffer({
128
+ data: new Float32Array(8),
129
+ isUBO: true
130
+ });
131
+ this.uniformBuffers.push(attributeUniformBuffer, commonUniforms);
132
+ _context2.next = 8;
112
133
  return this.layer.buildLayerModel({
113
134
  moduleName: type,
114
135
  vertexShader: vert,
@@ -119,10 +140,10 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
119
140
  enable: false
120
141
  }
121
142
  });
122
- case 5:
143
+ case 8:
123
144
  model = _context2.sent;
124
145
  return _context2.abrupt("return", [model]);
125
- case 7:
146
+ case 10:
126
147
  case "end":
127
148
  return _context2.stop();
128
149
  }
@@ -180,6 +201,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
180
201
  type: _l7Core.AttributeType.Attribute,
181
202
  descriptor: {
182
203
  name: 'a_Extrude',
204
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.EXTRUDE,
183
205
  buffer: {
184
206
  // give the WebGL driver a hint that this buffer may change
185
207
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -201,6 +223,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
201
223
  type: _l7Core.AttributeType.Attribute,
202
224
  descriptor: {
203
225
  name: 'a_Size',
226
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
204
227
  buffer: {
205
228
  // give the WebGL driver a hint that this buffer may change
206
229
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -222,6 +245,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
222
245
  type: _l7Core.AttributeType.Attribute,
223
246
  descriptor: {
224
247
  name: 'a_Shape',
248
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.SHAPE,
225
249
  buffer: {
226
250
  // give the WebGL driver a hint that this buffer may change
227
251
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -240,5 +264,4 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
240
264
  }
241
265
  }]);
242
266
  return FillModel;
243
- }(_BaseModel2.default);
244
- exports.default = FillModel;
267
+ }(_BaseModel2.default);
@@ -27,7 +27,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
27
27
  var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\nvarying float v_opacity;\n\nvoid main() {\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= v_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
28
28
  /* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
29
29
  var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\n\nuniform mat4 u_ModelMatrix;\n\nuniform mat2 u_RotateMatrix;\nuniform int u_size_unit;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\nvarying float v_opacity;\n// uniform vec2 u_offsets; // shader \u6CE8\u5165\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n v_opacity = opacity;\n float newSize = a_Size;\n if(u_size_unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n \n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (extrude.xy * (newSize) + offsets);\n\n offset = rotate_matrix(offset,rotation);\n\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\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 raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
30
- var FillImageModel = /*#__PURE__*/function (_BaseModel) {
30
+ var FillImageModel = exports.default = /*#__PURE__*/function (_BaseModel) {
31
31
  (0, _inherits2.default)(FillImageModel, _BaseModel);
32
32
  var _super = _createSuper(FillImageModel);
33
33
  function FillImageModel() {
@@ -164,7 +164,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
164
164
  value: function clearModels() {
165
165
  var _this$texture;
166
166
  this.iconService.off('imageUpdate', this.updateTexture);
167
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
167
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
168
168
  }
169
169
 
170
170
  // overwrite baseModel func
@@ -240,5 +240,4 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
240
240
  }
241
241
  }]);
242
242
  return FillImageModel;
243
- }(_BaseModel2.default);
244
- exports.default = FillImageModel;
243
+ }(_BaseModel2.default);
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
24
  var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nvarying float v_opacity;\nuniform vec2 u_textSize;\n\n#pragma include \"picking\"\n\nvoid main(){\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n gl_FragColor.a *= v_opacity;\n if (gl_FragColor.a < 0.01) {\n discard;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
25
25
  /* babel-plugin-inline-import '../shaders/image_vert.glsl' */
26
26
  var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nvarying float v_opacity;\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_opacity = opacity;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n vec2 offset = project_pixel(offsets);\n\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\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 raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
27
- var ImageModel = /*#__PURE__*/function (_BaseModel) {
27
+ var ImageModel = exports.default = /*#__PURE__*/function (_BaseModel) {
28
28
  (0, _inherits2.default)(ImageModel, _BaseModel);
29
29
  var _super = _createSuper(ImageModel);
30
30
  function ImageModel() {
@@ -112,7 +112,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
112
112
  key: "clearModels",
113
113
  value: function clearModels() {
114
114
  var _this$texture;
115
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
115
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
116
116
  this.iconService.off('imageUpdate', this.updateTexture);
117
117
  }
118
118
  }, {
@@ -203,5 +203,4 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
203
203
  }
204
204
  }]);
205
205
  return ImageModel;
206
- }(_BaseModel2.default);
207
- exports.default = ImageModel;
206
+ }(_BaseModel2.default);
@@ -29,5 +29,4 @@ var PointModels = {
29
29
  earthFill: _earthFill.default,
30
30
  earthExtrude: _earthExtrude.default
31
31
  };
32
- var _default = PointModels;
33
- exports.default = _default;
32
+ var _default = exports.default = PointModels;
@@ -16,15 +16,14 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
16
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
17
17
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
18
18
  var _l7Core = require("@antv/l7-core");
19
- var _l7Utils = require("@antv/l7-utils");
20
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
20
+ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
21
21
  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); }; }
22
22
  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; } }
23
23
  /* babel-plugin-inline-import '../shaders/normal_frag.glsl' */
24
- var normalFrag = "varying vec4 v_color;\nvoid main() {\n gl_FragColor = v_color;\n}\n";
24
+ var normalFrag = "in vec4 v_color;\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n}";
25
25
  /* babel-plugin-inline-import '../shaders/normal_vert.glsl' */
26
- var normalVert = "\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\nattribute float a_Size;\nattribute vec4 a_Color;\n\nvarying vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy),project_pos.z,project_pos.w));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n}\n";
27
- var isNumber = _l7Utils.lodashUtil.isNumber;
26
+ var normalVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\n\nlayout(std140) uniform u_Common {\n float u_size_scale;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2., -a_Size /2., 0., 0.);\n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;\n}\n";
28
27
  function PointTriangulation(feature) {
29
28
  var coordinates = feature.coordinates;
30
29
  return {
@@ -33,7 +32,7 @@ function PointTriangulation(feature) {
33
32
  size: coordinates.length
34
33
  };
35
34
  }
36
- var NormalModel = /*#__PURE__*/function (_BaseModel) {
35
+ var NormalModel = exports.default = /*#__PURE__*/function (_BaseModel) {
37
36
  (0, _inherits2.default)(NormalModel, _BaseModel);
38
37
  var _super = _createSuper(NormalModel);
39
38
  function NormalModel() {
@@ -50,10 +49,19 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
50
49
  }, {
51
50
  key: "getUninforms",
52
51
  value: function getUninforms() {
53
- var _ref = this.layer.getLayerConfig(),
54
- _ref$opacity = _ref.opacity,
55
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
56
- return (0, _objectSpread2.default)({}, this.getStyleAttribute());
52
+ var attributes = this.getStyleAttribute();
53
+ // FIXME: No need to update each frame
54
+ this.uniformBuffers[0].subData({
55
+ offset: 0,
56
+ data: new Uint8Array(new Float32Array([].concat((0, _toConsumableArray2.default)(attributes.u_stroke), (0, _toConsumableArray2.default)(attributes.u_offsets), [attributes.u_opacity, attributes.u_rotation])).buffer)
57
+ });
58
+ this.uniformBuffers[1].subData({
59
+ offset: 0,
60
+ data: new Uint8Array(new Float32Array([0.5]).buffer)
61
+ });
62
+ return (0, _objectSpread2.default)({
63
+ u_size_scale: 0.5
64
+ }, attributes);
57
65
  }
58
66
  }, {
59
67
  key: "initModels",
@@ -78,12 +86,21 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
78
86
  key: "buildModels",
79
87
  value: function () {
80
88
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
81
- var model;
89
+ var uniformBuffer, commonBuffer, model;
82
90
  return _regenerator.default.wrap(function _callee2$(_context2) {
83
91
  while (1) switch (_context2.prev = _context2.next) {
84
92
  case 0:
85
93
  this.layer.triangulation = PointTriangulation;
86
- _context2.next = 3;
94
+ uniformBuffer = this.rendererService.createBuffer({
95
+ data: new Float32Array(4 + 2 + 1 + 1),
96
+ isUBO: true
97
+ });
98
+ commonBuffer = this.rendererService.createBuffer({
99
+ data: new Float32Array(4),
100
+ isUBO: true
101
+ });
102
+ this.uniformBuffers.push(uniformBuffer, commonBuffer);
103
+ _context2.next = 6;
87
104
  return this.layer.buildLayerModel({
88
105
  moduleName: 'pointNormal',
89
106
  vertexShader: normalVert,
@@ -96,10 +113,10 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
96
113
  primitive: _l7Core.gl.POINTS,
97
114
  pick: false
98
115
  });
99
- case 3:
116
+ case 6:
100
117
  model = _context2.sent;
101
118
  return _context2.abrupt("return", [model]);
102
- case 5:
119
+ case 8:
103
120
  case "end":
104
121
  return _context2.stop();
105
122
  }
@@ -123,6 +140,7 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
123
140
  type: _l7Core.AttributeType.Attribute,
124
141
  descriptor: {
125
142
  name: 'a_Size',
143
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
126
144
  buffer: {
127
145
  usage: _l7Core.gl.DYNAMIC_DRAW,
128
146
  data: [],
@@ -139,5 +157,4 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
139
157
  }
140
158
  }]);
141
159
  return NormalModel;
142
- }(_BaseModel2.default);
143
- exports.default = NormalModel;
160
+ }(_BaseModel2.default);
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  var pointFillFrag = "\nuniform float u_additive;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = v_exteude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
23
23
  /* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
24
24
  var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nuniform mat4 u_ModelMatrix;\n\nuniform int u_size_unit;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_exteude = rotateMatrix * a_Extrude.xy;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n if(u_size_unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n // radius(16-bit)\n v_radius = newSize;\n\n vec2 offset = (extrude.xy * (newSize));\n vec3 aPosition = a_Position;\n \n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n \n v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
25
- var RadarModel = /*#__PURE__*/function (_BaseModel) {
25
+ var RadarModel = exports.default = /*#__PURE__*/function (_BaseModel) {
26
26
  (0, _inherits2.default)(RadarModel, _BaseModel);
27
27
  var _super = _createSuper(RadarModel);
28
28
  function RadarModel() {
@@ -167,5 +167,4 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
167
167
  }
168
168
  }]);
169
169
  return RadarModel;
170
- }(_BaseModel2.default);
171
- exports.default = RadarModel;
170
+ }(_BaseModel2.default);
@@ -59,7 +59,7 @@ function TextTrianglation(feature) {
59
59
  size: 7
60
60
  };
61
61
  }
62
- var TextModel = /*#__PURE__*/function (_BaseModel) {
62
+ var TextModel = exports.default = /*#__PURE__*/function (_BaseModel) {
63
63
  (0, _inherits2.default)(TextModel, _BaseModel);
64
64
  var _super = _createSuper(TextModel);
65
65
  function TextModel() {
@@ -242,7 +242,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
242
242
  key: "clearModels",
243
243
  value: function clearModels() {
244
244
  var _this$texture;
245
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
245
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
246
246
  // TODO this.mapping
247
247
  this.layer.off('remapping', this.mapping);
248
248
  }
@@ -615,5 +615,4 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
615
615
  }()
616
616
  }]);
617
617
  return TextModel;
618
- }(_BaseModel2.default);
619
- exports.default = TextModel;
618
+ }(_BaseModel2.default);
@@ -1,16 +1,22 @@
1
- uniform float u_additive;
2
- uniform float u_stroke_opacity : 1;
3
- uniform float u_stroke_width : 2;
4
1
 
5
- varying vec4 v_data;
6
- varying vec4 v_color;
7
- varying float v_radius;
8
- varying vec4 v_stroke;
2
+ layout(std140) uniform commonUniforms {
3
+ vec3 u_blur_height_fixed;
4
+ float u_stroke_width;
5
+ float u_additive;
6
+ float u_stroke_opacity;
7
+ float u_size_unit;
8
+ };
9
9
 
10
+ in vec4 v_color;
11
+ in vec4 v_stroke;
12
+ in vec4 v_data;
13
+ in float v_radius;
10
14
 
15
+ #pragma include "scene_uniforms"
11
16
  #pragma include "sdf_2d"
12
17
  #pragma include "picking"
13
18
 
19
+ out vec4 outputColor;
14
20
 
15
21
  void main() {
16
22
  int shape = int(floor(v_data.w + 0.5));
@@ -58,20 +64,20 @@ void main() {
58
64
  );
59
65
 
60
66
  if(u_stroke_width < 0.01) {
61
- gl_FragColor = v_color;
67
+ outputColor = v_color;
62
68
  } else {
63
- gl_FragColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
69
+ outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
64
70
  }
65
71
 
66
72
  if(u_additive > 0.0) {
67
- gl_FragColor *= opacity_t;
68
- gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);
73
+ outputColor *= opacity_t;
74
+ outputColor = filterColorAlpha(outputColor, outputColor.a);
69
75
  } else {
70
- gl_FragColor.a *= opacity_t;
71
- gl_FragColor = filterColor(gl_FragColor);
76
+ outputColor.a *= opacity_t;
77
+ outputColor = filterColor(outputColor);
72
78
  }
73
79
  // 作为 mask 模板时需要丢弃透明的像素
74
- if(gl_FragColor.a < 0.01) {
80
+ if(outputColor.a < 0.01) {
75
81
  discard;
76
82
  }
77
83
  }
@@ -1,25 +1,26 @@
1
- attribute vec4 a_Color;
2
- attribute vec3 a_Position;
3
- attribute vec3 a_Extrude;
4
- attribute float a_Size;
5
- attribute float a_Shape;
6
- uniform mat4 u_ModelMatrix;
7
-
8
- uniform int u_size_unit;
9
-
10
- varying vec4 v_data;
11
- varying vec4 v_color;
12
- varying float v_radius;
13
- varying vec4 v_stroke;
14
- uniform float u_stroke_width: 2;
15
- uniform vec3 u_blur_height_fixed: [0, 0, 0];
16
-
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec4 a_Color;
3
+ layout(location = 9) in float a_Size;
4
+ layout(location = 11) in vec3 a_Extrude;
5
+ layout(location = 10) in float a_Shape;
6
+
7
+ layout(std140) uniform commonUniforms {
8
+ vec3 u_blur_height_fixed;
9
+ float u_stroke_width;
10
+ float u_additive;
11
+ float u_stroke_opacity;
12
+ float u_size_unit;
13
+ };
14
+
15
+ out vec4 v_color;
16
+ out vec4 v_stroke;
17
+ out vec4 v_data;
18
+ out float v_radius;
17
19
 
18
20
  #pragma include "projection"
19
21
  #pragma include "picking"
20
22
  #pragma include "rotation_2d"
21
23
 
22
-
23
24
  void main() {
24
25
  // 透明度计算
25
26
  v_stroke = stroke;
@@ -37,7 +38,7 @@ void main() {
37
38
  // unpack color(vec2)
38
39
  v_color = vec4(a_Color.xyz, a_Color.w * opacity);
39
40
 
40
- if(u_size_unit == 1) {
41
+ if(u_size_unit == 1.0) {
41
42
  newSize = newSize * u_PixelsPerMeter.z;
42
43
  }
43
44
 
@@ -1,4 +1,5 @@
1
- varying vec4 v_color;
1
+ in vec4 v_color;
2
+ out vec4 outputColor;
2
3
  void main() {
3
- gl_FragColor = v_color;
4
- }
4
+ outputColor = v_color;
5
+ }
@@ -1,11 +1,12 @@
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec4 a_Color;
3
+ layout(location = 9) in float a_Size;
1
4
 
2
- attribute vec3 a_Position;
3
- uniform mat4 u_ModelMatrix;
5
+ layout(std140) uniform u_Common {
6
+ float u_size_scale;
7
+ };
4
8
 
5
- attribute float a_Size;
6
- attribute vec4 a_Color;
7
-
8
- varying vec4 v_color;
9
+ out vec4 v_color;
9
10
 
10
11
  #pragma include "projection"
11
12
  #pragma include "project"
@@ -13,12 +14,12 @@ varying vec4 v_color;
13
14
  void main() {
14
15
  v_color = vec4(a_Color.xyz, a_Color.w * opacity);
15
16
 
16
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
- gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);
17
+ if (u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
18
+ gl_Position = u_Mvp * vec4(a_Position, 1.0);
18
19
  } else {
19
- vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);
20
- gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy),project_pos.z,project_pos.w));
20
+ vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2., -a_Size /2., 0., 0.);
21
+ gl_Position = project_common_position_to_clipspace(project_pos);
21
22
  }
22
23
 
23
- gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
24
+ gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
24
25
  }
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
18
18
  var _models = _interopRequireDefault(require("./models/"));
19
19
  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); }; }
20
20
  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; } }
21
- var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
21
+ var PolygonLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
22
22
  (0, _inherits2.default)(PolygonLayer, _BaseLayer);
23
23
  var _super = _createSuper(PolygonLayer);
24
24
  function PolygonLayer() {
@@ -62,7 +62,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
62
62
  value: function getModelType() {
63
63
  var _shapeAttribute$scale;
64
64
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
65
- var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
65
+ var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
66
66
  if (shape === 'fill' || !shape) {
67
67
  return 'fill';
68
68
  } else if (shape === 'extrude') {
@@ -113,5 +113,4 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
113
113
  }
114
114
  }]);
115
115
  return PolygonLayer;
116
- }(_BaseLayer2.default);
117
- exports.default = PolygonLayer;
116
+ }(_BaseLayer2.default);
@@ -32,7 +32,7 @@ var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\
32
32
  var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
33
33
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
34
34
  var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
35
- var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
35
+ var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
36
36
  (0, _inherits2.default)(ExtrudeModel, _BaseModel);
37
37
  var _super = _createSuper(ExtrudeModel);
38
38
  function ExtrudeModel() {
@@ -160,7 +160,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
160
160
  key: "clearModels",
161
161
  value: function clearModels() {
162
162
  var _this$texture;
163
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
163
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
164
164
  }
165
165
  }, {
166
166
  key: "registerBuiltinAttributes",
@@ -296,5 +296,4 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
296
296
  }()
297
297
  }]);
298
298
  return ExtrudeModel;
299
- }(_BaseModel2.default);
300
- exports.default = ExtrudeModel;
299
+ }(_BaseModel2.default);
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
23
23
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
24
24
  var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
25
- var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
25
+ var ExtrusionModel = exports.default = /*#__PURE__*/function (_BaseModel) {
26
26
  (0, _inherits2.default)(ExtrusionModel, _BaseModel);
27
27
  var _super = _createSuper(ExtrusionModel);
28
28
  function ExtrusionModel() {
@@ -97,7 +97,7 @@ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
97
97
  key: "clearModels",
98
98
  value: function clearModels() {
99
99
  var _this$texture;
100
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
100
+ (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
101
101
  }
102
102
  }, {
103
103
  key: "registerBuiltinAttributes",
@@ -140,5 +140,4 @@ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
140
140
  }
141
141
  }]);
142
142
  return ExtrusionModel;
143
- }(_BaseModel2.default);
144
- exports.default = ExtrusionModel;
143
+ }(_BaseModel2.default);
@@ -27,7 +27,7 @@ var polygon_linear_frag = "#pragma include \"picking\"\nuniform float u_opacityl
27
27
  var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_Color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
28
28
  /* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
29
29
  var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
30
- var FillModel = /*#__PURE__*/function (_BaseModel) {
30
+ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
31
31
  (0, _inherits2.default)(FillModel, _BaseModel);
32
32
  var _super = _createSuper(FillModel);
33
33
  function FillModel() {
@@ -161,5 +161,4 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
161
161
  }
162
162
  }]);
163
163
  return FillModel;
164
- }(_BaseModel2.default);
165
- exports.default = FillModel;
164
+ }(_BaseModel2.default);