2023-09-15 03:37:07 -05:00
|
|
|
@vs vs
|
|
|
|
in vec2 vertex;
|
|
|
|
|
|
|
|
out vec2 texcoords;
|
|
|
|
out vec4 fcolor;
|
2023-11-21 01:07:50 -06:00
|
|
|
out vec4 femissive;
|
2023-09-15 03:37:07 -05:00
|
|
|
|
2024-04-23 15:58:08 -05:00
|
|
|
uniform app {
|
|
|
|
float time;
|
|
|
|
vec2 window;
|
|
|
|
};
|
|
|
|
|
|
|
|
uniform vp {
|
|
|
|
mat4 proj;
|
|
|
|
};
|
|
|
|
|
|
|
|
uniform sprite {
|
|
|
|
vec4 vcolor;
|
|
|
|
vec4 vemissive;
|
|
|
|
vec2 spritesize;
|
|
|
|
vec2 spriteoff;
|
|
|
|
mat4 model;
|
|
|
|
};
|
2023-09-15 03:37:07 -05:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2024-04-23 18:12:45 -05:00
|
|
|
texcoords = vertex;
|
|
|
|
texcoords.y = 1 - texcoords.y;
|
|
|
|
gl_Position = proj * model * vec4(vertex, 0, 1.0);
|
|
|
|
fcolor = vcolor;
|
|
|
|
femissive = vemissive;
|
2023-09-15 03:37:07 -05:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@fs fs
|
|
|
|
in vec2 texcoords;
|
|
|
|
in vec4 fcolor;
|
2023-11-21 01:07:50 -06:00
|
|
|
in vec4 femissive;
|
2024-04-23 15:58:08 -05:00
|
|
|
|
2023-09-15 03:37:07 -05:00
|
|
|
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);
|
2023-11-21 01:07:50 -06:00
|
|
|
color *= fcolor;
|
|
|
|
color.xyz = mix(color.xyz, femissive.xyz, femissive.a);
|
2023-09-15 03:37:07 -05:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@program sprite vs fs
|