prosperon/shaders/poly_ssbo.cg
2024-09-29 06:10:42 -05:00

39 lines
470 B
Plaintext

#depth off
#blend mix
#primitive triangle
#cull none
@vs vs
in vec3 a_pos;
uniform mat4 vp;
out vec4 shade;
struct poly {
mat4 model;
vec4 color;
};
readonly buffer ssbo {
poly polys[];
};
uniform float baseinstance;
void main() {
poly p = polys[int(baseinstance)+gl_InstanceIndex];
gl_Position = vp * p.model * vec4(a_pos, 1);
shade = p.color;
}
@end
@fs fs
in vec4 shade;
out vec4 color;
void main() {
color = shade;
}
@end
@program sprite vs fs