prosperon/shaders/baseparticle.cg

51 lines
601 B
Plaintext

#depth off
#blend mix
@vs vs
in vec2 a_pos;
in vec2 a_uv;
uniform vec2 diffuse_size;
struct particle {
mat4 model;
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];
pos = a_pos - 0.5;
gl_Position = vp * p.model * vec4(pos, 0.0, 1.0);
uv = a_pos;
color0 = p.color;
}
@end
@fs fs
in vec2 uv;
in vec4 color0;
out vec4 color;
texture2D diffuse;
sampler smp;
void main()
{
color = texture(sampler2D(diffuse,smp),uv);
color *= color0;
}
@end
@program text vs fs