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

using namespace metal;

struct Globals
{
    float4x4 uProj;
    float uLayer;
    float uShade;
    float4 uTint;
};

struct main0_out
{
    float4 FragColor [[color(0)]];
};

struct main0_in
{
    float2 vUV [[user(locn0)]];
};

fragment main0_out main0(main0_in in [[stage_in]], constant Globals& _22 [[buffer(0)]], texture2d_array<float> uAtlas [[texture(0)]], sampler uAtlasSmplr [[sampler(0)]])
{
    main0_out out = {};
    float3 _31 = float3(in.vUV, _22.uLayer);
    float4 t = uAtlas.sample(uAtlasSmplr, _31.xy, uint(rint(_31.z)));
    if (t.w < 0.0199999995529651641845703125)
    {
        discard_fragment();
    }
    out.FragColor = float4((t.xyz * _22.uShade) * _22.uTint.xyz, t.w * _22.uTint.w);
    return out;
}

