voxel-engine/shaders/shader-quad.fs

29 lines
797 B
Forth
Raw Normal View History

#version 330 core
in vec2 TexCoord;
out vec4 FragColor;
uniform sampler2D renderTex;
2023-09-17 15:50:54 +02:00
uniform int screenWidth;
uniform int screenHeight;
uniform int crosshairType;
void main(){
2023-09-17 15:50:54 +02:00
float crosshair_alpha = 0.8;
float dist = length(gl_FragCoord.xy-vec2(screenWidth/2, screenHeight/2));
FragColor = texture(renderTex, TexCoord);
2023-09-17 15:50:54 +02:00
/*float crosshair_color = (FragColor.x + FragColor.y + FragColor.z) / 3;
/*if(crosshair_color <= 0.5) crosshair_color = 1.0;
/*else crosshair_color = 0.0;*/
float crosshair_color = 1.0;
if(dist <= 7){
if( (crosshairType == 0 && dist >= 5) ||
(crosshairType == 1 && ( int(gl_FragCoord.x) == int(screenWidth / 2) ||
int(gl_FragCoord.y) == int(screenHeight / 2)) )
) FragColor = vec4(vec3(crosshair_color), crosshair_alpha);
}
}