DepthPlaneFS.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "varying vec4 positionEC;\n\
  3. \n\
  4. void main()\n\
  5. {\n\
  6. vec3 position;\n\
  7. vec3 direction;\n\
  8. if (czm_orthographicIn3D == 1.0)\n\
  9. {\n\
  10. vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\n\
  11. vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom\n\
  12. vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top\n\
  13. position = vec3(mix(minPlane, maxPlane, uv), 0.0);\n\
  14. direction = vec3(0.0, 0.0, -1.0);\n\
  15. } \n\
  16. else \n\
  17. {\n\
  18. position = vec3(0.0);\n\
  19. direction = normalize(positionEC.xyz);\n\
  20. }\n\
  21. \n\
  22. czm_ray ray = czm_ray(position, direction);\n\
  23. \n\
  24. vec3 ellipsoid_center = czm_view[3].xyz;\n\
  25. \n\
  26. czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\n\
  27. if (!czm_isEmpty(intersection))\n\
  28. {\n\
  29. gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n\
  30. }\n\
  31. else\n\
  32. {\n\
  33. discard;\n\
  34. }\n\
  35. \n\
  36. czm_writeLogDepth();\n\
  37. }\n\
  38. ";