ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
snake_dir.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file snake_dir.frag
5 * @brief Vulkan fragment shader: snake dir.
6 */
7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
8 vec4 mouse;
9 vec4 u0;
10 vec4 u1;
11 vec4 u2;
12 vec4 u3;
13 vec4 custom_uniforms[16];
14 vec4 audio_bands;
15 vec4 audio_history;
17#define alpha ext.u0.x
18#define iResolution ext.u0.zw
19#define time_f ext.u2.y
20
21layout(location = 0) out vec4 color;
22layout(location = 0) in vec2 tc;
23layout(set = 0, binding = 0) uniform sampler2D samp;
24
25
26
27
28/**
29 * @brief Evaluates snake1 for this shader effect.
30 * @return Computed vec4 value.
31 */
32vec4 snake1() {
33 vec2 uv = tc * iResolution;
34 float wave = sin(uv.x * 0.05 + time_f * 2.0) * 0.05;
35 vec2 shiftedUV = vec2(uv.x, uv.y + wave * iResolution.y);
36 vec4 texColor = texture(samp, shiftedUV / iResolution);
37 return texColor;
38}
39
40/**
41 * @brief Evaluates snake2 for this shader effect.
42 * @return Computed vec4 value.
43 */
44vec4 snake2() {
45 vec2 uv = tc * iResolution;
46 float wave = sin(uv.y * 0.05 + time_f * 2.0) * 0.05;
47 vec2 shiftedUV = vec2(uv.x + wave * iResolution.x, uv.y);
48 vec4 texColor = texture(samp, shiftedUV / iResolution);
49 return texColor;
50}
51
52/**
53 * @brief Executes the fragment shader entry point.
54 */
55void main(void) {
56 float time_t = mod(time_f, 10);
57 color = sin(mix(snake1(), snake2(), 0.5) * (alpha * time_t));
58 color.a = 1.0;
59}
layout(set=0, binding=1, std140) uniform SpriteExtended
Definition 3high.frag:7
ext
Definition 3high.frag:16
void main(void)
Executes the fragment shader entry point.
Definition 3high.frag:47
#define iResolution
Definition 3high.frag:18
#define time_f
Definition 3high.frag:19
vec3 wave(ivec2 p, ivec2 size)
Evaluates wave for this shader effect.
#define alpha
Definition color_g.frag:17
vec4 snake2()
Evaluates snake2 for this shader effect.
vec4 snake1()
Evaluates snake1 for this shader effect.