75 lines
1.3 KiB
Plaintext
75 lines
1.3 KiB
Plaintext
@vs vs
|
|
in vec2 vert;
|
|
in vec2 pos;
|
|
in vec2 wh;
|
|
in vec2 uv;
|
|
in vec2 st;
|
|
in vec4 vColor;
|
|
|
|
out vec2 TexCoords;
|
|
out vec4 fColor;
|
|
out vec2 fst;
|
|
|
|
uniform vs_params { mat4 projection; };
|
|
|
|
void main()
|
|
{
|
|
gl_Position = projection * vec4(pos + (vert * wh), 0.0, 1.0);
|
|
|
|
TexCoords = uv + vec2(vert.x*st.x, st.y - vert.y*st.y);
|
|
fst = st / wh;
|
|
|
|
fColor = vColor;
|
|
}
|
|
@end
|
|
|
|
@fs fs
|
|
in vec2 TexCoords;
|
|
in vec4 fColor;
|
|
in vec2 fst;
|
|
|
|
out vec4 color;
|
|
|
|
uniform texture2D text;
|
|
uniform sampler smp;
|
|
|
|
float osize = 1.0;
|
|
|
|
void main()
|
|
{
|
|
float lettera = texture(sampler2D(text,smp),TexCoords).r;
|
|
|
|
if (lettera <= 0.1f)
|
|
{
|
|
vec2 uvpos = TexCoords - fst;
|
|
for (int x = 0; x < 3; x++) {
|
|
for (int y = 0; y < 3; y++) {
|
|
float pa = texture(sampler2D(text,smp), uvpos + (fst*vec2(x,y))).r;
|
|
if (pa > 0.1) {
|
|
color = vec4(0.0,0.0,0.0, fColor.a);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
discard;
|
|
}
|
|
|
|
// vec2 lsize = fst / textureSize(dtext,0).xy;
|
|
/* vec2 uvpos = TexCoords - fst;
|
|
for (int x = 0; x < 3; x++) {
|
|
for (int y = 0; 0 < 3; y++) {
|
|
float pa = texture(sampler2D(text,smp), uvpos + (fst * vec2(x,y))).r;
|
|
|
|
if (pa <= 0.1) {
|
|
color = vec4(0.0,0.0,0.0,fColor.a);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
color = vec4(fColor.xyz, fColor.a);
|
|
}
|
|
@end
|
|
|
|
@program text vs fs |