Shihui dev (#806)

* feat: add getModelMatrix into viewport

* feat: 新增地球模式 (初步构建)

* feat: 完善地球交互

* style: lint style

* feat: 调整地球图层缩放的方向

* style: lint style

* feat: 增加地球模式的 pointLayer/fill 图层

* style: lint style

* feat: 增加地球、太阳的简单运动系统,优化部分代码结构

* fix: 修复时间点击出错

* style: lint style

* fix: 修复地图 panBy 方法参数错误

* style: lint style

* feat: pointLayer/cylinder 圆柱兼容地球模式

* style: lint style

* feat: 修复 pointLayer/fill 在拾取是破面严重的情况

* style: lint style

* feat: 增加 arc 弧度调节

* feat: 增加 lineLayer/arc3d 兼容地球模式

* style: lint style

* feat: 增加地球图层 - 大气层

* style: lint style

* feat: 增加设置可视化层背景色的能力

* style: lint style

* feat: 增加地球外发光效果

* style: lint style

* feat: 允许用户不使用 layer 的 source 方法 - 地球模式下光晕图层不需要传数据

* style: lint style

* feat: 调整光晕的 shader 计算

* feat: 调整地球大气层的渲染层级

* style: lint style

* feat: 调整案例

* style: lint style

* feat: 增加地球图层的默认参数、调整部分代码

* style: lint style

* fix: 修复 amap2 新增样式导致的 marker 失效

* feat: 修复 amap2 的 amap-maps 新增 z-index=0; 引发的marker 显示层级失效

* feat: amap2 的 amap-maps 新增 z-index=0; 样式,让 marker 中 zIndex 失效

* style: lint style

* chore: update version 2.5.36 -> 2.5.37

* feat: 修复 varying 传递 float 总数在部分终端设备 ios13 上突破限制的问题
This commit is contained in:
YiQianYao 2021-10-22 14:02:25 +08:00 committed by GitHub
parent 5e67c62049
commit 2a3aaa3725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 80 additions and 92 deletions

View File

@ -14,7 +14,7 @@
"message": "chore: publish" "message": "chore: publish"
} }
}, },
"version": "2.5.36", "version": "2.5.37",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"publishConfig": { "publishConfig": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-component", "name": "@antv/l7-component",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -25,8 +25,8 @@
"author": "lzxue", "author": "lzxue",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"eventemitter3": "^4.0.0", "eventemitter3": "^4.0.0",
"inversify": "^5.0.1", "inversify": "^5.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-core", "name": "@antv/l7-core",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -24,7 +24,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/tiny-sdf": "^1.1.1", "@mapbox/tiny-sdf": "^1.1.1",
"ajv": "^6.10.2", "ajv": "^6.10.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "2.5.36", "version": "2.5.37",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization", "description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -25,12 +25,12 @@
"author": "antv", "author": "antv",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@antv/l7-component": "^2.5.36", "@antv/l7-component": "^2.5.37",
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-layers": "^2.5.36", "@antv/l7-layers": "^2.5.37",
"@antv/l7-maps": "^2.5.36", "@antv/l7-maps": "^2.5.37",
"@antv/l7-scene": "^2.5.36", "@antv/l7-scene": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7" "@babel/runtime": "^7.7.7"
}, },
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",

View File

@ -1,2 +1,2 @@
const version = '2.5.36'; const version = '2.5.37';
export { version }; export { version };

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-layers", "name": "@antv/l7-layers",
"version": "2.5.36", "version": "2.5.37",
"description": "L7's collection of built-in layers", "description": "L7's collection of built-in layers",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -24,9 +24,9 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-source": "^2.5.36", "@antv/l7-source": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/martini": "^0.2.0", "@mapbox/martini": "^0.2.0",
"@turf/meta": "^6.0.2", "@turf/meta": "^6.0.2",

View File

