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

BufferPointMaterialVS.glsl 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifdef USE_FLOAT64
  2. in vec3 positionHigh;
  3. in vec3 positionLow;
  4. #else
  5. in vec3 position;
  6. #endif
  7. in vec4 pickColor;
  8. in vec4 showPixelSizeColorAlpha;
  9. in vec3 outlineWidthColorAlpha;
  10. out vec4 v_pickColor;
  11. out vec4 v_color;
  12. out vec4 v_outlineColor;
  13. out float v_innerRadiusFrac;
  14. void main()
  15. {
  16. // Unpack attributes.
  17. float show = showPixelSizeColorAlpha.x;
  18. float pixelSize = showPixelSizeColorAlpha.y;
  19. vec4 color = czm_decodeRGB8(showPixelSizeColorAlpha.z);
  20. float alpha = showPixelSizeColorAlpha.w;
  21. float outlineWidth = outlineWidthColorAlpha.x;
  22. vec4 outlineColor = czm_decodeRGB8(outlineWidthColorAlpha.y);
  23. float outlineAlpha = outlineWidthColorAlpha.z;
  24. ///////////////////////////////////////////////////////////////////////////
  25. float innerRadius = 0.5 * pixelSize * czm_pixelRatio;
  26. float outerRadius = (0.5 * pixelSize + outlineWidth) * czm_pixelRatio;
  27. ///////////////////////////////////////////////////////////////////////////
  28. #ifdef USE_FLOAT64
  29. vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
  30. vec4 positionEC = czm_modelViewRelativeToEye * p;
  31. #else
  32. vec4 positionEC = czm_modelView * vec4(position, 1.0);
  33. #endif
  34. ///////////////////////////////////////////////////////////////////////////
  35. gl_Position = czm_projection * positionEC;
  36. czm_vertexLogDepth();
  37. v_pickColor = pickColor / 255.0;
  38. v_color = color;
  39. v_color.a *= alpha * show;
  40. v_outlineColor = outlineColor;
  41. v_outlineColor.a *= outlineAlpha * show;
  42. v_innerRadiusFrac = innerRadius / outerRadius;
  43. gl_PointSize = 2.0 * outerRadius * show;
  44. gl_Position *= show;
  45. }