34 lines
416 B
Plaintext
34 lines
416 B
Plaintext
@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 |