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

using namespace metal;

struct Globals
{
    float4x4 uMVP;
    float uSize;
};

struct main0_out
{
    float3 vColor [[user(locn0)]];
    float4 gl_Position [[position]];
    float gl_PointSize [[point_size]];
};

struct main0_in
{
    float3 aPos [[attribute(0)]];
    float3 aColor [[attribute(1)]];
};

vertex main0_out main0(main0_in in [[stage_in]], constant Globals& _19 [[buffer(0)]])
{
    main0_out out = {};
    out.vColor = in.aColor;
    float4 clip = _19.uMVP * float4(in.aPos, 1.0);
    out.gl_Position = clip;
    out.gl_PointSize = fast::clamp(_19.uSize / fast::max(clip.w, 0.100000001490116119384765625), 2.0, 24.0);
    out.gl_Position.z = (out.gl_Position.z + out.gl_Position.w) * 0.5;
    return out;
}

