2023-05-12 11:29:44 +00:00
|
|
|
#version 460
|
|
|
|
layout (location = 0) in vec3 vPosition;
|
|
|
|
layout (location = 1) in vec3 vNormal;
|
|
|
|
layout (location = 2) in vec4 vColor;
|
2023-05-16 09:14:46 +00:00
|
|
|
layout (location = 3) in vec2 vTexCoord;
|
2023-05-12 11:29:44 +00:00
|
|
|
|
|
|
|
layout (location = 0) out vec4 outColor;
|
2023-05-16 09:14:46 +00:00
|
|
|
layout (location = 1) out vec2 texCoord;
|
2023-05-12 11:29:44 +00:00
|
|
|
|
|
|
|
layout(set = 0, binding = 0) uniform CameraBuffer{
|
|
|
|
mat4 view;
|
|
|
|
mat4 proj;
|
|
|
|
mat4 viewproj;
|
|
|
|
} cameraData;
|
|
|
|
|
|
|
|
struct ObjectData{
|
|
|
|
mat4 model;
|
|
|
|
};
|
|
|
|
|
|
|
|
//all object matrices
|
|
|
|
layout(std140,set = 1, binding = 0) readonly buffer ObjectBuffer{
|
|
|
|
|
|
|
|
ObjectData objects[];
|
|
|
|
} objectBuffer;
|
|
|
|
|
|
|
|
//push constants block
|
|
|
|
layout( push_constant ) uniform constants
|
|
|
|
{
|
|
|
|
vec4 data;
|
|
|
|
mat4 render_matrix;
|
|
|
|
} PushConstants;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
mat4 modelMatrix = objectBuffer.objects[gl_BaseInstance].model;
|
|
|
|
mat4 transformMatrix = (cameraData.viewproj * modelMatrix);
|
|
|
|
gl_Position = transformMatrix * vec4(vPosition, 1.0f);
|
|
|
|
outColor = vColor;
|
2023-05-16 09:14:46 +00:00
|
|
|
texCoord = vTexCoord;
|
2023-05-12 11:29:44 +00:00
|
|
|
}
|