export declare const vertex_shader = "attribute highp float aVertexIndex;\nattribute highp float aTransformationIndex;\nattribute highp float aStyleIndex;\nattribute highp float aProduct;\nattribute highp vec2 aState;\nattribute highp vec2 aNormal;\n\n\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\n\n\nuniform vec4 uHighlightColour;\n\n\nuniform vec4 uHoverPickColour;\n\n\nuniform vec4 uXRayColour;\n\n\nuniform float uMeter;\n\n\nuniform vec3 uWcs;\n\n\n\nuniform int uColorCoding;\n\n\n\n\n\n\nuniform int uRenderingMode;\n\n\nuniform highp sampler2D uVertexSampler;\nuniform highp float uVertexTextureSize;\n\n\nuniform highp sampler2D uMatrixSampler;\nuniform highp float uMatrixTextureSize;\n\n\nuniform highp sampler2D uStyleSampler;\nuniform highp float uStyleTextureSize;\n\n\nuniform highp sampler2D uStateStyleSampler;\n\n\nvarying vec4 vColor;\n\nvarying vec3 vPosition;\n\nvarying vec3 vNormal;\n\nvarying mediump float vDiscard;\n\nconst float PI = 3.1415926535897932384626433832795;\n\nvec3 getNormal(mat4 transform) {\n float U = aNormal[0];\n float V = aNormal[1];\n float lon = U / 252.0 * 2.0 * PI;\n float lat = V / 252.0 * PI;\n\n float x = sin(lon) * sin(lat);\n float z = cos(lon) * sin(lat);\n float y = cos(lat);\n\n vec3 normal = vec3(x, y, z);\n if (aTransformationIndex < -0.5) {\n return normalize(normal);\n }\n\n \n \n \n \n mat3 normTrans = mat3(transform);\n\n return normalize(vec3(normTrans * normal));\n}\n\nvec4 getIdColor(float id) {\n float B = floor(id / (256.0*256.0));\n float G = floor((id - B * 256.0*256.0) / 256.0);\n float R = mod(id, 256.0);\n \n \n\n return vec4(R / 255.0, G / 255.0, B / 255.0, 1.0);\n}\n\nvec2 getTextureCoordinates(float index, float size)\n{\n float x = floor(mod(index + 0.5, size)); \n float y = floor((index + 0.5)/ size); \n \n return vec2((x + 0.5) / size, (y + 0.5) / size);\n}\n\n\nvec4 getColor() { \n \n float restyle = aState[1];\n if (restyle > 224.5) {\n vec2 coords = getTextureCoordinates(aStyleIndex, uStyleTextureSize);\n vec4 col = texture2D(uStyleSampler, coords);\n \n \n if (uRenderingMode == 1) {\n float intensity = (col.r + col.g + col.b) / 3.0;\n return vec4(intensity, intensity, intensity, col.a);\n }\n\n \n return col;\n }\n\n \n \n vec2 coords = getTextureCoordinates(restyle, 15.0);\n vec4 col2 = texture2D(uStateStyleSampler, coords);\n\n \n if (uRenderingMode == 1) {\n float intensity = (col2.r + col2.g + col2.b) / 3.0;\n return vec4(intensity, intensity, intensity, col2.a);\n }\n\n return col2;\n}\n\nvec4 getVertexPosition(mat4 transform) {\n vec2 coords = getTextureCoordinates(aVertexIndex, uVertexTextureSize);\n vec3 point = vec3(texture2D(uVertexSampler, coords));\n\n if (aTransformationIndex < -0.5) {\n return vec4(point, 1.0);\n }\n\n return transform * vec4(point, 1.0);\n}\n\nmat4 getTransform() {\n if (aTransformationIndex < -0.5) {\n return mat4(1.0);\n }\n\n float tIndex = aTransformationIndex * 4.0;\n\n \n vec2 c1 = getTextureCoordinates(tIndex, uMatrixTextureSize);\n vec2 c2 = getTextureCoordinates(tIndex + 1.0, uMatrixTextureSize);\n vec2 c3 = getTextureCoordinates(tIndex + 2.0, uMatrixTextureSize);\n vec2 c4 = getTextureCoordinates(tIndex + 3.0, uMatrixTextureSize);\n\n \n vec4 v1 = texture2D(uMatrixSampler, c1);\n vec4 v2 = texture2D(uMatrixSampler, c2);\n vec4 v3 = texture2D(uMatrixSampler, c3);\n vec4 v4 = texture2D(uMatrixSampler, c4);\n\n \n return mat4(v1, v2, v3, v4);\n}\n\nvoid main(void) {\n int state = int(floor(aState[0] + 0.5));\n vDiscard = 0.0;\n\n if (state == 254 || \n (uColorCoding == -1 && state == 251) || \n (uColorCoding == -1 && (\n (uRenderingMode == 2 && state != 253 && state != 252 && state != 250) || \n (uRenderingMode == 3 && (state == 253 || state == 252 || state == 250))) \n ))\n {\n vDiscard = 1.0;\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n vNormal = vec3(0.0, 0.0, 0.0);\n vPosition = vec3(0.0, 0.0, 0.0);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n \n mat4 w = mat4(1.0);\n w[3] = w[3] + vec4(uWcs, 0.0);\n\n \n mat4 transform = getTransform();\n vPosition = vec3(w * getVertexPosition(transform));\n vNormal = getNormal(transform);\n\n \n vec4 baseColor = getColor();\n\n \n if (baseColor.a < 0.98)\n {\n float correction = -0.002;\n if (uColorCoding == -2 || uColorCoding >= 0) {\n correction = -0.02;\n }\n vec3 trans = correction * uMeter * normalize(vNormal);\n vPosition = vPosition + trans;\n }\n\n \n if (uColorCoding == -2) {\n float id = floor(aProduct + 0.5);\n vColor = getIdColor(id);\n vNormal = vec3(0.0, 0.0, 0.0);\n }\n \n else if (uColorCoding >= 0) {\n float id = float(uColorCoding);\n vColor = getIdColor(id);\n vNormal = vec3(0.0, 0.0, 0.0);\n }\n \n else {\n \n \n \n if (state == 250) {\n baseColor = uHoverPickColour;\n }\n else if (state == 253) {\n baseColor = uHighlightColour;\n }\n \n else if (uRenderingMode == 2 || uRenderingMode == 3) {\n \n if (state == 252) { \n baseColor = getColor();\n }\n \n else {\n baseColor = vec4(0.0, 0.0, 0.3, 0.5); \n }\n }\n\n \n vColor = baseColor;\n }\n\n \n gl_Position = uPMatrix * uMVMatrix * vec4(vPosition, 1.0);\n}";