GlobeFSPole.glsl 873 B

1234567891011121314151617181920212223242526272829
  1. uniform vec3 u_color;
  2. varying vec2 v_textureCoordinates;
  3. void main()
  4. {
  5. // TODO: make arbitrary ellipsoid
  6. czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();
  7. vec3 direction = normalize(czm_windowToEyeCoordinates(gl_FragCoord).xyz);
  8. czm_ray ray = czm_ray(vec3(0.0), direction);
  9. czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);
  10. if (!czm_isEmpty(intersection))
  11. {
  12. vec3 positionEC = czm_pointAlongRay(ray, intersection.start);
  13. vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;
  14. vec3 normalMC = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), vec3(1.0)));
  15. vec3 normalEC = normalize(czm_normal * normalMC);
  16. vec3 startDayColor = u_color;
  17. gl_FragColor = vec4(startDayColor, 1.0);
  18. }
  19. else
  20. {
  21. discard;
  22. }
  23. }