AllMaterialAppearanceFS.js 983 B

123456789101112131415161718192021222324252627
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "varying vec3 v_positionEC;\n\
  3. varying vec3 v_normalEC;\n\
  4. varying vec3 v_tangentEC;\n\
  5. varying vec3 v_bitangentEC;\n\
  6. varying vec2 v_st;\n\
  7. void main()\n\
  8. {\n\
  9. vec3 positionToEyeEC = -v_positionEC;\n\
  10. mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\n\
  11. vec3 normalEC = normalize(v_normalEC);\n\
  12. #ifdef FACE_FORWARD\n\
  13. normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
  14. #endif\n\
  15. czm_materialInput materialInput;\n\
  16. materialInput.normalEC = normalEC;\n\
  17. materialInput.tangentToEyeMatrix = tangentToEyeMatrix;\n\
  18. materialInput.positionToEyeEC = positionToEyeEC;\n\
  19. materialInput.st = v_st;\n\
  20. czm_material material = czm_getMaterial(materialInput);\n\
  21. #ifdef FLAT\n\
  22. gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
  23. #else\n\
  24. gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\
  25. #endif\n\
  26. }\n\
  27. ";