PolylineOutlineMaterial.js 932 B

1234567891011121314151617181920212223
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "uniform vec4 color;\n\
  3. uniform vec4 outlineColor;\n\
  4. uniform float outlineWidth;\n\
  5. varying float v_width;\n\
  6. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  7. {\n\
  8. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  9. vec2 st = materialInput.st;\n\
  10. float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\n\
  11. float b = step(0.5 - halfInteriorWidth, st.t);\n\
  12. b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\n\
  13. float d1 = abs(st.t - (0.5 - halfInteriorWidth));\n\
  14. float d2 = abs(st.t - (0.5 + halfInteriorWidth));\n\
  15. float dist = min(d1, d2);\n\
  16. vec4 currentColor = mix(outlineColor, color, b);\n\
  17. vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\n\
  18. outColor = czm_gammaCorrect(outColor);\n\
  19. material.diffuse = outColor.rgb;\n\
  20. material.alpha = outColor.a;\n\
  21. return material;\n\
  22. }\n\
  23. ";