fix: 修复 点图层兼容问题

This commit is contained in:
2912401452 2021-12-15 16:32:12 +08:00
parent 6a1eaaecd8
commit 82e2bcda36
3 changed files with 11 additions and 10 deletions

View File

@ -54,12 +54,12 @@ vec4 filterColor(vec4 color) {
}
// TODO: 优化水波点 blend additive 模式下有的拾取效果
vec4 filterColorAnimate(vec4 color) {
vec4 filterColorAnimate(vec4 color, float weight) {
// TODO: 过滤多余的 shader 计算
if(u_shaderPick < 0.5) {
return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题
} else {
return filterPickingColor(filterHighlightColor(color, color.a));
return filterPickingColor(filterHighlightColor(color, weight));
}
}

View File

@ -89,18 +89,19 @@ void main() {
float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);
// TODO: 根据叠加模式选择效果
if(u_additive > 0.0) {
gl_FragColor *= intensity;
} else {
gl_FragColor = vec4(gl_FragColor.xyz, intensity);
}
// if(u_additive > 0.0) {
// gl_FragColor *= intensity;
// } else {
// gl_FragColor = vec4(gl_FragColor.xyz, intensity);
// }
gl_FragColor = vec4(gl_FragColor.xyz, intensity);
// TODO: 优化在水波纹情况下的拾取a == 0 时无法拾取)
if(d < 0.7) {
gl_FragColor.a = max(gl_FragColor.a, 0.001);
}
gl_FragColor = u_additive > 0.0 filterColorAnimate(gl_FragColor) : filterColor(gl_FragColor);
// gl_FragColor = u_additive > 0.0 filterColorAnimate(gl_FragColor) : filterColor(gl_FragColor);
gl_FragColor = filterColor(gl_FragColor);
} else {
gl_FragColor = filterColor(gl_FragColor);
}

View File

@ -30,7 +30,7 @@ export default class GaodeMapComponent extends React.Component {
// none = 'none',
// blend: 'additive'
let layer = new PointLayer({ zIndex: 2, blend: 'additive' })
let layer = new PointLayer({ zIndex: 2, }) // blend: 'additive'
.source(
[
{