EllipsoidSurfaceAppearanceFS.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "in vec3 v_positionMC;\n\
  3. in vec3 v_positionEC;\n\
  4. in vec2 v_st;\n\
  5. \n\
  6. void main()\n\
  7. {\n\
  8. czm_materialInput materialInput;\n\
  9. \n\
  10. vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n\
  11. #ifdef FACE_FORWARD\n\
  12. normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
  13. #endif\n\
  14. \n\
  15. materialInput.s = v_st.s;\n\
  16. materialInput.st = v_st;\n\
  17. materialInput.str = vec3(v_st, 0.0);\n\
  18. \n\
  19. // Convert tangent space material normal to eye space\n\
  20. materialInput.normalEC = normalEC;\n\
  21. materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n\
  22. \n\
  23. // Convert view vector to world space\n\
  24. vec3 positionToEyeEC = -v_positionEC;\n\
  25. materialInput.positionToEyeEC = positionToEyeEC;\n\
  26. \n\
  27. czm_material material = czm_getMaterial(materialInput);\n\
  28. \n\
  29. #ifdef FLAT\n\
  30. out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
  31. #else\n\
  32. out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
  33. #endif\n\
  34. }\n\
  35. ";