gm-builds 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +59 -0
  2. package/dist/gm.min.css +1 -0
  3. package/dist/gm.min.js +16269 -0
  4. package/dist/gm.module.js +32 -0
  5. package/dist/index.js +16267 -0
  6. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
  7. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
  8. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
  9. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
  10. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
  11. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
  12. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
  13. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
  14. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
  15. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
  16. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
  17. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
  18. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
  19. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
  20. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
  21. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
  22. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
  23. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
  24. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
  25. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
  26. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
  27. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
  28. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
  29. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
  30. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
  31. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
  32. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
  33. package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
  34. package/dist/resources/Assets/Images/bing_maps_credit.png +0 -0
  35. package/dist/resources/Assets/Images/cesium_credit.png +0 -0
  36. package/dist/resources/Assets/Images/google_earth_credit.png +0 -0
  37. package/dist/resources/Assets/Images/ion-credit.png +0 -0
  38. package/dist/resources/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
  39. package/dist/resources/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
  40. package/dist/resources/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
  41. package/dist/resources/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
  42. package/dist/resources/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
  43. package/dist/resources/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
  44. package/dist/resources/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
  45. package/dist/resources/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
  46. package/dist/resources/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
  47. package/dist/resources/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
  48. package/dist/resources/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
  49. package/dist/resources/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
  50. package/dist/resources/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
  51. package/dist/resources/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
  52. package/dist/resources/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
  53. package/dist/resources/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
  54. package/dist/resources/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
  55. package/dist/resources/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
  56. package/dist/resources/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
  57. package/dist/resources/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
  58. package/dist/resources/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
  59. package/dist/resources/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
  60. package/dist/resources/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
  61. package/dist/resources/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
  62. package/dist/resources/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
  63. package/dist/resources/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
  64. package/dist/resources/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
  65. package/dist/resources/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
  66. package/dist/resources/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
  67. package/dist/resources/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
  68. package/dist/resources/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
  69. package/dist/resources/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
  70. package/dist/resources/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
  71. package/dist/resources/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
  72. package/dist/resources/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
  73. package/dist/resources/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
  74. package/dist/resources/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
  75. package/dist/resources/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
  76. package/dist/resources/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
  77. package/dist/resources/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
  78. package/dist/resources/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
  79. package/dist/resources/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
  80. package/dist/resources/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
  81. package/dist/resources/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
  82. package/dist/resources/Assets/Textures/NaturalEarthII/tilemapresource.xml +14 -0
  83. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
  84. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
  85. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
  86. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
  87. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
  88. package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
  89. package/dist/resources/Assets/Textures/maki/airfield.png +0 -0
  90. package/dist/resources/Assets/Textures/maki/airport.png +0 -0
  91. package/dist/resources/Assets/Textures/maki/alcohol-shop.png +0 -0
  92. package/dist/resources/Assets/Textures/maki/america-football.png +0 -0
  93. package/dist/resources/Assets/Textures/maki/art-gallery.png +0 -0
  94. package/dist/resources/Assets/Textures/maki/bakery.png +0 -0
  95. package/dist/resources/Assets/Textures/maki/bank.png +0 -0
  96. package/dist/resources/Assets/Textures/maki/bar.png +0 -0
  97. package/dist/resources/Assets/Textures/maki/baseball.png +0 -0
  98. package/dist/resources/Assets/Textures/maki/basketball.png +0 -0
  99. package/dist/resources/Assets/Textures/maki/beer.png +0 -0
  100. package/dist/resources/Assets/Textures/maki/bicycle.png +0 -0
  101. package/dist/resources/Assets/Textures/maki/building.png +0 -0
  102. package/dist/resources/Assets/Textures/maki/bus.png +0 -0
  103. package/dist/resources/Assets/Textures/maki/cafe.png +0 -0
  104. package/dist/resources/Assets/Textures/maki/camera.png +0 -0
  105. package/dist/resources/Assets/Textures/maki/campsite.png +0 -0
  106. package/dist/resources/Assets/Textures/maki/car.png +0 -0
  107. package/dist/resources/Assets/Textures/maki/cemetery.png +0 -0
  108. package/dist/resources/Assets/Textures/maki/cesium.png +0 -0
  109. package/dist/resources/Assets/Textures/maki/chemist.png +0 -0
  110. package/dist/resources/Assets/Textures/maki/cinema.png +0 -0
  111. package/dist/resources/Assets/Textures/maki/circle-stroked.png +0 -0
  112. package/dist/resources/Assets/Textures/maki/circle.png +0 -0
  113. package/dist/resources/Assets/Textures/maki/city.png +0 -0
  114. package/dist/resources/Assets/Textures/maki/clothing-store.png +0 -0
  115. package/dist/resources/Assets/Textures/maki/college.png +0 -0
  116. package/dist/resources/Assets/Textures/maki/commercial.png +0 -0
  117. package/dist/resources/Assets/Textures/maki/cricket.png +0 -0
  118. package/dist/resources/Assets/Textures/maki/cross.png +0 -0
  119. package/dist/resources/Assets/Textures/maki/dam.png +0 -0
  120. package/dist/resources/Assets/Textures/maki/danger.png +0 -0
  121. package/dist/resources/Assets/Textures/maki/disability.png +0 -0
  122. package/dist/resources/Assets/Textures/maki/dog-park.png +0 -0
  123. package/dist/resources/Assets/Textures/maki/embassy.png +0 -0
  124. package/dist/resources/Assets/Textures/maki/emergency-telephone.png +0 -0
  125. package/dist/resources/Assets/Textures/maki/entrance.png +0 -0
  126. package/dist/resources/Assets/Textures/maki/farm.png +0 -0
  127. package/dist/resources/Assets/Textures/maki/fast-food.png +0 -0
  128. package/dist/resources/Assets/Textures/maki/ferry.png +0 -0
  129. package/dist/resources/Assets/Textures/maki/fire-station.png +0 -0
  130. package/dist/resources/Assets/Textures/maki/fuel.png +0 -0
  131. package/dist/resources/Assets/Textures/maki/garden.png +0 -0
  132. package/dist/resources/Assets/Textures/maki/gift.png +0 -0
  133. package/dist/resources/Assets/Textures/maki/golf.png +0 -0
  134. package/dist/resources/Assets/Textures/maki/grocery.png +0 -0
  135. package/dist/resources/Assets/Textures/maki/hairdresser.png +0 -0
  136. package/dist/resources/Assets/Textures/maki/harbor.png +0 -0
  137. package/dist/resources/Assets/Textures/maki/heart.png +0 -0
  138. package/dist/resources/Assets/Textures/maki/heliport.png +0 -0
  139. package/dist/resources/Assets/Textures/maki/hospital.png +0 -0
  140. package/dist/resources/Assets/Textures/maki/ice-cream.png +0 -0
  141. package/dist/resources/Assets/Textures/maki/industrial.png +0 -0
  142. package/dist/resources/Assets/Textures/maki/land-use.png +0 -0
  143. package/dist/resources/Assets/Textures/maki/laundry.png +0 -0
  144. package/dist/resources/Assets/Textures/maki/library.png +0 -0
  145. package/dist/resources/Assets/Textures/maki/lighthouse.png +0 -0
  146. package/dist/resources/Assets/Textures/maki/lodging.png +0 -0
  147. package/dist/resources/Assets/Textures/maki/logging.png +0 -0
  148. package/dist/resources/Assets/Textures/maki/london-underground.png +0 -0
  149. package/dist/resources/Assets/Textures/maki/marker-stroked.png +0 -0
  150. package/dist/resources/Assets/Textures/maki/marker.png +0 -0
  151. package/dist/resources/Assets/Textures/maki/minefield.png +0 -0
  152. package/dist/resources/Assets/Textures/maki/mobilephone.png +0 -0
  153. package/dist/resources/Assets/Textures/maki/monument.png +0 -0
  154. package/dist/resources/Assets/Textures/maki/museum.png +0 -0
  155. package/dist/resources/Assets/Textures/maki/music.png +0 -0
  156. package/dist/resources/Assets/Textures/maki/oil-well.png +0 -0
  157. package/dist/resources/Assets/Textures/maki/park.png +0 -0
  158. package/dist/resources/Assets/Textures/maki/park2.png +0 -0
  159. package/dist/resources/Assets/Textures/maki/parking-garage.png +0 -0
  160. package/dist/resources/Assets/Textures/maki/parking.png +0 -0
  161. package/dist/resources/Assets/Textures/maki/pharmacy.png +0 -0
  162. package/dist/resources/Assets/Textures/maki/pitch.png +0 -0
  163. package/dist/resources/Assets/Textures/maki/place-of-worship.png +0 -0
  164. package/dist/resources/Assets/Textures/maki/playground.png +0 -0
  165. package/dist/resources/Assets/Textures/maki/police.png +0 -0
  166. package/dist/resources/Assets/Textures/maki/polling-place.png +0 -0
  167. package/dist/resources/Assets/Textures/maki/post.png +0 -0
  168. package/dist/resources/Assets/Textures/maki/prison.png +0 -0
  169. package/dist/resources/Assets/Textures/maki/rail-above.png +0 -0
  170. package/dist/resources/Assets/Textures/maki/rail-light.png +0 -0
  171. package/dist/resources/Assets/Textures/maki/rail-metro.png +0 -0
  172. package/dist/resources/Assets/Textures/maki/rail-underground.png +0 -0
  173. package/dist/resources/Assets/Textures/maki/rail.png +0 -0
  174. package/dist/resources/Assets/Textures/maki/religious-christian.png +0 -0
  175. package/dist/resources/Assets/Textures/maki/religious-jewish.png +0 -0
  176. package/dist/resources/Assets/Textures/maki/religious-muslim.png +0 -0
  177. package/dist/resources/Assets/Textures/maki/restaurant.png +0 -0
  178. package/dist/resources/Assets/Textures/maki/roadblock.png +0 -0
  179. package/dist/resources/Assets/Textures/maki/rocket.png +0 -0
  180. package/dist/resources/Assets/Textures/maki/school.png +0 -0
  181. package/dist/resources/Assets/Textures/maki/scooter.png +0 -0
  182. package/dist/resources/Assets/Textures/maki/shop.png +0 -0
  183. package/dist/resources/Assets/Textures/maki/skiing.png +0 -0
  184. package/dist/resources/Assets/Textures/maki/slaughterhouse.png +0 -0
  185. package/dist/resources/Assets/Textures/maki/soccer.png +0 -0
  186. package/dist/resources/Assets/Textures/maki/square-stroked.png +0 -0
  187. package/dist/resources/Assets/Textures/maki/square.png +0 -0
  188. package/dist/resources/Assets/Textures/maki/star-stroked.png +0 -0
  189. package/dist/resources/Assets/Textures/maki/star.png +0 -0
  190. package/dist/resources/Assets/Textures/maki/suitcase.png +0 -0
  191. package/dist/resources/Assets/Textures/maki/swimming.png +0 -0
  192. package/dist/resources/Assets/Textures/maki/telephone.png +0 -0
  193. package/dist/resources/Assets/Textures/maki/tennis.png +0 -0
  194. package/dist/resources/Assets/Textures/maki/theatre.png +0 -0
  195. package/dist/resources/Assets/Textures/maki/toilets.png +0 -0
  196. package/dist/resources/Assets/Textures/maki/town-hall.png +0 -0
  197. package/dist/resources/Assets/Textures/maki/town.png +0 -0
  198. package/dist/resources/Assets/Textures/maki/triangle-stroked.png +0 -0
  199. package/dist/resources/Assets/Textures/maki/triangle.png +0 -0
  200. package/dist/resources/Assets/Textures/maki/village.png +0 -0
  201. package/dist/resources/Assets/Textures/maki/warehouse.png +0 -0
  202. package/dist/resources/Assets/Textures/maki/waste-basket.png +0 -0
  203. package/dist/resources/Assets/Textures/maki/water.png +0 -0
  204. package/dist/resources/Assets/Textures/maki/wetland.png +0 -0
  205. package/dist/resources/Assets/Textures/maki/zoo.png +0 -0
  206. package/dist/resources/Assets/Textures/moonSmall.jpg +0 -0
  207. package/dist/resources/Assets/Textures/pin.svg +1 -0
  208. package/dist/resources/Assets/Textures/waterNormals.jpg +0 -0
  209. package/dist/resources/Assets/Textures/waterNormalsSmall.jpg +0 -0
  210. package/dist/resources/Assets/approximateTerrainHeights.json +1 -0
  211. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +21 -0
  212. package/dist/resources/ThirdParty/Workers/package.json +1 -0
  213. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +2 -0
  214. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +2 -0
  215. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -0
  216. package/dist/resources/ThirdParty/basis_transcoder.wasm +0 -0
  217. package/dist/resources/ThirdParty/draco_decoder.wasm +0 -0
  218. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +8337 -0
  219. package/dist/resources/Workers/chunk-3JBEPBPL.js +390 -0
  220. package/dist/resources/Workers/chunk-3LYROPON.js +781 -0
  221. package/dist/resources/Workers/chunk-3PIZQT3I.js +305 -0
  222. package/dist/resources/Workers/chunk-3QLSKXKF.js +456 -0
  223. package/dist/resources/Workers/chunk-4CHMVQTQ.js +138 -0
  224. package/dist/resources/Workers/chunk-5KWRW7YL.js +58 -0
  225. package/dist/resources/Workers/chunk-5S5OOA6U.js +37 -0
  226. package/dist/resources/Workers/chunk-77XPS7ZA.js +758 -0
  227. package/dist/resources/Workers/chunk-7EO56M5R.js +1800 -0
  228. package/dist/resources/Workers/chunk-7UHKH6M3.js +634 -0
  229. package/dist/resources/Workers/chunk-7ZB2RVIQ.js +834 -0
  230. package/dist/resources/Workers/chunk-B4GSRXE3.js +157 -0
  231. package/dist/resources/Workers/chunk-CI2HEJFC.js +1481 -0
  232. package/dist/resources/Workers/chunk-D7ZBZPHV.js +139 -0
  233. package/dist/resources/Workers/chunk-DT5NFR5C.js +239 -0
  234. package/dist/resources/Workers/chunk-ED6GLQTK.js +629 -0
  235. package/dist/resources/Workers/chunk-EWDGNOJE.js +1258 -0
  236. package/dist/resources/Workers/chunk-F4CUH4MR.js +500 -0
  237. package/dist/resources/Workers/chunk-FFBJDW4A.js +196 -0
  238. package/dist/resources/Workers/chunk-FX4R4MTH.js +115 -0
  239. package/dist/resources/Workers/chunk-FYGLNDKG.js +963 -0
  240. package/dist/resources/Workers/chunk-G3BVMPWG.js +101 -0
  241. package/dist/resources/Workers/chunk-HEZHXDYB.js +55 -0
  242. package/dist/resources/Workers/chunk-HKHQ3EDR.js +102 -0
  243. package/dist/resources/Workers/chunk-HUFQVUMY.js +300 -0
  244. package/dist/resources/Workers/chunk-J7IH4EYI.js +220 -0
  245. package/dist/resources/Workers/chunk-JHBPC4LK.js +435 -0
  246. package/dist/resources/Workers/chunk-JPDKYBLF.js +511 -0
  247. package/dist/resources/Workers/chunk-K4AH3TDT.js +959 -0
  248. package/dist/resources/Workers/chunk-KHWLAQVA.js +75 -0
  249. package/dist/resources/Workers/chunk-KM6MITPF.js +2857 -0
  250. package/dist/resources/Workers/chunk-KSYBJA4M.js +262 -0
  251. package/dist/resources/Workers/chunk-LJBJM6VI.js +171 -0
  252. package/dist/resources/Workers/chunk-LNSWJ43X.js +421 -0
  253. package/dist/resources/Workers/chunk-LOZ4NKY3.js +684 -0
  254. package/dist/resources/Workers/chunk-LS3KVHYY.js +353 -0
  255. package/dist/resources/Workers/chunk-MVM4JV5U.js +691 -0
  256. package/dist/resources/Workers/chunk-N2XAJBC6.js +368 -0
  257. package/dist/resources/Workers/chunk-OMXHEJTK.js +163 -0
  258. package/dist/resources/Workers/chunk-PWF4EY5P.js +122 -0
  259. package/dist/resources/Workers/chunk-Q4ZVWJXX.js +59 -0
  260. package/dist/resources/Workers/chunk-SDIDRZDG.js +476 -0
  261. package/dist/resources/Workers/chunk-TVL3F7IU.js +39 -0
  262. package/dist/resources/Workers/chunk-TY4DKOWR.js +44 -0
  263. package/dist/resources/Workers/chunk-VCNOFQYH.js +287 -0
  264. package/dist/resources/Workers/chunk-WEHZP4SE.js +10357 -0
  265. package/dist/resources/Workers/chunk-WVNLSTOF.js +73 -0
  266. package/dist/resources/Workers/chunk-XK4OP6VA.js +1073 -0
  267. package/dist/resources/Workers/chunk-YJX7X577.js +2717 -0
  268. package/dist/resources/Workers/chunk-Z3QWTHI7.js +398 -0
  269. package/dist/resources/Workers/chunk-ZGFIT57T.js +1048 -0
  270. package/dist/resources/Workers/chunk-ZMNLEL6W.js +100 -0
  271. package/dist/resources/Workers/combineGeometry.js +64 -0
  272. package/dist/resources/Workers/createBoxGeometry.js +56 -0
  273. package/dist/resources/Workers/createBoxOutlineGeometry.js +233 -0
  274. package/dist/resources/Workers/createCircleGeometry.js +199 -0
  275. package/dist/resources/Workers/createCircleOutlineGeometry.js +145 -0
  276. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +505 -0
  277. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +223 -0
  278. package/dist/resources/Workers/createCorridorGeometry.js +1261 -0
  279. package/dist/resources/Workers/createCorridorOutlineGeometry.js +566 -0
  280. package/dist/resources/Workers/createCylinderGeometry.js +58 -0
  281. package/dist/resources/Workers/createCylinderOutlineGeometry.js +229 -0
  282. package/dist/resources/Workers/createEllipseGeometry.js +69 -0
  283. package/dist/resources/Workers/createEllipseOutlineGeometry.js +62 -0
  284. package/dist/resources/Workers/createEllipsoidGeometry.js +57 -0
  285. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +59 -0
  286. package/dist/resources/Workers/createFrustumGeometry.js +56 -0
  287. package/dist/resources/Workers/createFrustumOutlineGeometry.js +234 -0
  288. package/dist/resources/Workers/createGeometry.js +168 -0
  289. package/dist/resources/Workers/createGroundPolylineGeometry.js +1606 -0
  290. package/dist/resources/Workers/createPlaneGeometry.js +222 -0
  291. package/dist/resources/Workers/createPlaneOutlineGeometry.js +122 -0
  292. package/dist/resources/Workers/createPolygonGeometry.js +1405 -0
  293. package/dist/resources/Workers/createPolygonOutlineGeometry.js +533 -0
  294. package/dist/resources/Workers/createPolylineGeometry.js +494 -0
  295. package/dist/resources/Workers/createPolylineVolumeGeometry.js +377 -0
  296. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +275 -0
  297. package/dist/resources/Workers/createRectangleGeometry.js +1270 -0
  298. package/dist/resources/Workers/createRectangleOutlineGeometry.js +477 -0
  299. package/dist/resources/Workers/createSimplePolylineGeometry.js +398 -0
  300. package/dist/resources/Workers/createSphereGeometry.js +116 -0
  301. package/dist/resources/Workers/createSphereOutlineGeometry.js +116 -0
  302. package/dist/resources/Workers/createTaskProcessorWorker.js +32 -0
  303. package/dist/resources/Workers/createVectorTileClampedPolylines.js +490 -0
  304. package/dist/resources/Workers/createVectorTileGeometries.js +385 -0
  305. package/dist/resources/Workers/createVectorTilePoints.js +112 -0
  306. package/dist/resources/Workers/createVectorTilePolygons.js +383 -0
  307. package/dist/resources/Workers/createVectorTilePolylines.js +260 -0
  308. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +563 -0
  309. package/dist/resources/Workers/createVerticesFromHeightmap.js +2276 -0
  310. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +753 -0
  311. package/dist/resources/Workers/createWallGeometry.js +488 -0
  312. package/dist/resources/Workers/createWallOutlineGeometry.js +336 -0
  313. package/dist/resources/Workers/decodeDraco.js +370 -0
  314. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2666 -0
  315. package/dist/resources/Workers/decodeI3S.js +1343 -0
  316. package/dist/resources/Workers/transcodeKTX2.js +3387 -0
  317. package/dist/resources/Workers/transferTypedArrayTest.js +41 -0
  318. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +817 -0
  319. package/package.json +22 -0
