/**
 * NOTE: This file is autogenerated. Do not edit.
 */
export const customDepthShader = {
    vertex: (options) => /* glsl */ `
        
        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;
        }`,
    fragment: (options) => /* glsl */ `
        
        precision highp float;
        precision highp int;
        
        in float vColorPixelIndex;
        in vec2 vUV;
        
        #ifndef nonLinearDepth
            in float vDepthMetric;
        #endif
        
        #ifdef requiresWorldFragment
            in vec3 vPositionW;
        #endif
        
        uniform sampler2D diffuseSampler;
        #ifdef isBabylonMesh
            uniform float babylonMeshAlpha;
        #else
            uniform sampler2D propertiesSampler;
        #endif
        
        uniform vec3 size;
        // #typescript options?.clipPlaneUniforms()
        ${options?.clipPlaneUniforms()}
        
        void main(void) {
        
            ivec2 textureSize = textureSize(diffuseSampler, 0);
            float colorPixelIndex = vColorPixelIndex + 0.5;
            float uvY = floor(colorPixelIndex / float(textureSize.x));
            float uvX = floor(floor(colorPixelIndex) - uvY * float(textureSize.x));
            vec2 pixelIndex = vec2(uvX, uvY);
        
            #ifndef isBabylonMesh
                // #include PropertiesPixel.glsl
        vec4 properties = texelFetch(propertiesSampler, ivec2(floor(pixelIndex)), 0);
        
        int castedA = int(ceil(clamp(properties.a, 0., 1.) * 255.0));
        #ifdef depthWriteIgnoresVisibilityProperty
            int lastBitMask = 1; // Depth write bit
            int depthWriteIgnoresVisibilityValue = castedA & lastBitMask;
            bool depthWriteIgnoresVisibility = depthWriteIgnoresVisibilityValue == lastBitMask;
        #endif
        
        #ifdef visibilityProperty
            int secondLastBitMask = 2; // Visibility bit
            int visibilityValue = castedA & secondLastBitMask;
            bool visible = visibilityValue == secondLastBitMask;
        #endif
        
        #ifdef highlightProperty
            int fourthAndThirdLastBitsMask = 12; // Highlight bits
            int highlightIndex = (castedA & fourthAndThirdLastBitsMask) >> 2; // Move 2 bits right to get 0-3 range
            bool highlighted = highlightIndex != 0;
        #endif
        
        #ifdef outlinedProperty
            int fifthBitMask = 16; // Outline bit
            int outlinedValue = castedA & fifthBitMask;
            bool outlined = outlinedValue == fifthBitMask;
        #endif
        
        #ifdef ignoreClipPlanesProperty
            int sixthBitMask = 32; // Clip plane ignore bit
            int clipPlaneIgnoreValue = castedA & sixthBitMask;
            bool clipPlaneIgnore = clipPlaneIgnoreValue == sixthBitMask;
        #endif
        
            #endif
        
            #ifdef discardDitherTransparent
                float alpha = texelFetch(diffuseSampler, ivec2(pixelIndex), 0).a;
        
                #ifndef isBabylonMesh
                    if (abs(alpha - 1.0) > 0.0001) {
                        discard;
                    }
                #endif
            #endif
        
            #ifdef isBabylonMesh
                if(babylonMeshAlpha < 0.001) {
                    discard;
                }
            #else
                if (!visible && !depthWriteIgnoresVisibility) {
                    discard;
                }
            #endif
        
            #ifdef requiresWorldFragment
                vec3 worldSpaceVertex = vPositionW;
        
                // #typescript options?.clipPlaneDiscarding()
        ${options?.clipPlaneDiscarding()}
            #endif
            float depthValue;
            #ifdef nonLinearDepth
                depthValue = gl_FragCoord.z;
            #else
                depthValue = vDepthMetric;
            #endif
        
            gl_FragColor = vec4(depthValue, 0, 0, 0);
        }`
};
//# sourceMappingURL=CustomDepthShader.js.map