智慧水务管理系统 - 精河县供水工程综合管理平台

PointPrimitiveCollectionFS.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "in vec4 v_color;\n\
  3. in vec4 v_outlineColor;\n\
  4. in float v_innerPercent;\n\
  5. in float v_pixelDistance;\n\
  6. in vec4 v_pickColor;\n\
  7. in float v_splitDirection;\n\
  8. \n\
  9. void main()\n\
  10. {\n\
  11. if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;\n\
  12. if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;\n\
  13. \n\
  14. // The distance in UV space from this fragment to the center of the point, at most 0.5.\n\
  15. float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n\
  16. // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n\
  17. float maxDistance = max(0.0, 0.5 - v_pixelDistance);\n\
  18. float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\n\
  19. float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\n\
  20. \n\
  21. vec4 color = mix(v_outlineColor, v_color, innerAlpha);\n\
  22. color.a *= wholeAlpha;\n\
  23. \n\
  24. // Fully transparent parts of the billboard are not pickable.\n\
  25. #if !defined(OPAQUE) && !defined(TRANSLUCENT)\n\
  26. if (color.a < 0.005) // matches 0/255 and 1/255\n\
  27. {\n\
  28. discard;\n\
  29. }\n\
  30. #else\n\
  31. // The billboard is rendered twice. The opaque pass discards translucent fragments\n\
  32. // and the translucent pass discards opaque fragments.\n\
  33. #ifdef OPAQUE\n\
  34. if (color.a < 0.995) // matches < 254/255\n\
  35. {\n\
  36. discard;\n\
  37. }\n\
  38. #else\n\
  39. if (color.a >= 0.995) // matches 254/255 and 255/255\n\
  40. {\n\
  41. discard;\n\
  42. }\n\
  43. #endif\n\
  44. #endif\n\
  45. \n\
  46. out_FragColor = czm_gammaCorrect(color);\n\
  47. czm_writeLogDepth();\n\
  48. }\n\
  49. ";