prosperon/shaders/baseparticle.cg

50 lines
617 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;
uniform mat4 vp;
uniform float baseinstance;
void main()
{
particle p = par[int(baseinstance)+gl_InstanceIndex];
gl_Position = vp * p.model * vec4(a_pos, 0.0, 1.0);
uv = a_uv;
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