41 lines
1.1 KiB
GLSL
41 lines
1.1 KiB
GLSL
#version 450
|
|
|
|
layout(location = 0) in vec3 position;
|
|
layout(location = 1) in vec3 normal;
|
|
layout(location = 2) in vec2 texcoord;
|
|
layout(location = 3) in ivec2 index;
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
layout(location = 1) out vec4 frag_mcolor;
|
|
layout(location = 2) out vec2 frag_texcoord;
|
|
layout(location = 3) out int frag_texindex;
|
|
layout(location = 4) out vec3 frag_pos;
|
|
layout(location = 5) out vec3 frag_normal;
|
|
|
|
struct VertexAttribute {
|
|
mat4 matrix;
|
|
mat4 nmatrix;
|
|
vec4 color;
|
|
vec4 mixcolor;
|
|
};
|
|
|
|
layout(binding = 0) uniform GlobalVars {
|
|
mat4 proj_view;
|
|
vec3 light;
|
|
vec3 eye;
|
|
} global;
|
|
|
|
layout (std430, binding = 1) buffer AttributeBlock {
|
|
VertexAttribute atts[2048];
|
|
} units;
|
|
|
|
void main() {
|
|
gl_Position = global.proj_view * units.atts[index[0]].matrix * vec4(position,1.0);
|
|
frag_color = units.atts[index[0]].color;
|
|
frag_mcolor = units.atts[index[0]].mixcolor;
|
|
frag_texcoord = texcoord;
|
|
frag_texindex = index[1];
|
|
frag_pos = vec3(units.atts[index[0]].matrix * vec4(position,1.0));
|
|
frag_normal = normalize(vec3(units.atts[index[0]].nmatrix * vec4(normal,1.0)));
|
|
}
|