27 lines
857 B
GLSL
27 lines
857 B
GLSL
uniform vec4 color;
|
|
uniform float spacing;
|
|
uniform float width;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
float distanceToContour = mod(materialInput.height, spacing);
|
|
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
float dxc = abs(dFdx(materialInput.height));
|
|
float dyc = abs(dFdy(materialInput.height));
|
|
float dF = max(dxc, dyc) * czm_pixelRatio * width;
|
|
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
|
|
#else
|
|
// If no derivatives available (IE 10?), use pixel ratio
|
|
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
|
|
#endif
|
|
|
|
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
|
|
material.diffuse = outColor.rgb;
|
|
material.alpha = outColor.a;
|
|
|
|
return material;
|
|
}
|