#include <metal_stdlib>
#include <simd/simd.h>

using namespace metal;

struct Globals
{
    float4x4 uMVP;
    float4x4 uModel;
    int uTextured;
    float uLayer;
    float4 uColor;
    packed_float3 uAccent;
    int uPattern;
    float uLight;
    char _m8_pad[12];
    packed_float3 uFog;
    float uFogAmt;
    int uDynLightCount;
    float4 uDynLightPosRadius0;
    float4 uDynLightPosRadius1;
    float4 uDynLightPosRadius2;
    float4 uDynLightPosRadius3;
    float4 uDynLightColor0;
    float4 uDynLightColor1;
    float4 uDynLightColor2;
    float4 uDynLightColor3;
};

struct main0_out
{
    float2 vUV [[user(locn0)]];
    float vShade [[user(locn1)]];
    float3 vWorld [[user(locn2)]];
    float4 gl_Position [[position]];
};

struct main0_in
{
    float3 aPos [[attribute(0)]];
    float2 aUV [[attribute(1)]];
    float aShade [[attribute(2)]];
};

vertex main0_out main0(main0_in in [[stage_in]], constant Globals& _26 [[buffer(0)]])
{
    main0_out out = {};
    out.vUV = in.aUV;
    out.vShade = in.aShade;
    float4 world = _26.uModel * float4(in.aPos, 1.0);
    out.vWorld = world.xyz;
    out.gl_Position = _26.uMVP * world;
    out.gl_Position.z = (out.gl_Position.z + out.gl_Position.w) * 0.5;
    return out;
}

