@antv/l7-layers 2.20.13 → 2.20.14
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 +0 -1
- package/es/core/BaseLayer.js +8 -5
- package/es/core/LayerPickService.d.ts +1 -1
- package/es/core/LayerPickService.js +28 -10
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/models/grid.js +2 -2
- package/es/heatmap/models/grid3d.js +4 -4
- package/es/heatmap/models/heatmap.js +10 -6
- package/es/heatmap/shaders/grid/grid_frag.glsl +1 -0
- package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +9 -0
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +4 -8
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +2 -1
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +3 -1
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -0
- package/es/image/models/image.js +6 -8
- package/es/line/models/arc.js +1 -1
- package/es/line/models/line.js +10 -45
- package/es/line/shaders/arc/line_arc_frag.glsl +2 -1
- package/es/line/shaders/line/line_frag.glsl +2 -2
- package/es/line/shaders/line/line_vert.glsl +10 -7
- package/es/plugins/ShaderUniformPlugin.js +3 -2
- package/es/point/models/extrude.js +2 -2
- package/es/point/models/fill.js +1 -1
- package/es/point/models/fillImage.js +3 -5
- package/es/point/models/text.js +2 -2
- package/es/point/shaders/extrude/extrude_frag.glsl +1 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +0 -1
- package/es/point/shaders/fill/fill_frag.glsl +1 -1
- package/es/point/shaders/fillImage/fillImage_frag.glsl +1 -2
- package/es/point/shaders/text/text_frag.glsl +3 -2
- package/es/point/shaders/text/text_vert.glsl +0 -2
- package/es/polygon/models/extrude.js +30 -39
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/fill.js +3 -3
- package/es/polygon/models/water.js +6 -4
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -3
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +7 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +1 -2
- package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +1 -0
- package/es/polygon/shaders/fill/fill_frag.glsl +1 -0
- package/es/polygon/shaders/fill/fill_linear_frag.glsl +4 -3
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +5 -8
- package/es/raster/models/rasterTerrainRgb.d.ts +8 -2
- package/es/raster/models/rasterTerrainRgb.js +20 -14
- package/es/raster/shaders/terrain/terrain_rgb_frag.glsl +18 -16
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +13 -5
- package/es/tile/service/TilePickService.d.ts +1 -1
- package/es/tile/service/TilePickService.js +36 -13
- package/es/tile/tile/Tile.js +4 -3
- package/es/utils/load-image.d.ts +1 -0
- package/es/utils/load-image.js +46 -0
- package/lib/core/BaseLayer.js +8 -5
- package/lib/core/LayerPickService.js +28 -10
- package/lib/geometry/models/sprite.js +2 -2
- package/lib/heatmap/models/grid.js +2 -2
- package/lib/heatmap/models/grid3d.js +4 -4
- package/lib/heatmap/models/heatmap.js +10 -6
- package/lib/heatmap/shaders/grid/grid_frag.glsl +1 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +9 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +4 -8
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +2 -1
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +3 -1
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -0
- package/lib/image/models/image.js +6 -8
- package/lib/line/models/arc.js +1 -1
- package/lib/line/models/line.js +10 -45
- package/lib/line/shaders/arc/line_arc_frag.glsl +2 -1
- package/lib/line/shaders/line/line_frag.glsl +2 -2
- package/lib/line/shaders/line/line_vert.glsl +10 -7
- package/lib/plugins/ShaderUniformPlugin.js +3 -2
- package/lib/point/models/extrude.js +2 -2
- package/lib/point/models/fill.js +1 -1
- package/lib/point/models/fillImage.js +3 -5
- package/lib/point/models/text.js +2 -2
- package/lib/point/shaders/extrude/extrude_frag.glsl +1 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +0 -1
- package/lib/point/shaders/fill/fill_frag.glsl +1 -1
- package/lib/point/shaders/fillImage/fillImage_frag.glsl +1 -2
- package/lib/point/shaders/text/text_frag.glsl +3 -2
- package/lib/point/shaders/text/text_vert.glsl +0 -2
- package/lib/polygon/models/extrude.js +29 -38
- package/lib/polygon/models/extrusion.js +1 -1
- package/lib/polygon/models/fill.js +3 -3
- package/lib/polygon/models/water.js +6 -4
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -3
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +7 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +1 -2
- package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +1 -0
- package/lib/polygon/shaders/fill/fill_frag.glsl +1 -0
- package/lib/polygon/shaders/fill/fill_linear_frag.glsl +4 -3
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +5 -8
- package/lib/raster/models/rasterTerrainRgb.js +20 -14
- package/lib/raster/shaders/terrain/terrain_rgb_frag.glsl +18 -16
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +13 -5
- package/lib/tile/service/TilePickService.js +36 -13
- package/lib/tile/tile/Tile.js +4 -3
- package/lib/utils/load-image.js +53 -0
- package/package.json +7 -7
package/es/core/BaseLayer.d.ts
CHANGED
package/es/core/BaseLayer.js
CHANGED
|
@@ -13,7 +13,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
13
13
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
14
14
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
15
15
|
var _excluded = ["passes"],
|
|
16
|
-
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "styleOption"];
|
|
16
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "styleOption", "pickingEnabled"];
|
|
17
17
|
var _dec, _class, _descriptor;
|
|
18
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
19
19
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -107,7 +107,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
107
107
|
_defineProperty(_assertThisInitialized(_this), "enableShaderEncodeStyles", []);
|
|
108
108
|
// 数据层数据映射
|
|
109
109
|
_defineProperty(_assertThisInitialized(_this), "enableDataEncodeStyles", []);
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "enablg", []);
|
|
111
110
|
/**
|
|
112
111
|
* 待更新样式属性,在初始化阶段完成注册
|
|
113
112
|
*/
|
|
@@ -1182,11 +1181,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1182
1181
|
value: function () {
|
|
1183
1182
|
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1184
1183
|
var _this10 = this;
|
|
1185
|
-
var moduleName, vertexShader, fragmentShader, inject, triangulation, styleOption, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1184
|
+
var moduleName, vertexShader, fragmentShader, inject, triangulation, styleOption, _options$pickingEnabl, pickingEnabled, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1186
1185
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1187
1186
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1188
1187
|
case 0:
|
|
1189
|
-
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, styleOption = options.styleOption, rest = _objectWithoutProperties(options, _excluded2);
|
|
1188
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, styleOption = options.styleOption, _options$pickingEnabl = options.pickingEnabled, pickingEnabled = _options$pickingEnabl === void 0 ? true : _options$pickingEnabl, rest = _objectWithoutProperties(options, _excluded2);
|
|
1190
1189
|
this.shaderModuleService.registerModule(moduleName, {
|
|
1191
1190
|
vs: vertexShader,
|
|
1192
1191
|
fs: fragmentShader,
|
|
@@ -1199,6 +1198,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1199
1198
|
attributes = _this10$styleAttribut.attributes,
|
|
1200
1199
|
elements = _this10$styleAttribut.elements,
|
|
1201
1200
|
count = _this10$styleAttribut.count;
|
|
1201
|
+
var uniformBuffers = [].concat(_toConsumableArray(_this10.layerModel.uniformBuffers), _toConsumableArray(_this10.rendererService.uniformBuffers), [_this10.getLayerUniformBuffer()]);
|
|
1202
|
+
if (pickingEnabled) {
|
|
1203
|
+
uniformBuffers.push(_this10.getPickingUniformBuffer());
|
|
1204
|
+
}
|
|
1202
1205
|
var modelOptions = _objectSpread({
|
|
1203
1206
|
attributes: attributes,
|
|
1204
1207
|
uniforms: uniforms,
|
|
@@ -1206,7 +1209,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1206
1209
|
vs: vs,
|
|
1207
1210
|
elements: elements,
|
|
1208
1211
|
blend: BlendTypes[BlendType.normal],
|
|
1209
|
-
uniformBuffers:
|
|
1212
|
+
uniformBuffers: uniformBuffers,
|
|
1210
1213
|
textures: _this10.layerModel.textures
|
|
1211
1214
|
}, rest);
|
|
1212
1215
|
if (count) {
|
|
@@ -3,7 +3,7 @@ export default class BaseLayerPickService implements ILayerPickService {
|
|
|
3
3
|
private layer;
|
|
4
4
|
constructor(layer: ILayer);
|
|
5
5
|
pickRender(target: IInteractionTarget): void;
|
|
6
|
-
pick(layer: ILayer, target: IInteractionTarget): boolean
|
|
6
|
+
pick(layer: ILayer, target: IInteractionTarget): Promise<boolean>;
|
|
7
7
|
pickRasterLayer(layer: ILayer, target: IInteractionTarget, parent?: ILayer): boolean;
|
|
8
8
|
readRasterValue(layer: ILayer, bbox: number[], mapService: IMapService, x: number, y: number): any;
|
|
9
9
|
selectFeature(pickedColors: Uint8Array | undefined): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
import { TYPES } from '@antv/l7-core';
|
|
6
8
|
import { lngLatInExtent } from '@antv/l7-utils';
|
|
7
9
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
@@ -19,24 +21,40 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
19
21
|
if (layer.tileLayer) {
|
|
20
22
|
return layer.tileLayer.pickRender(target);
|
|
21
23
|
}
|
|
22
|
-
layer.hooks.beforePickingEncode.call();
|
|
23
24
|
layerService.renderTileLayerMask(layer);
|
|
24
25
|
layer.renderModels({
|
|
25
26
|
ispick: true
|
|
26
27
|
});
|
|
27
|
-
layer.hooks.afterPickingEncode.call();
|
|
28
28
|
}
|
|
29
29
|
}, {
|
|
30
30
|
key: "pick",
|
|
31
|
-
value: function
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
value: function () {
|
|
32
|
+
var _pick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer, target) {
|
|
33
|
+
var container, pickingService;
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
container = this.layer.getContainer();
|
|
38
|
+
pickingService = container.get(TYPES.IPickingService);
|
|
39
|
+
if (!(layer.type === 'RasterLayer')) {
|
|
40
|
+
_context.next = 4;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return _context.abrupt("return", this.pickRasterLayer(layer, target));
|
|
44
|
+
case 4:
|
|
45
|
+
this.pickRender(target);
|
|
46
|
+
return _context.abrupt("return", pickingService.pickFromPickingFBO(layer, target));
|
|
47
|
+
case 6:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee, this);
|
|
52
|
+
}));
|
|
53
|
+
function pick(_x, _x2) {
|
|
54
|
+
return _pick.apply(this, arguments);
|
|
36
55
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
56
|
+
return pick;
|
|
57
|
+
}()
|
|
40
58
|
}, {
|
|
41
59
|
key: "pickRasterLayer",
|
|
42
60
|
value: function pickRasterLayer(layer, target, parent) {
|
|
@@ -11,10 +11,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
12
12
|
import BaseModel from "../../core/BaseModel";
|
|
13
13
|
import { HeatmapGridTriangulation } from "../../core/triangulation";
|
|
14
|
+
/* babel-plugin-inline-import '../shaders/grid/grid_frag.glsl' */
|
|
15
|
+
var grid_frag = "in vec4 v_color;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
14
16
|
/* babel-plugin-inline-import '../shaders/grid/grid_vert.glsl' */
|
|
15
17
|
var grid_vert = "layout(location = 0) in vec3 a_Position;\r\nlayout(location = 1) in vec4 a_Color;\r\nlayout(location = 10) in vec3 a_Pos;\r\n\r\nlayout(std140) uniform commonUniforms {\r\n vec2 u_radius;\r\n float u_opacity;\r\n float u_coverage;\r\n float u_angle;\r\n};\r\n\r\n\r\nout vec4 v_color;\r\n\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n v_color.a *= u_opacity;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
|
|
16
|
-
/* babel-plugin-inline-import '../shaders/grid/grid_frag.glsl' */
|
|
17
|
-
var grid_frag = "in vec4 v_color;\n\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
18
18
|
var GridModel = /*#__PURE__*/function (_BaseModel) {
|
|
19
19
|
_inherits(GridModel, _BaseModel);
|
|
20
20
|
var _super = _createSuper(GridModel);
|
|
@@ -10,12 +10,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
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; } }
|
|
11
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
12
12
|
import BaseModel from "../../core/BaseModel";
|
|
13
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
13
14
|
import { PointExtrudeTriangulation } from "../../core/triangulation";
|
|
14
|
-
/* babel-plugin-inline-import '../shaders/grid3d/grid_3d_vert.glsl' */
|
|
15
|
-
var grid_3d_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec3 a_Pos;\nlayout(location = 13) in vec3 a_Normal;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w * u_opacity);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/grid3d/grid_3d_frag.glsl' */
|
|
17
|
-
var grid_3d_frag = "in vec4 v_color;\n\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
18
|
-
import
|
|
16
|
+
var grid_3d_frag = "in vec4 v_color;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
17
|
+
/* babel-plugin-inline-import '../shaders/grid3d/grid_3d_vert.glsl' */
|
|
18
|
+
var grid_3d_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec3 a_Pos;\nlayout(location = 13) in vec3 a_Normal;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w * u_opacity);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
19
|
var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
20
20
|
_inherits(Grid3DModel, _BaseModel);
|
|
21
21
|
var _super = _createSuper(Grid3DModel);
|
|
@@ -26,12 +26,12 @@ var heatmap_3d_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location
|
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/heatmap/heatmap_frag.glsl' */
|
|
27
27
|
var heatmap_frag = "uniform sampler2D u_texture; // \u70ED\u529B\u5F3A\u5EA6\u56FE\nuniform sampler2D u_colorTexture; // \u6839\u636E\u5F3A\u5EA6\u5206\u5E03\u7684\u8272\u5E26\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n#pragma include \"scene_uniforms\"\n\nfloat getBlurIndusty() {\n float vW = 2.0/ u_ViewportSize.x;\n float vH = 2.0/ u_ViewportSize.y;\n vec2 vUv = v_texCoord;\n float i11 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i12 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i13 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n float i21 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n float i22 = texture(SAMPLER_2D(u_texture), vec2( vUv.x , vUv.y) ).r;\n float i23 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n float i31 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n float i32 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n float i33 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n return(\n i11 + \n i12 + \n i13 + \n i21 + \n i21 + \n i22 + \n i23 + \n i31 + \n i32 + \n i33\n )/9.0;\n}\n\n\nvoid main(){\n // float intensity = texture(u_texture, v_texCoord).r;\n float intensity = getBlurIndusty();\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(intensity, 0.0));\n outputColor = color;\n outputColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n}\n";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/heatmap/heatmap_vert.glsl' */
|
|
29
|
-
var heatmap_vert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\n\n#pragma include \"scene_uniforms\"\n\nout vec2 v_texCoord;\nvoid main() {\n v_texCoord = a_Uv;\n\n gl_Position = vec4(a_Position.xy, 0, 1.);\n}\n";
|
|
29
|
+
var heatmap_vert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\n\n#pragma include \"scene_uniforms\"\n\nout vec2 v_texCoord;\nvoid main() {\n v_texCoord = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_texCoord.y = 1.0 - v_texCoord.y;\n #endif\n\n gl_Position = vec4(a_Position.xy, 0, 1.);\n}\n";
|
|
30
30
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
31
31
|
/* babel-plugin-inline-import '../shaders/heatmap/heatmap_framebuffer_frag.glsl' */
|
|
32
|
-
var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nin
|
|
32
|
+
var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nin vec2 v_extrude;\nin float v_weight;\nout vec4 outputColor;\n#define GAUSS_COEF 0.3989422804014327\n\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n outputColor = vec4(val, 1., 1., 1.);\n}\n";
|
|
33
33
|
/* babel-plugin-inline-import '../shaders/heatmap/heatmap_framebuffer_vert.glsl' */
|
|
34
|
-
var heatmap_framebuffer_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec2 a_Dir;\n\n\nlayout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nout vec2 v_extrude;\nout float v_weight;\n\n
|
|
34
|
+
var heatmap_framebuffer_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec2 a_Dir;\n\n\nlayout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nout vec2 v_extrude;\nout float v_weight;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main(){\n vec3 picking_color_placeholder = u_PickingColor;\n\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
|
|
35
35
|
import { heatMap3DTriangulation } from "../triangulation";
|
|
36
36
|
var isEqual = lodashUtil.isEqual;
|
|
37
37
|
var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -114,7 +114,9 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
114
114
|
});
|
|
115
115
|
this.heatmapFramerBuffer = createFramebuffer({
|
|
116
116
|
color: this.heatmapTexture,
|
|
117
|
-
depth:
|
|
117
|
+
depth: true,
|
|
118
|
+
width: Math.floor(width / 4),
|
|
119
|
+
height: Math.floor(height / 4)
|
|
118
120
|
});
|
|
119
121
|
this.updateColorTexture();
|
|
120
122
|
return _context.abrupt("return", [this.intensityModel, this.colorModel]);
|
|
@@ -474,14 +476,16 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
474
476
|
rampColors = _ref5.rampColors;
|
|
475
477
|
var imageData = generateColorRamp(rampColors);
|
|
476
478
|
this.colorTexture = createTexture2D({
|
|
477
|
-
data:
|
|
479
|
+
data: imageData.data,
|
|
480
|
+
usage: TextureUsage.SAMPLED,
|
|
478
481
|
width: imageData.width,
|
|
479
482
|
height: imageData.height,
|
|
480
483
|
wrapS: gl.CLAMP_TO_EDGE,
|
|
481
484
|
wrapT: gl.CLAMP_TO_EDGE,
|
|
482
485
|
min: gl.NEAREST,
|
|
483
486
|
mag: gl.NEAREST,
|
|
484
|
-
flipY: false
|
|
487
|
+
flipY: false,
|
|
488
|
+
unorm: true
|
|
485
489
|
});
|
|
486
490
|
this.preRampColors = rampColors;
|
|
487
491
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
in vec4 v_color;
|
|
2
2
|
|
|
3
|
+
layout(std140) uniform commonUniforms {
|
|
4
|
+
vec2 u_radius;
|
|
5
|
+
float u_opacity;
|
|
6
|
+
float u_coverage;
|
|
7
|
+
float u_angle;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
#pragma include "scene_uniforms"
|
|
3
11
|
#pragma include "picking"
|
|
12
|
+
|
|
4
13
|
out vec4 outputColor;
|
|
5
14
|
void main() {
|
|
6
15
|
outputColor = v_color;
|
|
@@ -5,10 +5,10 @@ layout(location = 10) in vec3 a_Pos;
|
|
|
5
5
|
layout(location = 13) in vec3 a_Normal;
|
|
6
6
|
|
|
7
7
|
layout(std140) uniform commonUniforms {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
vec2 u_radius;
|
|
9
|
+
float u_opacity;
|
|
10
|
+
float u_coverage;
|
|
11
|
+
float u_angle;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
out vec4 v_color;
|
|
@@ -18,12 +18,10 @@ out vec4 v_color;
|
|
|
18
18
|
#pragma include "light"
|
|
19
19
|
#pragma include "picking"
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
void main() {
|
|
23
22
|
mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));
|
|
24
23
|
vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));
|
|
25
24
|
|
|
26
|
-
|
|
27
25
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
28
26
|
|
|
29
27
|
vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // 经纬度
|
|
@@ -44,7 +42,5 @@ void main() {
|
|
|
44
42
|
gl_Position = project_common_position_to_clipspace(project_pos);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
45
|
setPickingColor(a_PickingColor);
|
|
50
46
|
}
|
|
@@ -5,10 +5,11 @@ layout(std140) uniform commonUniforms {
|
|
|
5
5
|
float u_common_uniforms_padding2;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
in float v_weight;
|
|
9
8
|
in vec2 v_extrude;
|
|
9
|
+
in float v_weight;
|
|
10
10
|
out vec4 outputColor;
|
|
11
11
|
#define GAUSS_COEF 0.3989422804014327
|
|
12
|
+
|
|
12
13
|
void main(){
|
|
13
14
|
float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);
|
|
14
15
|
float val = v_weight * u_intensity * GAUSS_COEF * exp(d);
|
|
@@ -13,12 +13,14 @@ layout(std140) uniform commonUniforms {
|
|
|
13
13
|
out vec2 v_extrude;
|
|
14
14
|
out float v_weight;
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
#define GAUSS_COEF 0.3989422804014327
|
|
18
17
|
|
|
19
18
|
#pragma include "projection"
|
|
19
|
+
#pragma include "picking"
|
|
20
20
|
|
|
21
21
|
void main(){
|
|
22
|
+
vec3 picking_color_placeholder = u_PickingColor;
|
|
23
|
+
|
|
22
24
|
v_weight = a_Size;
|
|
23
25
|
float ZERO = 1.0 / 255.0 / 16.0;
|
|
24
26
|
float extrude_x = a_Dir.x * 2.0 -1.0;
|
package/es/image/models/image.js
CHANGED
|
@@ -8,14 +8,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
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
9
|
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
10
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
11
|
+
import { defaultValue } from '@antv/l7-utils';
|
|
11
12
|
import BaseModel from "../../core/BaseModel";
|
|
13
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
12
14
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
13
15
|
/* babel-plugin-inline-import '../shaders/image_frag.glsl' */
|
|
14
16
|
var ImageFrag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n float u_opacity:1.0;\n float u_brightness:1.0;\n float u_contrast:1.0;\n float u_saturation:1.0;\n float u_gamma:1.0;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\nvec3 setContrast(vec3 rgb, float contrast) {\n vec3 color = mix(vec3(0.5), rgb, contrast);\n color = clamp(color, 0.0, 1.0);\n return color;\n}\nvec3 setSaturation(vec3 rgb, float adjustment) {\n const vec3 grayVector = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, grayVector));\n vec3 color = mix(intensity, rgb, adjustment);\n color = clamp(color, 0.0, 1.0);\n return color;\n}\nvoid main() {\n vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y));\n //brightness\n color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, u_brightness);\n //contrast\n color.rgb = setContrast(color.rgb, u_contrast);\n // saturation\n color.rgb = setSaturation(color.rgb, u_saturation);\n // gamma\n color.rgb = pow(color.rgb, vec3(u_gamma));\n outputColor = color;\n outputColor.a *= u_opacity;\n if(outputColor.a < 0.01)\n discard;\n}\n";
|
|
15
17
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
16
18
|
var ImageVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity:1.0;\n float u_brightness:1.0;\n float u_contrast:1.0;\n float u_saturation:1.0;\n float u_gamma:1.0;\n};\n\nout vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n \n}\n";
|
|
17
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
18
|
-
import { defaultValue, rgb2arr } from '@antv/l7-utils';
|
|
19
19
|
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
20
20
|
_inherits(ImageModel, _BaseModel);
|
|
21
21
|
var _super = _createSuper(ImageModel);
|
|
@@ -27,14 +27,11 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
27
27
|
key: "getCommonUniformsInfo",
|
|
28
28
|
value: function getCommonUniformsInfo() {
|
|
29
29
|
var _ref = this.layer.getLayerConfig(),
|
|
30
|
-
_ref$color = _ref.color,
|
|
31
|
-
color = _ref$color === void 0 ? 'rgb(255,255,255)' : _ref$color,
|
|
32
30
|
opacity = _ref.opacity,
|
|
33
31
|
brightness = _ref.brightness,
|
|
34
32
|
contrast = _ref.contrast,
|
|
35
33
|
saturation = _ref.saturation,
|
|
36
34
|
gamma = _ref.gamma;
|
|
37
|
-
var colorArry = rgb2arr(color);
|
|
38
35
|
var commonOptions = {
|
|
39
36
|
u_opacity: defaultValue(opacity, 1.0),
|
|
40
37
|
u_brightness: defaultValue(brightness, 1.0),
|
|
@@ -84,8 +81,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
84
81
|
case 0:
|
|
85
82
|
createTexture2D = this.rendererService.createTexture2D;
|
|
86
83
|
this.texture = createTexture2D({
|
|
87
|
-
height:
|
|
88
|
-
width:
|
|
84
|
+
height: 1,
|
|
85
|
+
width: 1
|
|
89
86
|
});
|
|
90
87
|
source = this.layer.getSource();
|
|
91
88
|
_context2.next = 5;
|
|
@@ -132,7 +129,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
132
129
|
},
|
|
133
130
|
depth: {
|
|
134
131
|
enable: false
|
|
135
|
-
}
|
|
132
|
+
},
|
|
133
|
+
pickingEnabled: false
|
|
136
134
|
});
|
|
137
135
|
case 3:
|
|
138
136
|
model = _context3.sent;
|
package/es/line/models/arc.js
CHANGED
|
@@ -15,7 +15,7 @@ import BaseModel from "../../core/BaseModel";
|
|
|
15
15
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
16
16
|
import { LineArcTriangulation } from "../../core/triangulation";
|
|
17
17
|
/* babel-plugin-inline-import '../shaders/arc/line_arc_frag.glsl' */
|
|
18
|
-
var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_lineDir: 1.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_blur : 0.9;\n float u_line_type: 0.0;\n float u_time;\n float u_linearColor: 0.0;\n};\nin
|
|
18
|
+
var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_lineDir: 1.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_blur : 0.9;\n float u_line_type: 0.0;\n float u_time;\n float u_linearColor: 0.0;\n};\n\nin vec4 v_color;\nin vec2 v_iconMapUV;\nin vec4 v_lineData;\n//dash\nin vec4 v_dash_array;\nin float v_distance_ratio;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n outputColor = v_color;\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n outputColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = v_lineData.g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = v_lineData.a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n \n } else {\n outputColor = filterColor(outputColor);\n }\n}";
|
|
19
19
|
/* babel-plugin-inline-import '../shaders/arc/line_arc_vert.glsl' */
|
|
20
20
|
var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_lineDir: 1.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_blur : 0.9;\n float u_line_type: 0.0;\n float u_time;\n float u_linearColor: 0.0;\n};\nout vec4 v_color;\nout vec2 v_iconMapUV;\nout vec4 v_lineData;\n//dash\nout vec4 v_dash_array;\nout float v_distance_ratio;\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n //vs\u4E2D\u8BA1\u7B97\u6E10\u53D8\u8272\n if(u_linearColor==1.0){\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n }\n else{\n v_color = a_Color;\n }\n v_color.a = v_color.a * opacity;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n\n\n\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n //\u8BA1\u7B97dashArray\u548CdistanceRatio \u8F93\u51FA\u5230\u7247\u5143\n vec2 s = source;\n vec2 t = target;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n v_distance_ratio = segmentIndex / segmentNumber;\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n v_lineData.b = d_distance_ratio;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));\n\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_lineData.r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n v_lineData.g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n v_lineData.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
21
21
|
var lineStyleObj = {
|
package/es/line/models/line.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
@@ -17,9 +18,9 @@ import { LinearDir, TextureBlend } from "../../core/interface";
|
|
|
17
18
|
|
|
18
19
|
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
19
20
|
/* babel-plugin-inline-import '../shaders/line/line_frag.glsl' */
|
|
20
|
-
var line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\
|
|
21
|
+
var line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\n// dash\nin vec4 v_dash_array;\nin float v_d_distance_ratio;\nin vec2 v_iconMapUV;\nin vec4 v_texture_data;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_texture_data.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n d_distance_ratio = v_texture_data.a;\n }\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_texture_data.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_texture_data.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_texture_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor += pattern;\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = pattern;\n }\n } \n\n float v = v_texture_data.a;\n float strokeWidth = min(0.5, u_strokeWidth);\n // \u7ED8\u5236 border\n if(strokeWidth > 0.01) {\n float borderOuterWidth = strokeWidth / 2.0;\n\n\n if(v >= 1.0 - strokeWidth || v <= strokeWidth) {\n if(v > strokeWidth) { // \u5916\u4FA7\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);\n // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);\n outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);\n } else if(v <= strokeWidth) {\n float linear = smoothstep(0.0, 1.0, v/strokeWidth);\n outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = v_texture_data.a;\n if(blurV < 0.5) {\n outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n outputColor = filterColor(outputColor);\n}\n";
|
|
21
22
|
/* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
|
|
22
|
-
var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location =
|
|
23
|
+
var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n \n v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
23
24
|
var lineStyleObj = {
|
|
24
25
|
solid: 0.0,
|
|
25
26
|
dash: 1.0
|
|
@@ -235,7 +236,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
235
236
|
name: 'distanceAndIndex',
|
|
236
237
|
type: AttributeType.Attribute,
|
|
237
238
|
descriptor: {
|
|
238
|
-
name: '
|
|
239
|
+
name: 'a_DistanceAndIndexAndMiter',
|
|
239
240
|
shaderLocation: 10,
|
|
240
241
|
buffer: {
|
|
241
242
|
// give the WebGL driver a hint that this buffer may change
|
|
@@ -243,27 +244,9 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
243
244
|
data: [],
|
|
244
245
|
type: gl.FLOAT
|
|
245
246
|
},
|
|
246
|
-
size:
|
|
247
|
+
size: 3,
|
|
247
248
|
update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
|
|
248
|
-
return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
253
|
-
name: 'total_distance',
|
|
254
|
-
type: AttributeType.Attribute,
|
|
255
|
-
descriptor: {
|
|
256
|
-
name: 'a_Total_Distance',
|
|
257
|
-
shaderLocation: 11,
|
|
258
|
-
buffer: {
|
|
259
|
-
// give the WebGL driver a hint that this buffer may change
|
|
260
|
-
usage: gl.STATIC_DRAW,
|
|
261
|
-
data: [],
|
|
262
|
-
type: gl.FLOAT
|
|
263
|
-
},
|
|
264
|
-
size: 1,
|
|
265
|
-
update: function update(feature, featureIdx, vertex) {
|
|
266
|
-
return [vertex[5]];
|
|
249
|
+
return vertexIndex === undefined ? [vertex[3], 10, vertex[4]] : [vertex[3], vertexIndex, vertex[4]];
|
|
267
250
|
}
|
|
268
251
|
}
|
|
269
252
|
});
|
|
@@ -290,10 +273,10 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
290
273
|
|
|
291
274
|
// point layer size;
|
|
292
275
|
this.styleAttributeService.registerStyleAttribute({
|
|
293
|
-
name: '
|
|
276
|
+
name: 'normal_total_distance',
|
|
294
277
|
type: AttributeType.Attribute,
|
|
295
278
|
descriptor: {
|
|
296
|
-
name: '
|
|
279
|
+
name: 'a_Normal_Total_Distance',
|
|
297
280
|
shaderLocation: ShaderLocation.NORMAL,
|
|
298
281
|
buffer: {
|
|
299
282
|
// give the WebGL driver a hint that this buffer may change
|
|
@@ -301,27 +284,9 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
301
284
|
data: [],
|
|
302
285
|
type: gl.FLOAT
|
|
303
286
|
},
|
|
304
|
-
size:
|
|
287
|
+
size: 4,
|
|
305
288
|
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
306
|
-
return normal;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
311
|
-
name: 'miter',
|
|
312
|
-
type: AttributeType.Attribute,
|
|
313
|
-
descriptor: {
|
|
314
|
-
shaderLocation: 15,
|
|
315
|
-
name: 'a_Miter',
|
|
316
|
-
buffer: {
|
|
317
|
-
// give the WebGL driver a hint that this buffer may change
|
|
318
|
-
usage: gl.STATIC_DRAW,
|
|
319
|
-
data: [],
|
|
320
|
-
type: gl.FLOAT
|
|
321
|
-
},
|
|
322
|
-
size: 1,
|
|
323
|
-
update: function update(feature, featureIdx, vertex) {
|
|
324
|
-
return [vertex[4]];
|
|
289
|
+
return [].concat(_toConsumableArray(normal), [vertex[5]]);
|
|
325
290
|
}
|
|
326
291
|
}
|
|
327
292
|
});
|
|
@@ -24,11 +24,11 @@ layout(std140) uniform commonUniorm {
|
|
|
24
24
|
|
|
25
25
|
in vec4 v_color;
|
|
26
26
|
in vec4 v_stroke;
|
|
27
|
-
in vec2 v_iconMapUV;
|
|
28
|
-
in vec4 v_texture_data;
|
|
29
27
|
// dash
|
|
30
28
|
in vec4 v_dash_array;
|
|
31
29
|
in float v_d_distance_ratio;
|
|
30
|
+
in vec2 v_iconMapUV;
|
|
31
|
+
in vec4 v_texture_data;
|
|
32
32
|
|
|
33
33
|
out vec4 outputColor;
|
|
34
34
|
#pragma include "picking"
|