ElevationContourMaterial.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "#ifdef GL_OES_standard_derivatives\n\
  3. #extension GL_OES_standard_derivatives : enable\n\
  4. #endif\n\
  5. \n\
  6. uniform vec4 color;\n\
  7. uniform float spacing;\n\
  8. uniform float width;\n\
  9. \n\
  10. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  11. {\n\
  12. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  13. \n\
  14. float distanceToContour = mod(materialInput.height, spacing);\n\
  15. \n\
  16. #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n\
  17. float dxc = abs(dFdx(materialInput.height));\n\
  18. float dyc = abs(dFdy(materialInput.height));\n\
  19. float dF = max(dxc, dyc) * czm_pixelRatio * width;\n\
  20. float alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n\
  21. #else\n\
  22. // If no derivatives available (IE 10?), use pixel ratio\n\
  23. float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n\
  24. #endif\n\
  25. \n\
  26. vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\n\
  27. material.diffuse = outColor.rgb;\n\
  28. material.alpha = outColor.a;\n\
  29. \n\
  30. return material;\n\
  31. }\n\
  32. ";