fixed movement not wrapping around the world.. again

This commit is contained in:
2025-08-02 00:34:19 +03:00
parent e67a3c72ec
commit 83bd1bf452
3 changed files with 18 additions and 20 deletions

View File

@@ -21,14 +21,7 @@ float get_dissipation_from(ivec2 uv) {
}
ivec2 loop_position(ivec2 pos) {
int width = params.texture_size.x;
int height = params.texture_size.y;
vec2 looped = pos;
if (pos.x > width) looped.x = mod(pos.x, width);
if (pos.y > height) looped.y = mod(pos.y, height);
if (pos.x < 0) looped.x = width - pos.x;
if (pos.y < 0) looped.y = height - pos.y;
return ivec2(looped);
return pos % params.texture_size;
}
// The code we want to execute in each invocation