52 lines
694 B
Plaintext
52 lines
694 B
Plaintext
@vs vs
|
|
in vec2 vertex;
|
|
|
|
out vec2 texcoords;
|
|
out vec4 fcolor;
|
|
out vec4 femissive;
|
|
|
|
uniform app {
|
|
float time;
|
|
vec2 window;
|
|
};
|
|
|
|
uniform vp {
|
|
mat4 proj;
|
|
};
|
|
|
|
uniform sprite {
|
|
vec4 vcolor;
|
|
vec4 vemissive;
|
|
vec2 spritesize;
|
|
vec2 spriteoff;
|
|
mat4 model;
|
|
};
|
|
|
|
void main()
|
|
{
|
|
texcoords = spriteoff + spritesize*vertex;
|
|
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()
|
|
{
|
|
color = texture(sampler2D(image,smp), texcoords);
|
|
color *= fcolor;
|
|
color.xyz = mix(color.xyz, femissive.xyz, femissive.a);
|
|
color.a = 1.0;
|
|
|
|
}
|
|
@end
|
|
|
|
@program sprite vs fs |