prosperon/source/shaders/particle.sglsl

44 lines
587 B
Plaintext
Raw Permalink Normal View History

2023-12-29 19:08:53 -06:00
@vs vs
in vec2 vertex;
in vec2 apos;
in float angle;
2024-01-01 17:30:42 -06:00
in vec2 scale;
2023-12-29 19:08:53 -06:00
in vec4 vc;
out vec4 fcolor;
out vec2 uv;
uniform vs_p { mat4 proj; };
void main()
{
fcolor = vc;
uv = vertex;
vec2 v = vertex - 0.5;
vec2 p = vec2(
cos(angle)*v.x-sin(angle)*v.y,
sin(angle)*v.x+cos(angle)*v.y
);
p *= scale;
p += apos;
gl_Position = proj * vec4(p, 0.0, 1.0);
}
@end
@fs fs
in vec4 fcolor;
out vec4 color;
in vec2 uv;
uniform texture2D image;
uniform sampler smp;
void main()
{
color = texture(sampler2D(image,smp),uv);
color *= fcolor;
}
@end
@program particle vs fs