@@ -0,0 +1,1405 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.126
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ BoundingRectangle_default
28
+ } from "./chunk-J7IH4EYI.js";
29
+ import {
30
+ PolygonGeometryLibrary_default
31
+ } from "./chunk-ZGFIT57T.js";
32
+ import {
33
+ ArcType_default
34
+ } from "./chunk-HEZHXDYB.js";
35
+ import {
36
+ GeometryInstance_default
37
+ } from "./chunk-Q4ZVWJXX.js";
38
+ import {
39
+ GeometryPipeline_default
40
+ } from "./chunk-YJX7X577.js";
41
+ import "./chunk-JHBPC4LK.js";
42
+ import "./chunk-HKHQ3EDR.js";
43
+ import {
44
+ GeometryOffsetAttribute_default
45
+ } from "./chunk-5S5OOA6U.js";
46
+ import {
47
+ VertexFormat_default
48
+ } from "./chunk-4CHMVQTQ.js";
49
+ import {
50
+ EllipsoidTangentPlane_default
51
+ } from "./chunk-VCNOFQYH.js";
52
+ import "./chunk-B4GSRXE3.js";
53
+ import {
54
+ PolygonPipeline_default,
55
+ WindingOrder_default
56
+ } from "./chunk-K4AH3TDT.js";
57
+ import "./chunk-ZMNLEL6W.js";
58
+ import "./chunk-3QLSKXKF.js";
59
+ import {
60
+ IntersectionTests_default,
61
+ Ray_default
62
+ } from "./chunk-EWDGNOJE.js";
63
+ import "./chunk-LJBJM6VI.js";
64
+ import {
65
+ IndexDatatype_default
66
+ } from "./chunk-D7ZBZPHV.js";
67
+ import "./chunk-TY4DKOWR.js";
68
+ import {
69
+ GeometryAttribute_default,
70
+ Geometry_default
71
+ } from "./chunk-HUFQVUMY.js";
72
+ import {
73
+ BoundingSphere_default
74
+ } from "./chunk-FYGLNDKG.js";
75
+ import {
76
+ Quaternion_default,
77
+ Rectangle_default
78
+ } from "./chunk-WEHZP4SE.js";
79
+ import {
80
+ ComponentDatatype_default
81
+ } from "./chunk-KSYBJA4M.js";
82
+ import {
83
+ Cartesian2_default,
84
+ Cartesian3_default,
85
+ Cartographic_default,
86
+ Ellipsoid_default,
87
+ Matrix3_default
88
+ } from "./chunk-KM6MITPF.js";
89
+ import {
90
+ Math_default
91
+ } from "./chunk-F4CUH4MR.js";
92
+ import "./chunk-ED6GLQTK.js";
93
+ import "./chunk-5KWRW7YL.js";
94
+ import {
95
+ defaultValue_default
96
+ } from "./chunk-TVL3F7IU.js";
97
+ import {
98
+ Check_default,
99
+ DeveloperError_default
100
+ } from "./chunk-OMXHEJTK.js";
101
+ import {
102
+ defined_default
103
+ } from "./chunk-KHWLAQVA.js";
104
+
105
+ // packages/engine/Source/Core/Stereographic.js
106
+ function Stereographic(position, tangentPlane) {
107
+ this.position = position;
108
+ if (!defined_default(this.position)) {
109
+ this.position = new Cartesian2_default();
110
+ }
111
+ this.tangentPlane = tangentPlane;
112
+ if (!defined_default(this.tangentPlane)) {
113
+ this.tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
114
+ }
115
+ }
116
+ Object.defineProperties(Stereographic.prototype, {
117
+ /**
118
+ * Gets the ellipsoid.
119
+ * @memberof Stereographic.prototype
120
+ * @type {Ellipsoid}
121
+ */
122
+ ellipsoid: {
123
+ get: function() {
124
+ return this.tangentPlane.ellipsoid;
125
+ }
126
+ },
127
+ /**
128
+ * Gets the x coordinate
129
+ * @memberof Stereographic.prototype
130
+ * @type {number}
131
+ */
132
+ x: {
133
+ get: function() {
134
+ return this.position.x;
135
+ }
136
+ },
137
+ /**
138
+ * Gets the y coordinate
139
+ * @memberof Stereographic.prototype
140
+ * @type {number}
141
+ */
142
+ y: {
143
+ get: function() {
144
+ return this.position.y;
145
+ }
146
+ },
147
+ /**
148
+ * Computes the conformal latitude, or the ellipsoidal latitude projected onto an arbitrary sphere.
149
+ * @memberof Stereographic.prototype
150
+ * @type {number}
151
+ */
152
+ conformalLatitude: {
153
+ get: function() {
154
+ const r = Cartesian2_default.magnitude(this.position);
155
+ const d = 2 * this.ellipsoid.maximumRadius;
156
+ const sign = this.tangentPlane.plane.normal.z;
157
+ return sign * (Math_default.PI_OVER_TWO - 2 * Math.atan2(r, d));
158
+ }
159
+ },
160
+ /**
161
+ * Computes the longitude
162
+ * @memberof Stereographic.prototype
163
+ * @type {number}
164
+ */
165
+ longitude: {
166
+ get: function() {
167
+ let longitude = Math_default.PI_OVER_TWO + Math.atan2(this.y, this.x);
168
+ if (longitude > Math.PI) {
169
+ longitude -= Math_default.TWO_PI;
170
+ }
171
+ return longitude;
172
+ }
173
+ }
174
+ });
175
+ var scratchCartographic = new Cartographic_default();
176
+ var scratchCartesian = new Cartesian3_default();
177
+ Stereographic.prototype.getLatitude = function(ellipsoid) {
178
+ if (!defined_default(ellipsoid)) {
179
+ ellipsoid = Ellipsoid_default.default;
180
+ }
181
+ scratchCartographic.latitude = this.conformalLatitude;
182
+ scratchCartographic.longitude = this.longitude;
183
+ scratchCartographic.height = 0;
184
+ const cartesian = this.ellipsoid.cartographicToCartesian(
185
+ scratchCartographic,
186
+ scratchCartesian
187
+ );
188
+ ellipsoid.cartesianToCartographic(cartesian, scratchCartographic);
189
+ return scratchCartographic.latitude;
190
+ };
191
+ var scratchProjectPointOntoPlaneRay = new Ray_default();
192
+ var scratchProjectPointOntoPlaneRayDirection = new Cartesian3_default();
193
+ var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
194
+ Stereographic.fromCartesian = function(cartesian, result) {
195
+ Check_default.defined("cartesian", cartesian);
196
+ const sign = Math_default.signNotZero(cartesian.z);
197
+ let tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
198
+ let origin = Stereographic.SOUTH_POLE;
199
+ if (sign < 0) {
200
+ tangentPlane = Stereographic.SOUTH_POLE_TANGENT_PLANE;
201
+ origin = Stereographic.NORTH_POLE;
202
+ }
203
+ const ray = scratchProjectPointOntoPlaneRay;
204
+ ray.origin = tangentPlane.ellipsoid.scaleToGeocentricSurface(
205
+ cartesian,
206
+ ray.origin
207
+ );
208
+ ray.direction = Cartesian3_default.subtract(
209
+ ray.origin,
210
+ origin,
211
+ scratchProjectPointOntoPlaneRayDirection
212
+ );
213
+ Cartesian3_default.normalize(ray.direction, ray.direction);
214
+ const intersectionPoint = IntersectionTests_default.rayPlane(
215
+ ray,
216
+ tangentPlane.plane,
217
+ scratchProjectPointOntoPlaneCartesian3
218
+ );
219
+ const v = Cartesian3_default.subtract(intersectionPoint, origin, intersectionPoint);
220
+ const x = Cartesian3_default.dot(tangentPlane.xAxis, v);
221
+ const y = sign * Cartesian3_default.dot(tangentPlane.yAxis, v);
222
+ if (!defined_default(result)) {
223
+ return new Stereographic(new Cartesian2_default(x, y), tangentPlane);
224
+ }
225
+ result.position = new Cartesian2_default(x, y);
226
+ result.tangentPlane = tangentPlane;
227
+ return result;
228
+ };
229
+ Stereographic.fromCartesianArray = function(cartesians, result) {
230
+ Check_default.defined("cartesians", cartesians);
231
+ const length = cartesians.length;
232
+ if (!defined_default(result)) {
233
+ result = new Array(length);
234
+ } else {
235
+ result.length = length;
236
+ }
237
+ for (let i = 0; i < length; i++) {
238
+ result[i] = Stereographic.fromCartesian(cartesians[i], result[i]);
239
+ }
240
+ return result;
241
+ };
242
+ Stereographic.clone = function(stereographic, result) {
243
+ if (!defined_default(stereographic)) {
244
+ return void 0;
245
+ }
246
+ if (!defined_default(result)) {
247
+ return new Stereographic(
248
+ stereographic.position,
249
+ stereographic.tangentPlane
250
+ );
251
+ }
252
+ result.position = stereographic.position;
253
+ result.tangentPlane = stereographic.tangentPlane;
254
+ return result;
255
+ };
256
+ Stereographic.HALF_UNIT_SPHERE = Object.freeze(new Ellipsoid_default(0.5, 0.5, 0.5));
257
+ Stereographic.NORTH_POLE = Object.freeze(new Cartesian3_default(0, 0, 0.5));
258
+ Stereographic.SOUTH_POLE = Object.freeze(new Cartesian3_default(0, 0, -0.5));
259
+ Stereographic.NORTH_POLE_TANGENT_PLANE = Object.freeze(
260
+ new EllipsoidTangentPlane_default(
261
+ Stereographic.NORTH_POLE,
262
+ Stereographic.HALF_UNIT_SPHERE
263
+ )
264
+ );
265
+ Stereographic.SOUTH_POLE_TANGENT_PLANE = Object.freeze(
266
+ new EllipsoidTangentPlane_default(
267
+ Stereographic.SOUTH_POLE,
268
+ Stereographic.HALF_UNIT_SPHERE
269
+ )
270
+ );
271
+ var Stereographic_default = Stereographic;
272
+
273
+ // packages/engine/Source/Core/PolygonGeometry.js
274
+ var scratchCarto1 = new Cartographic_default();
275
+ var scratchCarto2 = new Cartographic_default();
276
+ function adjustPosHeightsForNormal(position, p1, p2, ellipsoid) {
277
+ const carto1 = ellipsoid.cartesianToCartographic(position, scratchCarto1);
278
+ const height = carto1.height;
279
+ const p1Carto = ellipsoid.cartesianToCartographic(p1, scratchCarto2);
280
+ p1Carto.height = height;
281
+ ellipsoid.cartographicToCartesian(p1Carto, p1);
282
+ const p2Carto = ellipsoid.cartesianToCartographic(p2, scratchCarto2);
283
+ p2Carto.height = height - 100;
284
+ ellipsoid.cartographicToCartesian(p2Carto, p2);
285
+ }
286
+ var scratchBoundingRectangle = new BoundingRectangle_default();
287
+ var scratchPosition = new Cartesian3_default();
288
+ var scratchNormal = new Cartesian3_default();
289
+ var scratchTangent = new Cartesian3_default();
290
+ var scratchBitangent = new Cartesian3_default();
291
+ var p1Scratch = new Cartesian3_default();
292
+ var p2Scratch = new Cartesian3_default();
293
+ var scratchPerPosNormal = new Cartesian3_default();
294
+ var scratchPerPosTangent = new Cartesian3_default();
295
+ var scratchPerPosBitangent = new Cartesian3_default();
296
+ var appendTextureCoordinatesOrigin = new Cartesian2_default();
297
+ var appendTextureCoordinatesCartesian2 = new Cartesian2_default();
298
+ var appendTextureCoordinatesCartesian3 = new Cartesian3_default();
299
+ var appendTextureCoordinatesQuaternion = new Quaternion_default();
300
+ var appendTextureCoordinatesMatrix3 = new Matrix3_default();
301
+ var tangentMatrixScratch = new Matrix3_default();
302
+ function computeAttributes(options) {
303
+ const vertexFormat = options.vertexFormat;
304
+ const geometry = options.geometry;
305
+ const shadowVolume = options.shadowVolume;
306
+ const flatPositions = geometry.attributes.position.values;
307
+ const flatTexcoords = defined_default(geometry.attributes.st) ? geometry.attributes.st.values : void 0;
308
+ let length = flatPositions.length;
309
+ const wall = options.wall;
310
+ const top = options.top || wall;
311
+ const bottom = options.bottom || wall;
312
+ if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
313
+ const boundingRectangle = options.boundingRectangle;
314
+ const rotationAxis = options.rotationAxis;
315
+ const projectTo2d = options.projectTo2d;
316
+ const ellipsoid = options.ellipsoid;
317
+ const stRotation = options.stRotation;
318
+ const perPositionHeight = options.perPositionHeight;
319
+ const origin = appendTextureCoordinatesOrigin;
320
+ origin.x = boundingRectangle.x;
321
+ origin.y = boundingRectangle.y;
322
+ const textureCoordinates = vertexFormat.st ? new Float32Array(2 * (length / 3)) : void 0;
323
+ let normals;
324
+ if (vertexFormat.normal) {
325
+ if (perPositionHeight && top && !wall) {
326
+ normals = geometry.attributes.normal.values;
327
+ } else {
328
+ normals = new Float32Array(length);
329
+ }
330
+ }
331
+ const tangents = vertexFormat.tangent ? new Float32Array(length) : void 0;
332
+ const bitangents = vertexFormat.bitangent ? new Float32Array(length) : void 0;
333
+ const extrudeNormals = shadowVolume ? new Float32Array(length) : void 0;
334
+ let textureCoordIndex = 0;
335
+ let attrIndex = 0;
336
+ let normal = scratchNormal;
337
+ let tangent = scratchTangent;
338
+ let bitangent = scratchBitangent;
339
+ let recomputeNormal = true;
340
+ let textureMatrix = appendTextureCoordinatesMatrix3;
341
+ let tangentRotationMatrix = tangentMatrixScratch;
342
+ if (stRotation !== 0) {
343
+ let rotation = Quaternion_default.fromAxisAngle(
344
+ rotationAxis,
345
+ stRotation,
346
+ appendTextureCoordinatesQuaternion
347
+ );
348
+ textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
349
+ rotation = Quaternion_default.fromAxisAngle(
350
+ rotationAxis,
351
+ -stRotation,
352
+ appendTextureCoordinatesQuaternion
353
+ );
354
+ tangentRotationMatrix = Matrix3_default.fromQuaternion(
355
+ rotation,
356
+ tangentRotationMatrix
357
+ );
358
+ } else {
359
+ textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
360
+ tangentRotationMatrix = Matrix3_default.clone(
361
+ Matrix3_default.IDENTITY,
362
+ tangentRotationMatrix
363
+ );
364
+ }
365
+ let bottomOffset = 0;
366
+ let bottomOffset2 = 0;
367
+ if (top && bottom) {
368
+ bottomOffset = length / 2;
369
+ bottomOffset2 = length / 3;
370
+ length /= 2;
371
+ }
372
+ for (let i = 0; i < length; i += 3) {
373
+ const position = Cartesian3_default.fromArray(
374
+ flatPositions,
375
+ i,
376
+ appendTextureCoordinatesCartesian3
377
+ );
378
+ if (vertexFormat.st) {
379
+ if (!defined_default(flatTexcoords)) {
380
+ let p = Matrix3_default.multiplyByVector(
381
+ textureMatrix,
382
+ position,
383
+ scratchPosition
384
+ );
385
+ p = ellipsoid.scaleToGeodeticSurface(p, p);
386
+ const st = projectTo2d([p], appendTextureCoordinatesCartesian2)[0];
387
+ Cartesian2_default.subtract(st, origin, st);
388
+ const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
389
+ const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
390
+ if (bottom) {
391
+ textureCoordinates[textureCoordIndex + bottomOffset2] = stx;
392
+ textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = sty;
393
+ }
394
+ if (top) {
395
+ textureCoordinates[textureCoordIndex] = stx;
396
+ textureCoordinates[textureCoordIndex + 1] = sty;
397
+ }
398
+ textureCoordIndex += 2;
399
+ }
400
+ }
401
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
402
+ const attrIndex1 = attrIndex + 1;
403
+ const attrIndex2 = attrIndex + 2;
404
+ if (wall) {
405
+ if (i + 3 < length) {
406
+ const p1 = Cartesian3_default.fromArray(flatPositions, i + 3, p1Scratch);
407
+ if (recomputeNormal) {
408
+ const p2 = Cartesian3_default.fromArray(
409
+ flatPositions,
410
+ i + length,
411
+ p2Scratch
412
+ );
413
+ if (perPositionHeight) {
414
+ adjustPosHeightsForNormal(position, p1, p2, ellipsoid);
415
+ }
416
+ Cartesian3_default.subtract(p1, position, p1);
417
+ Cartesian3_default.subtract(p2, position, p2);
418
+ normal = Cartesian3_default.normalize(
419
+ Cartesian3_default.cross(p2, p1, normal),
420
+ normal
421
+ );
422
+ recomputeNormal = false;
423
+ }
424
+ if (Cartesian3_default.equalsEpsilon(p1, position, Math_default.EPSILON10)) {
425
+ recomputeNormal = true;
426
+ }
427
+ }
428
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
429
+ bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
430
+ if (vertexFormat.tangent) {
431
+ tangent = Cartesian3_default.normalize(
432
+ Cartesian3_default.cross(bitangent, normal, tangent),
433
+ tangent
434
+ );
435
+ }
436
+ }
437
+ } else {
438
+ normal = ellipsoid.geodeticSurfaceNormal(position, normal);
439
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
440
+ if (perPositionHeight) {
441
+ scratchPerPosNormal = Cartesian3_default.fromArray(
442
+ normals,
443
+ attrIndex,
444
+ scratchPerPosNormal
445
+ );
446
+ scratchPerPosTangent = Cartesian3_default.cross(
447
+ Cartesian3_default.UNIT_Z,
448
+ scratchPerPosNormal,
449
+ scratchPerPosTangent
450
+ );
451
+ scratchPerPosTangent = Cartesian3_default.normalize(
452
+ Matrix3_default.multiplyByVector(
453
+ tangentRotationMatrix,
454
+ scratchPerPosTangent,
455
+ scratchPerPosTangent
456
+ ),
457
+ scratchPerPosTangent
458
+ );
459
+ if (vertexFormat.bitangent) {
460
+ scratchPerPosBitangent = Cartesian3_default.normalize(
461
+ Cartesian3_default.cross(
462
+ scratchPerPosNormal,
463
+ scratchPerPosTangent,
464
+ scratchPerPosBitangent
465
+ ),
466
+ scratchPerPosBitangent
467
+ );
468
+ }
469
+ }
470
+ tangent = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent);
471
+ tangent = Cartesian3_default.normalize(
472
+ Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent),
473
+ tangent
474
+ );
475
+ if (vertexFormat.bitangent) {
476
+ bitangent = Cartesian3_default.normalize(
477
+ Cartesian3_default.cross(normal, tangent, bitangent),
478
+ bitangent
479
+ );
480
+ }
481
+ }
482
+ }
483
+ if (vertexFormat.normal) {
484
+ if (options.wall) {
485
+ normals[attrIndex + bottomOffset] = normal.x;
486
+ normals[attrIndex1 + bottomOffset] = normal.y;
487
+ normals[attrIndex2 + bottomOffset] = normal.z;
488
+ } else if (bottom) {
489
+ normals[attrIndex + bottomOffset] = -normal.x;
490
+ normals[attrIndex1 + bottomOffset] = -normal.y;
491
+ normals[attrIndex2 + bottomOffset] = -normal.z;
492
+ }
493
+ if (top && !perPositionHeight || wall) {
494
+ normals[attrIndex] = normal.x;
495
+ normals[attrIndex1] = normal.y;
496
+ normals[attrIndex2] = normal.z;
497
+ }
498
+ }
499
+ if (shadowVolume) {
500
+ if (wall) {
501
+ normal = ellipsoid.geodeticSurfaceNormal(position, normal);
502
+ }
503
+ extrudeNormals[attrIndex + bottomOffset] = -normal.x;
504
+ extrudeNormals[attrIndex1 + bottomOffset] = -normal.y;
505
+ extrudeNormals[attrIndex2 + bottomOffset] = -normal.z;
506
+ }
507
+ if (vertexFormat.tangent) {
508
+ if (options.wall) {
509
+ tangents[attrIndex + bottomOffset] = tangent.x;
510
+ tangents[attrIndex1 + bottomOffset] = tangent.y;
511
+ tangents[attrIndex2 + bottomOffset] = tangent.z;
512
+ } else if (bottom) {
513
+ tangents[attrIndex + bottomOffset] = -tangent.x;
514
+ tangents[attrIndex1 + bottomOffset] = -tangent.y;
515
+ tangents[attrIndex2 + bottomOffset] = -tangent.z;
516
+ }
517
+ if (top) {
518
+ if (perPositionHeight) {
519
+ tangents[attrIndex] = scratchPerPosTangent.x;
520
+ tangents[attrIndex1] = scratchPerPosTangent.y;
521
+ tangents[attrIndex2] = scratchPerPosTangent.z;
522
+ } else {
523
+ tangents[attrIndex] = tangent.x;
524
+ tangents[attrIndex1] = tangent.y;
525
+ tangents[attrIndex2] = tangent.z;
526
+ }
527
+ }
528
+ }
529
+ if (vertexFormat.bitangent) {
530
+ if (bottom) {
531
+ bitangents[attrIndex + bottomOffset] = bitangent.x;
532
+ bitangents[attrIndex1 + bottomOffset] = bitangent.y;
533
+ bitangents[attrIndex2 + bottomOffset] = bitangent.z;
534
+ }
535
+ if (top) {
536
+ if (perPositionHeight) {
537
+ bitangents[attrIndex] = scratchPerPosBitangent.x;
538
+ bitangents[attrIndex1] = scratchPerPosBitangent.y;
539
+ bitangents[attrIndex2] = scratchPerPosBitangent.z;
540
+ } else {
541
+ bitangents[attrIndex] = bitangent.x;
542
+ bitangents[attrIndex1] = bitangent.y;
543
+ bitangents[attrIndex2] = bitangent.z;
544
+ }
545
+ }
546
+ }
547
+ attrIndex += 3;
548
+ }
549
+ }
550
+ if (vertexFormat.st && !defined_default(flatTexcoords)) {
551
+ geometry.attributes.st = new GeometryAttribute_default({
552
+ componentDatatype: ComponentDatatype_default.FLOAT,
553
+ componentsPerAttribute: 2,
554
+ values: textureCoordinates
555
+ });
556
+ }
557
+ if (vertexFormat.normal) {
558
+ geometry.attributes.normal = new GeometryAttribute_default({
559
+ componentDatatype: ComponentDatatype_default.FLOAT,
560
+ componentsPerAttribute: 3,
561
+ values: normals
562
+ });
563
+ }
564
+ if (vertexFormat.tangent) {
565
+ geometry.attributes.tangent = new GeometryAttribute_default({
566
+ componentDatatype: ComponentDatatype_default.FLOAT,
567
+ componentsPerAttribute: 3,
568
+ values: tangents
569
+ });
570
+ }
571
+ if (vertexFormat.bitangent) {
572
+ geometry.attributes.bitangent = new GeometryAttribute_default({
573
+ componentDatatype: ComponentDatatype_default.FLOAT,
574
+ componentsPerAttribute: 3,
575
+ values: bitangents
576
+ });
577
+ }
578
+ if (shadowVolume) {
579
+ geometry.attributes.extrudeDirection = new GeometryAttribute_default({
580
+ componentDatatype: ComponentDatatype_default.FLOAT,
581
+ componentsPerAttribute: 3,
582
+ values: extrudeNormals
583
+ });
584
+ }
585
+ }
586
+ if (options.extrude && defined_default(options.offsetAttribute)) {
587
+ const size = flatPositions.length / 3;
588
+ let offsetAttribute = new Uint8Array(size);
589
+ if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
590
+ if (top && bottom || wall) {
591
+ offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
592
+ } else if (top) {
593
+ offsetAttribute = offsetAttribute.fill(1);
594
+ }
595
+ } else {
596
+ const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
597
+ offsetAttribute = offsetAttribute.fill(offsetValue);
598
+ }
599
+ geometry.attributes.applyOffset = new GeometryAttribute_default({
600
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
601
+ componentsPerAttribute: 1,
602
+ values: offsetAttribute
603
+ });
604
+ }
605
+ return geometry;
606
+ }
607
+ var createGeometryFromPositionsExtrudedPositions = [];
608
+ function createGeometryFromPositionsExtruded(ellipsoid, polygon2, textureCoordinates, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
609
+ const geos = {
610
+ walls: []
611
+ };
612
+ let i;
613
+ if (closeTop || closeBottom) {
614
+ const topGeo = PolygonGeometryLibrary_default.createGeometryFromPositions(
615
+ ellipsoid,
616
+ polygon2,
617
+ textureCoordinates,
618
+ granularity,
619
+ perPositionHeight,
620
+ vertexFormat,
621
+ arcType
622
+ );
623
+ const edgePoints = topGeo.attributes.position.values;
624
+ const indices = topGeo.indices;
625
+ let numPositions;
626
+ let newIndices;
627
+ if (closeTop && closeBottom) {
628
+ const topBottomPositions = edgePoints.concat(edgePoints);
629
+ numPositions = topBottomPositions.length / 3;
630
+ newIndices = IndexDatatype_default.createTypedArray(
631
+ numPositions,
632
+ indices.length * 2
633
+ );
634
+ newIndices.set(indices);
635
+ const ilength = indices.length;
636
+ const length = numPositions / 2;
637
+ for (i = 0; i < ilength; i += 3) {
638
+ const i0 = newIndices[i] + length;
639
+ const i1 = newIndices[i + 1] + length;
640
+ const i2 = newIndices[i + 2] + length;
641
+ newIndices[i + ilength] = i2;
642
+ newIndices[i + 1 + ilength] = i1;
643
+ newIndices[i + 2 + ilength] = i0;
644
+ }
645
+ topGeo.attributes.position.values = topBottomPositions;
646
+ if (perPositionHeight && vertexFormat.normal) {
647
+ const normals = topGeo.attributes.normal.values;
648
+ topGeo.attributes.normal.values = new Float32Array(
649
+ topBottomPositions.length
650
+ );
651
+ topGeo.attributes.normal.values.set(normals);
652
+ }
653
+ if (vertexFormat.st && defined_default(textureCoordinates)) {
654
+ const texcoords = topGeo.attributes.st.values;
655
+ topGeo.attributes.st.values = new Float32Array(numPositions * 2);
656
+ topGeo.attributes.st.values = texcoords.concat(texcoords);
657
+ }
658
+ topGeo.indices = newIndices;
659
+ } else if (closeBottom) {
660
+ numPositions = edgePoints.length / 3;
661
+ newIndices = IndexDatatype_default.createTypedArray(numPositions, indices.length);
662
+ for (i = 0; i < indices.length; i += 3) {
663
+ newIndices[i] = indices[i + 2];
664
+ newIndices[i + 1] = indices[i + 1];
665
+ newIndices[i + 2] = indices[i];
666
+ }
667
+ topGeo.indices = newIndices;
668
+ }
669
+ geos.topAndBottom = new GeometryInstance_default({
670
+ geometry: topGeo
671
+ });
672
+ }
673
+ let outerRing = hierarchy.outerRing;
674
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
675
+ let positions2D = tangentPlane.projectPointsOntoPlane(
676
+ outerRing,
677
+ createGeometryFromPositionsExtrudedPositions
678
+ );
679
+ let windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
680
+ if (windingOrder === WindingOrder_default.CLOCKWISE) {
681
+ outerRing = outerRing.slice().reverse();
682
+ }
683
+ let wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
684
+ outerRing,
685
+ textureCoordinates,
686
+ ellipsoid,
687
+ granularity,
688
+ perPositionHeight,
689
+ arcType
690
+ );
691
+ geos.walls.push(
692
+ new GeometryInstance_default({
693
+ geometry: wallGeo
694
+ })
695
+ );
696
+ const holes = hierarchy.holes;
697
+ for (i = 0; i < holes.length; i++) {
698
+ let hole = holes[i];
699
+ positions2D = tangentPlane.projectPointsOntoPlane(
700
+ hole,
701
+ createGeometryFromPositionsExtrudedPositions
702
+ );
703
+ windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
704
+ if (windingOrder === WindingOrder_default.COUNTER_CLOCKWISE) {
705
+ hole = hole.slice().reverse();
706
+ }
707
+ wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
708
+ hole,
709
+ textureCoordinates,
710
+ ellipsoid,
711
+ granularity,
712
+ perPositionHeight,
713
+ arcType
714
+ );
715
+ geos.walls.push(
716
+ new GeometryInstance_default({
717
+ geometry: wallGeo
718
+ })
719
+ );
720
+ }
721
+ return geos;
722
+ }
723
+ function PolygonGeometry(options) {
724
+ Check_default.typeOf.object("options", options);
725
+ Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
726
+ if (defined_default(options.perPositionHeight) && options.perPositionHeight && defined_default(options.height)) {
727
+ throw new DeveloperError_default(
728
+ "Cannot use both options.perPositionHeight and options.height"
729
+ );
730
+ }
731
+ if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
732
+ throw new DeveloperError_default(
733
+ "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
734
+ );
735
+ }
736
+ const polygonHierarchy = options.polygonHierarchy;
737
+ const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
738
+ const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
739
+ const granularity = defaultValue_default(
740
+ options.granularity,
741
+ Math_default.RADIANS_PER_DEGREE
742
+ );
743
+ const stRotation = defaultValue_default(options.stRotation, 0);
744
+ const textureCoordinates = options.textureCoordinates;
745
+ const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
746
+ const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
747
+ let height = defaultValue_default(options.height, 0);
748
+ let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
749
+ if (!perPositionHeightExtrude) {
750
+ const h = Math.max(height, extrudedHeight);
751
+ extrudedHeight = Math.min(height, extrudedHeight);
752
+ height = h;
753
+ }
754
+ this._vertexFormat = VertexFormat_default.clone(vertexFormat);
755
+ this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
756
+ this._granularity = granularity;
757
+ this._stRotation = stRotation;
758
+ this._height = height;
759
+ this._extrudedHeight = extrudedHeight;
760
+ this._closeTop = defaultValue_default(options.closeTop, true);
761
+ this._closeBottom = defaultValue_default(options.closeBottom, true);
762
+ this._polygonHierarchy = polygonHierarchy;
763
+ this._perPositionHeight = perPositionHeight;
764
+ this._perPositionHeightExtrude = perPositionHeightExtrude;
765
+ this._shadowVolume = defaultValue_default(options.shadowVolume, false);
766
+ this._workerName = "createPolygonGeometry";
767
+ this._offsetAttribute = options.offsetAttribute;
768
+ this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
769
+ this._rectangle = void 0;
770
+ this._textureCoordinateRotationPoints = void 0;
771
+ this._textureCoordinates = textureCoordinates;
772
+ this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
773
+ polygonHierarchy,
774
+ Cartesian3_default
775
+ ) + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + (textureCoordinates ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
776
+ textureCoordinates,
777
+ Cartesian2_default
778
+ ) : 1) + 12;
779
+ }
780
+ PolygonGeometry.fromPositions = function(options) {
781
+ options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
782
+ Check_default.defined("options.positions", options.positions);
783
+ const newOptions = {
784
+ polygonHierarchy: {
785
+ positions: options.positions
786
+ },
787
+ height: options.height,
788
+ extrudedHeight: options.extrudedHeight,
789
+ vertexFormat: options.vertexFormat,
790
+ stRotation: options.stRotation,
791
+ ellipsoid: options.ellipsoid,
792
+ granularity: options.granularity,
793
+ perPositionHeight: options.perPositionHeight,
794
+ closeTop: options.closeTop,
795
+ closeBottom: options.closeBottom,
796
+ offsetAttribute: options.offsetAttribute,
797
+ arcType: options.arcType,
798
+ textureCoordinates: options.textureCoordinates
799
+ };
800
+ return new PolygonGeometry(newOptions);
801
+ };
802
+ PolygonGeometry.pack = function(value, array, startingIndex) {
803
+ Check_default.typeOf.object("value", value);
804
+ Check_default.defined("array", array);
805
+ startingIndex = defaultValue_default(startingIndex, 0);
806
+ startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
807
+ value._polygonHierarchy,
808
+ array,
809
+ startingIndex,
810
+ Cartesian3_default
811
+ );
812
+ Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
813
+ startingIndex += Ellipsoid_default.packedLength;
814
+ VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
815
+ startingIndex += VertexFormat_default.packedLength;
816
+ array[startingIndex++] = value._height;
817
+ array[startingIndex++] = value._extrudedHeight;
818
+ array[startingIndex++] = value._granularity;
819
+ array[startingIndex++] = value._stRotation;
820
+ array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
821
+ array[startingIndex++] = value._perPositionHeight ? 1 : 0;
822
+ array[startingIndex++] = value._closeTop ? 1 : 0;
823
+ array[startingIndex++] = value._closeBottom ? 1 : 0;
824
+ array[startingIndex++] = value._shadowVolume ? 1 : 0;
825
+ array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
826
+ array[startingIndex++] = value._arcType;
827
+ if (defined_default(value._textureCoordinates)) {
828
+ startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
829
+ value._textureCoordinates,
830
+ array,
831
+ startingIndex,
832
+ Cartesian2_default
833
+ );
834
+ } else {
835
+ array[startingIndex++] = -1;
836
+ }
837
+ array[startingIndex++] = value.packedLength;
838
+ return array;
839
+ };
840
+ var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
841
+ var scratchVertexFormat = new VertexFormat_default();
842
+ var dummyOptions = {
843
+ polygonHierarchy: {}
844
+ };
845
+ PolygonGeometry.unpack = function(array, startingIndex, result) {
846
+ Check_default.defined("array", array);
847
+ startingIndex = defaultValue_default(startingIndex, 0);
848
+ const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
849
+ array,
850
+ startingIndex,
851
+ Cartesian3_default
852
+ );
853
+ startingIndex = polygonHierarchy.startingIndex;
854
+ delete polygonHierarchy.startingIndex;
855
+ const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
856
+ startingIndex += Ellipsoid_default.packedLength;
857
+ const vertexFormat = VertexFormat_default.unpack(
858
+ array,
859
+ startingIndex,
860
+ scratchVertexFormat
861
+ );
862
+ startingIndex += VertexFormat_default.packedLength;
863
+ const height = array[startingIndex++];
864
+ const extrudedHeight = array[startingIndex++];
865
+ const granularity = array[startingIndex++];
866
+ const stRotation = array[startingIndex++];
867
+ const perPositionHeightExtrude = array[startingIndex++] === 1;
868
+ const perPositionHeight = array[startingIndex++] === 1;
869
+ const closeTop = array[startingIndex++] === 1;
870
+ const closeBottom = array[startingIndex++] === 1;
871
+ const shadowVolume = array[startingIndex++] === 1;
872
+ const offsetAttribute = array[startingIndex++];
873
+ const arcType = array[startingIndex++];
874
+ const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
875
+ array,
876
+ startingIndex,
877
+ Cartesian2_default
878
+ );
879
+ if (defined_default(textureCoordinates)) {
880
+ startingIndex = textureCoordinates.startingIndex;
881
+ delete textureCoordinates.startingIndex;
882
+ } else {
883
+ startingIndex++;
884
+ }
885
+ const packedLength = array[startingIndex++];
886
+ if (!defined_default(result)) {
887
+ result = new PolygonGeometry(dummyOptions);
888
+ }
889
+ result._polygonHierarchy = polygonHierarchy;
890
+ result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
891
+ result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
892
+ result._height = height;
893
+ result._extrudedHeight = extrudedHeight;
894
+ result._granularity = granularity;
895
+ result._stRotation = stRotation;
896
+ result._perPositionHeightExtrude = perPositionHeightExtrude;
897
+ result._perPositionHeight = perPositionHeight;
898
+ result._closeTop = closeTop;
899
+ result._closeBottom = closeBottom;
900
+ result._shadowVolume = shadowVolume;
901
+ result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
902
+ result._arcType = arcType;
903
+ result._textureCoordinates = textureCoordinates;
904
+ result.packedLength = packedLength;
905
+ return result;
906
+ };
907
+ var scratchCartesian0 = new Cartesian2_default();
908
+ var scratchCartesian1 = new Cartesian2_default();
909
+ var scratchPolarClosest = new Stereographic_default();
910
+ function expandRectangle(polar, lastPolar, ellipsoid, arcType, polygon2, result) {
911
+ const longitude = polar.longitude;
912
+ const lonAdjusted = longitude >= 0 ? longitude : longitude + Math_default.TWO_PI;
913
+ polygon2.westOverIdl = Math.min(polygon2.westOverIdl, lonAdjusted);
914
+ polygon2.eastOverIdl = Math.max(polygon2.eastOverIdl, lonAdjusted);
915
+ result.west = Math.min(result.west, longitude);
916
+ result.east = Math.max(result.east, longitude);
917
+ const latitude = polar.getLatitude(ellipsoid);
918
+ let segmentLatitude = latitude;
919
+ result.south = Math.min(result.south, latitude);
920
+ result.north = Math.max(result.north, latitude);
921
+ if (arcType !== ArcType_default.RHUMB) {
922
+ const segment = Cartesian2_default.subtract(
923
+ lastPolar.position,
924
+ polar.position,
925
+ scratchCartesian0
926
+ );
927
+ const t = Cartesian2_default.dot(lastPolar.position, segment) / Cartesian2_default.dot(segment, segment);
928
+ if (t > 0 && t < 1) {
929
+ const projected = Cartesian2_default.add(
930
+ lastPolar.position,
931
+ Cartesian2_default.multiplyByScalar(segment, -t, segment),
932
+ scratchCartesian1
933
+ );
934
+ const closestPolar = Stereographic_default.clone(lastPolar, scratchPolarClosest);
935
+ closestPolar.position = projected;
936
+ const adjustedLatitude = closestPolar.getLatitude(ellipsoid);
937
+ result.south = Math.min(result.south, adjustedLatitude);
938
+ result.north = Math.max(result.north, adjustedLatitude);
939
+ if (Math.abs(latitude) > Math.abs(adjustedLatitude)) {
940
+ segmentLatitude = adjustedLatitude;
941
+ }
942
+ }
943
+ }
944
+ const direction = lastPolar.x * polar.y - polar.x * lastPolar.y;
945
+ let angle = Math.sign(direction);
946
+ if (angle !== 0) {
947
+ angle *= Cartesian2_default.angleBetween(lastPolar.position, polar.position);
948
+ }
949
+ if (segmentLatitude >= 0) {
950
+ polygon2.northAngle += angle;
951
+ }
952
+ if (segmentLatitude <= 0) {
953
+ polygon2.southAngle += angle;
954
+ }
955
+ }
956
+ var scratchPolar = new Stereographic_default();
957
+ var scratchPolarPrevious = new Stereographic_default();
958
+ var polygon = {
959
+ northAngle: 0,
960
+ southAngle: 0,
961
+ westOverIdl: 0,
962
+ eastOverIdl: 0
963
+ };
964
+ PolygonGeometry.computeRectangleFromPositions = function(positions, ellipsoid, arcType, result) {
965
+ Check_default.defined("positions", positions);
966
+ if (!defined_default(result)) {
967
+ result = new Rectangle_default();
968
+ }
969
+ if (positions.length < 3) {
970
+ return result;
971
+ }
972
+ result.west = Number.POSITIVE_INFINITY;
973
+ result.east = Number.NEGATIVE_INFINITY;
974
+ result.south = Number.POSITIVE_INFINITY;
975
+ result.north = Number.NEGATIVE_INFINITY;
976
+ polygon.northAngle = 0;
977
+ polygon.southAngle = 0;
978
+ polygon.westOverIdl = Number.POSITIVE_INFINITY;
979
+ polygon.eastOverIdl = Number.NEGATIVE_INFINITY;
980
+ const positionsLength = positions.length;
981
+ let lastPolarPosition = Stereographic_default.fromCartesian(
982
+ positions[0],
983
+ scratchPolarPrevious
984
+ );
985
+ for (let i = 1; i < positionsLength; i++) {
986
+ const polarPosition = Stereographic_default.fromCartesian(
987
+ positions[i],
988
+ scratchPolar
989
+ );
990
+ expandRectangle(
991
+ polarPosition,
992
+ lastPolarPosition,
993
+ ellipsoid,
994
+ arcType,
995
+ polygon,
996
+ result
997
+ );
998
+ lastPolarPosition = Stereographic_default.clone(polarPosition, lastPolarPosition);
999
+ }
1000
+ expandRectangle(
1001
+ Stereographic_default.fromCartesian(positions[0], scratchPolar),
1002
+ lastPolarPosition,
1003
+ ellipsoid,
1004
+ arcType,
1005
+ polygon,
1006
+ result
1007
+ );
1008
+ if (result.east - result.west > polygon.eastOverIdl - polygon.westOverIdl) {
1009
+ result.west = polygon.westOverIdl;
1010
+ result.east = polygon.eastOverIdl;
1011
+ if (result.east > Math_default.PI) {
1012
+ result.east = result.east - Math_default.TWO_PI;
1013
+ }
1014
+ if (result.west > Math_default.PI) {
1015
+ result.west = result.west - Math_default.TWO_PI;
1016
+ }
1017
+ }
1018
+ if (Math_default.equalsEpsilon(
1019
+ Math.abs(polygon.northAngle),
1020
+ Math_default.TWO_PI,
1021
+ Math_default.EPSILON10
1022
+ )) {
1023
+ result.north = Math_default.PI_OVER_TWO;
1024
+ result.east = Math_default.PI;
1025
+ result.west = -Math_default.PI;
1026
+ }
1027
+ if (Math_default.equalsEpsilon(
1028
+ Math.abs(polygon.southAngle),
1029
+ Math_default.TWO_PI,
1030
+ Math_default.EPSILON10
1031
+ )) {
1032
+ result.south = -Math_default.PI_OVER_TWO;
1033
+ result.east = Math_default.PI;
1034
+ result.west = -Math_default.PI;
1035
+ }
1036
+ return result;
1037
+ };
1038
+ var scratchPolarForPlane = new Stereographic_default();
1039
+ function getTangentPlane(rectangle, positions, ellipsoid) {
1040
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1041
+ const polar = Stereographic_default.fromCartesian(
1042
+ positions[0],
1043
+ scratchPolarForPlane
1044
+ );
1045
+ return polar.tangentPlane;
1046
+ }
1047
+ return EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
1048
+ }
1049
+ var scratchCartographicCyllindrical = new Cartographic_default();
1050
+ function createProjectTo2d(rectangle, outerPositions, ellipsoid) {
1051
+ return (positions, results) => {
1052
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1053
+ if (rectangle.south < 0 && rectangle.north > 0) {
1054
+ if (!defined_default(results)) {
1055
+ results = [];
1056
+ }
1057
+ for (let i = 0; i < positions.length; ++i) {
1058
+ const cartographic = ellipsoid.cartesianToCartographic(
1059
+ positions[i],
1060
+ scratchCartographicCyllindrical
1061
+ );
1062
+ results[i] = new Cartesian2_default(
1063
+ cartographic.longitude / Math_default.PI,
1064
+ cartographic.latitude / Math_default.PI_OVER_TWO
1065
+ );
1066
+ }
1067
+ results.length = positions.length;
1068
+ return results;
1069
+ }
1070
+ return Stereographic_default.fromCartesianArray(positions, results);
1071
+ }
1072
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
1073
+ outerPositions,
1074
+ ellipsoid
1075
+ );
1076
+ return tangentPlane.projectPointsOntoPlane(positions, results);
1077
+ };
1078
+ }
1079
+ function createProjectPositionTo2d(rectangle, outerRing, ellipsoid) {
1080
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1081
+ return (position, result) => {
1082
+ if (rectangle.south < 0 && rectangle.north > 0) {
1083
+ const cartographic = ellipsoid.cartesianToCartographic(
1084
+ position,
1085
+ scratchCartographicCyllindrical
1086
+ );
1087
+ if (!defined_default(result)) {
1088
+ result = new Cartesian2_default();
1089
+ }
1090
+ result.x = cartographic.longitude / Math_default.PI;
1091
+ result.y = cartographic.latitude / Math_default.PI_OVER_TWO;
1092
+ return result;
1093
+ }
1094
+ return Stereographic_default.fromCartesian(position, result);
1095
+ };
1096
+ }
1097
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
1098
+ return (position, result) => {
1099
+ return tangentPlane.projectPointsOntoPlane(position, result);
1100
+ };
1101
+ }
1102
+ function createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight) {
1103
+ return (polygons, results) => {
1104
+ if (!perPositionHeight && (rectangle.height >= Math_default.PI_OVER_TWO || rectangle.width >= 2 * Math_default.PI_OVER_THREE)) {
1105
+ return PolygonGeometryLibrary_default.splitPolygonsOnEquator(
1106
+ polygons,
1107
+ ellipsoid,
1108
+ arcType,
1109
+ results
1110
+ );
1111
+ }
1112
+ return polygons;
1113
+ };
1114
+ }
1115
+ function computeBoundingRectangle(outerRing, rectangle, ellipsoid, stRotation) {
1116
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1117
+ return BoundingRectangle_default.fromRectangle(
1118
+ rectangle,
1119
+ void 0,
1120
+ scratchBoundingRectangle
1121
+ );
1122
+ }
1123
+ const outerPositions = outerRing;
1124
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
1125
+ outerPositions,
1126
+ ellipsoid
1127
+ );
1128
+ return PolygonGeometryLibrary_default.computeBoundingRectangle(
1129
+ tangentPlane.plane.normal,
1130
+ tangentPlane.projectPointOntoPlane.bind(tangentPlane),
1131
+ outerPositions,
1132
+ stRotation,
1133
+ scratchBoundingRectangle
1134
+ );
1135
+ }
1136
+ PolygonGeometry.createGeometry = function(polygonGeometry) {
1137
+ const vertexFormat = polygonGeometry._vertexFormat;
1138
+ const ellipsoid = polygonGeometry._ellipsoid;
1139
+ const granularity = polygonGeometry._granularity;
1140
+ const stRotation = polygonGeometry._stRotation;
1141
+ const polygonHierarchy = polygonGeometry._polygonHierarchy;
1142
+ const perPositionHeight = polygonGeometry._perPositionHeight;
1143
+ const closeTop = polygonGeometry._closeTop;
1144
+ const closeBottom = polygonGeometry._closeBottom;
1145
+ const arcType = polygonGeometry._arcType;
1146
+ const textureCoordinates = polygonGeometry._textureCoordinates;
1147
+ const hasTextureCoordinates = defined_default(textureCoordinates);
1148
+ const outerPositions = polygonHierarchy.positions;
1149
+ if (outerPositions.length < 3) {
1150
+ return;
1151
+ }
1152
+ const rectangle = polygonGeometry.rectangle;
1153
+ const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
1154
+ polygonHierarchy,
1155
+ hasTextureCoordinates,
1156
+ createProjectTo2d(rectangle, outerPositions, ellipsoid),
1157
+ !perPositionHeight,
1158
+ ellipsoid,
1159
+ createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight)
1160
+ );
1161
+ const hierarchy = results.hierarchy;
1162
+ const polygons = results.polygons;
1163
+ const dummyFunction = function(identity) {
1164
+ return identity;
1165
+ };
1166
+ const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
1167
+ textureCoordinates,
1168
+ true,
1169
+ dummyFunction,
1170
+ false,
1171
+ ellipsoid
1172
+ ).polygons : void 0;
1173
+ if (hierarchy.length === 0) {
1174
+ return;
1175
+ }
1176
+ const outerRing = hierarchy[0].outerRing;
1177
+ const boundingRectangle = computeBoundingRectangle(
1178
+ outerRing,
1179
+ rectangle,
1180
+ ellipsoid,
1181
+ stRotation
1182
+ );
1183
+ const geometries = [];
1184
+ const height = polygonGeometry._height;
1185
+ const extrudedHeight = polygonGeometry._extrudedHeight;
1186
+ const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
1187
+ const options = {
1188
+ perPositionHeight,
1189
+ vertexFormat,
1190
+ geometry: void 0,
1191
+ rotationAxis: getTangentPlane(rectangle, outerRing, ellipsoid).plane.normal,
1192
+ projectTo2d: createProjectPositionTo2d(rectangle, outerRing, ellipsoid),
1193
+ boundingRectangle,
1194
+ ellipsoid,
1195
+ stRotation,
1196
+ textureCoordinates: void 0,
1197
+ bottom: false,
1198
+ top: true,
1199
+ wall: false,
1200
+ extrude: false,
1201
+ arcType
1202
+ };
1203
+ let i;
1204
+ if (extrude) {
1205
+ options.extrude = true;
1206
+ options.top = closeTop;
1207
+ options.bottom = closeBottom;
1208
+ options.shadowVolume = polygonGeometry._shadowVolume;
1209
+ options.offsetAttribute = polygonGeometry._offsetAttribute;
1210
+ for (i = 0; i < polygons.length; i++) {
1211
+ const splitGeometry = createGeometryFromPositionsExtruded(
1212
+ ellipsoid,
1213
+ polygons[i],
1214
+ hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
1215
+ granularity,
1216
+ hierarchy[i],
1217
+ perPositionHeight,
1218
+ closeTop,
1219
+ closeBottom,
1220
+ vertexFormat,
1221
+ arcType
1222
+ );
1223
+ let topAndBottom;
1224
+ if (closeTop && closeBottom) {
1225
+ topAndBottom = splitGeometry.topAndBottom;
1226
+ options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
1227
+ topAndBottom.geometry,
1228
+ height,
1229
+ extrudedHeight,
1230
+ ellipsoid,
1231
+ perPositionHeight
1232
+ );
1233
+ } else if (closeTop) {
1234
+ topAndBottom = splitGeometry.topAndBottom;
1235
+ topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1236
+ topAndBottom.geometry.attributes.position.values,
1237
+ height,
1238
+ ellipsoid,
1239
+ !perPositionHeight
1240
+ );
1241
+ options.geometry = topAndBottom.geometry;
1242
+ } else if (closeBottom) {
1243
+ topAndBottom = splitGeometry.topAndBottom;
1244
+ topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1245
+ topAndBottom.geometry.attributes.position.values,
1246
+ extrudedHeight,
1247
+ ellipsoid,
1248
+ true
1249
+ );
1250
+ options.geometry = topAndBottom.geometry;
1251
+ }
1252
+ if (closeTop || closeBottom) {
1253
+ options.wall = false;
1254
+ topAndBottom.geometry = computeAttributes(options);
1255
+ geometries.push(topAndBottom);
1256
+ }
1257
+ const walls = splitGeometry.walls;
1258
+ options.wall = true;
1259
+ for (let k = 0; k < walls.length; k++) {
1260
+ const wall = walls[k];
1261
+ options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
1262
+ wall.geometry,
1263
+ height,
1264
+ extrudedHeight,
1265
+ ellipsoid,
1266
+ perPositionHeight
1267
+ );
1268
+ wall.geometry = computeAttributes(options);
1269
+ geometries.push(wall);
1270
+ }
1271
+ }
1272
+ } else {
1273
+ for (i = 0; i < polygons.length; i++) {
1274
+ const geometryInstance = new GeometryInstance_default({
1275
+ geometry: PolygonGeometryLibrary_default.createGeometryFromPositions(
1276
+ ellipsoid,
1277
+ polygons[i],
1278
+ hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
1279
+ granularity,
1280
+ perPositionHeight,
1281
+ vertexFormat,
1282
+ arcType
1283
+ )
1284
+ });
1285
+ geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1286
+ geometryInstance.geometry.attributes.position.values,
1287
+ height,
1288
+ ellipsoid,
1289
+ !perPositionHeight
1290
+ );
1291
+ options.geometry = geometryInstance.geometry;
1292
+ geometryInstance.geometry = computeAttributes(options);
1293
+ if (defined_default(polygonGeometry._offsetAttribute)) {
1294
+ const length = geometryInstance.geometry.attributes.position.values.length;
1295
+ const offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
1296
+ const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
1297
+ geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default({
1298
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
1299
+ componentsPerAttribute: 1,
1300
+ values: applyOffset
1301
+ });
1302
+ }
1303
+ geometries.push(geometryInstance);
1304
+ }
1305
+ }
1306
+ const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
1307
+ geometry.attributes.position.values = new Float64Array(
1308
+ geometry.attributes.position.values
1309
+ );
1310
+ geometry.indices = IndexDatatype_default.createTypedArray(
1311
+ geometry.attributes.position.values.length / 3,
1312
+ geometry.indices
1313
+ );
1314
+ const attributes = geometry.attributes;
1315
+ const boundingSphere = BoundingSphere_default.fromVertices(
1316
+ attributes.position.values
1317
+ );
1318
+ if (!vertexFormat.position) {
1319
+ delete attributes.position;
1320
+ }
1321
+ return new Geometry_default({
1322
+ attributes,
1323
+ indices: geometry.indices,
1324
+ primitiveType: geometry.primitiveType,
1325
+ boundingSphere,
1326
+ offsetAttribute: polygonGeometry._offsetAttribute
1327
+ });
1328
+ };
1329
+ PolygonGeometry.createShadowVolume = function(polygonGeometry, minHeightFunc, maxHeightFunc) {
1330
+ const granularity = polygonGeometry._granularity;
1331
+ const ellipsoid = polygonGeometry._ellipsoid;
1332
+ const minHeight = minHeightFunc(granularity, ellipsoid);
1333
+ const maxHeight = maxHeightFunc(granularity, ellipsoid);
1334
+ return new PolygonGeometry({
1335
+ polygonHierarchy: polygonGeometry._polygonHierarchy,
1336
+ ellipsoid,
1337
+ stRotation: polygonGeometry._stRotation,
1338
+ granularity,
1339
+ perPositionHeight: false,
1340
+ extrudedHeight: minHeight,
1341
+ height: maxHeight,
1342
+ vertexFormat: VertexFormat_default.POSITION_ONLY,
1343
+ shadowVolume: true,
1344
+ arcType: polygonGeometry._arcType
1345
+ });
1346
+ };
1347
+ function textureCoordinateRotationPoints(polygonGeometry) {
1348
+ const stRotation = -polygonGeometry._stRotation;
1349
+ if (stRotation === 0) {
1350
+ return [0, 0, 0, 1, 1, 0];
1351
+ }
1352
+ const ellipsoid = polygonGeometry._ellipsoid;
1353
+ const positions = polygonGeometry._polygonHierarchy.positions;
1354
+ const boundingRectangle = polygonGeometry.rectangle;
1355
+ return Geometry_default._textureCoordinateRotationPoints(
1356
+ positions,
1357
+ stRotation,
1358
+ ellipsoid,
1359
+ boundingRectangle
1360
+ );
1361
+ }
1362
+ Object.defineProperties(PolygonGeometry.prototype, {
1363
+ /**
1364
+ * @private
1365
+ */
1366
+ rectangle: {
1367
+ get: function() {
1368
+ if (!defined_default(this._rectangle)) {
1369
+ const positions = this._polygonHierarchy.positions;
1370
+ this._rectangle = PolygonGeometry.computeRectangleFromPositions(
1371
+ positions,
1372
+ this._ellipsoid,
1373
+ this._arcType
1374
+ );
1375
+ }
1376
+ return this._rectangle;
1377
+ }
1378
+ },
1379
+ /**
1380
+ * For remapping texture coordinates when rendering PolygonGeometries as GroundPrimitives.
1381
+ * @private
1382
+ */
1383
+ textureCoordinateRotationPoints: {
1384
+ get: function() {
1385
+ if (!defined_default(this._textureCoordinateRotationPoints)) {
1386
+ this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(this);
1387
+ }
1388
+ return this._textureCoordinateRotationPoints;
1389
+ }
1390
+ }
1391
+ });
1392
+ var PolygonGeometry_default = PolygonGeometry;
1393
+
1394
+ // packages/engine/Source/Workers/createPolygonGeometry.js
1395
+ function createPolygonGeometry(polygonGeometry, offset) {
1396
+ if (defined_default(offset)) {
1397
+ polygonGeometry = PolygonGeometry_default.unpack(polygonGeometry, offset);
1398
+ }
1399
+ polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
1400
+ return PolygonGeometry_default.createGeometry(polygonGeometry);
1401
+ }
1402
+ var createPolygonGeometry_default = createPolygonGeometry;
1403
+ export {
1404
+ createPolygonGeometry_default as default
1405
+ };