Rebuild shaders with glslang-tools 7.12.3352-10

This commit is contained in:
Denis Pauk 2020-01-26 12:05:39 +02:00 committed by Yamagi
parent d291e0bbc5
commit bfab2d3042
47 changed files with 616 additions and 23 deletions

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t basic_color_quad_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000000d,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t basic_color_quad_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t basic_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000025,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t basic_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000003e,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t beam_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t d_light_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t model_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000028,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t model_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t nullmodel_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000002e,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t particle_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000002d,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t point_particle_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000020,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t point_particle_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000055,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t polygon_lmap_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t polygon_lmap_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000036,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t polygon_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000030,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t polygon_warp_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000058,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t postprocess_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000033,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t postprocess_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t shadows_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000002b,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t skybox_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t sprite_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t world_warp_frag_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000078,0x00000000,0x00020011,0x00000001,0x0006000b,

View file

@ -1,4 +1,4 @@
// 7.12.3294
// 7.12.3352
#pragma once
const uint32_t world_warp_vert_spv[] = {
0x07230203,0x00010000,0x00080007,0x00000024,0x00000000,0x00020011,0x00000001,0x0006000b,

25
stuff/shaders.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
glslangValidator --variable-name basic_vert_spv -V shaders/basic.vert -o ../src/client/refresh/vk/spirv/basic_vert.c
glslangValidator --variable-name basic_frag_spv -V shaders/basic.frag -o ../src/client/refresh/vk/spirv/basic_frag.c
glslangValidator --variable-name basic_color_quad_vert_spv -V shaders/basic_color_quad.vert -o ../src/client/refresh/vk/spirv/basic_color_quad_vert.c
glslangValidator --variable-name basic_color_quad_frag_spv -V shaders/basic_color_quad.frag -o ../src/client/refresh/vk/spirv/basic_color_quad_frag.c
glslangValidator --variable-name model_vert_spv -V shaders/model.vert -o ../src/client/refresh/vk/spirv/model_vert.c
glslangValidator --variable-name model_frag_spv -V shaders/model.frag -o ../src/client/refresh/vk/spirv/model_frag.c
glslangValidator --variable-name nullmodel_vert_spv -V shaders/nullmodel.vert -o ../src/client/refresh/vk/spirv/nullmodel_vert.c
glslangValidator --variable-name particle_vert_spv -V shaders/particle.vert -o ../src/client/refresh/vk/spirv/particle_vert.c
glslangValidator --variable-name point_particle_vert_spv -V shaders/point_particle.vert -o ../src/client/refresh/vk/spirv/point_particle_vert.c
glslangValidator --variable-name point_particle_frag_spv -V shaders/point_particle.frag -o ../src/client/refresh/vk/spirv/point_particle_frag.c
glslangValidator --variable-name sprite_vert_spv -V shaders/sprite.vert -o ../src/client/refresh/vk/spirv/sprite_vert.c
glslangValidator --variable-name beam_vert_spv -V shaders/beam.vert -o ../src/client/refresh/vk/spirv/beam_vert.c
glslangValidator --variable-name skybox_vert_spv -V shaders/skybox.vert -o ../src/client/refresh/vk/spirv/skybox_vert.c
glslangValidator --variable-name d_light_vert_spv -V shaders/d_light.vert -o ../src/client/refresh/vk/spirv/d_light_vert.c
glslangValidator --variable-name polygon_vert_spv -V shaders/polygon.vert -o ../src/client/refresh/vk/spirv/polygon_vert.c
glslangValidator --variable-name polygon_lmap_vert_spv -V shaders/polygon_lmap.vert -o ../src/client/refresh/vk/spirv/polygon_lmap_vert.c
glslangValidator --variable-name polygon_lmap_frag_spv -V shaders/polygon_lmap.frag -o ../src/client/refresh/vk/spirv/polygon_lmap_frag.c
glslangValidator --variable-name polygon_warp_vert_spv -V shaders/polygon_warp.vert -o ../src/client/refresh/vk/spirv/polygon_warp_vert.c
glslangValidator --variable-name shadows_vert_spv -V shaders/shadows.vert -o ../src/client/refresh/vk/spirv/shadows_vert.c
glslangValidator --variable-name postprocess_vert_spv -V shaders/postprocess.vert -o ../src/client/refresh/vk/spirv/postprocess_vert.c
glslangValidator --variable-name postprocess_frag_spv -V shaders/postprocess.frag -o ../src/client/refresh/vk/spirv/postprocess_frag.c
glslangValidator --variable-name world_warp_vert_spv -V shaders/world_warp.vert -o ../src/client/refresh/vk/spirv/world_warp_vert.c
glslangValidator --variable-name world_warp_frag_spv -V shaders/world_warp.frag -o ../src/client/refresh/vk/spirv/world_warp_frag.c

16
stuff/shaders/basic.frag Normal file
View file

@ -0,0 +1,16 @@
#version 450
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec2 texCoord;
layout(location = 1) in vec4 color;
layout(location = 2) in float aTreshold;
layout(location = 0) out vec4 fragmentColor;
void main()
{
fragmentColor = texture(sTexture, texCoord) * color;
if(fragmentColor.a < aTreshold)
discard;
}

30
stuff/shaders/basic.vert Normal file
View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// normalized offset and scale
layout(set = 1, binding = 0) uniform imageTransform
{
vec2 offset;
vec2 scale;
vec2 uvOffset;
vec2 uvScale;
} it;
layout(location = 0) in vec2 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale);
gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0);
texCoord = inTexCoord.xy * it.uvScale + it.uvOffset;
color = vec4(1.0, 1.0, 1.0, 1.0);
aTreshold = 0.666;
}

