saving what I've done

This commit is contained in:
2025-08-01 23:54:06 +03:00
parent 15639ff098
commit e67a3c72ec
5 changed files with 38 additions and 19 deletions

View File

@@ -7,8 +7,8 @@ layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout(r32f, binding = 0) uniform restrict readonly image2D current_trail;
layout(r32f, binding = 1) uniform restrict writeonly image2D output_trail;
layout(binding = 2) restrict buffer AgentBuffer {
vec2 positions[1024];
float headings[1024];
vec2 positions[1024 * 1024];
float headings[1024 * 1024];
} agent_buffer;
layout(push_constant, std430) uniform Params {
@@ -19,13 +19,17 @@ layout(push_constant, std430) uniform Params {
const float SPEED = 1.0;
float random(vec2 coords) {
return fract(sin(dot(coords.xy, vec2(12.9898,78.233))) * 43758.5453);
}
vec2 loop_position(vec2 pos) {
int width = params.texture_size.x;
int height = params.texture_size.y;
if (pos.x > width) pos.x = mod(pos.x, width);
if (pos.y > height) pos.y = mod(pos.y, height);
if (pos.x < 0) pos.x = width - pos.x;
if (pos.y < 0) pos.y = height - pos.y;
if (pos.x < 0) pos.x = width + pos.x;
if (pos.y < 0) pos.y = height + pos.y;
return pos;
}