BasicMaterialAppearanceFS.js 883 B

12345678910111213141516171819202122232425262728293031
  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. \n\
  8. void main()\n\
  9. {\n\
  10. vec3 positionToEyeEC = -v_positionEC; \n\
  11. \n\
  12. vec3 normalEC;\n\
  13. #ifdef FACE_FORWARD\n\
  14. normalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n\
  15. #else\n\
  16. normalEC = normalize(v_normalEC);\n\
  17. #endif\n\
  18. \n\
  19. czm_materialInput materialInput;\n\
  20. materialInput.normalEC = normalEC;\n\
  21. materialInput.positionToEyeEC = positionToEyeEC;\n\
  22. czm_material material = czm_getMaterial(materialInput);\n\
  23. \n\
  24. #ifdef FLAT \n\
  25. gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
  26. #else\n\
  27. gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\
  28. #endif\n\
  29. }\n\
  30. ";
  31. });