ADD: Particle system
This commit is contained in:
26
shaders/particles.frag
Normal file
26
shaders/particles.frag
Normal file
@@ -0,0 +1,26 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 v_color;
|
||||
layout(location = 1) in vec2 v_uv;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Soft circular sprite.
|
||||
vec2 p = v_uv * 2.0 - 1.0;
|
||||
float r = length(p);
|
||||
float mask = smoothstep(1.0, 0.0, r);
|
||||
|
||||
vec4 c = v_color;
|
||||
c.rgb *= mask;
|
||||
c.a *= mask;
|
||||
|
||||
if (c.a <= 0.001)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
outColor = c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user