Merge pull request #3 from rz5/patch-1

Update crt-easymode.slang
This commit is contained in:
hizzlekizzle 2016-07-15 21:04:11 -05:00 committed by GitHub
commit 41f065993e

View file

@ -12,8 +12,6 @@ layout(std140, set = 0, binding = 0) uniform UBO
layout(location = 0) in vec4 Position; layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord; layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord; layout(location = 0) out vec2 vTexCoord;
layout(location = 2) out vec2 coords;
void main() void main()
{ {
@ -53,7 +51,6 @@ void main()
#pragma stage fragment #pragma stage fragment
layout(location = 0) in vec2 vTexCoord; layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 FragCoord; layout(location = 1) in vec2 FragCoord;
layout(location = 2) in vec2 coords;
layout(location = 0) out vec4 FragColor; layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 2) uniform sampler2D Source;
@ -128,7 +125,7 @@ void main()
{ {
vec2 dx = vec2(1.0 / global.SourceSize.x, 0.0); vec2 dx = vec2(1.0 / global.SourceSize.x, 0.0);
vec2 dy = vec2(0.0, 1.0 / global.SourceSize.y); vec2 dy = vec2(0.0, 1.0 / global.SourceSize.y);
vec2 pix_co = coords * global.SourceSize.xy - vec2(0.5, 0.5); vec2 pix_co = vTexCoord * global.SourceSize.xy - vec2(0.5, 0.5);
vec2 tex_co = (floor(pix_co) + vec2(0.5, 0.5)) / global.SourceSize.xy; vec2 tex_co = (floor(pix_co) + vec2(0.5, 0.5)) / global.SourceSize.xy;
vec2 dist = fract(pix_co); vec2 dist = fract(pix_co);
float curve_x; float curve_x;
@ -159,10 +156,10 @@ void main()
float bright = (max(col.r, max(col.g, col.b)) + luma) / 2.0; float bright = (max(col.r, max(col.g, col.b)) + luma) / 2.0;
float scan_bright = clamp(bright, SCANLINE_BRIGHT_MIN, SCANLINE_BRIGHT_MAX); float scan_bright = clamp(bright, SCANLINE_BRIGHT_MIN, SCANLINE_BRIGHT_MAX);
float scan_beam = clamp(bright * SCANLINE_BEAM_WIDTH_MAX, SCANLINE_BEAM_WIDTH_MIN, SCANLINE_BEAM_WIDTH_MAX); float scan_beam = clamp(bright * SCANLINE_BEAM_WIDTH_MAX, SCANLINE_BEAM_WIDTH_MIN, SCANLINE_BEAM_WIDTH_MAX);
float scan_weight = 1.0 - pow(cos(coords.y * 2.0 * PI * global.SourceSize.y) * 0.5 + 0.5, scan_beam) * SCANLINE_STRENGTH; float scan_weight = 1.0 - pow(cos(vTexCoord.y * 2.0 * PI * global.SourceSize.y) * 0.5 + 0.5, scan_beam) * SCANLINE_STRENGTH;
float mask = 1.0 - MASK_STRENGTH; float mask = 1.0 - MASK_STRENGTH;
vec2 mod_fac = floor(coords * global.OutputSize.xy * global.SourceSize.xy / (global.SourceSize.xy * vec2(MASK_SIZE, MASK_DOT_HEIGHT * MASK_SIZE))); vec2 mod_fac = floor(vTexCoord * global.OutputSize.xy * global.SourceSize.xy / (global.SourceSize.xy * vec2(MASK_SIZE, MASK_DOT_HEIGHT * MASK_SIZE)));
int dot_no = int(mod((mod_fac.x + mod(mod_fac.y, 2.0) * MASK_STAGGER) / MASK_DOT_WIDTH, 3.0)); int dot_no = int(mod((mod_fac.x + mod(mod_fac.y, 2.0) * MASK_STAGGER) / MASK_DOT_WIDTH, 3.0));
vec3 mask_weight; vec3 mask_weight;