
precision highp float;

attribute vec3 position;
attribute vec2 uv;

out float vColorPixelIndex;
out vec2 vUV;

#ifdef requiresWorldFragment
    out vec3 vPositionW;
    uniform mat4 worldMatrix;
    uniform mat4 viewProjectionMatrix;
#else
    uniform mat4 worldViewProjectionMatrix_custom;
#endif

#ifndef nonLinearDepth
    uniform vec2 depthValues;
    out float vDepthMetric;
#endif

uniform vec3 size;

void main(void) {
    #ifdef requiresWorldFragment
        vec4 worldPos = worldMatrix * vec4(position, 1.0);
        vPositionW = worldPos.xyz;
        gl_Position = viewProjectionMatrix * worldPos;
    #else
        gl_Position = worldViewProjectionMatrix_custom * vec4(position, 1.0);
    #endif
    
    #ifndef nonLinearDepth
        vDepthMetric = ((gl_Position.z + depthValues.x) / (depthValues.y));
    #endif
    
    vColorPixelIndex = uv.x;
    vUV = uv;
}