@ -17,8 +17,6 @@ uniform vec2 u_textSize;
varying float v_segmentIndex; varying float v_segmentIndex;
uniform float segmentNumber; uniform float segmentNumber;
varying vec4 v_dataset; // 数据集
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
uniform float u_time; uniform float u_time;
@ -35,7 +33,7 @@ varying mat4 styleMappingMat;
void main() { void main() {
float opacity = styleMappingMat[0][0]; float opacity = styleMappingMat[0][0];
float animateSpeed = 0.0; // 运动速度 float animateSpeed = 0.0; // 运动速度
float d_distance_ratio = v_dataset.g; // 当前点位距离占线总长的比例 float d_distance_ratio = styleMappingMat[3].g; // 当前点位距离占线总长的比例
if(u_linearColor == 1.0) { // 使用渐变颜色 if(u_linearColor == 1.0) { // 使用渐变颜色
gl_FragColor = mix(u_sourceColor, u_targetColor, v_segmentIndex/segmentNumber); gl_FragColor = mix(u_sourceColor, u_targetColor, v_segmentIndex/segmentNumber);
@ -68,7 +66,7 @@ void main() {
if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture
// float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber)); // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));
float arcRadio = v_segmentIndex / (segmentNumber - 1.0); float arcRadio = v_segmentIndex / (segmentNumber - 1.0);
float count = v_dataset.b; // // 贴图在弧线上重复的数量 float count = styleMappingMat[3].b; // // 贴图在弧线上重复的数量
float u = fract(arcRadio * count - animateSpeed * count); float u = fract(arcRadio * count - animateSpeed * count);
@ -76,7 +74,7 @@ void main() {
u = gl_FragColor.a/opacity; u = gl_FragColor.a/opacity;
} }
float v = v_dataset.a; // 线图层贴图部分的 v 坐标值 float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture2D(u_texture, uv); vec4 pattern = texture2D(u_texture, uv);

View File

@ -24,8 +24,6 @@ uniform float u_icon_step: 100;
uniform float u_line_texture: 0.0; uniform float u_line_texture: 0.0;
varying float v_segmentIndex; varying float v_segmentIndex;
varying vec4 v_dataset; // 数据集
attribute vec2 a_iconMapUV; attribute vec2 a_iconMapUV;
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
@ -106,7 +104,7 @@ void main() {
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0 // dataset 数据集
); );
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行 float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
@ -151,7 +149,7 @@ void main() {
if(u_aimate.x == Animate) { if(u_aimate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber; d_distance_ratio = segmentIndex / segmentNumber;
} }
v_dataset.g = d_distance_ratio; // 当前点位距离占线总长的比例 styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
vec3 curr = getPos(source, target, segmentRatio); vec3 curr = getPos(source, target, segmentRatio);
@ -165,12 +163,12 @@ void main() {
float arcDistrance = length(source - target); float arcDistrance = length(source - target);
float pixelLen = project_pixel(u_icon_step); float pixelLen = project_pixel(u_icon_step);
v_dataset.b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量 styleMappingMat[3].b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
vec2 projectOffset = project_pixel(offset); vec2 projectOffset = project_pixel(offset);
float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离 float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离 float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
v_dataset.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值 styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
v_iconMapUV = a_iconMapUV; v_iconMapUV = a_iconMapUV;
} }

View File

@ -21,8 +21,6 @@ uniform vec2 u_textSize;
uniform float segmentNumber; uniform float segmentNumber;
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
varying vec4 v_dataset; // 数据集 - 用于合并单个的 varying 变量
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据 varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
uniform float u_linearColor: 0; uniform float u_linearColor: 0;
@ -34,8 +32,8 @@ uniform vec4 u_targetColor;
void main() { void main() {
float opacity = styleMappingMat[0][0]; float opacity = styleMappingMat[0][0];
float animateSpeed = 0.0; // 运动速度 float animateSpeed = 0.0; // 运动速度
float d_segmentIndex = v_dataset.r; // 当前顶点在弧线中所处的分段位置 float d_segmentIndex = styleMappingMat[3].r; // 当前顶点在弧线中所处的分段位置
float d_distance_ratio = v_dataset.b; // 当前顶点在弧线中所处的分段比例 float d_distance_ratio = styleMappingMat[3].b; // 当前顶点在弧线中所处的分段比例
// 设置弧线的底色 // 设置弧线的底色
if(u_linearColor == 1.0) { // 使用渐变颜色 if(u_linearColor == 1.0) { // 使用渐变颜色
@ -70,14 +68,14 @@ void main() {
float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber)); float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));
// float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio); // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);
float d_texCount = v_dataset.g; // 贴图在弧线上重复的数量 float d_texCount = styleMappingMat[3].g; // 贴图在弧线上重复的数量
float u = 1.0 - fract(arcRadio * d_texCount + animateSpeed); float u = 1.0 - fract(arcRadio * d_texCount + animateSpeed);
if(u_aimate.x == Animate) { if(u_aimate.x == Animate) {
u = gl_FragColor.a/opacity; u = gl_FragColor.a/opacity;
} }
float v = v_dataset.a; // 横向 v float v = styleMappingMat[3].a; // 横向 v
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture2D(u_texture, uv); vec4 pattern = texture2D(u_texture, uv);

View File

@ -20,8 +20,6 @@ uniform sampler2D u_texture;
uniform vec2 u_textSize; uniform vec2 u_textSize;
uniform float segmentNumber; uniform float segmentNumber;
varying vec4 v_dataset; // 数据集
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
uniform float u_linearColor: 0; uniform float u_linearColor: 0;
@ -37,7 +35,7 @@ varying mat4 styleMappingMat;
void main() { void main() {
float opacity = styleMappingMat[0][0]; float opacity = styleMappingMat[0][0];
float animateSpeed = 0.0; float animateSpeed = 0.0;
float d_segmentIndex = v_dataset.g; float d_segmentIndex = styleMappingMat[3].g;
// 设置弧线的底色 // 设置弧线的底色
if(u_linearColor == 1.0) { // 使用渐变颜色 if(u_linearColor == 1.0) { // 使用渐变颜色
@ -71,14 +69,14 @@ void main() {
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { if(LineTexture == u_line_texture && u_line_type != LineTypeDash) {
float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0))); float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));
// float arcRadio = d_segmentIndex / (segmentNumber - 1.0); // float arcRadio = d_segmentIndex / (segmentNumber - 1.0);
float count = v_dataset.b; // 贴图在弧线上重复的数量 float count = styleMappingMat[3].b; // 贴图在弧线上重复的数量
float u = fract(arcRadio * count - animateSpeed * count); float u = fract(arcRadio * count - animateSpeed * count);
// float u = fract(arcRadio * count - animateSpeed); // float u = fract(arcRadio * count - animateSpeed);
if(u_aimate.x == Animate) { if(u_aimate.x == Animate) {
u = gl_FragColor.a/opacity; u = gl_FragColor.a/opacity;
} }
float v = v_dataset.a; // 线图层贴图部分的 v 坐标值 float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture2D(u_texture, uv); vec4 pattern = texture2D(u_texture, uv);

View File

@ -22,8 +22,6 @@ varying vec4 v_dash_array;
uniform float u_icon_step: 100; uniform float u_icon_step: 100;
uniform float u_line_texture: 0.0; uniform float u_line_texture: 0.0;
varying vec4 v_dataset; // 数据集
attribute vec2 a_iconMapUV; attribute vec2 a_iconMapUV;
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
@ -131,7 +129,7 @@ void main() {
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0 // dataset 数据集
); );
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行 float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
@ -185,7 +183,7 @@ void main() {
// vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0)); // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0)); // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
v_dataset.g = a_Position.x; // 该顶点在弧线上的分段排序 styleMappingMat[3].g = a_Position.x; // 该顶点在弧线上的分段排序
if(LineTexture == u_line_texture) { // 开启贴图模式 if(LineTexture == u_line_texture) { // 开启贴图模式
// float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0; // float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;
float d_arcDistrance = length(source - target); float d_arcDistrance = length(source - target);
@ -196,11 +194,11 @@ void main() {
d_arcDistrance = project_pixel_allmap(d_arcDistrance); d_arcDistrance = project_pixel_allmap(d_arcDistrance);
} }
float d_pixelLen = project_pixel(u_icon_step)/8.0; float d_pixelLen = project_pixel(u_icon_step)/8.0;
v_dataset.b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量 styleMappingMat[3].b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离 float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离 float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
v_dataset.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值 styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
v_iconMapUV = a_iconMapUV; v_iconMapUV = a_iconMapUV;
} }

View File

@ -25,8 +25,6 @@ uniform float u_line_texture: 0.0;
attribute vec2 a_iconMapUV; attribute vec2 a_iconMapUV;
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
varying vec4 v_dataset; // 数据集 - 用于合并单个的 varying 变量
uniform float u_opacity: 1.0; uniform float u_opacity: 1.0;
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元 varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
@ -92,7 +90,7 @@ void main() {
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0 // dataset 数据集
); );
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行 float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
@ -144,7 +142,7 @@ void main() {
} }
} }
v_dataset.b = d_distance_ratio; styleMappingMat[3].b = d_distance_ratio;
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0)); vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio), 0.0, 1.0)); vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio), 0.0, 1.0));
@ -155,7 +153,7 @@ void main() {
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置 float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
v_dataset.r = d_segmentIndex; styleMappingMat[3].r = d_segmentIndex;
if(LineTexture == u_line_texture) { // 开启贴图模式 if(LineTexture == u_line_texture) { // 开启贴图模式
@ -171,11 +169,11 @@ void main() {
float pixelLen = project_pixel(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变 float pixelLen = project_pixel(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变
float texCount = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量 float texCount = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
v_dataset.g = texCount; styleMappingMat[3].g = texCount;
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离 float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移 float linePixelSize = project_pixel(a_Size); // 定点位置偏移
v_dataset.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值 styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
} }

View File

@ -7,7 +7,7 @@ uniform float u_line_type: 0.0;
uniform float u_opacity : 1.0; uniform float u_opacity : 1.0;
uniform float u_textureBlend; uniform float u_textureBlend;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_normal; // varying vec2 v_normal;
// line texture // line texture
uniform float u_line_texture; uniform float u_line_texture;
@ -19,8 +19,6 @@ uniform float u_dash_offset : 0.0;
uniform float u_dash_ratio : 0.1; uniform float u_dash_ratio : 0.1;
varying vec4 v_dash_array; varying vec4 v_dash_array;
varying vec4 v_dataset; // 数据集 - distance_ratio/distance/pixelLen/texV
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
uniform float u_linearColor: 0; uniform float u_linearColor: 0;
@ -37,7 +35,7 @@ varying mat4 styleMappingMat;
void main() { void main() {
float opacity = styleMappingMat[0][0]; float opacity = styleMappingMat[0][0];
float animateSpeed = 0.0; // 运动速度 float animateSpeed = 0.0; // 运动速度
float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例 float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
if(u_linearColor == 1.0) { // 使用渐变颜色 if(u_linearColor == 1.0) { // 使用渐变颜色
gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio); gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);
@ -66,13 +64,14 @@ void main() {
} }
if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture
float aDistance = v_dataset.g; // 当前顶点的距离 float aDistance = styleMappingMat[3].g; // 当前顶点的距离
float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放 float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed); float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
float v = v_dataset.a; // 线图层贴图部分的 v 坐标值 float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
v = max(smoothstep(0.95, 1.0, v), v); v = max(smoothstep(0.95, 1.0, v), v);
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v))); // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv)); // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
vec4 pattern = texture2D(u_texture, uv); vec4 pattern = texture2D(u_texture, uv);
@ -90,13 +89,14 @@ void main() {
} else { } else {
gl_FragColor = filterColor(gl_FragColor); gl_FragColor = filterColor(gl_FragColor);
} }
// gl_FragColor = filterColor(vec4(1.0, 0.0, 0.0, 1.0));
// gl_FragColor = (vec4(1.0, 0.0, 0.0, 1.0));
// if(rV < r || rV > 1.0 - r) { // if(rV < r || rV > 1.0 - r) {
// gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
// } // }
// if(v > 0.9) { // if(v > 0.9) {
// gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0); // gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0);
// } else if(v < 0.1) { // } else if(v < 0.1) {
// gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0); // gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0);
// } // }

