@antv/l7-layers 2.16.0 → 2.16.2
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 +3 -0
- package/es/core/BaseLayer.js +76 -80
- package/es/core/BaseModel.d.ts +9 -71
- package/es/core/BaseModel.js +75 -357
- package/es/core/CommonStyleAttribute.d.ts +2 -0
- package/es/core/CommonStyleAttribute.js +66 -0
- package/es/core/interface.d.ts +13 -3
- package/es/core/shape/extrude.js +18 -6
- package/es/core/triangulation.d.ts +12 -0
- package/es/core/triangulation.js +70 -0
- package/es/heatmap/models/grid.js +1 -1
- package/es/heatmap/models/grid3d.js +1 -1
- package/es/heatmap/models/heatmap.d.ts +1 -0
- package/es/heatmap/models/heatmap.js +17 -13
- package/es/heatmap/models/hexagon.js +1 -1
- package/es/heatmap/shaders/grid_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +3 -2
- package/es/line/models/arc.js +9 -45
- package/es/line/models/arc_3d.js +12 -45
- package/es/line/models/earthArc_3d.js +6 -40
- package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
- package/es/line/models/flow.js +167 -0
- package/es/line/models/great_circle.js +4 -38
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +3 -3
- package/es/line/models/line.js +7 -41
- package/es/line/models/linearline.js +4 -38
- package/es/line/models/simpleLine.d.ts +0 -1
- package/es/line/models/simpleLine.js +4 -43
- package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/es/line/shaders/line_arc_frag.glsl +7 -11
- package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/es/line/shaders/line_arc_vert.glsl +9 -45
- package/es/line/shaders/line_frag.glsl +15 -17
- package/es/line/shaders/line_vert.glsl +3 -34
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/es/plugins/DataMappingPlugin.js +20 -34
- package/es/plugins/LayerModelPlugin.js +13 -1
- package/es/plugins/ShaderUniformPlugin.js +3 -3
- package/es/point/index.d.ts +1 -0
- package/es/point/index.js +1 -0
- package/es/point/models/earthExtrude.d.ts +0 -3
- package/es/point/models/earthExtrude.js +2 -40
- package/es/point/models/earthFill.d.ts +0 -1
- package/es/point/models/earthFill.js +9 -60
- package/es/point/models/extrude.d.ts +0 -3
- package/es/point/models/extrude.js +3 -42
- package/es/point/models/fill.d.ts +0 -1
- package/es/point/models/fill.js +15 -76
- package/es/point/models/fillmage.js +6 -43
- package/es/point/models/image.js +7 -41
- package/es/point/models/normal.js +2 -2
- package/es/point/models/radar.d.ts +0 -1
- package/es/point/models/radar.js +4 -13
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +8 -49
- package/es/point/models/text.js +17 -47
- package/es/point/shaders/animate/wave_frag.glsl +1 -11
- package/es/point/shaders/earth/extrude_frag.glsl +5 -17
- package/es/point/shaders/earth/extrude_vert.glsl +14 -29
- package/es/point/shaders/earth/fill_frag.glsl +5 -14
- package/es/point/shaders/earth/fill_vert.glsl +1 -75
- package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/es/point/shaders/fill_frag.glsl +9 -20
- package/es/point/shaders/fill_vert.glsl +16 -101
- package/es/point/shaders/image/fillImage_frag.glsl +2 -5
- package/es/point/shaders/image/fillImage_vert.glsl +4 -47
- package/es/point/shaders/image_frag.glsl +1 -5
- package/es/point/shaders/image_vert.glsl +1 -44
- package/es/point/shaders/normal_frag.glsl +0 -2
- package/es/point/shaders/normal_vert.glsl +2 -1
- package/es/point/shaders/radar/radar_vert.glsl +2 -2
- package/es/point/shaders/simplePoint_frag.glsl +0 -7
- package/es/point/shaders/simplePoint_vert.glsl +3 -45
- package/es/point/shaders/text_frag.glsl +6 -19
- package/es/point/shaders/text_vert.glsl +5 -66
- package/es/polygon/index.d.ts +1 -0
- package/es/polygon/index.js +1 -0
- package/es/polygon/models/extrude.d.ts +0 -3
- package/es/polygon/models/extrude.js +86 -82
- package/es/polygon/models/fill.d.ts +0 -4
- package/es/polygon/models/fill.js +8 -47
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/es/polygon/shaders/polygon_frag.glsl +0 -5
- package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/es/polygon/shaders/polygon_vert.glsl +1 -27
- package/es/utils/layerData.js +2 -2
- package/lib/core/BaseLayer.js +74 -78
- package/lib/core/BaseModel.js +74 -356
- package/lib/core/CommonStyleAttribute.js +72 -0
- package/lib/core/shape/extrude.js +18 -6
- package/lib/core/triangulation.js +72 -0
- package/lib/heatmap/models/grid.js +1 -1
- package/lib/heatmap/models/grid3d.js +1 -1
- package/lib/heatmap/models/heatmap.js +17 -13
- package/lib/heatmap/models/hexagon.js +1 -1
- package/lib/heatmap/shaders/grid_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/lib/line/index.js +3 -2
- package/lib/line/models/arc.js +9 -45
- package/lib/line/models/arc_3d.js +12 -45
- package/lib/line/models/earthArc_3d.js +6 -40
- package/lib/line/models/flow.js +174 -0
- package/lib/line/models/great_circle.js +4 -38
- package/lib/line/models/index.js +3 -3
- package/lib/line/models/line.js +7 -41
- package/lib/line/models/linearline.js +4 -38
- package/lib/line/models/simpleLine.js +4 -43
- package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/lib/line/shaders/line_arc_frag.glsl +7 -11
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/lib/line/shaders/line_arc_vert.glsl +9 -45
- package/lib/line/shaders/line_frag.glsl +15 -17
- package/lib/line/shaders/line_vert.glsl +3 -34
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/lib/plugins/DataMappingPlugin.js +20 -34
- package/lib/plugins/LayerModelPlugin.js +13 -1
- package/lib/plugins/ShaderUniformPlugin.js +3 -3
- package/lib/point/index.js +1 -0
- package/lib/point/models/earthExtrude.js +2 -40
- package/lib/point/models/earthFill.js +9 -60
- package/lib/point/models/extrude.js +3 -42
- package/lib/point/models/fill.js +15 -76
- package/lib/point/models/fillmage.js +6 -43
- package/lib/point/models/image.js +7 -41
- package/lib/point/models/normal.js +2 -2
- package/lib/point/models/radar.js +4 -13
- package/lib/point/models/simplePoint.js +8 -49
- package/lib/point/models/text.js +15 -45
- package/lib/point/shaders/animate/wave_frag.glsl +1 -11
- package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
- package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
- package/lib/point/shaders/earth/fill_frag.glsl +5 -14
- package/lib/point/shaders/earth/fill_vert.glsl +1 -75
- package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/lib/point/shaders/fill_frag.glsl +9 -20
- package/lib/point/shaders/fill_vert.glsl +16 -101
- package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
- package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
- package/lib/point/shaders/image_frag.glsl +1 -5
- package/lib/point/shaders/image_vert.glsl +1 -44
- package/lib/point/shaders/normal_frag.glsl +0 -2
- package/lib/point/shaders/normal_vert.glsl +2 -1
- package/lib/point/shaders/radar/radar_vert.glsl +2 -2
- package/lib/point/shaders/simplePoint_frag.glsl +0 -7
- package/lib/point/shaders/simplePoint_vert.glsl +3 -45
- package/lib/point/shaders/text_frag.glsl +6 -19
- package/lib/point/shaders/text_vert.glsl +5 -66
- package/lib/polygon/index.js +1 -0
- package/lib/polygon/models/extrude.js +86 -82
- package/lib/polygon/models/fill.js +8 -47
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/lib/polygon/shaders/polygon_frag.glsl +0 -5
- package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/lib/polygon/shaders/polygon_vert.glsl +1 -27
- package/lib/utils/layerData.js +2 -2
- package/package.json +7 -7
- package/es/line/models/half.js +0 -267
- package/es/line/shaders/half/line_half_frag.glsl +0 -53
- package/es/line/shaders/half/line_half_vert.glsl +0 -169
- package/es/utils/dataMappingStyle.d.ts +0 -31
- package/es/utils/dataMappingStyle.js +0 -137
- package/lib/line/models/half.js +0 -274
- package/lib/line/shaders/half/line_half_frag.glsl +0 -53
- package/lib/line/shaders/half/line_half_vert.glsl +0 -169
- package/lib/utils/dataMappingStyle.js +0 -140
|
@@ -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"));
|
|
@@ -14,19 +15,18 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
16
|
var _l7Core = require("@antv/l7-core");
|
|
16
17
|
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
-
var _lodash = require("lodash");
|
|
18
18
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
19
19
|
var _triangulation = require("../../core/triangulation");
|
|
20
20
|
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
21
|
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; } }
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/polygon_frag.glsl' */
|
|
23
|
-
var polygon_frag = "
|
|
23
|
+
var polygon_frag = "varying vec4 v_color;\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
|
|
25
|
-
var polygon_linear_frag = "
|
|
25
|
+
var polygon_linear_frag = "#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\n\nvoid main() {\n \n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
|
|
27
|
-
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float
|
|
27
|
+
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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 vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
|
|
29
|
-
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float
|
|
29
|
+
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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 if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
30
30
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
31
31
|
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
32
32
|
var _super = _createSuper(FillModel);
|
|
@@ -40,50 +40,16 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
40
40
|
var _ref = this.layer.getLayerConfig(),
|
|
41
41
|
_ref$raisingHeight = _ref.raisingHeight,
|
|
42
42
|
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
43
|
-
_ref$opacity = _ref.opacity,
|
|
44
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
45
43
|
_ref$opacityLinear = _ref.opacityLinear,
|
|
46
44
|
opacityLinear = _ref$opacityLinear === void 0 ? {
|
|
47
45
|
enable: false,
|
|
48
46
|
dir: 'in'
|
|
49
47
|
} : _ref$opacityLinear;
|
|
50
|
-
|
|
51
|
-
opacity: opacity
|
|
52
|
-
})) {
|
|
53
|
-
this.judgeStyleAttributes({
|
|
54
|
-
opacity: opacity
|
|
55
|
-
});
|
|
56
|
-
var encodeData = this.layer.getEncodedData();
|
|
57
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
58
|
-
data = _this$calDataFrame.data,
|
|
59
|
-
width = _this$calDataFrame.width,
|
|
60
|
-
height = _this$calDataFrame.height;
|
|
61
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
62
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
63
|
-
flipY: true,
|
|
64
|
-
data: data,
|
|
65
|
-
format: _l7Core.gl.LUMINANCE,
|
|
66
|
-
type: _l7Core.gl.FLOAT,
|
|
67
|
-
width: width,
|
|
68
|
-
height: height
|
|
69
|
-
}) : this.createTexture2D({
|
|
70
|
-
flipY: true,
|
|
71
|
-
data: [1],
|
|
72
|
-
format: _l7Core.gl.LUMINANCE,
|
|
73
|
-
type: _l7Core.gl.FLOAT,
|
|
74
|
-
width: 1,
|
|
75
|
-
height: 1
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
u_dataTexture: this.dataTexture,
|
|
80
|
-
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
81
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
48
|
+
return (0, _objectSpread2.default)({
|
|
82
49
|
u_raisingHeight: Number(raisingHeight),
|
|
83
|
-
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
|
|
84
50
|
u_opacitylinear: Number(opacityLinear.enable),
|
|
85
51
|
u_dir: opacityLinear.dir === 'in' ? 1.0 : 0.0
|
|
86
|
-
};
|
|
52
|
+
}, this.getStyleAttribute());
|
|
87
53
|
}
|
|
88
54
|
}, {
|
|
89
55
|
key: "initModels",
|
|
@@ -120,6 +86,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
120
86
|
moduleName: type,
|
|
121
87
|
vertexShader: vert,
|
|
122
88
|
fragmentShader: frag,
|
|
89
|
+
inject: this.getInject(),
|
|
123
90
|
triangulation: triangulation,
|
|
124
91
|
primitive: _l7Core.gl.TRIANGLES,
|
|
125
92
|
depth: {
|
|
@@ -145,12 +112,6 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
145
112
|
}
|
|
146
113
|
return buildModels;
|
|
147
114
|
}()
|
|
148
|
-
}, {
|
|
149
|
-
key: "clearModels",
|
|
150
|
-
value: function clearModels() {
|
|
151
|
-
var _this$dataTexture;
|
|
152
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
153
|
-
}
|
|
154
115
|
}, {
|
|
155
116
|
key: "registerBuiltinAttributes",
|
|
156
117
|
value: function registerBuiltinAttributes() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
uniform float u_opacity: 1.0;
|
|
2
1
|
uniform vec4 u_sourceColor;
|
|
3
2
|
uniform vec4 u_targetColor;
|
|
4
3
|
uniform float u_linearColor: 0;
|
|
@@ -7,39 +6,19 @@ uniform float u_topsurface: 1.0;
|
|
|
7
6
|
uniform float u_sidesurface: 1.0;
|
|
8
7
|
|
|
9
8
|
varying vec4 v_Color;
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
#pragma include "picking"
|
|
12
11
|
|
|
13
12
|
void main() {
|
|
14
|
-
float opacity = styleMappingMat[0][0];
|
|
15
|
-
float isSide = styleMappingMat[0][3];
|
|
16
|
-
float sidey = styleMappingMat[3][0];
|
|
17
|
-
float lightWeight = styleMappingMat[3][1];
|
|
18
|
-
|
|
19
|
-
// Tip: 部分机型 GPU 计算精度兼容
|
|
20
|
-
if(isSide < 0.999) {
|
|
21
|
-
// side face
|
|
22
|
-
if(u_sidesurface < 1.0) {
|
|
23
|
-
discard;
|
|
24
|
-
}
|
|
25
13
|
|
|
26
|
-
if(u_linearColor == 1.0) {
|
|
27
|
-
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
|
|
28
|
-
linearColor.rgb *= lightWeight;
|
|
29
|
-
gl_FragColor = linearColor;
|
|
30
|
-
} else {
|
|
31
|
-
gl_FragColor = v_Color;
|
|
32
|
-
}
|
|
33
14
|
|
|
34
|
-
} else {
|
|
35
15
|
// top face
|
|
36
16
|
if(u_topsurface < 1.0) {
|
|
37
17
|
discard;
|
|
38
18
|
}
|
|
39
19
|
|
|
40
20
|
gl_FragColor = v_Color;
|
|
41
|
-
|
|
21
|
+
|
|
42
22
|
|
|
43
|
-
gl_FragColor.a *= opacity;
|
|
44
23
|
gl_FragColor = filterColor(gl_FragColor);
|
|
45
24
|
}
|
|
@@ -7,14 +7,16 @@ uniform float u_topsurface: 1.0;
|
|
|
7
7
|
uniform float u_sidesurface: 1.0;
|
|
8
8
|
|
|
9
9
|
varying vec4 v_Color;
|
|
10
|
-
varying
|
|
10
|
+
varying vec3 v_uvs;
|
|
11
|
+
varying vec2 v_texture_data;
|
|
12
|
+
|
|
11
13
|
#pragma include "picking"
|
|
12
14
|
|
|
13
15
|
void main() {
|
|
14
|
-
float opacity =
|
|
15
|
-
float isSide =
|
|
16
|
-
float sidey =
|
|
17
|
-
float lightWeight =
|
|
16
|
+
float opacity = u_opacity;
|
|
17
|
+
float isSide = v_texture_data.x;
|
|
18
|
+
float sidey = v_uvs[2];
|
|
19
|
+
float lightWeight = v_texture_data.y;
|
|
18
20
|
|
|
19
21
|
// Tip: 部分机型 GPU 计算精度兼容
|
|
20
22
|
if(isSide < 0.999) {
|
|
@@ -12,46 +12,22 @@ attribute vec3 a_uvs;
|
|
|
12
12
|
uniform mat4 u_ModelMatrix;
|
|
13
13
|
uniform mat4 u_Mvp;
|
|
14
14
|
|
|
15
|
-
varying vec4 v_Color;
|
|
16
15
|
uniform float u_heightfixed: 0.0; // 默认不固定
|
|
17
16
|
uniform float u_raisingHeight: 0.0;
|
|
18
|
-
uniform float u_opacity: 1.0;
|
|
19
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
varying vec2 v_texture_data;
|
|
19
|
+
varying vec3 v_uvs;
|
|
20
|
+
varying vec4 v_Color;
|
|
21
|
+
|
|
23
22
|
|
|
24
23
|
#pragma include "projection"
|
|
25
24
|
#pragma include "light"
|
|
26
25
|
#pragma include "picking"
|
|
27
26
|
|
|
28
27
|
void main() {
|
|
29
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
30
|
-
styleMappingMat = mat4(
|
|
31
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide
|
|
32
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
33
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
34
|
-
0.0, 0.0, 0.0, 0.0 // sidey
|
|
35
|
-
);
|
|
36
|
-
styleMappingMat[0][3] = a_Position.z;
|
|
37
|
-
styleMappingMat[3][0] = a_uvs[2];
|
|
38
28
|
|
|
39
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
40
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
41
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
42
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
43
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
44
|
-
float id = a_vertexId; // 第n个顶点
|
|
45
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
46
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
47
|
-
|
|
48
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
49
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
50
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
51
29
|
|
|
52
|
-
|
|
53
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
54
|
-
textureOffset = opacityAndOffset.g;
|
|
30
|
+
v_uvs = a_uvs;
|
|
55
31
|
// cal style mapping - 数据纹理映射部分的计算
|
|
56
32
|
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
|
|
57
33
|
vec4 project_pos = project_position(pos);
|
|
@@ -76,10 +52,9 @@ void main() {
|
|
|
76
52
|
}
|
|
77
53
|
|
|
78
54
|
float lightWeight = calc_lighting(pos);
|
|
79
|
-
|
|
80
|
-
v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
55
|
+
v_texture_data = vec2(a_Position.z,lightWeight);
|
|
81
56
|
|
|
82
|
-
|
|
57
|
+
v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
83
58
|
|
|
84
59
|
setPickingColor(a_PickingColor);
|
|
85
60
|
}
|
|
@@ -11,50 +11,31 @@ attribute float a_Size;
|
|
|
11
11
|
attribute vec3 a_uvs;
|
|
12
12
|
uniform mat4 u_ModelMatrix;
|
|
13
13
|
uniform mat4 u_Mvp;
|
|
14
|
+
uniform vec4 u_sourceColor;
|
|
15
|
+
uniform vec4 u_targetColor;
|
|
16
|
+
uniform float u_linearColor: 0;
|
|
17
|
+
|
|
18
|
+
uniform float u_topsurface: 1.0;
|
|
19
|
+
uniform float u_sidesurface: 1.0;
|
|
14
20
|
|
|
15
21
|
varying vec4 v_Color;
|
|
16
22
|
uniform float u_heightfixed: 0.0; // 默认不固定
|
|
17
23
|
uniform float u_raisingHeight: 0.0;
|
|
18
|
-
uniform float u_opacity: 1.0;
|
|
19
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
20
|
-
|
|
21
|
-
#pragma include "styleMapping"
|
|
22
|
-
#pragma include "styleMappingCalOpacity"
|
|
23
24
|
|
|
24
25
|
#pragma include "projection"
|
|
25
26
|
#pragma include "light"
|
|
26
27
|
#pragma include "picking"
|
|
27
28
|
|
|
28
29
|
void main() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
0.0, 0.0, 0.0, 0.0 // sidey
|
|
35
|
-
);
|
|
36
|
-
styleMappingMat[0][3] = a_Position.z;
|
|
37
|
-
styleMappingMat[3][0] = a_uvs[2];
|
|
38
|
-
|
|
39
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
40
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
41
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
42
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
43
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
44
|
-
float id = a_vertexId; // 第n个顶点
|
|
45
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
46
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
47
|
-
|
|
48
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
49
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
50
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
51
|
-
|
|
52
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
53
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
54
|
-
textureOffset = opacityAndOffset.g;
|
|
55
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
30
|
+
|
|
31
|
+
float isSide = a_Position.z;
|
|
32
|
+
float topU = a_uvs[0];
|
|
33
|
+
float topV = 1.0 - a_uvs[1];
|
|
34
|
+
float sidey = a_uvs[2];
|
|
56
35
|
|
|
57
36
|
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
|
|
37
|
+
float lightWeight = calc_lighting(pos);
|
|
38
|
+
|
|
58
39
|
vec4 project_pos = project_position(pos);
|
|
59
40
|
|
|
60
41
|
if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
|
|
@@ -68,10 +49,7 @@ void main() {
|
|
|
68
49
|
}
|
|
69
50
|
}
|
|
70
51
|
|
|
71
|
-
// project_pos.z += 500000.0; // amap1
|
|
72
52
|
|
|
73
|
-
// project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
|
|
74
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
75
53
|
|
|
76
54
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
77
55
|
// gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
|
|
@@ -80,11 +58,28 @@ void main() {
|
|
|
80
58
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
81
59
|
}
|
|
82
60
|
|
|
83
|
-
|
|
61
|
+
// Tip: 部分机型 GPU 计算精度兼容
|
|
62
|
+
if(isSide < 0.999) {
|
|
63
|
+
// side face
|
|
64
|
+
// if(u_sidesurface < 1.0) {
|
|
65
|
+
// discard;
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
if(u_linearColor == 1.0) {
|
|
69
|
+
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
|
|
70
|
+
linearColor.rgb *= lightWeight;
|
|
71
|
+
v_Color = linearColor;
|
|
72
|
+
} else {
|
|
73
|
+
v_Color = a_Color;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} else {
|
|
77
|
+
v_Color = a_Color;
|
|
78
|
+
}
|
|
79
|
+
|
|
84
80
|
// v_Color = a_Color;
|
|
85
|
-
v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
81
|
+
v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
|
|
86
82
|
|
|
87
|
-
styleMappingMat[3][1] = lightWeight;
|
|
88
83
|
|
|
89
84
|
setPickingColor(a_PickingColor);
|
|
90
85
|
}
|
|
@@ -8,19 +8,21 @@ uniform float u_topsurface: 1.0;
|
|
|
8
8
|
uniform float u_sidesurface: 1.0;
|
|
9
9
|
|
|
10
10
|
varying vec4 v_Color;
|
|
11
|
-
varying
|
|
11
|
+
varying vec3 v_uvs;
|
|
12
|
+
varying vec2 v_texture_data;
|
|
13
|
+
|
|
14
|
+
|
|
12
15
|
#pragma include "picking"
|
|
13
16
|
|
|
14
17
|
void main() {
|
|
15
|
-
float opacity =
|
|
16
|
-
float isSide =
|
|
17
|
-
float lightWeight =
|
|
18
|
-
float topU =
|
|
19
|
-
float topV =
|
|
20
|
-
|
|
21
|
-
float sidey = styleMappingMat[3][0];
|
|
18
|
+
float opacity = u_opacity;
|
|
19
|
+
float isSide = v_texture_data.x;
|
|
20
|
+
float lightWeight = v_texture_data.y;
|
|
21
|
+
float topU = v_uvs[0];
|
|
22
|
+
float topV = 1.0 - v_uvs[1];
|
|
23
|
+
float sidey = v_uvs[2];
|
|
22
24
|
// Tip: 部分机型 GPU 计算精度兼容
|
|
23
|
-
if(isSide < 0.999) {
|
|
25
|
+
if(isSide < 0.999) {// 是否是边缘
|
|
24
26
|
// side face
|
|
25
27
|
if(u_sidesurface < 1.0) {
|
|
26
28
|
discard;
|
|
@@ -41,6 +43,7 @@ void main() {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
gl_FragColor = texture2D(u_texture, vec2(topU, topV));
|
|
46
|
+
// gl_FragColor = vec4(1.0, 0., 0., 1.0);
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
|
|
@@ -11,57 +11,33 @@ attribute float a_Size;
|
|
|
11
11
|
attribute vec3 a_uvs;
|
|
12
12
|
uniform mat4 u_ModelMatrix;
|
|
13
13
|
uniform mat4 u_Mvp;
|
|
14
|
+
uniform sampler2D u_texture;
|
|
14
15
|
|
|
16
|
+
|
|
17
|
+
uniform vec4 u_sourceColor;
|
|
18
|
+
uniform vec4 u_targetColor;
|
|
19
|
+
uniform float u_topsurface: 1.0;
|
|
20
|
+
uniform float u_sidesurface: 1.0;
|
|
15
21
|
varying vec4 v_Color;
|
|
16
22
|
uniform float u_heightfixed: 0.0; // 默认不固定
|
|
17
23
|
uniform float u_raisingHeight: 0.0;
|
|
18
|
-
uniform float
|
|
19
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
24
|
+
uniform float u_linearColor: 0.0;
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
varying vec2 v_texture_data;
|
|
27
|
+
varying vec3 v_uvs;
|
|
23
28
|
|
|
24
29
|
#pragma include "projection"
|
|
25
30
|
#pragma include "light"
|
|
26
31
|
#pragma include "picking"
|
|
27
32
|
|
|
28
33
|
void main() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
32
|
-
styleMappingMat = mat4(
|
|
33
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)
|
|
34
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
35
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v
|
|
36
|
-
0.0, 0.0, 0.0, 0.0 // sidey
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
styleMappingMat[0][3] = a_Position.z;
|
|
40
|
-
styleMappingMat[2][2] = a_uvs[0];
|
|
41
|
-
styleMappingMat[2][3] = 1.0 - a_uvs[1];
|
|
42
|
-
styleMappingMat[3][0] = a_uvs[2];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
46
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
47
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
48
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
49
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
50
|
-
float id = a_vertexId; // 第n个顶点
|
|
51
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
52
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
53
|
-
|
|
54
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
55
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
56
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
57
|
-
|
|
58
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
59
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
60
|
-
textureOffset = opacityAndOffset.g;
|
|
61
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
62
|
-
|
|
34
|
+
|
|
63
35
|
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
|
|
36
|
+
float lightWeight = calc_lighting(pos);
|
|
64
37
|
vec4 project_pos = project_position(pos);
|
|
38
|
+
v_uvs = a_uvs;
|
|
39
|
+
|
|
40
|
+
v_texture_data = vec2(a_Position.z, lightWeight);
|
|
65
41
|
|
|
66
42
|
if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
|
|
67
43
|
project_pos.z = a_Position.z * a_Size;
|
|
@@ -74,10 +50,6 @@ void main() {
|
|
|
74
50
|
}
|
|
75
51
|
}
|
|
76
52
|
|
|
77
|
-
// project_pos.z += 500000.0; // amap1
|
|
78
|
-
|
|
79
|
-
// project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
|
|
80
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
81
53
|
|
|
82
54
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
83
55
|
// gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
|
|
@@ -86,8 +58,8 @@ void main() {
|
|
|
86
58
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
87
59
|
}
|
|
88
60
|
|
|
89
|
-
|
|
90
|
-
|
|
61
|
+
|
|
62
|
+
|
|
91
63
|
|
|
92
64
|
setPickingColor(a_PickingColor);
|
|
93
65
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
uniform float u_opacity: 1.0;
|
|
2
1
|
varying vec4 v_color;
|
|
3
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
4
|
-
|
|
5
2
|
#pragma include "picking"
|
|
6
3
|
|
|
7
4
|
void main() {
|
|
8
|
-
float opacity = styleMappingMat[0][0];
|
|
9
5
|
gl_FragColor = v_color;
|
|
10
|
-
gl_FragColor.a *= opacity;
|
|
11
6
|
gl_FragColor = filterColor(gl_FragColor);
|
|
12
7
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
uniform float u_opacity: 1.0;
|
|
2
|
-
varying vec4 v_Color;
|
|
3
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
4
|
-
|
|
5
1
|
#pragma include "picking"
|
|
6
2
|
uniform float u_opacitylinear: 0.0;
|
|
7
3
|
uniform float u_dir: 1.0;
|
|
@@ -10,13 +6,9 @@ varying vec2 v_pos;
|
|
|
10
6
|
|
|
11
7
|
|
|
12
8
|
void main() {
|
|
13
|
-
float opacity = styleMappingMat[0][0];
|
|
14
|
-
gl_FragColor = v_Color;
|
|
15
9
|
|
|
16
10
|
if(u_opacitylinear > 0.0) {
|
|
17
11
|
gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
gl_FragColor.a *= opacity;
|
|
21
13
|
gl_FragColor = filterColor(gl_FragColor);
|
|
22
14
|
}
|
|
@@ -3,14 +3,10 @@ attribute vec3 a_Position;
|
|
|
3
3
|
|
|
4
4
|
uniform mat4 u_ModelMatrix;
|
|
5
5
|
uniform mat4 u_Mvp;
|
|
6
|
-
uniform float u_opacity: 1.0;
|
|
7
6
|
uniform float u_raisingHeight: 0.0;
|
|
8
7
|
|
|
9
8
|
varying vec4 v_Color;
|
|
10
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
11
9
|
|
|
12
|
-
#pragma include "styleMapping"
|
|
13
|
-
#pragma include "styleMappingCalOpacity"
|
|
14
10
|
|
|
15
11
|
#pragma include "projection"
|
|
16
12
|
#pragma include "picking"
|
|
@@ -26,34 +22,6 @@ void main() {
|
|
|
26
22
|
v_linear = a_linear;
|
|
27
23
|
v_pos = a_Position.xy;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
31
|
-
styleMappingMat = mat4(
|
|
32
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
33
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
34
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
35
|
-
0.0, 0.0, 0.0, 0.0
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
39
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
40
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
41
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
42
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
43
|
-
float id = a_vertexId; // 第n个顶点
|
|
44
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
45
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
46
|
-
|
|
47
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
48
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
49
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
50
|
-
|
|
51
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
52
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
53
|
-
textureOffset = opacityAndOffset.g;
|
|
54
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
55
|
-
|
|
56
|
-
v_Color = a_Color;
|
|
57
25
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
58
26
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
59
27
|
project_pos.z += u_raisingHeight;
|
|
@@ -4,46 +4,20 @@ attribute vec3 a_Position;
|
|
|
4
4
|
uniform mat4 u_ModelMatrix;
|
|
5
5
|
uniform mat4 u_Mvp;
|
|
6
6
|
|
|
7
|
-
uniform float u_opacity: 1.0;
|
|
8
7
|
uniform float u_raisingHeight: 0.0;
|
|
9
8
|
|
|
10
9
|
varying vec4 v_color;
|
|
11
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
12
10
|
|
|
13
|
-
#pragma include "styleMapping"
|
|
14
|
-
#pragma include "styleMappingCalOpacity"
|
|
15
11
|
|
|
16
12
|
#pragma include "projection"
|
|
17
13
|
#pragma include "picking"
|
|
18
14
|
|
|
19
15
|
void main() {
|
|
20
16
|
// cal style mapping - 数据纹理映射部分的计算
|
|
21
|
-
styleMappingMat = mat4(
|
|
22
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
23
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
24
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
25
|
-
0.0, 0.0, 0.0, 0.0
|
|
26
|
-
);
|
|
27
17
|
|
|
28
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
29
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
30
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
31
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
32
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
33
|
-
float id = a_vertexId; // 第n个顶点
|
|
34
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
35
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
36
|
-
|
|
37
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
38
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
39
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
40
|
-
|
|
41
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
42
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
43
|
-
textureOffset = opacityAndOffset.g;
|
|
44
18
|
// cal style mapping - 数据纹理映射部分的计算
|
|
45
19
|
|
|
46
|
-
v_color = a_Color;
|
|
20
|
+
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
47
21
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
48
22
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
49
23
|
|
package/lib/utils/layerData.js
CHANGED
|
@@ -32,7 +32,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
|
|
|
32
32
|
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
33
33
|
// @ts-ignore
|
|
34
34
|
// d.coordinates = mapService.lngLatToCoord(d.coordinates);
|
|
35
|
-
d.coordinates = mapService.
|
|
35
|
+
d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
36
36
|
});
|
|
37
37
|
} else {
|
|
38
38
|
// 连续的线、面数据
|
|
@@ -47,7 +47,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
|
|
|
47
47
|
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
48
48
|
// @ts-ignore
|
|
49
49
|
// d.coordinates = mapService.lngLatToCoords(d.coordinates);
|
|
50
|
-
d.coordinates = mapService.
|
|
50
|
+
d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}
|