45 lines
600 B
Plaintext
45 lines
600 B
Plaintext
|
@vs vs
|
||
|
in vec2 vertex;
|
||
|
in vec2 apos;
|
||
|
in float angle;
|
||
|
in float scale;
|
||
|
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 += 0.5;
|
||
|
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
|