TexturedMaterialAppearanceFS.js 937 B

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