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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "#ifdef QUANTIZATION_BITS12\n\
  3. in vec4 compressed0;\n\
  4. in float compressed1;\n\
  5. #else\n\
  6. in vec4 position3DAndHeight;\n\
  7. in vec4 textureCoordAndEncodedNormals;\n\
  8. #endif\n\
  9. \n\
  10. #ifdef GEODETIC_SURFACE_NORMALS\n\
  11. in vec3 geodeticSurfaceNormal;\n\
  12. #endif\n\
  13. \n\
  14. #ifdef EXAGGERATION\n\
  15. uniform vec2 u_verticalExaggerationAndRelativeHeight;\n\
  16. #endif\n\
  17. \n\
  18. uniform vec3 u_center3D;\n\
  19. uniform mat4 u_modifiedModelView;\n\
  20. uniform mat4 u_modifiedModelViewProjection;\n\
  21. uniform vec4 u_tileRectangle;\n\
  22. \n\
  23. // Uniforms for 2D Mercator projection\n\
  24. uniform vec2 u_southAndNorthLatitude;\n\
  25. uniform vec2 u_southMercatorYAndOneOverHeight;\n\
  26. \n\
  27. out vec3 v_positionMC;\n\
  28. out vec3 v_positionEC;\n\
  29. \n\
  30. out vec3 v_textureCoordinates;\n\
  31. out vec3 v_normalMC;\n\
  32. out vec3 v_normalEC;\n\
  33. \n\
  34. #ifdef APPLY_MATERIAL\n\
  35. out float v_slope;\n\
  36. out float v_aspect;\n\
  37. out float v_height;\n\
  38. #endif\n\
  39. \n\
  40. #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\n\
  41. out float v_distance;\n\
  42. #endif\n\
  43. \n\
  44. #if defined(FOG) || defined(GROUND_ATMOSPHERE)\n\
  45. out vec3 v_atmosphereRayleighColor;\n\
  46. out vec3 v_atmosphereMieColor;\n\
  47. out float v_atmosphereOpacity;\n\
  48. #endif\n\
  49. \n\
  50. #ifdef ENABLE_CLIPPING_POLYGONS\n\
  51. uniform highp sampler2D u_clippingExtents;\n\
  52. out vec2 v_clippingPosition;\n\
  53. flat out int v_regionIndex;\n\
  54. #endif\n\
  55. \n\
  56. // These functions are generated at runtime.\n\
  57. vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\n\
  58. float get2DYPositionFraction(vec2 textureCoordinates);\n\
  59. \n\
  60. vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n\
  61. {\n\
  62. return u_modifiedModelViewProjection * vec4(position, 1.0);\n\
  63. }\n\
  64. \n\
  65. float get2DMercatorYPositionFraction(vec2 textureCoordinates)\n\
  66. {\n\
  67. // The width of a tile at level 11, in radians and assuming a single root tile, is\n\
  68. // 2.0 * czm_pi / pow(2.0, 11.0)\n\
  69. // We want to just linearly interpolate the 2D position from the texture coordinates\n\
  70. // when we're at this level or higher. The constant below is the expression\n\
  71. // above evaluated and then rounded up at the 4th significant digit.\n\
  72. const float maxTileWidth = 0.003068;\n\
  73. float positionFraction = textureCoordinates.y;\n\
  74. float southLatitude = u_southAndNorthLatitude.x;\n\
  75. float northLatitude = u_southAndNorthLatitude.y;\n\
  76. if (northLatitude - southLatitude > maxTileWidth)\n\
  77. {\n\
  78. float southMercatorY = u_southMercatorYAndOneOverHeight.x;\n\
  79. float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\n\
  80. \n\
  81. float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\n\
  82. currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\n\
  83. positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n\
  84. }\n\
  85. return positionFraction;\n\
  86. }\n\
  87. \n\
  88. float get2DGeographicYPositionFraction(vec2 textureCoordinates)\n\
  89. {\n\
  90. return textureCoordinates.y;\n\
  91. }\n\
  92. \n\
  93. vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n\
  94. {\n\
  95. float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\
  96. vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\
  97. return u_modifiedModelViewProjection * rtcPosition2D;\n\
  98. }\n\
  99. \n\
  100. vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n\
  101. {\n\
  102. return getPositionPlanarEarth(position, 0.0, textureCoordinates);\n\
  103. }\n\
  104. \n\
  105. vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n\
  106. {\n\
  107. return getPositionPlanarEarth(position, height, textureCoordinates);\n\
  108. }\n\
  109. \n\
  110. vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n\
  111. {\n\
  112. // We do not do RTC while morphing, so there is potential for jitter.\n\
  113. // This is unlikely to be noticeable, though.\n\
  114. vec3 position3DWC = position + u_center3D;\n\
  115. float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\
  116. vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\
  117. vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n\
  118. vec4 morphPositionEC = czm_modelView * morphPosition;\n\
  119. return czm_projection * morphPositionEC;\n\
  120. }\n\
  121. \n\
  122. #ifdef QUANTIZATION_BITS12\n\
  123. uniform vec2 u_minMaxHeight;\n\
  124. uniform mat4 u_scaleAndBias;\n\
  125. #endif\n\
  126. \n\
  127. void main()\n\
  128. {\n\
  129. #ifdef QUANTIZATION_BITS12\n\
  130. vec2 xy = czm_decompressTextureCoordinates(compressed0.x);\n\
  131. vec2 zh = czm_decompressTextureCoordinates(compressed0.y);\n\
  132. vec3 position = vec3(xy, zh.x);\n\
  133. float height = zh.y;\n\
  134. vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\n\
  135. \n\
  136. height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\n\
  137. position = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n\
  138. \n\
  139. #if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y) || defined(APPLY_MATERIAL)\n\
  140. float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\
  141. float encodedNormal = compressed1;\n\
  142. #elif defined(INCLUDE_WEB_MERCATOR_Y)\n\
  143. float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\
  144. float encodedNormal = 0.0;\n\
  145. #elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\
  146. float webMercatorT = textureCoordinates.y;\n\
  147. float encodedNormal = compressed0.w;\n\
  148. #else\n\
  149. float webMercatorT = textureCoordinates.y;\n\
  150. float encodedNormal = 0.0;\n\
  151. #endif\n\
  152. \n\
  153. #else\n\
  154. // A single float per element\n\
  155. vec3 position = position3DAndHeight.xyz;\n\
  156. float height = position3DAndHeight.w;\n\
  157. vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n\
  158. \n\
  159. #if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n\
  160. float webMercatorT = textureCoordAndEncodedNormals.z;\n\
  161. float encodedNormal = textureCoordAndEncodedNormals.w;\n\
  162. #elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\
  163. float webMercatorT = textureCoordinates.y;\n\
  164. float encodedNormal = textureCoordAndEncodedNormals.z;\n\
  165. #elif defined(INCLUDE_WEB_MERCATOR_Y)\n\
  166. float webMercatorT = textureCoordAndEncodedNormals.z;\n\
  167. float encodedNormal = 0.0;\n\
  168. #else\n\
  169. float webMercatorT = textureCoordinates.y;\n\
  170. float encodedNormal = 0.0;\n\
  171. #endif\n\
  172. \n\
  173. #endif\n\
  174. \n\
  175. vec3 position3DWC = position + u_center3D;\n\
  176. \n\
  177. #ifdef GEODETIC_SURFACE_NORMALS\n\
  178. vec3 ellipsoidNormal = geodeticSurfaceNormal;\n\
  179. #else\n\
  180. vec3 ellipsoidNormal = normalize(position3DWC);\n\
  181. #endif\n\
  182. \n\
  183. #if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n\
  184. float exaggeration = u_verticalExaggerationAndRelativeHeight.x;\n\
  185. float relativeHeight = u_verticalExaggerationAndRelativeHeight.y;\n\
  186. float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\n\
  187. \n\
  188. // stop from going through center of earth\n\
  189. float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\n\
  190. newHeight = max(newHeight, -minRadius);\n\
  191. \n\
  192. vec3 offset = ellipsoidNormal * (newHeight - height);\n\
  193. position += offset;\n\
  194. position3DWC += offset;\n\
  195. height = newHeight;\n\
  196. #endif\n\
  197. \n\
  198. gl_Position = getPosition(position, height, textureCoordinates);\n\
  199. \n\
  200. v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n\
  201. v_positionMC = position3DWC; // position in model coordinates\n\
  202. \n\
  203. v_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n\
  204. \n\
  205. #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\
  206. vec3 normalMC = czm_octDecode(encodedNormal);\n\
  207. \n\
  208. #if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n\
  209. vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\n\
  210. vec3 rejection = normalMC - projection;\n\
  211. normalMC = normalize(projection + rejection * exaggeration);\n\
  212. #endif\n\
  213. \n\
  214. v_normalMC = normalMC;\n\
  215. v_normalEC = czm_normal3D * v_normalMC;\n\
  216. #endif\n\
  217. \n\
  218. #ifdef ENABLE_CLIPPING_POLYGONS\n\
  219. vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC);\n\
  220. sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\n\
  221. \n\
  222. vec2 minDistance = vec2(czm_infinity);\n\
  223. v_clippingPosition = vec2(czm_infinity);\n\
  224. v_regionIndex = -1;\n\
  225. \n\
  226. for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {\n\
  227. vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex);\n\
  228. vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;\n\
  229. \n\
  230. vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));\n\
  231. vec2 distance = abs(rectUv - clamped) * extents.wz;\n\
  232. \n\
  233. float threshold = 0.01;\n\
  234. if (minDistance.x > distance.x || minDistance.y > distance.y) {\n\
  235. minDistance = distance;\n\
  236. v_clippingPosition = rectUv;\n\
  237. if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {\n\
  238. v_regionIndex = regionIndex;\n\
  239. }\n\
  240. }\n\
  241. }\n\
  242. #endif\n\
  243. \n\
  244. #if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))\n\
  245. \n\
  246. bool dynamicLighting = false;\n\
  247. \n\
  248. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\n\
  249. dynamicLighting = true;\n\
  250. #endif\n\
  251. \n\
  252. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\n\
  253. vec3 atmosphereLightDirection = czm_sunDirectionWC;\n\
  254. #else\n\
  255. vec3 atmosphereLightDirection = czm_lightDirectionWC;\n\
  256. #endif\n\
  257. \n\
  258. vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));\n\
  259. \n\
  260. computeAtmosphereScattering(\n\
  261. position3DWC,\n\
  262. lightDirection,\n\
  263. v_atmosphereRayleighColor,\n\
  264. v_atmosphereMieColor,\n\
  265. v_atmosphereOpacity\n\
  266. );\n\
  267. #endif\n\
  268. \n\
  269. #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\n\
  270. v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n\
  271. #endif\n\
  272. \n\
  273. #ifdef APPLY_MATERIAL\n\
  274. float northPoleZ = czm_ellipsoidRadii.z;\n\
  275. vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\n\
  276. vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\n\
  277. float dotProd = abs(dot(ellipsoidNormal, v_normalMC));\n\
  278. v_slope = acos(dotProd);\n\
  279. vec3 normalRejected = ellipsoidNormal * dotProd;\n\
  280. vec3 normalProjected = v_normalMC - normalRejected;\n\
  281. vec3 aspectVector = normalize(normalProjected);\n\
  282. v_aspect = acos(dot(aspectVector, vectorEastMC));\n\
  283. float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\n\
  284. v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\n\
  285. v_height = height;\n\
  286. #endif\n\
  287. }\n\
  288. ";