fix: 3d 热力图抖动问题 fixes #138 #263

This commit is contained in:
thinkinggis 2020-03-26 16:59:19 +08:00
parent b97d0840b3
commit 527cc1d3af
6 changed files with 13 additions and 7 deletions

View File

@ -6,6 +6,10 @@
[GitHub](https://github.com/antvis/L7) [GitHub](https://github.com/antvis/L7)
```bash
git clone https://github.com/antvis/L7 --depth=1
```
L7 是由蚂蚁金服 AntV 数据可视化团队推出的基于 WebGL 的开源大规模地理空间数据可视分析开发框架。L7 中的 L 代表 Location7 代表世界七大洲寓意能为全球位置数据提供可视分析的能力。L7 专注数据可视化化表达,通过颜色、大小、纹理,方向,体积等视觉变量设置实现从数据到信息清晰,有效的表达。 L7 是由蚂蚁金服 AntV 数据可视化团队推出的基于 WebGL 的开源大规模地理空间数据可视分析开发框架。L7 中的 L 代表 Location7 代表世界七大洲寓意能为全球位置数据提供可视分析的能力。L7 专注数据可视化化表达,通过颜色、大小、纹理,方向,体积等视觉变量设置实现从数据到信息清晰,有效的表达。
L7 能够满足常见的地图图表BI 系统的可视化分析、以及 GIS交通电力国土农业城市等领域的空间信息管理分析等应用系统开发需求。 L7 能够满足常见的地图图表BI 系统的可视化分析、以及 GIS交通电力国土农业城市等领域的空间信息管理分析等应用系统开发需求。

View File

@ -276,7 +276,7 @@ export default class HeatMapModel extends BaseModel {
private build3dHeatMap() { private build3dHeatMap() {
const { getViewportSize } = this.rendererService; const { getViewportSize } = this.rendererService;
const { width, height } = getViewportSize(); const { width, height } = getViewportSize();
const triangulation = heatMap3DTriangulation(width / 2.0, height / 2.0); const triangulation = heatMap3DTriangulation(width / 4.0, height / 4.0);
this.shaderModuleService.registerModule('heatmap3dColor', { this.shaderModuleService.registerModule('heatmap3dColor', {
vs: heatmap3DVert, vs: heatmap3DVert,
fs: heatmap3DFrag, fs: heatmap3DFrag,

View File

@ -9,5 +9,7 @@ void main(){
float intensity = texture2D(u_texture, v_texCoord).r; float intensity = texture2D(u_texture, v_texCoord).r;
vec4 color = texture2D(u_colorTexture,vec2(intensity, 0)); vec4 color = texture2D(u_colorTexture,vec2(intensity, 0));
gl_FragColor = color; gl_FragColor = color;
gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity; // gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity;
gl_FragColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;
} }

View File

@ -20,7 +20,7 @@ vec2 toBezier(float t, vec4 p){
void main() { void main() {
v_texCoord = a_Uv; v_texCoord = a_Uv;
vec2 pos = 1.8 * (a_Uv * vec2(2.0) - vec2(1.0)); vec2 pos =(a_Uv * vec2(2.0) - vec2(1.0));
vec4 p1 = vec4(pos, 0.0, 1.0); vec4 p1 = vec4(pos, 0.0, 1.0);
@ -40,6 +40,6 @@ void main() {
v_intensity = texture2D(u_texture, v_texCoord).r; v_intensity = texture2D(u_texture, v_texCoord).r;
fh = toBezier(v_intensity, b).y; fh = toBezier(v_intensity, b).y;
gl_Position = project_common_position_to_clipspace(vec4(position.xy, fh * 50., 1.0)); gl_Position = project_common_position_to_clipspace(vec4(position.xy, fh * project_pixel(50.), 1.0));
} }

View File

@ -29,7 +29,7 @@ export default class HeatMapLayerDemo extends React.Component {
const layer = new HeatmapLayer(); const layer = new HeatmapLayer();
layer layer
.source(data) .source(data)
.shape('heatmap') .shape('heatmap3D')
.size('mag', [0, 1.0]) // weight映射通道 .size('mag', [0, 1.0]) // weight映射通道
.style({ .style({
intensity: 2, intensity: 2,

View File

@ -1,5 +1,5 @@
import { HeatmapLayer, Scene } from '@antv/l7'; import { HeatmapLayer, Scene } from '@antv/l7';
import { Mapbox } from '@antv/l7-maps'; import { Mapbox,GaodeMap } from '@antv/l7-maps';
// @ts-ignore // @ts-ignore
import * as React from 'react'; import * as React from 'react';
@ -17,7 +17,7 @@ export default class HeatMapLayerDemo extends React.Component {
); );
const scene = new Scene({ const scene = new Scene({
id: 'map', id: 'map',
map: new Mapbox({ map: new GaodeMap({
style: 'dark', style: 'dark',
pitch: 58.5, pitch: 58.5,
center: [111.8759, 30.6942], center: [111.8759, 30.6942],