@antv/l7-layers 2.20.8 → 2.20.9
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/core/BaseLayer.d.ts +1 -0
- package/es/core/BaseLayer.js +3 -0
- package/es/core/BaseModel.d.ts +1 -0
- package/es/core/BaseModel.js +4 -1
- package/es/heatmap/index.d.ts +1 -0
- package/es/heatmap/index.js +10 -0
- package/es/heatmap/models/heatmap.d.ts +1 -0
- package/es/heatmap/models/heatmap.js +9 -6
- package/es/mask/models/fill.d.ts +8 -2
- package/es/mask/models/fill.js +21 -10
- package/es/mask/shaders/mask_vert.glsl +5 -2
- package/es/shader/minify_frag.glsl +8 -4
- package/es/utils/stencil.js +1 -1
- package/lib/core/BaseLayer.js +3 -0
- package/lib/core/BaseModel.js +4 -1
- package/lib/heatmap/index.js +10 -0
- package/lib/heatmap/models/heatmap.js +8 -5
- package/lib/mask/models/fill.js +20 -9
- package/lib/mask/shaders/mask_vert.glsl +5 -2
- package/lib/shader/minify_frag.glsl +8 -4
- package/package.json +7 -7
package/es/core/BaseLayer.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
159
159
|
* 渲染所有的图层
|
|
160
160
|
*/
|
|
161
161
|
renderLayers(): void;
|
|
162
|
+
prerender(): void;
|
|
162
163
|
render(options?: Partial<IRenderOptions>): ILayer;
|
|
163
164
|
/**
|
|
164
165
|
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -633,6 +633,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
633
633
|
this.layerService.reRender();
|
|
634
634
|
this.rendering = false;
|
|
635
635
|
}
|
|
636
|
+
}, {
|
|
637
|
+
key: "prerender",
|
|
638
|
+
value: function prerender() {}
|
|
636
639
|
}, {
|
|
637
640
|
key: "render",
|
|
638
641
|
value: function render() {
|
package/es/core/BaseModel.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerMod
|
|
|
50
50
|
};
|
|
51
51
|
elements: IElements;
|
|
52
52
|
};
|
|
53
|
+
prerender(): void;
|
|
53
54
|
render(renderOptions?: Partial<IRenderOptions>): void;
|
|
54
55
|
protected registerBuiltinAttributes(): void;
|
|
55
56
|
protected animateOption2Array(option: IAnimateOption): number[];
|
package/es/core/BaseModel.js
CHANGED
|
@@ -13,9 +13,9 @@ import { BlendType, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/
|
|
|
13
13
|
import { rgb2arr } from '@antv/l7-utils';
|
|
14
14
|
import { BlendTypes } from "../utils/blend";
|
|
15
15
|
import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
|
|
16
|
+
import { getCommonStyleAttributeOptions, ShaderLocation } from "./CommonStyleAttribute";
|
|
16
17
|
import { DefaultUniformStyleType, DefaultUniformStyleValue } from "./constant";
|
|
17
18
|
import { MultipleOfFourNumber } from "./utils";
|
|
18
|
-
import { getCommonStyleAttributeOptions, ShaderLocation } from "./CommonStyleAttribute";
|
|
19
19
|
var shaderLocationMap = {
|
|
20
20
|
opacity: ShaderLocation.OPACITY,
|
|
21
21
|
stroke: ShaderLocation.STROKE,
|
|
@@ -204,6 +204,9 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
204
204
|
value: function getAttribute() {
|
|
205
205
|
throw new Error('Method not implemented.');
|
|
206
206
|
}
|
|
207
|
+
}, {
|
|
208
|
+
key: "prerender",
|
|
209
|
+
value: function prerender() {}
|
|
207
210
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
208
211
|
}, {
|
|
209
212
|
key: "render",
|
package/es/heatmap/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { HeatMapModelType } from './models';
|
|
|
5
5
|
export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
|
|
6
6
|
type: string;
|
|
7
7
|
buildModels(): Promise<void>;
|
|
8
|
+
prerender(): void;
|
|
8
9
|
renderModels(options?: Partial<IRenderOptions>): this;
|
|
9
10
|
updateModelData(data: IAttributeAndElements): void;
|
|
10
11
|
getModelType(): HeatMapModelType;
|
package/es/heatmap/index.js
CHANGED
|
@@ -47,6 +47,16 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
47
47
|
}
|
|
48
48
|
return buildModels;
|
|
49
49
|
}()
|
|
50
|
+
}, {
|
|
51
|
+
key: "prerender",
|
|
52
|
+
value: function prerender() {
|
|
53
|
+
var shape = this.getModelType();
|
|
54
|
+
if (shape === 'heatmap') {
|
|
55
|
+
if (this.layerModel) {
|
|
56
|
+
this.layerModel.prerender(); // 独立的渲染流程
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
50
60
|
}, {
|
|
51
61
|
key: "renderModels",
|
|
52
62
|
value: function renderModels() {
|
|
@@ -12,6 +12,7 @@ export default class HeatMapModel extends BaseModel {
|
|
|
12
12
|
private preRampColors;
|
|
13
13
|
private colorModelUniformBuffer;
|
|
14
14
|
private heat3DModelUniformBuffer;
|
|
15
|
+
prerender(): void;
|
|
15
16
|
render(options: Partial<IRenderOptions>): void;
|
|
16
17
|
getUninforms(): IModelUniform;
|
|
17
18
|
initModels(): Promise<IModel[]>;
|
|
@@ -12,7 +12,7 @@ var _dec, _class;
|
|
|
12
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
14
|
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; } }
|
|
15
|
-
import { AttributeType,
|
|
15
|
+
import { AttributeType, TextureUsage, gl } from '@antv/l7-core';
|
|
16
16
|
import { generateColorRamp, getCullFace, lodashUtil } from '@antv/l7-utils';
|
|
17
17
|
import { mat4 } from 'gl-matrix';
|
|
18
18
|
import { injectable } from 'inversify';
|
|
@@ -49,14 +49,12 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
49
49
|
return _this;
|
|
50
50
|
}
|
|
51
51
|
_createClass(HeatMapModel, [{
|
|
52
|
-
key: "
|
|
53
|
-
value: function
|
|
52
|
+
key: "prerender",
|
|
53
|
+
value: function prerender() {
|
|
54
54
|
var _this2 = this;
|
|
55
55
|
var _this$rendererService = this.rendererService,
|
|
56
56
|
clear = _this$rendererService.clear,
|
|
57
57
|
useFramebuffer = _this$rendererService.useFramebuffer;
|
|
58
|
-
var _ref = this.layer.getLayerConfig(),
|
|
59
|
-
rampColors = _ref.rampColors;
|
|
60
58
|
useFramebuffer(this.heatmapFramerBuffer, function () {
|
|
61
59
|
clear({
|
|
62
60
|
color: [0, 0, 0, 0],
|
|
@@ -66,7 +64,12 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
66
64
|
});
|
|
67
65
|
_this2.drawIntensityMode(); // 密度图
|
|
68
66
|
});
|
|
69
|
-
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "render",
|
|
70
|
+
value: function render(options) {
|
|
71
|
+
var _ref = this.layer.getLayerConfig(),
|
|
72
|
+
rampColors = _ref.rampColors;
|
|
70
73
|
if (!isEqual(this.preRampColors, rampColors)) {
|
|
71
74
|
this.updateColorTexture();
|
|
72
75
|
}
|
package/es/mask/models/fill.d.ts
CHANGED
|
@@ -2,8 +2,14 @@ import type { IModel } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class MaskModel extends BaseModel {
|
|
4
4
|
getUninforms(): {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
};
|
|
7
|
+
protected getCommonUniformsInfo(): {
|
|
8
|
+
uniformsArray: number[];
|
|
9
|
+
uniformsLength: number;
|
|
10
|
+
uniformsOption: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
7
13
|
};
|
|
8
14
|
initModels(): Promise<IModel[]>;
|
|
9
15
|
buildModels(): Promise<IModel[]>;
|
package/es/mask/models/fill.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -7,14 +8,13 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
7
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
10
|
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; } }
|
|
10
|
-
import {
|
|
11
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
11
12
|
import BaseModel from "../../core/BaseModel";
|
|
12
13
|
import { polygonTriangulation } from "../../core/triangulation";
|
|
13
14
|
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
14
|
-
var mask_frag = "uniform float u_opacity
|
|
15
|
+
var mask_frag = "layout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = u_color;\n outputColor.a *= u_opacity;\n}\n";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
16
|
-
var mask_vert = "
|
|
17
|
-
var isNumber = lodashUtil.isNumber;
|
|
17
|
+
var mask_vert = "layout(location = 0) in vec3 a_Position;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
|
|
18
18
|
var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
19
19
|
_inherits(MaskModel, _BaseModel);
|
|
20
20
|
var _super = _createSuper(MaskModel);
|
|
@@ -25,15 +25,25 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
25
25
|
_createClass(MaskModel, [{
|
|
26
26
|
key: "getUninforms",
|
|
27
27
|
value: function getUninforms() {
|
|
28
|
+
var commoninfo = this.getCommonUniformsInfo();
|
|
29
|
+
var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
30
|
+
this.updateStyleUnifoms();
|
|
31
|
+
return _objectSpread(_objectSpread({}, commoninfo.uniformsOption), attributeInfo.uniformsOption);
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "getCommonUniformsInfo",
|
|
35
|
+
value: function getCommonUniformsInfo() {
|
|
28
36
|
var _ref = this.layer.getLayerConfig(),
|
|
29
37
|
_ref$opacity = _ref.opacity,
|
|
30
38
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
31
39
|
_ref$color = _ref.color,
|
|
32
40
|
color = _ref$color === void 0 ? '#000' : _ref$color;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
var commonOptions = {
|
|
42
|
+
u_color: rgb2arr(color),
|
|
43
|
+
u_opacity: opacity || 1
|
|
36
44
|
};
|
|
45
|
+
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
46
|
+
return commonBufferInfo;
|
|
37
47
|
}
|
|
38
48
|
}, {
|
|
39
49
|
key: "initModels",
|
|
@@ -62,7 +72,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
62
72
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
63
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
64
74
|
case 0:
|
|
65
|
-
|
|
75
|
+
this.initUniformsBuffer();
|
|
76
|
+
_context2.next = 3;
|
|
66
77
|
return this.layer.buildLayerModel({
|
|
67
78
|
moduleName: 'mask',
|
|
68
79
|
vertexShader: mask_vert,
|
|
@@ -73,10 +84,10 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
73
84
|
},
|
|
74
85
|
pick: false
|
|
75
86
|
});
|
|
76
|
-
case
|
|
87
|
+
case 3:
|
|
77
88
|
model = _context2.sent;
|
|
78
89
|
return _context2.abrupt("return", [model]);
|
|
79
|
-
case
|
|
90
|
+
case 5:
|
|
80
91
|
case "end":
|
|
81
92
|
return _context2.stop();
|
|
82
93
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
uniform
|
|
2
|
-
|
|
1
|
+
layout(std140) uniform commonUniorm {
|
|
2
|
+
vec4 u_color;
|
|
3
|
+
float u_opacity;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
out vec4 outputColor;
|
|
3
7
|
|
|
4
8
|
void main() {
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
outputColor = u_color;
|
|
10
|
+
outputColor.a *= u_opacity;
|
|
7
11
|
}
|
package/es/utils/stencil.js
CHANGED
package/lib/core/BaseLayer.js
CHANGED
|
@@ -639,6 +639,9 @@ var BaseLayer = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.
|
|
|
639
639
|
this.layerService.reRender();
|
|
640
640
|
this.rendering = false;
|
|
641
641
|
}
|
|
642
|
+
}, {
|
|
643
|
+
key: "prerender",
|
|
644
|
+
value: function prerender() {}
|
|
642
645
|
}, {
|
|
643
646
|
key: "render",
|
|
644
647
|
value: function render() {
|
package/lib/core/BaseModel.js
CHANGED
|
@@ -19,9 +19,9 @@ var _l7Core = require("@antv/l7-core");
|
|
|
19
19
|
var _l7Utils = require("@antv/l7-utils");
|
|
20
20
|
var _blend = require("../utils/blend");
|
|
21
21
|
var _stencil = require("../utils/stencil");
|
|
22
|
+
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
22
23
|
var _constant = require("./constant");
|
|
23
24
|
var _utils = require("./utils");
|
|
24
|
-
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
25
25
|
var _dec, _class, _descriptor;
|
|
26
26
|
var shaderLocationMap = {
|
|
27
27
|
opacity: _CommonStyleAttribute.ShaderLocation.OPACITY,
|
|
@@ -211,6 +211,9 @@ var BaseModel = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.
|
|
|
211
211
|
value: function getAttribute() {
|
|
212
212
|
throw new Error('Method not implemented.');
|
|
213
213
|
}
|
|
214
|
+
}, {
|
|
215
|
+
key: "prerender",
|
|
216
|
+
value: function prerender() {}
|
|
214
217
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
215
218
|
}, {
|
|
216
219
|
key: "render",
|
package/lib/heatmap/index.js
CHANGED
|
@@ -54,6 +54,16 @@ var HeatMapLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
|
54
54
|
}
|
|
55
55
|
return buildModels;
|
|
56
56
|
}()
|
|
57
|
+
}, {
|
|
58
|
+
key: "prerender",
|
|
59
|
+
value: function prerender() {
|
|
60
|
+
var shape = this.getModelType();
|
|
61
|
+
if (shape === 'heatmap') {
|
|
62
|
+
if (this.layerModel) {
|
|
63
|
+
this.layerModel.prerender(); // 独立的渲染流程
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
57
67
|
}, {
|
|
58
68
|
key: "renderModels",
|
|
59
69
|
value: function renderModels() {
|
|
@@ -56,14 +56,12 @@ var HeatMapModel = exports.default = (_dec = (0, _inversify.injectable)(), _dec(
|
|
|
56
56
|
return _this;
|
|
57
57
|
}
|
|
58
58
|
(0, _createClass2.default)(HeatMapModel, [{
|
|
59
|
-
key: "
|
|
60
|
-
value: function
|
|
59
|
+
key: "prerender",
|
|
60
|
+
value: function prerender() {
|
|
61
61
|
var _this2 = this;
|
|
62
62
|
var _this$rendererService = this.rendererService,
|
|
63
63
|
clear = _this$rendererService.clear,
|
|
64
64
|
useFramebuffer = _this$rendererService.useFramebuffer;
|
|
65
|
-
var _ref = this.layer.getLayerConfig(),
|
|
66
|
-
rampColors = _ref.rampColors;
|
|
67
65
|
useFramebuffer(this.heatmapFramerBuffer, function () {
|
|
68
66
|
clear({
|
|
69
67
|
color: [0, 0, 0, 0],
|
|
@@ -73,7 +71,12 @@ var HeatMapModel = exports.default = (_dec = (0, _inversify.injectable)(), _dec(
|
|
|
73
71
|
});
|
|
74
72
|
_this2.drawIntensityMode(); // 密度图
|
|
75
73
|
});
|
|
76
|
-
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render(options) {
|
|
78
|
+
var _ref = this.layer.getLayerConfig(),
|
|
79
|
+
rampColors = _ref.rampColors;
|
|
77
80
|
if (!isEqual(this.preRampColors, rampColors)) {
|
|
78
81
|
this.updateColorTexture();
|
|
79
82
|
}
|
package/lib/mask/models/fill.js
CHANGED
|
@@ -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 _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -18,10 +19,9 @@ var _triangulation = require("../../core/triangulation");
|
|
|
18
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); }; }
|
|
19
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; } }
|
|
20
21
|
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
21
|
-
var mask_frag = "uniform float u_opacity
|
|
22
|
+
var mask_frag = "layout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = u_color;\n outputColor.a *= u_opacity;\n}\n";
|
|
22
23
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
23
|
-
var mask_vert = "
|
|
24
|
-
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
24
|
+
var mask_vert = "layout(location = 0) in vec3 a_Position;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
|
|
25
25
|
var MaskModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(MaskModel, _BaseModel);
|
|
27
27
|
var _super = _createSuper(MaskModel);
|
|
@@ -32,15 +32,25 @@ var MaskModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
32
32
|
(0, _createClass2.default)(MaskModel, [{
|
|
33
33
|
key: "getUninforms",
|
|
34
34
|
value: function getUninforms() {
|
|
35
|
+
var commoninfo = this.getCommonUniformsInfo();
|
|
36
|
+
var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
37
|
+
this.updateStyleUnifoms();
|
|
38
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, commoninfo.uniformsOption), attributeInfo.uniformsOption);
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "getCommonUniformsInfo",
|
|
42
|
+
value: function getCommonUniformsInfo() {
|
|
35
43
|
var _ref = this.layer.getLayerConfig(),
|
|
36
44
|
_ref$opacity = _ref.opacity,
|
|
37
45
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
38
46
|
_ref$color = _ref.color,
|
|
39
47
|
color = _ref$color === void 0 ? '#000' : _ref$color;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
var commonOptions = {
|
|
49
|
+
u_color: (0, _l7Utils.rgb2arr)(color),
|
|
50
|
+
u_opacity: opacity || 1
|
|
43
51
|
};
|
|
52
|
+
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
53
|
+
return commonBufferInfo;
|
|
44
54
|
}
|
|
45
55
|
}, {
|
|
46
56
|
key: "initModels",
|
|
@@ -69,7 +79,8 @@ var MaskModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
69
79
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
70
80
|
while (1) switch (_context2.prev = _context2.next) {
|
|
71
81
|
case 0:
|
|
72
|
-
|
|
82
|
+
this.initUniformsBuffer();
|
|
83
|
+
_context2.next = 3;
|
|
73
84
|
return this.layer.buildLayerModel({
|
|
74
85
|
moduleName: 'mask',
|
|
75
86
|
vertexShader: mask_vert,
|
|
@@ -80,10 +91,10 @@ var MaskModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
80
91
|
},
|
|
81
92
|
pick: false
|
|
82
93
|
});
|
|
83
|
-
case
|
|
94
|
+
case 3:
|
|
84
95
|
model = _context2.sent;
|
|
85
96
|
return _context2.abrupt("return", [model]);
|
|
86
|
-
case
|
|
97
|
+
case 5:
|
|
87
98
|
case "end":
|
|
88
99
|
return _context2.stop();
|
|
89
100
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
uniform
|
|
2
|
-
|
|
1
|
+
layout(std140) uniform commonUniorm {
|
|
2
|
+
vec4 u_color;
|
|
3
|
+
float u_opacity;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
out vec4 outputColor;
|
|
3
7
|
|
|
4
8
|
void main() {
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
outputColor = u_color;
|
|
10
|
+
outputColor.a *= u_opacity;
|
|
7
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.9",
|
|
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.20.
|
|
31
|
-
"@antv/l7-maps": "2.20.
|
|
32
|
-
"@antv/l7-source": "2.20.
|
|
33
|
-
"@antv/l7-utils": "2.20.
|
|
30
|
+
"@antv/l7-core": "2.20.9",
|
|
31
|
+
"@antv/l7-maps": "2.20.9",
|
|
32
|
+
"@antv/l7-source": "2.20.9",
|
|
33
|
+
"@antv/l7-utils": "2.20.9",
|
|
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.20.
|
|
55
|
+
"@antv/l7-test-utils": "2.20.9",
|
|
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": "09352d485c5be1478d063e37a7266edecefecb9a",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|