AllMaterialAppearanceFS.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //This file is automatically rebuilt by the Cesium build process.
  2. /*global define*/
  3. define(function() {
  4. "use strict";
  5. return "varying vec3 v_positionEC;\n\
  6. varying vec3 v_normalEC;\n\
  7. varying vec3 v_tangentEC;\n\
  8. varying vec3 v_binormalEC;\n\
  9. varying vec2 v_st;\n\
  10. \n\
  11. void main()\n\
  12. {\n\
  13. vec3 positionToEyeEC = -v_positionEC; \n\
  14. mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_binormalEC);\n\
  15. \n\
  16. vec3 normalEC;\n\
  17. #ifdef FACE_FORWARD\n\
  18. normalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n\
  19. #else\n\
  20. normalEC = normalize(v_normalEC);\n\
  21. #endif\n\
  22. \n\
  23. czm_materialInput materialInput;\n\
  24. materialInput.normalEC = normalEC;\n\
  25. materialInput.tangentToEyeMatrix = tangentToEyeMatrix;\n\
  26. materialInput.positionToEyeEC = positionToEyeEC;\n\
  27. materialInput.st = v_st;\n\
  28. czm_material material = czm_getMaterial(materialInput);\n\
  29. \n\
  30. #ifdef FLAT \n\
  31. gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
  32. #else\n\
  33. gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\
  34. #endif\n\
  35. }\n\
  36. ";
  37. });