prosperon/shaders/poly_ssbo.cg

34 lines
416 B
Plaintext
Raw Normal View History

2024-07-23 12:02:46 -05:00
@vs vs
in vec3 a_pos;
uniform mat4 vp;
out vec4 shade;
struct poly {
mat4 model;
vec4 color;
};
readonly buffer ssbo {
poly polys[];
};
2024-09-29 06:10:42 -05:00
uniform float baseinstance;
2024-07-23 12:02:46 -05:00
void main() {
2024-09-29 06:10:42 -05:00
poly p = polys[int(baseinstance)+gl_InstanceIndex];
2024-07-23 12:02:46 -05:00
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