From a48e8adf10e490a5c33baf83c6d6fec67134a729 Mon Sep 17 00:00:00 2001 From: Nanako <469449812@qq.com> Date: Mon, 15 Jul 2024 20:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Arona/resources/waveform_cs.comp | 47 -------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Arona/resources/waveform_cs.comp diff --git a/Arona/resources/waveform_cs.comp b/Arona/resources/waveform_cs.comp deleted file mode 100644 index b75e44b..0000000 --- a/Arona/resources/waveform_cs.comp +++ /dev/null @@ -1,47 +0,0 @@ -#version 460 - -layout (local_size_x = 1,local_size_y = 1,local_size_z = 1) in; - -layout (std430, binding = 0) buffer Samples -{ - float AudioSamples[]; -}; -layout (std430, binding = 1) buffer Params -{ - vec4 WaveColor; - vec4 BgColor; - float LineUV; -}; -layout (binding = 2) writeonly uniform image2D Result; - -vec4 lerp(vec4 a, vec4 b, float x) -{ - return a + x * (b - a); -} - -void main() -{ - vec2 size = vec2(imageSize(Result)); - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); - - int X = pos.x; - int Y = pos.y; - - float height = size.y; - float Top = AudioSamples[X * 2] + 1; // -1; - float Bottom = AudioSamples[X * 2 + 1] + 1; // 1; - Top = min(Top, 1); - Bottom = max(Bottom, 0); - Top *= height; - Top *= 0.5; - Bottom *= height; - Bottom *= 0.5; - - - // (id.y >= Top && id.y <= Bottom) - float b1 = min(step(Top, Y), step(Y , Bottom)); - // (Y == height / 2) - float b2 = step(Y, height * LineUV) * step(height * LineUV, Y); - float b3 = max(b1, b2); - imageStore(Result, pos, lerp(BgColor, WaveColor, b3)); -}