#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(binding = 0) uniform UniformBufferObject {
    mat4 normalMat;
    mat4 view;
    mat4 proj;
} ubo;

layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec3 inColour;
layout(location = 3) in vec2 inTexCoord;
layout(location = 4) in uint inTexIndex;
layout(location = 5) in vec3 inExtraColour;
layout(location = 7) in uint inTileIndex;

layout(location = 0) out vec3 fragColour;
layout(location = 1) out vec2 fragTexCoord;
layout(location = 2) out uint fragTexIndex;
layout(location = 3) out vec3 fragExtraColour;
layout(location = 4) out vec3 fragNormal;
layout(location = 5) out uint fragTileIndex;
layout(location = 6) out vec3 fragCoord;

out gl_PerVertex {
    vec4 gl_Position;
};

void main() {
    gl_Position = ubo.proj * ubo.view * vec4(inPosition, 1.0);
    fragColour = inColour;
    fragTexCoord = inTexCoord;
    fragTexIndex = inTexIndex;
    fragExtraColour = inExtraColour;
    fragTileIndex = inTileIndex;
    fragCoord =  inPosition;
    // lighting information passed on to the fragment shader
    fragNormal = inNormal;
}