AllMaterialAppearanceFS.js 1.0 KB

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