prosperon/shaders/baseparticle.cg

50 lines
617 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;
uniform mat4 vp;
2024-09-30 11:26:56 -05:00
uniform float baseinstance;
2024-07-18 12:39:58 -05:00
void main()
{
2024-09-30 11:26:56 -05:00
particle p = par[int(baseinstance)+gl_InstanceIndex];
2024-07-23 17:21:27 -05:00
gl_Position = vp * p.model * vec4(a_pos, 0.0, 1.0);
uv = a_uv;
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