Skip to content

Commit

Permalink
fix: 顶点着色器与片元着色器 varying 变量顺序不一致 (#2527)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei authored Jun 7, 2024
1 parent 7c78b4a commit 1797625
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions packages/layers/src/line/shaders/arc3d/line_arc_3d_frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ layout(std140) uniform commonUniorm {
float u_linearColor: 0.0;
};

// varying vec2 v_normal;
in vec4 v_dash_array;
in vec4 v_color;
in vec4 v_line_data;
in vec4 v_dash_array;
in float v_segmentIndex;
in vec2 v_iconMapUV;
in vec4 v_line_data;

out vec4 outputColor;

Expand Down Expand Up @@ -57,7 +56,7 @@ void main() {
alpha = clamp(alpha, 0.0, 1.0);
outputColor.a *= alpha;

// u_animate
// u_animate
// x enable
// y duration
// z interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ layout(std140) uniform commonUniorm {
float u_linearColor: 0;
};

in vec4 v_line_data;
in vec2 v_iconMapUV;
in vec4 v_dash_array;
in float v_distance_ratio;
in vec4 v_color;
in vec2 v_iconMapUV;
in vec4 v_line_data;
in float v_distance_ratio;

out vec4 outputColor;
#pragma include "picking"
Expand All @@ -34,7 +34,7 @@ void main() {

float animateSpeed = 0.0;
float d_segmentIndex = v_line_data.g;

// 设置弧线的底色
if(u_linearColor == 1.0) { // 使用渐变颜色
outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
Expand Down Expand Up @@ -65,7 +65,7 @@ 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 = d_segmentIndex / (segmentNumber - 1.0);
float count = v_line_data.b; // 贴图在弧线上重复的数量
Expand All @@ -79,7 +79,7 @@ void main() {

vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);

// 设置贴图和底色的叠加模式
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
Expand All @@ -96,4 +96,4 @@ void main() {
}

// gl_FragColor = filterColor(gl_FragColor);
}
}
8 changes: 5 additions & 3 deletions packages/layers/src/line/shaders/wall/wall_frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ layout(std140) uniform commonUniorm {
float u_iconStepCount;
float u_time;
};


in vec2 v_iconMapUV;
in float v_blur;
in float v_radio;
in vec4 v_color;
in float v_blur;
in vec4 v_dataset;

out vec4 outputColor;

#pragma include "picking"

void main() {
Expand Down Expand Up @@ -79,7 +81,7 @@ void main() {
outputColor = filterColor(pattern);
}
}


// blur - AA
if(v < v_blur) {
Expand Down
9 changes: 4 additions & 5 deletions packages/layers/src/line/shaders/wall/wall_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ layout(std140) uniform commonUniorm {
float u_time;
};

#pragma include "projection"
#pragma include "light"
#pragma include "picking"

// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
out vec2 v_iconMapUV;
out vec4 v_color;
out float v_blur;
out float v_radio;
out vec4 v_dataset;

#pragma include "projection"
#pragma include "light"
#pragma include "picking"

void main() {
float a_Distance = a_Distance_Total_Miter.x;
float a_Miter = a_Distance_Total_Miter.y;
Expand Down

0 comments on commit 1797625

Please sign in to comment.