View File

@ -28,9 +28,10 @@ varying vec4 v_color;
varying vec4 v_dash_array; varying vec4 v_dash_array;
varying vec2 v_normal; varying vec2 v_normal;
varying vec4 v_dataset; // 数据集 - distance_ratio/distance/pixelLen/texV
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向) // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
varying vec2 v_iconMapUV; varying vec2 v_iconMapUV;
uniform float u_linearColor: 0; uniform float u_linearColor: 0;
uniform float u_opacity: 1.0; uniform float u_opacity: 1.0;
@ -45,7 +46,7 @@ void main() {
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
); );
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行 float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
@ -84,7 +85,6 @@ void main() {
} }
v_normal = vec2(reverse_offset_normal(a_Normal) * sign(a_Miter)); v_normal = vec2(reverse_offset_normal(a_Normal) * sign(a_Miter));
v_color = a_Color; v_color = a_Color;
vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal); vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
@ -96,10 +96,10 @@ void main() {
float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值 float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
// 设置数据集的参数 // 设置数据集的参数
v_dataset.r = d_distance_ratio; // 当前点位距离占线总长的比例 styleMappingMat[3][0] = d_distance_ratio; // 当前点位距离占线总长的比例
v_dataset.g = a_Distance; // 当前顶点的距离 styleMappingMat[3][1] = a_Distance; // 当前顶点的距离
v_dataset.b = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放 styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
v_dataset.a = texV; // 线图层贴图部分的 v 坐标值 styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0)); vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-map", "name": "@antv/l7-map",
"version": "2.5.36", "version": "2.5.37",
"description": "l7 map", "description": "l7 map",
"keywords": [], "keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>", "author": "thinkinggis <lzx199065@gmail.com>",
@ -37,7 +37,7 @@
}, },
"homepage": "https://github.com/antvis/L7#readme", "homepage": "https://github.com/antvis/L7#readme",
"dependencies": { "dependencies": {
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/point-geometry": "^0.1.0", "@mapbox/point-geometry": "^0.1.0",
"@mapbox/unitbezier": "^0.0.0", "@mapbox/unitbezier": "^0.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-maps", "name": "@antv/l7-maps",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -27,9 +27,9 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^0.0.3", "@amap/amap-jsapi-loader": "^0.0.3",
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-map": "^2.5.36", "@antv/l7-map": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6", "@types/amap-js-api": "^1.4.6",
"@types/mapbox-gl": "^1.11.2", "@types/mapbox-gl": "^1.11.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-renderer", "name": "@antv/l7-renderer",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -26,7 +26,7 @@
"gl": "^4.4.0" "gl": "^4.4.0"
}, },
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"l7regl": "^0.0.14", "l7regl": "^0.0.14",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-scene", "name": "@antv/l7-scene",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -23,12 +23,12 @@
"author": "xiaoiver", "author": "xiaoiver",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/l7-component": "^2.5.36", "@antv/l7-component": "^2.5.37",
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-layers": "^2.5.36", "@antv/l7-layers": "^2.5.37",
"@antv/l7-maps": "^2.5.36", "@antv/l7-maps": "^2.5.37",
"@antv/l7-renderer": "^2.5.36", "@antv/l7-renderer": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"mapbox-gl": "^1.2.1", "mapbox-gl": "^1.2.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-source", "name": "@antv/l7-source",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -26,8 +26,8 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@antv/async-hook": "^2.1.0", "@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-utils": "^2.5.36", "@antv/l7-utils": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"@mapbox/geojson-rewind": "^0.4.0", "@mapbox/geojson-rewind": "^0.4.0",
"@turf/helpers": "^6.1.4", "@turf/helpers": "^6.1.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-three", "name": "@antv/l7-three",
"version": "2.5.36", "version": "2.5.37",
"description": "three for L7 ", "description": "three for L7 ",
"keywords": [ "keywords": [
"3D", "3D",
@ -44,9 +44,9 @@
}, },
"homepage": "https://github.com/antvis/L7#readme", "homepage": "https://github.com/antvis/L7#readme",
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.5.36", "@antv/l7-core": "^2.5.37",
"@antv/l7-layers": "^2.5.36", "@antv/l7-layers": "^2.5.37",
"@antv/l7-scene": "^2.5.36", "@antv/l7-scene": "^2.5.37",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7-utils", "name": "@antv/l7-utils",
"version": "2.5.36", "version": "2.5.37",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",