#version 450

layout(location = 0) in vec2 position[4];
layout(location = 4) in vec2 textureCoordinates[4];
layout(location = 8) in vec4 color;
layout(location = 9) in vec4 bgColor;

layout(location = 0) out vec4 outColor;
layout(location = 1) out vec4 outBgColor;
layout(location = 2) out vec2 fragTextureCoordinates;

layout(set = 0, binding = 0) uniform NodeData
{
	mat4 world;
} node;

layout(set = 1, binding = 0) uniform CameraData
{
	mat4 viewProjection;
} cam;

void main() {
	gl_Position = cam.viewProjection * node.world * vec4(position[gl_VertexIndex], 0.0, 1.0);
	fragTextureCoordinates = textureCoordinates[gl_VertexIndex];
	outColor = color;
	outBgColor = bgColor;
}
