#version 430 core struct particle_t { vec2 pos; vec2 dir; }; struct cell_t { float pheromone; float result; int population; }; layout(binding = 0, rgba8) writeonly uniform image2D canvas; uniform uint map_width; uniform uint map_height; uniform float display_population_value; uniform float display_pheromone_value; layout(std430, binding = 1) readonly buffer particles_buffer { particle_t particles[]; }; layout(std430, binding = 2) readonly buffer map_buffer { cell_t map[]; }; layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; void main(){ uint x = gl_GlobalInvocationID.x; uint y = gl_GlobalInvocationID.y; if(x >= map_width || y >= map_height){ return; } uint cell_id = y * map_width + x; cell_t cell = map[cell_id]; float pop_value = cell.population / display_population_value / 2.5; float phe_value = cell.pheromone / display_pheromone_value; imageStore(canvas, ivec2(gl_GlobalInvocationID.xy), vec4(pop_value + phe_value, pop_value / 2, pop_value / 3, 1)); // Particules rouges, phero bleues // imageStore(canvas, ivec2(gl_GlobalInvocationID.xy), // vec4(cell.population / display_population_value, // cell.pheromone / display_pheromone_value, // cell.pheromone / (display_pheromone_value), // 1)); }