Skip to content

Commit

Permalink
fix(shader): incorrect iteration index
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Nov 20, 2024
1 parent 2b4adad commit dd231c9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions assets/shaders/OutlineFragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ vec4[24] getGaussianNeighbors(vec2 unitLength) {
0.0035434, 0.0158805, 0.0261825, 0.0158805, 0.0035434
);
vec4 neighbors[24];
int i = 0;
int ni = 0;
int ki = 0;
for (int y = -2; y <= 2; y++) {
for (int x = -2; x <= 2; x++) {
if (y != 0 && x != 0) {
if (!(y == 0 && x == 0)) {
vec2 offset = vec2(x, y) * unitLength;
neighbors[i] = texture2D(u_texture, v_texCoords + offset) * kernel[i];
i++;
neighbors[ni] = texture2D(u_texture, v_texCoords + offset) * kernel[ki];
ni++;
}
ki++;
}
}
return neighbors;
Expand Down

0 comments on commit dd231c9

Please sign in to comment.