CheckerboardMaterial.js 932 B

12345678910111213141516171819202122
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "uniform vec4 lightColor;\n\
  3. uniform vec4 darkColor;\n\
  4. uniform vec2 repeat;\n\
  5. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  6. {\n\
  7. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  8. vec2 st = materialInput.st;\n\
  9. float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\n\
  10. float scaledWidth = fract(repeat.s * st.s);\n\
  11. scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\n\
  12. float scaledHeight = fract(repeat.t * st.t);\n\
  13. scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\n\
  14. float value = min(scaledWidth, scaledHeight);\n\
  15. vec4 currentColor = mix(lightColor, darkColor, b);\n\
  16. vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\n\
  17. color = czm_gammaCorrect(color);\n\
  18. material.diffuse = color.rgb;\n\
  19. material.alpha = color.a;\n\
  20. return material;\n\
  21. }\n\
  22. ";