EllipsoidSurfaceAppearanceFS.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_positionMC;\n\
  6. varying vec3 v_positionEC;\n\
  7. varying vec2 v_st;\n\
  8. \n\
  9. void main()\n\
  10. {\n\
  11. czm_materialInput materialInput;\n\
  12. \n\
  13. vec3 normalEC = czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\n\
  14. #ifdef FACE_FORWARD\n\
  15. normalEC = normalize(faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC));\n\
  16. #else\n\
  17. normalEC = normalize(normalEC);\n\
  18. #endif\n\
  19. \n\
  20. materialInput.s = v_st.s;\n\
  21. materialInput.st = v_st;\n\
  22. materialInput.str = vec3(v_st, 0.0);\n\
  23. \n\
  24. // Convert tangent space material normal to eye space\n\
  25. materialInput.normalEC = normalEC;\n\
  26. materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n\
  27. \n\
  28. // Convert view vector to world space\n\
  29. vec3 positionToEyeEC = -v_positionEC; \n\
  30. materialInput.positionToEyeEC = positionToEyeEC;\n\
  31. \n\
  32. czm_material material = czm_getMaterial(materialInput);\n\
  33. \n\
  34. #ifdef FLAT \n\
  35. gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
  36. #else\n\
  37. gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\
  38. #endif\n\
  39. }\n\
  40. ";
  41. });