mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 18:37:29 +01:00
35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
#version 460 core
|
|
#define STAGE_COMPUTE 1
|
|
// the water on the windscreens (water_sim.glsl): the blades going over the wetted paths in the step wipe them. a thread per texel
|
|
// of the map of the paths, a row of groups per glass
|
|
|
|
#include "common.glsl"
|
|
#include "water_sim.glsl"
|
|
|
|
layout(local_size_x = WATER_GROUP_SIZE) in;
|
|
|
|
void main()
|
|
{
|
|
uint slot = gl_WorkGroupID.y;
|
|
uint texel = gl_GlobalInvocationID.x;
|
|
if ((water_slots[slot].z < 0.5) || (texel >= uint(WATER_TRAIL * WATER_TRAIL)))
|
|
return;
|
|
uint index = water_trail_base(slot) + texel;
|
|
if (water_cells[index] == 0u)
|
|
return;
|
|
vec2 uv = (vec2(float(texel % uint(WATER_TRAIL)), float(texel / uint(WATER_TRAIL))) + 0.5) / float(WATER_TRAIL);
|
|
vec4 mask = water_blades_at(slot, uv);
|
|
for (int k = 0; k < 4; ++k)
|
|
{
|
|
float before = water_blades_before[k];
|
|
float now = water_blades_now[k];
|
|
if ((mask[k] < 0.001) || (before < 0.0) || (now < 0.0) || (before == now))
|
|
continue;
|
|
if ((mask[k] > min(before, now)) && (mask[k] <= max(before, now)))
|
|
{
|
|
water_cells[index] = 0u;
|
|
return;
|
|
}
|
|
}
|
|
}
|