View file

@ -0,0 +1,10 @@
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragmentColor;
void main()
{
fragmentColor = color;
}

View file

@ -0,0 +1,24 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// normalized offset and scale
layout(set = 0, binding = 0) uniform imageTransform
{
vec2 offset;
vec2 scale;
vec4 color;
} it;
layout(location = 0) in vec2 inVertex;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale);
gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0);
color = it.color;
}

25
stuff/shaders/beam.vert Normal file
View file

@ -0,0 +1,25 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
vec4 color;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
color = ubo.color;
}

View file

@ -0,0 +1,21 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec3 inColor;
layout(binding = 0) uniform UniformBufferObject
{
mat4 mvpMatrix;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = ubo.mvpMatrix * vec4(inVertex, 1.0);
color = vec4(inColor, 1.0);
}

17
stuff/shaders/model.frag Normal file
View file

@ -0,0 +1,17 @@
#version 450
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec4 color;
layout(location = 1) in vec2 texCoord;
layout(location = 2) in flat int textured;
layout(location = 0) out vec4 fragmentColor;
void main()
{
if(textured != 0)
fragmentColor = texture(sTexture, texCoord) * clamp(color, 0.0, 1.0);
else
fragmentColor = color;
}

32
stuff/shaders/model.vert Normal file
View file

@ -0,0 +1,32 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
int textured;
} ubo;
layout(location = 0) out vec4 color;
layout(location = 1) out vec2 texCoord;
layout(location = 2) out int textured;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = inColor;
texCoord = inTexCoord;
textured = ubo.textured;
}

View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec3 inColor;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = vec4(inColor, 1.0);
}

View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = inColor;
aTreshold = 0.0;
}

View file

@ -0,0 +1,14 @@
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragmentColor;
void main()
{
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
if(dot(cxy, cxy) > 1.0)
discard;
fragmentColor = color;
}

View file

@ -0,0 +1,37 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
float pointSize;
float pointScale;
float minPointSize;
float maxPointSize;
float att_a;
float att_b;
float att_c;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
float dist_atten = ubo.pointScale / (ubo.att_a + ubo.att_b * gl_Position.w + ubo.att_c * gl_Position.w * gl_Position.w);
gl_PointSize = clamp(ubo.pointScale * ubo.pointSize * sqrt(dist_atten), ubo.minPointSize, ubo.maxPointSize);
color = inColor;
}

View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
vec4 color;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = ubo.color;
aTreshold = 0.0;
}

View file

@ -0,0 +1,17 @@
#version 450
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(set = 2, binding = 0) uniform sampler2D sLightmap;
layout(location = 0) in vec2 texCoord;
layout(location = 1) in vec2 texCoordLmap;
layout(location = 2) in float viewLightmaps;
layout(location = 0) out vec4 fragmentColor;
void main()
{
vec4 color = texture(sTexture, texCoord);
vec4 light = texture(sLightmap, texCoordLmap);
fragmentColor = (1.0 - viewLightmaps) * color * light + viewLightmaps * light;
}

View file

@ -0,0 +1,32 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(location = 2) in vec2 inTexCoordLmap;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
float viewLightmaps;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec2 texCoordLmap;
layout(location = 2) out float viewLightmaps;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord;
texCoordLmap = inTexCoordLmap;
viewLightmaps = ubo.viewLightmaps;
}

View file

@ -0,0 +1,34 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
vec4 color;
float time;
float scroll;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord + vec2(sin(2.0 * ubo.time + inTexCoord.y * 3.28), sin(2.0 * ubo.time + inTexCoord.x * 3.28)) * 0.05;
texCoord.x += ubo.scroll;
color = ubo.color;
aTreshold = 0.0;
}

View file

@ -0,0 +1,27 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(push_constant) uniform PushConstant
{
float postprocess;
float gamma;
} pc;
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec2 texCoord;
layout(location = 0) out vec4 fragmentColor;
void main()
{
// apply any additional world-only postprocessing effects here (if enabled)
if (pc.postprocess > 0.0)
{
//gamma + color intensity bump
fragmentColor = vec4(pow(texture(sTexture, texCoord).rgb * 1.5, vec3(pc.gamma)), 1.0);
}
else
{
fragmentColor = texture(sTexture, texCoord);
}
}

View file

@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// rendering a fullscreen quad (which is actually just a huge triangle)
// source: https://www.saschawillems.de/blog/2016/08/13/vulkan-tutorial-on-rendering-a-fullscreen-quad-without-buffers/
out gl_PerVertex {
vec4 gl_Position;
};
layout(location = 0) out vec2 texCoord;
void main()
{
texCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
gl_Position = vec4(texCoord * 2.0f + -1.0f, 0.0f, 1.0f);
}

View file

@ -0,0 +1,24 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 0) out vec4 color;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = vec4(0.0, 0.0, 0.0, 0.5);
}

30
stuff/shaders/skybox.vert Normal file
View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = vec4(1.0, 1.0, 1.0, 1.0);
aTreshold = 0.0;
}

26
stuff/shaders/sprite.vert Normal file
View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
float alpha;
} pc;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = vec4(1.0, 1.0, 1.0, pc.alpha);
aTreshold = 0.0666;
}

View file

@ -0,0 +1,36 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// Underwater screen warp effect similar to what software renderer provides
layout(push_constant) uniform PushConstant
{
float time;
float scale;
float scrWidth;
float scrHeight;
} pc;
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) out vec4 fragmentColor;
#define PI 3.1415
void main()
{
vec2 uv = vec2(gl_FragCoord.x / pc.scrWidth, gl_FragCoord.y / pc.scrHeight);
if (pc.time > 0)
{
float sx = pc.scale - abs(pc.scrWidth / 2.0 - gl_FragCoord.x) * 2.0 / pc.scrWidth;
float sy = pc.scale - abs(pc.scrHeight / 2.0 - gl_FragCoord.y) * 2.0 / pc.scrHeight;
float xShift = 2.0 * pc.time + uv.y * PI * 10;
float yShift = 2.0 * pc.time + uv.x * PI * 10;
vec2 distortion = vec2(sin(xShift) * sx, sin(yShift) * sy) * 0.00666;
uv += distortion;
}
fragmentColor = texture(sTexture, uv);
}

View file

@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
out gl_PerVertex {
vec4 gl_Position;
};
void main()
{
vec4 positions[3] = {
vec4(-1.0f, -1.0f, 0.0f, 1.0f),
vec4(3.0f, -1.0f, 0.0f, 1.0f),
vec4(-1.0f, 3.0f, 0.0f, 1.0f)
};
gl_Position = positions[gl_VertexIndex % 3];
}