prosperon/shaders/baseparticle.cg

51 lines
601 B
Plaintext
Raw Normal View History

2024-07-18 12:39:58 -05:00
#depth off
#blend mix
@vs vs
in vec2 a_pos;
in vec2 a_uv;
2024-07-22 08:29:31 -05:00
uniform vec2 diffuse_size;
2024-07-18 12:39:58 -05:00
struct particle {
2024-07-22 15:40:58 -05:00
mat4 model;
2024-07-18 12:39:58 -05:00
vec4 color;
};
readonly buffer ssbo {
particle par[];
};
out vec2 uv;
out vec4 color0;
vec2 pos;
uniform mat4 vp;
void main()
{
particle p = par[gl_InstanceIndex];
2024-07-21 15:03:43 -05:00
pos = a_pos - 0.5;
2024-07-22 15:40:58 -05:00
gl_Position = vp * p.model * vec4(pos, 0.0, 1.0);
2024-07-22 08:29:31 -05:00
uv = a_pos;
2024-07-22 15:40:58 -05:00
color0 = p.color;
2024-07-18 12:39:58 -05:00
}
@end
@fs fs
in vec2 uv;
2024-07-22 15:40:58 -05:00
in vec4 color0;
2024-07-18 12:39:58 -05:00
out vec4 color;
2024-07-22 08:29:31 -05:00
texture2D diffuse;
2024-07-18 12:39:58 -05:00
sampler smp;
void main()
{
2024-07-22 15:40:58 -05:00
color = texture(sampler2D(diffuse,smp),uv);
2024-07-22 08:29:31 -05:00
color *= color0;
2024-07-18 12:39:58 -05:00
}
@end
@program text vs fs