Skip to content

Commit

Permalink
Step 07
Browse files Browse the repository at this point in the history
- Draw in neighbor tiles
  • Loading branch information
kekkorider committed Aug 4, 2021
1 parent 275115f commit 09ac4cf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/shaders/effect.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,18 @@ float Tiles(vec2 uv) {
// "gv" stands for "grid UV".
vec2 gv = fract(uv*5.0);

result += Triangle(gv, vec2(0.5));
// For each tile, loop through its neighbor tiles and
// draw a triangle in each one of them.
// This gives the illusion that what's drawn goes past the boundaries.
for (float y = -1.0; y <= 1.0; y++) {
for (float x = -1.0; x <= 1.0; x++) {
// Get the coordinates of the neighbor tile
vec2 tileOffset = vec2(x, y);

// Draw the triangle
result += Triangle(gv - tileOffset, vec2(0.5));
}
}

return result;
}
Expand Down

0 comments on commit 09ac4cf

Please sign in to comment.