You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
810 B
Plaintext

2 years ago
@module quad
2 years ago
@vs vs
in vec3 position;
2 years ago
in vec2 texcoord0;
out vec2 uv;
out vec2 pos;
2 years ago
void main() {
gl_Position = vec4(position.xyz, 1.0);
2 years ago
uv = texcoord0;
pos = position.xy;
2 years ago
}
@end
@fs fs
2 years ago
uniform sampler2D tex;
2 years ago
uniform fs_params {
vec4 tint;
// both in clip space
vec2 clip_ul;
vec2 clip_lr;
float alpha_clip_threshold;
2 years ago
};
2 years ago
in vec2 uv;
in vec2 pos;
2 years ago
out vec4 frag_color;
2 years ago
2 years ago
void main() {
// clip space is from [-1,1] [left, right]of screen on X, and [-1,1] [bottom, top] of screen on Y
if(pos.x < clip_ul.x || pos.x > clip_lr.x || pos.y < clip_lr.y || pos.y > clip_ul.y) discard;
frag_color = texture(tex, uv) * tint;
if(frag_color.a <= alpha_clip_threshold)
{
discard;
}
//frag_color = vec4(pos.x,0.0,0.0,1.0);
2 years ago
}
@end
@program program vs fs