UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

3 lines (2 loc) 1.11 kB
declare const _default: "#version 300 es\n#define SHADER_NAME raster-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\n\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = vTexCoord;\n vec4 image;\n DECKGL_CREATE_COLOR(image, vTexCoord);\n\n DECKGL_MUTATE_COLOR(image, vTexCoord);\n\n vec3 normal;\n if (flatShading) {\n\n// This is necessary because\n// headless.gl reports the extension as\n// available but does not support it in\n// the shader.\n#ifdef DERIVATIVES_AVAILABLE\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n normal = vec3(0.0, 0.0, 1.0);\n#endif\n } else {\n normal = normals_commonspace;\n }\n\n vec3 lightColor = lighting_getLightColor(image.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, opacity);\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n"; export default _default;