prosperon/source/shaders/sprite.sglsl

39 lines
575 B
Plaintext
Raw Permalink Normal View History

@vs vs
in vec2 vertex;
in vec2 uv;
2023-10-26 11:48:02 -05:00
in vec4 vc;
in vec4 emissive;
out vec2 texcoords;
out vec4 fcolor;
out vec4 femissive;
uniform vs_p { mat4 proj; };
void main()
{
2023-10-26 11:48:02 -05:00
fcolor = vc;
femissive = emissive;
texcoords = uv;
2024-01-01 07:44:43 -06:00
gl_Position = proj * vec4(vertex, 0, 1.0);
}
@end
@fs fs
in vec2 texcoords;
in vec4 fcolor;
in vec4 femissive;
out vec4 color;
uniform texture2D image;
uniform sampler smp;
void main()
{
2023-10-10 17:37:58 -05:00
color = texture(sampler2D(image,smp), texcoords);
color *= fcolor;
color.xyz = mix(color.xyz, femissive.xyz, femissive.a);
}
@end
@program sprite vs fs