Skip to content

Commit

Permalink
fix: radar 数据映射
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Dec 1, 2023
1 parent f7d7b62 commit 16057eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/layers/src/point/models/radar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ export default class RadarModel extends BaseModel {
// this.layer.getLayerConfig() as ILayerConfig;
const commonOptions = {
u_additive: blend === 'additive' ? 1.0 : 0.0,
u_opacity: opacity,
u_size_unit: SizeUnitType[unit] as SizeUnitType,
u_speed: speed,
// u_animate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
};
const commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
Expand Down Expand Up @@ -74,6 +72,7 @@ export default class RadarModel extends BaseModel {
vertexShader: pointFillVert,
fragmentShader: pointFillFrag,
triangulation: PointFillTriangulation,
inject:this.getInject(),
depth: { enable: false },
});
return [model];
Expand Down
5 changes: 2 additions & 3 deletions packages/layers/src/point/shaders/radar/radar_frag.glsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

layout(std140) uniform uBlock1{
layout(std140) uniform commonUniorm{
float u_additive;
float u_opacity:1.0;
float u_size_unit;
float u_speed: 1.0;
float u_time;
Expand All @@ -25,7 +24,7 @@ void main() {

float opacity_t = smoothstep(0.0, antialiasblur, outer_df);

outputColor = vec4(v_color.rgb, v_color.a * u_opacity);
outputColor = vec4(v_color.rgb, v_color.a);

if(u_additive > 0.0) {
outputColor *= opacity_t;
Expand Down
4 changes: 2 additions & 2 deletions packages/layers/src/point/shaders/radar/radar_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ layout(location = 1) in vec4 a_Color;
layout(location = 9) in float a_Size;
layout(location = 11) in vec3 a_Extrude;

layout(std140) uniform uBlock1{
layout(std140) uniform commonUniorm {
float u_additive;
float u_opacity:1.0;
float u_size_unit;
float u_speed: 1.0;
float u_time;
Expand All @@ -31,6 +30,7 @@ void main() {
v_extrude = rotateMatrix * a_Extrude.xy;

v_color = a_Color;
v_color.a *= opacity;

float blur = 0.0;
float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);
Expand Down

0 comments on commit 16057eb

Please sign in to comment.