#version 400



float depthmult=20.0f;
float depthmax=19.3872f;

varying vec2 texCoord;

uniform sampler2D colorMap;
varying vec4 vpos;





void main (void)
{








    
    
    


    

    

    
    float x=vpos.z/vpos.w*depthmult-depthmax;

    float depth=x;
    double x2=depth*(65536*256);
    double r2=floor(x2/(65536)); x2=x2-r2*(65536);
    double g2=floor(x2/(256)); x2=x2-g2*(256);
    double b2=floor(x2/(1)); x2=x2-b2*(1);
    
    float r1=float(r2/256.0f);
    float g1=float(g2/256.0f);
    float b1=float(b2/256.0f);
    

    gl_FragColor = vec4(r1,g1,b1,1.0f);





}






