@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.
- package/es/canvas/models/canvas.js +2 -2
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +18 -11
- package/es/core/BaseModel.d.ts +3 -1
- package/es/core/BaseModel.js +28 -4
- package/es/core/CommonStyleAttribute.d.ts +15 -0
- package/es/core/CommonStyleAttribute.js +21 -0
- package/es/core/TextureService.js +2 -2
- package/es/earth/index.js +1 -1
- package/es/geometry/index.js +1 -1
- package/es/geometry/models/billboard.js +1 -1
- package/es/geometry/models/plane.js +2 -2
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/index.js +1 -1
- package/es/heatmap/models/heatmap.js +4 -4
- package/es/image/models/image.js +1 -1
- package/es/line/index.js +1 -1
- package/es/line/models/arc.js +1 -1
- package/es/line/models/arc_3d.js +1 -1
- package/es/line/models/earthArc_3d.js +1 -1
- package/es/line/models/great_circle.js +1 -1
- package/es/line/models/line.js +1 -1
- package/es/line/models/linearline.js +1 -1
- package/es/line/models/wall.js +1 -1
- package/es/plugins/DataMappingPlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.d.ts +4 -1
- package/es/plugins/PixelPickingPlugin.js +91 -22
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
- package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
- package/es/plugins/ShaderUniformPlugin.js +74 -6
- package/es/point/index.js +1 -1
- package/es/point/models/fill.js +31 -7
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.js +30 -12
- package/es/point/models/text.js +1 -1
- package/es/point/shaders/fill_frag.glsl +20 -14
- package/es/point/shaders/fill_vert.glsl +19 -18
- package/es/point/shaders/normal_frag.glsl +4 -3
- package/es/point/shaders/normal_vert.glsl +12 -11
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +1 -1
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/ocean.js +3 -3
- package/es/polygon/models/water.js +1 -1
- package/es/raster/models/raster.js +2 -2
- package/es/raster/models/rasterRgb.js +1 -1
- package/es/raster/models/rasterTerrainRgb.js +1 -1
- package/es/tile/core/BaseLayer.js +4 -4
- package/es/tile/interaction/getRasterData.js +4 -4
- package/es/tile/service/TileLayerService.js +4 -4
- package/es/tile/service/TilePickService.js +3 -3
- package/es/tile/tile/Tile.d.ts +3 -0
- package/es/tile/tile/Tile.js +2 -2
- package/es/wind/models/wind.js +5 -6
- package/lib/canvas/index.js +2 -3
- package/lib/canvas/models/canvas.js +4 -5
- package/lib/canvas/models/index.js +1 -2
- package/lib/citybuliding/building.js +2 -3
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +19 -13
- package/lib/core/BaseModel.js +30 -7
- package/lib/core/CommonStyleAttribute.js +22 -0
- package/lib/core/LayerPickService.js +2 -3
- package/lib/core/TextureService.js +4 -5
- package/lib/core/constant.js +3 -5
- package/lib/core/interface.js +6 -11
- package/lib/core/schema.js +2 -3
- package/lib/core/shape/Path.js +3 -6
- package/lib/core/triangulation.js +2 -2
- package/lib/earth/index.js +3 -4
- package/lib/earth/models/atmosphere.js +2 -3
- package/lib/earth/models/base.js +2 -3
- package/lib/earth/models/bloomsphere.js +2 -3
- package/lib/earth/utils.js +3 -6
- package/lib/geometry/index.js +3 -4
- package/lib/geometry/models/billboard.js +3 -4
- package/lib/geometry/models/index.js +1 -2
- package/lib/geometry/models/plane.js +4 -5
- package/lib/geometry/models/sprite.js +4 -5
- package/lib/heatmap/index.js +3 -4
- package/lib/heatmap/models/grid.js +2 -3
- package/lib/heatmap/models/grid3d.js +2 -3
- package/lib/heatmap/models/heatmap.js +6 -7
- package/lib/heatmap/models/hexagon.js +2 -3
- package/lib/heatmap/models/index.js +1 -2
- package/lib/image/index.js +2 -3
- package/lib/image/models/image.js +3 -4
- package/lib/image/models/index.js +1 -2
- package/lib/line/index.js +3 -4
- package/lib/line/models/arc.js +3 -4
- package/lib/line/models/arc_3d.js +3 -4
- package/lib/line/models/earthArc_3d.js +3 -4
- package/lib/line/models/flow.js +2 -3
- package/lib/line/models/great_circle.js +3 -4
- package/lib/line/models/index.js +1 -2
- package/lib/line/models/line.js +3 -4
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +2 -3
- package/lib/line/models/wall.js +3 -4
- package/lib/mask/index.js +2 -3
- package/lib/mask/models/fill.js +2 -3
- package/lib/mask/models/index.js +1 -2
- package/lib/plugins/DataMappingPlugin.js +3 -4
- package/lib/plugins/DataSourcePlugin.js +2 -3
- package/lib/plugins/FeatureScalePlugin.js +4 -5
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
- package/lib/plugins/LayerMaskPlugin.js +2 -3
- package/lib/plugins/LayerModelPlugin.js +2 -3
- package/lib/plugins/LayerStylePlugin.js +2 -3
- package/lib/plugins/LightingPlugin.js +2 -3
- package/lib/plugins/MultiPassRendererPlugin.js +2 -3
- package/lib/plugins/PixelPickingPlugin.js +93 -25
- package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
- package/lib/plugins/ShaderUniformPlugin.js +75 -8
- package/lib/plugins/UpdateModelPlugin.js +2 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
- package/lib/point/index.js +3 -4
- package/lib/point/models/billboard_point.js +2 -3
- package/lib/point/models/earthExtrude.js +2 -3
- package/lib/point/models/earthFill.js +2 -3
- package/lib/point/models/extrude.js +2 -3
- package/lib/point/models/fill.js +33 -10
- package/lib/point/models/fillmage.js +3 -4
- package/lib/point/models/image.js +3 -4
- package/lib/point/models/index.js +1 -2
- package/lib/point/models/normal.js +32 -15
- package/lib/point/models/radar.js +2 -3
- package/lib/point/models/text.js +3 -4
- package/lib/point/shaders/fill_frag.glsl +20 -14
- package/lib/point/shaders/fill_vert.glsl +19 -18
- package/lib/point/shaders/normal_frag.glsl +4 -3
- package/lib/point/shaders/normal_vert.glsl +12 -11
- package/lib/polygon/index.js +3 -4
- package/lib/polygon/models/extrude.js +3 -4
- package/lib/polygon/models/extrusion.js +3 -4
- package/lib/polygon/models/fill.js +2 -3
- package/lib/polygon/models/index.js +1 -2
- package/lib/polygon/models/ocean.js +5 -6
- package/lib/polygon/models/water.js +3 -4
- package/lib/raster/index.js +2 -3
- package/lib/raster/models/index.js +1 -2
- package/lib/raster/models/raster.js +4 -5
- package/lib/raster/models/rasterRgb.js +3 -4
- package/lib/raster/models/rasterTerrainRgb.js +3 -4
- package/lib/tile/core/BaseLayer.js +6 -7
- package/lib/tile/core/TileDebugLayer.js +2 -3
- package/lib/tile/interaction/getRasterData.js +4 -4
- package/lib/tile/service/TileLayerService.js +6 -7
- package/lib/tile/service/TilePickService.js +5 -6
- package/lib/tile/service/TileSourceService.js +4 -5
- package/lib/tile/tile/DebugTile.js +2 -3
- package/lib/tile/tile/ImageTile.js +2 -3
- package/lib/tile/tile/MaskTile.js +2 -3
- package/lib/tile/tile/RasterRGBTile.js +2 -3
- package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
- package/lib/tile/tile/RasterTile.js +2 -3
- package/lib/tile/tile/Tile.js +4 -5
- package/lib/tile/tile/VectorTile.js +2 -3
- package/lib/tile/utils/constants.js +2 -3
- package/lib/tile/utils/utils.js +1 -2
- package/lib/utils/blend.js +2 -3
- package/lib/utils/collision-index.js +2 -3
- package/lib/utils/extrude_polyline.js +2 -3
- package/lib/utils/grid-index.js +1 -2
- package/lib/utils/simpleLine.js +2 -3
- package/lib/wind/index.js +2 -3
- package/lib/wind/models/index.js +1 -2
- package/lib/wind/models/wind.js +7 -9
- package/lib/wind/models/windRender.js +4 -5
- package/lib/wind/models/windShader.js +6 -12
- package/package.json +7 -7
package/lib/utils/simpleLine.js
CHANGED
|
@@ -17,7 +17,7 @@ function direction(out, a, b) {
|
|
|
17
17
|
_glMatrix.vec2.normalize(out, out);
|
|
18
18
|
return out;
|
|
19
19
|
}
|
|
20
|
-
var ExtrudePolyline = /*#__PURE__*/function () {
|
|
20
|
+
var ExtrudePolyline = exports.default = /*#__PURE__*/function () {
|
|
21
21
|
function ExtrudePolyline() {
|
|
22
22
|
(0, _classCallCheck2.default)(this, ExtrudePolyline);
|
|
23
23
|
(0, _defineProperty2.default)(this, "started", false);
|
|
@@ -93,5 +93,4 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
93
93
|
}
|
|
94
94
|
}]);
|
|
95
95
|
return ExtrudePolyline;
|
|
96
|
-
}();
|
|
97
|
-
exports.default = ExtrudePolyline;
|
|
96
|
+
}();
|
package/lib/wind/index.js
CHANGED
|
@@ -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 WindLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var WindLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(WindLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(WindLayer);
|
|
24
24
|
function WindLayer() {
|
|
@@ -80,5 +80,4 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
80
80
|
}
|
|
81
81
|
}]);
|
|
82
82
|
return WindLayer;
|
|
83
|
-
}(_BaseLayer2.default);
|
|
84
|
-
exports.default = WindLayer;
|
|
83
|
+
}(_BaseLayer2.default);
|
package/lib/wind/models/index.js
CHANGED
package/lib/wind/models/wind.js
CHANGED
|
@@ -35,7 +35,7 @@ var defaultRampColors = {
|
|
|
35
35
|
0.6: '#f46d43',
|
|
36
36
|
1.0: '#d53e4f'
|
|
37
37
|
};
|
|
38
|
-
var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
38
|
+
var WindModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
39
39
|
(0, _inherits2.default)(WindModel, _BaseModel);
|
|
40
40
|
var _super = _createSuper(WindModel);
|
|
41
41
|
function WindModel() {
|
|
@@ -72,7 +72,6 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
72
72
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
73
73
|
var _source$data,
|
|
74
74
|
_source$data2,
|
|
75
|
-
_source$data2$images,
|
|
76
75
|
_this3 = this;
|
|
77
76
|
var _ref, _ref$uMin, uMin, _ref$uMax, uMax, _ref$vMin, vMin, _ref$vMax, vMax, _ref$fadeOpacity, fadeOpacity, _ref$speedFactor, speedFactor, _ref$dropRate, dropRate, _ref$dropRateBump, dropRateBump, _ref$rampColors, rampColors, _ref$sizeScale, sizeScale, createTexture2D, source, glContext, model;
|
|
78
77
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -88,7 +87,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
88
87
|
this.cacheZoom = Math.floor(this.mapService.getZoom());
|
|
89
88
|
glContext = this.rendererService.getGLContext();
|
|
90
89
|
this.imageCoords = (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.dataArray[0].coordinates;
|
|
91
|
-
(_source$data2 = source.data) === null || _source$data2 === void 0
|
|
90
|
+
(_source$data2 = source.data) === null || _source$data2 === void 0 || (_source$data2 = _source$data2.images) === null || _source$data2 === void 0 || _source$data2.then(function (imageData) {
|
|
92
91
|
var _this3$texture;
|
|
93
92
|
_this3.sizeScale = sizeScale * _this3.getZoomScale();
|
|
94
93
|
var _this3$getWindSize = _this3.getWindSize(),
|
|
@@ -114,7 +113,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
114
113
|
vMax: vMax,
|
|
115
114
|
image: imageData[0]
|
|
116
115
|
});
|
|
117
|
-
(_this3$texture = _this3.texture) === null || _this3$texture === void 0
|
|
116
|
+
(_this3$texture = _this3.texture) === null || _this3$texture === void 0 || _this3$texture.destroy();
|
|
118
117
|
_this3.texture = createTexture2D({
|
|
119
118
|
width: imageWidth,
|
|
120
119
|
height: imageHeight
|
|
@@ -182,8 +181,8 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
182
181
|
key: "clearModels",
|
|
183
182
|
value: function clearModels() {
|
|
184
183
|
var _this$texture, _this$wind;
|
|
185
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
186
|
-
(_this$wind = this.wind) === null || _this$wind === void 0
|
|
184
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
185
|
+
(_this$wind = this.wind) === null || _this$wind === void 0 || _this$wind.destroy();
|
|
187
186
|
}
|
|
188
187
|
}, {
|
|
189
188
|
key: "registerBuiltinAttributes",
|
|
@@ -281,7 +280,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
281
280
|
this.layerService.beforeRenderData(this.layer);
|
|
282
281
|
this.layer.hooks.beforeRender.call();
|
|
283
282
|
this.layerService.renderMask(this.layer.masks);
|
|
284
|
-
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0
|
|
283
|
+
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
|
|
285
284
|
uniforms: {
|
|
286
285
|
u_opacity: opacity || 1.0,
|
|
287
286
|
u_texture: this.texture
|
|
@@ -293,5 +292,4 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
293
292
|
}
|
|
294
293
|
}]);
|
|
295
294
|
return WindModel;
|
|
296
|
-
}(_BaseModel2.default);
|
|
297
|
-
exports.default = WindModel;
|
|
295
|
+
}(_BaseModel2.default);
|
|
@@ -11,8 +11,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var glUtils = _interopRequireWildcard(require("./utils"));
|
|
13
13
|
var _windShader = require("./windShader");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
function getColorRamp(colors) {
|
|
17
17
|
var canvas = document.createElement('canvas');
|
|
18
18
|
var ctx = canvas.getContext('2d');
|
|
@@ -41,7 +41,7 @@ function bindFramebuffer(gl, framebuffer, texture) {
|
|
|
41
41
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
var Wind = /*#__PURE__*/function () {
|
|
44
|
+
var Wind = exports.Wind = /*#__PURE__*/function () {
|
|
45
45
|
function Wind(options) {
|
|
46
46
|
(0, _classCallCheck2.default)(this, Wind);
|
|
47
47
|
(0, _defineProperty2.default)(this, "width", 512);
|
|
@@ -351,5 +351,4 @@ var Wind = /*#__PURE__*/function () {
|
|
|
351
351
|
}
|
|
352
352
|
}]);
|
|
353
353
|
return Wind;
|
|
354
|
-
}();
|
|
355
|
-
exports.Wind = Wind;
|
|
354
|
+
}();
|
|
@@ -10,15 +10,9 @@ exports.updateVert = exports.updateFrag = exports.fullScreenVert = exports.fullS
|
|
|
10
10
|
* updateProgram updateVert updateFrag
|
|
11
11
|
* fullScreenProgram fullScreenVert fullScreenFrag
|
|
12
12
|
*/
|
|
13
|
-
var drawVert = "\n precision mediump float;\n\n attribute float a_index;\n\n uniform sampler2D u_particles;\n uniform float u_particles_res;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec4 color = texture2D(u_particles, vec2(\n fract(a_index / u_particles_res),\n floor(a_index / u_particles_res) / u_particles_res)\n );\n\n // decode current particle position from the pixel's RGBA value\n v_particle_pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a);\n\n gl_PointSize = 1.0;\n gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1);\n }";
|
|
14
|
-
exports.
|
|
15
|
-
var
|
|
16
|
-
exports.
|
|
17
|
-
var
|
|
18
|
-
exports.
|
|
19
|
-
var updateFrag = "\n precision highp float;\n\n uniform sampler2D u_particles;\n uniform sampler2D u_wind;\n uniform vec2 u_wind_res;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform float u_rand_seed;\n uniform float u_speed_factor;\n uniform float u_drop_rate;\n uniform float u_drop_rate_bump;\n\n varying vec2 v_tex_pos;\n\n // pseudo-random generator\n const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);\n float rand(const vec2 co) {\n float t = dot(rand_constants.xy, co);\n return fract(sin(t) * (rand_constants.z + t));\n }\n\n // wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation\n vec2 lookup_wind(const vec2 uv) {\n // return texture2D(u_wind, uv).rg; // lower-res hardware filtering\n vec2 px = 1.0 / u_wind_res;\n vec2 vc = (floor(uv * u_wind_res)) * px;\n vec2 f = fract(uv * u_wind_res);\n vec2 tl = texture2D(u_wind, vc).rg;\n vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;\n vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;\n vec2 br = texture2D(u_wind, vc + px).rg;\n return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\n }\n\n void main() {\n vec4 color = texture2D(u_particles, v_tex_pos);\n vec2 pos = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a); // decode particle position from pixel RGBA\n vec2 velocity = mix(u_wind_min, u_wind_max, lookup_wind(pos));\n float speed_t = length(velocity) / length(u_wind_max);\n\n // take EPSG:4236 distortion into account for calculating where the particle moved\n float distortion = cos(radians(pos.y * 180.0 - 90.0));\n vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;\n\n // update particle position, wrapping around the date line\n pos = fract(1.0 + pos + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (pos + v_tex_pos) * u_rand_seed;\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump;\n float drop = step(1.0 - drop_rate, rand(seed));\n\n vec2 random_pos = vec2(\n rand(seed + 1.3),\n rand(seed + 2.1));\n pos = mix(pos, random_pos, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(pos * 255.0),\n floor(pos * 255.0) / 255.0);\n }";
|
|
20
|
-
exports.updateFrag = updateFrag;
|
|
21
|
-
var fullScreenVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0.0, 1.0);\n gl_PointSize = 100.0;\n }";
|
|
22
|
-
exports.fullScreenVert = fullScreenVert;
|
|
23
|
-
var fullScreenFrag = "\n precision mediump float;\n\n uniform sampler2D u_screen;\n uniform float u_opacity;\n varying vec2 v_tex_pos;\n\n void main() {\n vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);\n\n // a hack to guarantee opacity fade out even with a value close to 1.0\n gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0);\n }";
|
|
24
|
-
exports.fullScreenFrag = fullScreenFrag;
|
|
13
|
+
var drawVert = exports.drawVert = "\n precision mediump float;\n\n attribute float a_index;\n\n uniform sampler2D u_particles;\n uniform float u_particles_res;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec4 color = texture2D(u_particles, vec2(\n fract(a_index / u_particles_res),\n floor(a_index / u_particles_res) / u_particles_res)\n );\n\n // decode current particle position from the pixel's RGBA value\n v_particle_pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a);\n\n gl_PointSize = 1.0;\n gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1);\n }";
|
|
14
|
+
var drawFrag = exports.drawFrag = "\n precision mediump float;\n\n uniform sampler2D u_wind;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform sampler2D u_color_ramp;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec2 velocity = mix(u_wind_min, u_wind_max, texture2D(u_wind, v_particle_pos).rg);\n float speed_t = length(velocity) / length(u_wind_max);\n\n // color ramp is encoded in a 16x16 texture\n vec2 ramp_pos = vec2( fract(16.0 * speed_t), floor(16.0 * speed_t) / 16.0);\n\n gl_FragColor = texture2D(u_color_ramp, ramp_pos);\n }";
|
|
15
|
+
var updateVert = exports.updateVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0, 1);\n // framebuffer \u59CB\u7EC8\u7528\u94FA\u6EE1\u5C4F\u5E55\u7684 texture\n }";
|
|
16
|
+
var updateFrag = exports.updateFrag = "\n precision highp float;\n\n uniform sampler2D u_particles;\n uniform sampler2D u_wind;\n uniform vec2 u_wind_res;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform float u_rand_seed;\n uniform float u_speed_factor;\n uniform float u_drop_rate;\n uniform float u_drop_rate_bump;\n\n varying vec2 v_tex_pos;\n\n // pseudo-random generator\n const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);\n float rand(const vec2 co) {\n float t = dot(rand_constants.xy, co);\n return fract(sin(t) * (rand_constants.z + t));\n }\n\n // wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation\n vec2 lookup_wind(const vec2 uv) {\n // return texture2D(u_wind, uv).rg; // lower-res hardware filtering\n vec2 px = 1.0 / u_wind_res;\n vec2 vc = (floor(uv * u_wind_res)) * px;\n vec2 f = fract(uv * u_wind_res);\n vec2 tl = texture2D(u_wind, vc).rg;\n vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;\n vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;\n vec2 br = texture2D(u_wind, vc + px).rg;\n return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\n }\n\n void main() {\n vec4 color = texture2D(u_particles, v_tex_pos);\n vec2 pos = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a); // decode particle position from pixel RGBA\n vec2 velocity = mix(u_wind_min, u_wind_max, lookup_wind(pos));\n float speed_t = length(velocity) / length(u_wind_max);\n\n // take EPSG:4236 distortion into account for calculating where the particle moved\n float distortion = cos(radians(pos.y * 180.0 - 90.0));\n vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;\n\n // update particle position, wrapping around the date line\n pos = fract(1.0 + pos + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (pos + v_tex_pos) * u_rand_seed;\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump;\n float drop = step(1.0 - drop_rate, rand(seed));\n\n vec2 random_pos = vec2(\n rand(seed + 1.3),\n rand(seed + 2.1));\n pos = mix(pos, random_pos, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(pos * 255.0),\n floor(pos * 255.0) / 255.0);\n }";
|
|
17
|
+
var fullScreenVert = exports.fullScreenVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0.0, 1.0);\n gl_PointSize = 100.0;\n }";
|
|
18
|
+
var fullScreenFrag = exports.fullScreenFrag = "\n precision mediump float;\n\n uniform sampler2D u_screen;\n uniform float u_opacity;\n varying vec2 v_tex_pos;\n\n void main() {\n vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);\n\n // a hack to guarantee opacity fade out even with a value close to 1.0\n gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0);\n }";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.1",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@antv/async-hook": "^2.2.9",
|
|
30
|
-
"@antv/l7-core": "2.
|
|
31
|
-
"@antv/l7-maps": "2.
|
|
32
|
-
"@antv/l7-source": "2.
|
|
33
|
-
"@antv/l7-utils": "2.
|
|
30
|
+
"@antv/l7-core": "2.20.1",
|
|
31
|
+
"@antv/l7-maps": "2.20.1",
|
|
32
|
+
"@antv/l7-source": "2.20.1",
|
|
33
|
+
"@antv/l7-utils": "2.20.1",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"reflect-metadata": "^0.1.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@antv/l7-test-utils": "2.
|
|
55
|
+
"@antv/l7-test-utils": "2.20.1",
|
|
56
56
|
"@types/d3-array": "^2.0.0",
|
|
57
57
|
"@types/d3-color": "^1.2.2",
|
|
58
58
|
"@types/d3-interpolate": "1.1.6",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/gl-matrix": "^2.4.5",
|
|
62
62
|
"@types/lodash": "^4.14.138"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9cf19c5a23723463d852a905b8a8230abbe96c72",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|