mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
988 B
Plaintext
32 lines
988 B
Plaintext
#version 440 core
|
|
|
|
layout (binding = 0, rgba16f) restrict writeonly uniform image2D imageOut;
|
|
layout (binding = 1, rgba16f) restrict readonly uniform image2D imageIn;
|
|
|
|
layout (local_size_x=16, local_size_y=16) in;
|
|
|
|
#define MAX_POSITIONS 100
|
|
uniform vec3 positions[MAX_POSITIONS];
|
|
uniform int positionCount;
|
|
|
|
uniform float osg_SimulationTime;
|
|
uniform vec2 offset;
|
|
|
|
#include "lib/water/ripples.glsl"
|
|
|
|
void main()
|
|
{
|
|
ivec2 texel = ivec2(gl_GlobalInvocationID.xy + offset);
|
|
|
|
vec4 color = imageLoad(imageIn, texel);
|
|
float wavesizeMultiplier = getTemporalWaveSizeMultiplier(osg_SimulationTime);
|
|
for (int i = 0; i < positionCount; ++i)
|
|
{
|
|
float wavesize = wavesizeMultiplier * positions[i].z;
|
|
float displace = clamp(0.2 * abs(length((positions[i].xy + offset) - vec2(gl_GlobalInvocationID.xy)) / wavesize - 1.0) + 0.8, 0.0, 1.0);
|
|
color.rg = mix(vec2(-1.0), color.rg, displace);
|
|
}
|
|
|
|
imageStore(imageOut, ivec2(gl_GlobalInvocationID.xy), color);
|
|
}
|