StripeMaterial.js 992 B

1234567891011121314151617181920212223242526272829
  1. //This file is automatically rebuilt by the Cesium build process.
  2. /*global define*/
  3. define(function() {
  4. "use strict";
  5. return "uniform vec4 evenColor;\n\
  6. uniform vec4 oddColor;\n\
  7. uniform float offset;\n\
  8. uniform float repeat;\n\
  9. uniform bool horizontal;\n\
  10. \n\
  11. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  12. {\n\
  13. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  14. \n\
  15. // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)\n\
  16. float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\n\
  17. float value = fract((coord - offset) * (repeat * 0.5));\n\
  18. float dist = min(value, min(abs(value - 0.5), 1.0 - value));\n\
  19. \n\
  20. vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\n\
  21. vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\n\
  22. \n\
  23. material.diffuse = color.rgb;\n\
  24. material.alpha = color.a;\n\
  25. \n\
  26. return material;\n\
  27. }\n\
  28. ";
  29. });