Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

线图重构升级,统一标准化配置参数 #1993

Open
1 task done
lzxue opened this issue Oct 30, 2023 · 0 comments
Open
1 task done

线图重构升级,统一标准化配置参数 #1993

lzxue opened this issue Oct 30, 2023 · 0 comments
Assignees

Comments

@lzxue
Copy link
Contributor

lzxue commented Oct 30, 2023

AntV Open Source Contribution Plan(可选)

  • 我同意将这个 Issue 参与 OSCP 计划

Issue 类型

专家任务

任务介绍

https://github.com/antvis/L7/blob/master/packages/layers/src/line/shaders/line_vert.glsl#L129

  • 统一高度参数 u_heightfixed(pixeled,or meter 单位)、u_raisingHeight(baseheight) 等单位标准化,
f(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
    lineHeight *= 0.2; // 保持和 amap/mapbox 一致的效果
    h *= 0.2;
    if(u_heightfixed < 1.0) {
      lineHeight = project_pixel(a_Size.y);
    }
    gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));
  } else {
    // mapbox -  amap
    
    // 兼容 mapbox 在线高度上的效果表现基本一致
    if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
      // mapbox
      // 保持高度相对不变
      float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
      h *= mapboxZoomScale;
      h += u_raisingHeight * mapboxZoomScale;
      if(u_heightfixed > 0.0) {
        lineHeight *= mapboxZoomScale;
      }
      
    } else {
      // amap
      h += u_raisingHeight;
      // lineHeight 顶点偏移高度
      if(u_heightfixed < 1.0) {
        lineHeight *= pow(2.0, 20.0 - u_Zoom);
      }
    }

    gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
  }

参考说明

任务要求:

  • 熟悉 WebGL ,熟悉 shader 语言编写
  • 了解线图层,顶点构造原理
  • 了解地图单位换算关系
@lzxue lzxue changed the title 重构线图层 Shader 剔除 if else 等语句 线图重构升级,统一标准化配置参数 Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants