2018-03-24 10:39:00 +11:00
|
|
|
#version 450
|
|
|
|
|
|
|
|
/*
|
|
|
|
AGS-001 shader
|
|
|
|
A pristine recreation of the illuminated Game Boy Advance SP
|
|
|
|
Author: endrift
|
|
|
|
License: MPL 2.0
|
|
|
|
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
layout(std140, set = 0, binding = 0) uniform UBO
|
|
|
|
{
|
2018-03-25 08:17:10 +11:00
|
|
|
mat4 MVP;
|
|
|
|
vec4 OutputSize;
|
|
|
|
vec4 OriginalSize;
|
|
|
|
vec4 SourceSize;
|
2018-03-24 10:39:00 +11:00
|
|
|
} global;
|
|
|
|
|
|
|
|
#pragma stage vertex
|
|
|
|
layout(location = 0) in vec4 Position;
|
|
|
|
layout(location = 1) in vec2 TexCoord;
|
|
|
|
layout(location = 0) out vec2 vTexCoord;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2018-03-25 08:17:10 +11:00
|
|
|
gl_Position = global.MVP * Position;
|
|
|
|
vTexCoord = TexCoord;
|
2018-03-24 10:39:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma stage fragment
|
|
|
|
layout(location = 0) in vec2 vTexCoord;
|
|
|
|
layout(location = 0) out vec4 FragColor;
|
|
|
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec4 color = texture(Source, vTexCoord);
|
|
|
|
vec3 arrayX[4];
|
|
|
|
arrayX[0] = vec3(1.0, 0.2, 0.2);
|
|
|
|
arrayX[1] = vec3(0.2, 1.0, 0.2);
|
|
|
|
arrayX[2] = vec3(0.2, 0.2, 1.0);
|
|
|
|
arrayX[3] = vec3(0.4, 0.4, 0.4);
|
|
|
|
vec3 arrayY[4];
|
|
|
|
arrayY[0] = vec3(1.0, 1.0, 1.0);
|
|
|
|
arrayY[1] = vec3(1.0, 1.0, 1.0);
|
|
|
|
arrayY[2] = vec3(1.0, 1.0, 1.0);
|
|
|
|
arrayY[3] = vec3(0.9, 0.9, 0.9);
|
|
|
|
color.rgb = pow(color.rgb, vec3(1.6, 1.6, 1.6));
|
|
|
|
color.rgb *= arrayX[int(mod(vTexCoord.s * global.SourceSize.x * 4.0, 4.0))];
|
|
|
|
color.rgb *= arrayY[int(mod(vTexCoord.t * global.SourceSize.y * 4.0, 4.0))];
|
|
|
|
color.a = 0.8;
|
|
|
|
FragColor = color;
|
|
|
|
|
2018-03-24 10:44:32 +11:00
|
|
|
}
|