prosperon/source/shaders/sprite.sglsl

36 lines
475 B
Plaintext
Raw Normal View History

@vs vs
in vec2 vertex;
in vec2 uv;
in vec4 vColor;
out vec2 texcoords;
out vec4 fcolor;
uniform vs_p { mat4 proj; };
void main()
{
fcolor = vColor;
texcoords = uv;
gl_Position = proj * vec4(vertex, 0.0, 1.0);
}
@end
@fs fs
in vec2 texcoords;
in vec4 fcolor;
out vec4 color;
uniform texture2D image;
uniform sampler smp;
void main()
{
color = fcolor * texture(sampler2D(image,smp), texcoords);
if (color.a <= 0.1f)
discard;
}
@end
@program sprite vs fs