#version 450
// Unskinned glTF world prop (currently the SunCountry Bus). UBO variant of staticmodel.vert.
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aNormal;
layout(location = 2) in vec4 aColor;

layout(std140, binding = 0) uniform Globals {
    mat4  uMVP;
    mat4  uModel;
    vec3  uCamPos;
    float uLight;
    vec3  uFog;
    float uFogStart;
    float uFogEnd;
    vec4  uTint;
    float uFlash;
    int   uDynLightCount;
    vec4  uDynLightPosRadius0;
    vec4  uDynLightPosRadius1;
    vec4  uDynLightPosRadius2;
    vec4  uDynLightPosRadius3;
    vec4  uDynLightColor0;
    vec4  uDynLightColor1;
    vec4  uDynLightColor2;
    vec4  uDynLightColor3;
};

layout(location = 0) out vec3  vNormal;
layout(location = 1) out vec4  vColor;
layout(location = 2) out float vDist;
layout(location = 3) out vec3  vWorld;

void main() {
    vec4 wp = uModel * vec4(aPos, 1.0);
    vNormal = mat3(uModel) * aNormal;
    vColor  = aColor;
    vDist   = length(wp.xyz - uCamPos);
    vWorld  = wp.xyz;
    gl_Position = uMVP * vec4(aPos, 1.0);
}
