Add chapter 2.1-end
This commit is contained in:
26
resources/scanlines.fs
Normal file
26
resources/scanlines.fs
Normal file
@@ -0,0 +1,26 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform vec3 screenSize;
|
||||
uniform bool screenBurn;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture(screenTexture, TexCoords).rgb;
|
||||
float scanLine = mod(gl_FragCoord.y, 2.0) * 0.25;
|
||||
vec3 scanColor = col.rgb - scanLine;
|
||||
|
||||
if (col.r < 0.1f && col.g < 0.1f && col.b < 0.1f) {
|
||||
if (screenBurn) {
|
||||
float dist = (1.0 - distance(vec2(gl_FragCoord.x / screenSize.x, gl_FragCoord.y / screenSize.y), vec2(0.5,0.5))) * 0.2;
|
||||
FragColor = vec4(0.0, dist, dist, 1.0);
|
||||
} else {
|
||||
FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
} else {
|
||||
FragColor = vec4(scanColor, 1.0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user