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

using namespace metal;

struct type_LightBuffer
{
    float4 uDiffuseColor;
    float3 uLightDirection;
    float4 uLightColor;
};

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

struct main0_in
{
    float2 in_var_TEXCOORD0 [[user(locn0)]];
    float3 in_var_NORMAL [[user(locn1)]];
};

fragment main0_out main0(main0_in in [[stage_in]], constant type_LightBuffer& LightBuffer [[buffer(0)]], texture2d<float> uDiffuseTexture [[texture(0)]], sampler samplerState [[sampler(0)]])
{
    main0_out out = {};
    out.out_var_SV_TARGET = uDiffuseTexture.sample(samplerState, in.in_var_TEXCOORD0) * (LightBuffer.uLightColor * fast::clamp(dot(fast::normalize(in.in_var_NORMAL), -LightBuffer.uLightDirection), 0.0, 1.0));
    return out;
}

