@rtzh/engine 0.0.11 → 0.0.12

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 (517) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +656 -518
  2. package/Build/Workers/{chunk-23CHWHW6.js → chunk-2QUYHF2A.js} +4 -4
  3. package/Build/Workers/{chunk-DHWZGIOA.js → chunk-3J7LZYZG.js} +5 -5
  4. package/Build/Workers/{chunk-F4Q3VOCC.js → chunk-3KDCIRQI.js} +7 -7
  5. package/Build/Workers/{chunk-IVDXHQYL.js → chunk-3M6XQXJL.js} +5 -5
  6. package/Build/Workers/{chunk-K6PDZWHZ.js → chunk-3P5AO3U5.js} +5 -5
  7. package/Build/Workers/{chunk-FUFHIXPT.js → chunk-4DH5OOWE.js} +4 -4
  8. package/Build/Workers/{chunk-GDHDJK32.js → chunk-4G6JR2MZ.js} +10 -10
  9. package/Build/Workers/{chunk-5WKGRIN6.js → chunk-4VMTI2WC.js} +6 -6
  10. package/Build/Workers/{chunk-5D3ECYS3.js → chunk-55JFCPW4.js} +4 -4
  11. package/Build/Workers/{chunk-3CD4WIF4.js → chunk-5CVGPIDD.js} +2 -2
  12. package/Build/Workers/{chunk-FYW5UQ24.js → chunk-6JO3MGIQ.js} +12 -12
  13. package/Build/Workers/{chunk-DLRIAMQF.js → chunk-6SYRFK5R.js} +2 -2
  14. package/Build/Workers/{chunk-ATC2WXI4.js → chunk-6TITDWW4.js} +17 -17
  15. package/Build/Workers/{chunk-7EU3DIKZ.js → chunk-6ZPTOV5S.js} +18 -18
  16. package/Build/Workers/{chunk-MJVNNURF.js → chunk-74FGX7I7.js} +12 -12
  17. package/Build/Workers/{chunk-KMZXZUA7.js → chunk-7DG7QQQ6.js} +5 -5
  18. package/Build/Workers/{chunk-4BJHO56J.js → chunk-7DUCNF2V.js} +6 -6
  19. package/Build/Workers/{chunk-CTARL7CY.js → chunk-A3KVKXRR.js} +13 -13
  20. package/Build/Workers/{chunk-6HB2DMC2.js → chunk-A3OQ66NS.js} +16 -16
  21. package/Build/Workers/{chunk-5SVTAJRH.js → chunk-ADOJA3C4.js} +12 -12
  22. package/Build/Workers/{chunk-DKJMD2HX.js → chunk-AM7WOPMS.js} +6 -6
  23. package/Build/Workers/{chunk-6RUDXAFC.js → chunk-AUWAGN3U.js} +16 -16
  24. package/Build/Workers/{chunk-AEURJQ3B.js → chunk-B3SSRLUO.js} +2 -2
  25. package/Build/Workers/{chunk-ET7LWDHA.js → chunk-B7PKU4HH.js} +2 -2
  26. package/Build/Workers/{chunk-GPWELPVQ.js → chunk-B7SQOHFY.js} +7 -7
  27. package/Build/Workers/{chunk-F7IITURY.js → chunk-BGIF6VMP.js} +3 -3
  28. package/Build/Workers/{chunk-72YPCD72.js → chunk-BHYR5M4Y.js} +17 -17
  29. package/Build/Workers/{chunk-243UEBJF.js → chunk-BIPYGVES.js} +10 -10
  30. package/Build/Workers/{chunk-6BIU5AL4.js → chunk-BU5W4J4F.js} +10 -10
  31. package/Build/Workers/{chunk-4GPHI5UY.js → chunk-C3DT73MC.js} +10 -10
  32. package/Build/Workers/{chunk-IXM65GBF.js → chunk-CD2WSWPY.js} +4 -4
  33. package/Build/Workers/{chunk-HFCJLXTG.js → chunk-CHAPQYGD.js} +1 -1
  34. package/Build/Workers/{chunk-2UNHFFAZ.js → chunk-CXC4JSSY.js} +5 -5
  35. package/Build/Workers/{chunk-6MYDYE24.js → chunk-DB2NML4I.js} +1 -1
  36. package/Build/Workers/{chunk-32ZGDYJY.js → chunk-DKP3PVXJ.js} +18 -18
  37. package/Build/Workers/{chunk-CV5JLCHF.js → chunk-DLNCIAY5.js} +13 -13
  38. package/Build/Workers/{chunk-FD62YGTB.js → chunk-DMQ2K2CH.js} +7 -7
  39. package/Build/Workers/{chunk-J766O3PA.js → chunk-DN54YAFV.js} +4 -4
  40. package/Build/Workers/{chunk-7AS3X42P.js → chunk-E3YEHNIJ.js} +10 -10
  41. package/Build/Workers/{chunk-4NAHNN5G.js → chunk-ECYQUWGD.js} +10 -10
  42. package/Build/Workers/{chunk-54AFUJNV.js → chunk-EUE3UD5F.js} +11 -11
  43. package/Build/Workers/{chunk-DAYNPAVN.js → chunk-EXMUTZB4.js} +2 -2
  44. package/Build/Workers/{chunk-54LZ6OUD.js → chunk-F5SRLVVZ.js} +17 -17
  45. package/Build/Workers/{chunk-EWDHM5NC.js → chunk-FBSLGF4L.js} +1 -1
  46. package/Build/Workers/{chunk-565HBO3F.js → chunk-FNX2KJDD.js} +6 -6
  47. package/Build/Workers/{chunk-IYAZCFAC.js → chunk-FPEAW6NQ.js} +6 -6
  48. package/Build/Workers/{chunk-CQ5PWUMS.js → chunk-GAZENUEZ.js} +1 -1
  49. package/Build/Workers/{chunk-7BOVULMD.js → chunk-GBB5VIA3.js} +2 -2
  50. package/Build/Workers/{chunk-7R74V5Z3.js → chunk-HTMJEEON.js} +8 -8
  51. package/Build/Workers/{chunk-I5JHYEIE.js → chunk-HZ4N44YJ.js} +8 -8
  52. package/Build/Workers/{chunk-5UKR42KW.js → chunk-I4CJV4A3.js} +14 -14
  53. package/Build/Workers/{chunk-3L7XBXFS.js → chunk-IB22JEKK.js} +5 -5
  54. package/Build/Workers/{chunk-F6JVBOM5.js → chunk-IG64RWHT.js} +11 -11
  55. package/Build/Workers/{chunk-6AUSOZOL.js → chunk-IK5A56IF.js} +7 -7
  56. package/Build/Workers/{chunk-I3VVEQQ6.js → chunk-IMC7L6CL.js} +9 -9
  57. package/Build/Workers/{chunk-JRPAFYGJ.js → chunk-IPBVNANG.js} +17 -17
  58. package/Build/Workers/{chunk-6J63N735.js → chunk-IUIXI2XJ.js} +6 -6
  59. package/Build/Workers/{chunk-CGAHG2LR.js → chunk-J3WRL2GC.js} +2 -2
  60. package/Build/Workers/{chunk-AMJRLIO3.js → chunk-JF6HRK66.js} +11 -11
  61. package/Build/Workers/{chunk-2ZR6KBRW.js → chunk-JFOADEL2.js} +8 -8
  62. package/Build/Workers/{chunk-KGQGZ7PF.js → chunk-JNSU4PGT.js} +12 -12
  63. package/Build/Workers/{chunk-6ZF4QOFM.js → chunk-JPORXJB2.js} +6 -6
  64. package/Build/Workers/{chunk-6YSUD2OH.js → chunk-JTH56QYP.js} +7 -7
  65. package/Build/Workers/{chunk-G7PGTG3P.js → chunk-K5QIQSHR.js} +13 -13
  66. package/Build/Workers/{chunk-H33FCT5U.js → chunk-KN3RXSGH.js} +9 -9
  67. package/Build/Workers/{chunk-4SC4KVID.js → chunk-KTUWGLXR.js} +10 -10
  68. package/Build/Workers/{chunk-B3FJJGCH.js → chunk-LBVC3PWG.js} +4 -4
  69. package/Build/Workers/{chunk-6YT2LZ3Z.js → chunk-LKUMU7VD.js} +4 -4
  70. package/Build/Workers/{chunk-FARHIBOA.js → chunk-LUA5G72O.js} +1 -1
  71. package/Build/Workers/{chunk-7X6CLAD2.js → chunk-MSYP7LPX.js} +9 -9
  72. package/Build/Workers/{chunk-LGMONS4O.js → chunk-MZWPVY6R.js} +7 -7
  73. package/Build/Workers/{chunk-4SZJ3KRD.js → chunk-N557LIW2.js} +3 -3
  74. package/Build/Workers/{chunk-45SKJP37.js → chunk-NGTONEWG.js} +4 -4
  75. package/Build/Workers/{chunk-FRUZKVBP.js → chunk-NLAR3AKL.js} +6 -6
  76. package/Build/Workers/{chunk-APOATHFZ.js → chunk-OF3WIS5R.js} +4 -4
  77. package/Build/Workers/{chunk-BQRZMSMM.js → chunk-OHWONB5E.js} +4 -4
  78. package/Build/Workers/{chunk-QDNIPHD7.js → chunk-OTYYR4HA.js} +12 -12
  79. package/Build/Workers/{chunk-GCZNJHST.js → chunk-OVJADFWR.js} +5 -5
  80. package/Build/Workers/{chunk-MPHEIDPB.js → chunk-OWR6KGDV.js} +1 -1
  81. package/Build/Workers/{chunk-7QPQGSS3.js → chunk-PEZ2F4AC.js} +5 -5
  82. package/Build/Workers/{chunk-553BNJPP.js → chunk-PJEU2YDM.js} +8 -8
  83. package/Build/Workers/{chunk-7KOMCIWI.js → chunk-PNJB4ARY.js} +8 -8
  84. package/Build/Workers/{chunk-2CZLDPAQ.js → chunk-PSGQHI7V.js} +2 -2
  85. package/Build/Workers/{chunk-EDFDPOY6.js → chunk-PTBF7YWH.js} +1 -1
  86. package/Build/Workers/{chunk-BIJHMMCD.js → chunk-QICSE57I.js} +4 -4
  87. package/Build/Workers/{chunk-2VN5W6HA.js → chunk-QM26UZ4G.js} +5 -5
  88. package/Build/Workers/{chunk-4IXXMXPJ.js → chunk-QMUEVSBY.js} +10 -10
  89. package/Build/Workers/{chunk-HKSICPYV.js → chunk-QNTU5YFH.js} +1 -1
  90. package/Build/Workers/{chunk-J2S3WMUZ.js → chunk-RLMDD7LI.js} +6 -6
  91. package/Build/Workers/{chunk-E7SFSMUX.js → chunk-RWZLJD75.js} +2 -2
  92. package/Build/Workers/{chunk-4UBPBH32.js → chunk-SCDH4DI7.js} +5 -5
  93. package/Build/Workers/{chunk-CQB3KRGK.js → chunk-SKWZGTC6.js} +7 -7
  94. package/Build/Workers/{chunk-5W4ISZGQ.js → chunk-SUTV4NUG.js} +14 -14
  95. package/Build/Workers/{chunk-J2CUNLQP.js → chunk-T3CBEYZZ.js} +9 -9
  96. package/Build/Workers/{chunk-5T4DXPEL.js → chunk-T6IEXU63.js} +8 -8
  97. package/Build/Workers/{chunk-DPTYP7J3.js → chunk-TBIPO5CH.js} +1 -1
  98. package/Build/Workers/{chunk-37WPNI52.js → chunk-TEAYSUTK.js} +1 -1
  99. package/Build/Workers/{chunk-5L3PEFKO.js → chunk-TSB4I6D6.js} +1 -1
  100. package/Build/Workers/{chunk-2ZXYLPPT.js → chunk-ULWGQGIU.js} +2 -2
  101. package/Build/Workers/{chunk-GZMTBQM2.js → chunk-UTAFOZR6.js} +4 -4
  102. package/Build/Workers/{chunk-6KA3AJM6.js → chunk-V4BLFYXZ.js} +6 -6
  103. package/Build/Workers/{chunk-3ZDA3MBK.js → chunk-VH4ZDU2H.js} +6 -6
  104. package/Build/Workers/{chunk-JUJONRWD.js → chunk-WAJ236EA.js} +11 -11
  105. package/Build/Workers/{chunk-56MKFDJH.js → chunk-WDTR5ZPN.js} +12 -12
  106. package/Build/Workers/{chunk-FNI64UKI.js → chunk-WJ74Z47X.js} +5 -5
  107. package/Build/Workers/{chunk-3PWX65TL.js → chunk-WKYBYW6H.js} +14 -14
  108. package/Build/Workers/{chunk-G6PDJHNG.js → chunk-WTKUVRNG.js} +7 -7
  109. package/Build/Workers/{chunk-HAR6Y2HP.js → chunk-XH535OLG.js} +2 -2
  110. package/Build/Workers/{chunk-LSGHTNF5.js → chunk-XMN6BU5T.js} +13 -13
  111. package/Build/Workers/{chunk-ET7K6FSD.js → chunk-Y6KZOXMR.js} +14 -14
  112. package/Build/Workers/{chunk-42I3QSKJ.js → chunk-YGPS3DPM.js} +1 -1
  113. package/Build/Workers/{chunk-6TWMNB7Q.js → chunk-YMGBVMJH.js} +6 -6
  114. package/Build/Workers/{chunk-32GOIUYC.js → chunk-ZESIYF5P.js} +5 -5
  115. package/Build/Workers/{chunk-2LMIHR6B.js → chunk-ZSDJVMQL.js} +2 -2
  116. package/Build/Workers/combineGeometry.js +24 -24
  117. package/Build/Workers/createBoxGeometry.js +18 -18
  118. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  119. package/Build/Workers/createCircleGeometry.js +26 -26
  120. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  121. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  122. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  123. package/Build/Workers/createCorridorGeometry.js +29 -29
  124. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  125. package/Build/Workers/createCylinderGeometry.js +20 -20
  126. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  127. package/Build/Workers/createEllipseGeometry.js +26 -26
  128. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  129. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  130. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  131. package/Build/Workers/createFrustumGeometry.js +18 -18
  132. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  133. package/Build/Workers/createGeometry.js +24 -24
  134. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  135. package/Build/Workers/createPlaneGeometry.js +16 -16
  136. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  137. package/Build/Workers/createPolygonGeometry.js +32 -32
  138. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  139. package/Build/Workers/createPolylineGeometry.js +25 -25
  140. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  141. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  142. package/Build/Workers/createRectangleGeometry.js +27 -27
  143. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  144. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  145. package/Build/Workers/createSphereGeometry.js +19 -19
  146. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  147. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  148. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  149. package/Build/Workers/createVectorTileGeometries.js +24 -24
  150. package/Build/Workers/createVectorTilePoints.js +13 -13
  151. package/Build/Workers/createVectorTilePolygons.js +22 -22
  152. package/Build/Workers/createVectorTilePolylines.js +14 -14
  153. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  154. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  155. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  156. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  157. package/Build/Workers/createWallGeometry.js +24 -24
  158. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  159. package/Build/Workers/decodeDraco.js +10 -10
  160. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  161. package/Build/Workers/decodeI3S.js +10 -10
  162. package/Build/Workers/gaussianSplatSorter.js +4 -4
  163. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  164. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  165. package/Build/Workers/transcodeKTX2.js +6 -6
  166. package/Build/Workers/transferTypedArrayTest.js +1 -1
  167. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  168. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  169. package/README.md +69 -69
  170. package/Source/Scene/Model/CustomShader.js +5 -4
  171. package/Source/Scene/Model/CustomShaderPipelineStage.js +11 -5
  172. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +8 -0
  173. package/Source/Scene/Model/MaterialPipelineStage.js +919 -919
  174. package/Source/Scene/Model/ModelDrawCommand.js +8 -2
  175. package/Source/Shaders/Model/CPUStylingStageFS.glsl +1 -1
  176. package/Source/Shaders/Model/CPUStylingStageFS.js +1 -1
  177. package/Source/Shaders/Model/CPUStylingStageVS.glsl +1 -1
  178. package/Source/Shaders/Model/CPUStylingStageVS.js +1 -1
  179. package/Source/Shaders/Model/ModelFS.glsl +13 -0
  180. package/Source/Shaders/Model/ModelFS.js +13 -0
  181. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  182. package/index.d.ts +7 -1
  183. package/index.js +90 -90
  184. package/package.json +1 -1
  185. package/Build/Workers/chunk-27JI7F7B.js +0 -101
  186. package/Build/Workers/chunk-2B7VLWK3.js +0 -58
  187. package/Build/Workers/chunk-2OWEFNS4.js +0 -97
  188. package/Build/Workers/chunk-2Y2KA6PM.js +0 -387
  189. package/Build/Workers/chunk-2YAONTGQ.js +0 -476
  190. package/Build/Workers/chunk-324L25HV.js +0 -352
  191. package/Build/Workers/chunk-3EZBCDBK.js +0 -439
  192. package/Build/Workers/chunk-3JPA6GA3.js +0 -837
  193. package/Build/Workers/chunk-3NSMZ3XW.js +0 -1067
  194. package/Build/Workers/chunk-3QLIXW6V.js +0 -778
  195. package/Build/Workers/chunk-3SVEN5QG.js +0 -288
  196. package/Build/Workers/chunk-3WRJXCJS.js +0 -497
  197. package/Build/Workers/chunk-3WT5VKYM.js +0 -101
  198. package/Build/Workers/chunk-3YO7HM5H.js +0 -476
  199. package/Build/Workers/chunk-3ZJ6X3BW.js +0 -57
  200. package/Build/Workers/chunk-4C4UR2S6.js +0 -682
  201. package/Build/Workers/chunk-4CQDMEZY.js +0 -2058
  202. package/Build/Workers/chunk-4DIL24GG.js +0 -1460
  203. package/Build/Workers/chunk-4DQ3ODGO.js +0 -629
  204. package/Build/Workers/chunk-4FEDW3WT.js +0 -299
  205. package/Build/Workers/chunk-4GZLJPDW.js +0 -8366
  206. package/Build/Workers/chunk-52UUGJQ6.js +0 -288
  207. package/Build/Workers/chunk-53AFSDGM.js +0 -37
  208. package/Build/Workers/chunk-54SSO7NS.js +0 -352
  209. package/Build/Workers/chunk-5A4OWIAY.js +0 -511
  210. package/Build/Workers/chunk-5DPCF65K.js +0 -162
  211. package/Build/Workers/chunk-5IOA3NCI.js +0 -8366
  212. package/Build/Workers/chunk-5MCUZL44.js +0 -455
  213. package/Build/Workers/chunk-5RMI6LFO.js +0 -692
  214. package/Build/Workers/chunk-5UHIRI2A.js +0 -1800
  215. package/Build/Workers/chunk-5VDZEVQX.js +0 -788
  216. package/Build/Workers/chunk-5VWFNSLF.js +0 -44
  217. package/Build/Workers/chunk-5WAMP6Z4.js +0 -299
  218. package/Build/Workers/chunk-5ZMMQ7HE.js +0 -37
  219. package/Build/Workers/chunk-64VDO4BW.js +0 -114
  220. package/Build/Workers/chunk-664SI23B.js +0 -368
  221. package/Build/Workers/chunk-6BNIWSFA.js +0 -940
  222. package/Build/Workers/chunk-6F4HKBHD.js +0 -352
  223. package/Build/Workers/chunk-6GNLKYQO.js +0 -114
  224. package/Build/Workers/chunk-72Q33KL6.js +0 -280
  225. package/Build/Workers/chunk-73EGVDOC.js +0 -398
  226. package/Build/Workers/chunk-74HENCNJ.js +0 -171
  227. package/Build/Workers/chunk-763Q2YKY.js +0 -1483
  228. package/Build/Workers/chunk-7BQLJI3P.js +0 -692
  229. package/Build/Workers/chunk-7C2MOK27.js +0 -57
  230. package/Build/Workers/chunk-7EFYX4FL.js +0 -642
  231. package/Build/Workers/chunk-7MMYV5PM.js +0 -288
  232. package/Build/Workers/chunk-7RAUHLDW.js +0 -497
  233. package/Build/Workers/chunk-ADQVXDEJ.js +0 -2719
  234. package/Build/Workers/chunk-AFZVC5JN.js +0 -778
  235. package/Build/Workers/chunk-ASGXCLGL.js +0 -97
  236. package/Build/Workers/chunk-AVNHAFMV.js +0 -114
  237. package/Build/Workers/chunk-AWMYTHW4.js +0 -101
  238. package/Build/Workers/chunk-B5ZUBUPB.js +0 -398
  239. package/Build/Workers/chunk-BCYABDWF.js +0 -3514
  240. package/Build/Workers/chunk-BGG3BP2R.js +0 -280
  241. package/Build/Workers/chunk-BHTWF7UG.js +0 -73
  242. package/Build/Workers/chunk-BJHSYHOQ.js +0 -97
  243. package/Build/Workers/chunk-BLZILZWF.js +0 -2719
  244. package/Build/Workers/chunk-BM6ZG63T.js +0 -171
  245. package/Build/Workers/chunk-BYTLHM7N.js +0 -414
  246. package/Build/Workers/chunk-C3G2NDXM.js +0 -162
  247. package/Build/Workers/chunk-CCPKBCZD.js +0 -171
  248. package/Build/Workers/chunk-CMAG5O53.js +0 -1483
  249. package/Build/Workers/chunk-CR6BZUQC.js +0 -1443
  250. package/Build/Workers/chunk-CXDJ7YNS.js +0 -305
  251. package/Build/Workers/chunk-D3FNWB3Q.js +0 -138
  252. package/Build/Workers/chunk-DBM2NHJ5.js +0 -352
  253. package/Build/Workers/chunk-DIA4J2DB.js +0 -497
  254. package/Build/Workers/chunk-DVTKM7FF.js +0 -256
  255. package/Build/Workers/chunk-E3NHG3TR.js +0 -1460
  256. package/Build/Workers/chunk-E5BSDIGY.js +0 -139
  257. package/Build/Workers/chunk-EDVAQGDJ.js +0 -2719
  258. package/Build/Workers/chunk-EE4T7VKT.js +0 -368
  259. package/Build/Workers/chunk-EFHDO3L2.js +0 -102
  260. package/Build/Workers/chunk-EJVGOIOW.js +0 -1317
  261. package/Build/Workers/chunk-ENIF6OQ5.js +0 -139
  262. package/Build/Workers/chunk-EPVJ5OOH.js +0 -8366
  263. package/Build/Workers/chunk-ERYOZBVC.js +0 -171
  264. package/Build/Workers/chunk-F2BQY3GT.js +0 -1317
  265. package/Build/Workers/chunk-FCSN7XOU.js +0 -55
  266. package/Build/Workers/chunk-FHM3HFYM.js +0 -1045
  267. package/Build/Workers/chunk-FRF5LWIM.js +0 -299
  268. package/Build/Workers/chunk-FSYQE5XE.js +0 -55
  269. package/Build/Workers/chunk-FTHCZAWE.js +0 -44
  270. package/Build/Workers/chunk-FTXEOX64.js +0 -1067
  271. package/Build/Workers/chunk-FYZVCB32.js +0 -75
  272. package/Build/Workers/chunk-G2KELS4I.js +0 -138
  273. package/Build/Workers/chunk-GAQXLBFJ.js +0 -1483
  274. package/Build/Workers/chunk-GCPD37SU.js +0 -1054
  275. package/Build/Workers/chunk-GEH53ULL.js +0 -299
  276. package/Build/Workers/chunk-GJFIEALZ.js +0 -387
  277. package/Build/Workers/chunk-GLA2PT5T.js +0 -476
  278. package/Build/Workers/chunk-GMOKUODV.js +0 -352
  279. package/Build/Workers/chunk-GNGGEDZK.js +0 -352
  280. package/Build/Workers/chunk-GNGZG6C6.js +0 -162
  281. package/Build/Workers/chunk-GWLEBUVI.js +0 -2058
  282. package/Build/Workers/chunk-GYIGOBV2.js +0 -439
  283. package/Build/Workers/chunk-H2MM7FMU.js +0 -1054
  284. package/Build/Workers/chunk-H3BSU65R.js +0 -1067
  285. package/Build/Workers/chunk-HBL3QZ2L.js +0 -642
  286. package/Build/Workers/chunk-HC6DDPFU.js +0 -198
  287. package/Build/Workers/chunk-HEFUSHA6.js +0 -3514
  288. package/Build/Workers/chunk-HEKLTOOR.js +0 -1443
  289. package/Build/Workers/chunk-HHN2M3ES.js +0 -682
  290. package/Build/Workers/chunk-HHUKBKWS.js +0 -414
  291. package/Build/Workers/chunk-HKII76UV.js +0 -1800
  292. package/Build/Workers/chunk-HLIXASKN.js +0 -476
  293. package/Build/Workers/chunk-HM4MH5IG.js +0 -138
  294. package/Build/Workers/chunk-HWUHUN7Z.js +0 -387
  295. package/Build/Workers/chunk-I7LWED3Z.js +0 -101
  296. package/Build/Workers/chunk-IB2XQV6U.js +0 -101
  297. package/Build/Workers/chunk-IC2JHDCI.js +0 -114
  298. package/Build/Workers/chunk-IEBTKCMB.js +0 -497
  299. package/Build/Workers/chunk-IEEHNZ36.js +0 -241
  300. package/Build/Workers/chunk-IHOM6QXV.js +0 -439
  301. package/Build/Workers/chunk-IK4D64GY.js +0 -439
  302. package/Build/Workers/chunk-IKMU6YHA.js +0 -288
  303. package/Build/Workers/chunk-IRG63TBY.js +0 -55
  304. package/Build/Workers/chunk-IY53MZW2.js +0 -58
  305. package/Build/Workers/chunk-IYXLSOLF.js +0 -692
  306. package/Build/Workers/chunk-J4PNHKWO.js +0 -2719
  307. package/Build/Workers/chunk-JFLJS4QU.js +0 -1443
  308. package/Build/Workers/chunk-JJD7S2CV.js +0 -3514
  309. package/Build/Workers/chunk-JJWMDUOJ.js +0 -44
  310. package/Build/Workers/chunk-JM4TFRYQ.js +0 -163
  311. package/Build/Workers/chunk-JNNIPGJU.js +0 -163
  312. package/Build/Workers/chunk-JOQFYJZ2.js +0 -692
  313. package/Build/Workers/chunk-JQ7IQ56G.js +0 -837
  314. package/Build/Workers/chunk-JWEZXKBE.js +0 -73
  315. package/Build/Workers/chunk-K2PUGKEO.js +0 -2058
  316. package/Build/Workers/chunk-KFOT2YV5.js +0 -138
  317. package/Build/Workers/chunk-KMJD5APO.js +0 -162
  318. package/Build/Workers/chunk-KOVKY3HB.js +0 -198
  319. package/Build/Workers/chunk-KQ4ET526.js +0 -163
  320. package/Build/Workers/chunk-KWFCDTXS.js +0 -940
  321. package/Build/Workers/chunk-KWX3CJFT.js +0 -198
  322. package/Build/Workers/chunk-L2QIVAZV.js +0 -3514
  323. package/Build/Workers/chunk-L33HPENB.js +0 -75
  324. package/Build/Workers/chunk-LENXRROQ.js +0 -398
  325. package/Build/Workers/chunk-LFQ63ZU4.js +0 -455
  326. package/Build/Workers/chunk-LHJDLAZT.js +0 -1483
  327. package/Build/Workers/chunk-LJHG4PJQ.js +0 -305
  328. package/Build/Workers/chunk-LNS36LUZ.js +0 -2058
  329. package/Build/Workers/chunk-LPJHTJDQ.js +0 -305
  330. package/Build/Workers/chunk-LRW2QXMW.js +0 -352
  331. package/Build/Workers/chunk-LUUEGFLT.js +0 -305
  332. package/Build/Workers/chunk-LVU4AZC6.js +0 -219
  333. package/Build/Workers/chunk-LW2VGHDM.js +0 -1800
  334. package/Build/Workers/chunk-LXM2ZC4V.js +0 -288
  335. package/Build/Workers/chunk-LXMLERGC.js +0 -1067
  336. package/Build/Workers/chunk-LXOUU2I5.js +0 -219
  337. package/Build/Workers/chunk-M7EEEKQE.js +0 -476
  338. package/Build/Workers/chunk-MB2ZJQR3.js +0 -55
  339. package/Build/Workers/chunk-MCJRXFRL.js +0 -102
  340. package/Build/Workers/chunk-MCNY7SPD.js +0 -139
  341. package/Build/Workers/chunk-MEFWVMG6.js +0 -788
  342. package/Build/Workers/chunk-MHEKNHOF.js +0 -511
  343. package/Build/Workers/chunk-MLL4AAXV.js +0 -1460
  344. package/Build/Workers/chunk-MPCZC3G6.js +0 -414
  345. package/Build/Workers/chunk-MRLJERN3.js +0 -114
  346. package/Build/Workers/chunk-MWN26ZEM.js +0 -280
  347. package/Build/Workers/chunk-MXKQUDTP.js +0 -55
  348. package/Build/Workers/chunk-NEF7XO5W.js +0 -940
  349. package/Build/Workers/chunk-NIWB6UMY.js +0 -198
  350. package/Build/Workers/chunk-NJEG7WRW.js +0 -387
  351. package/Build/Workers/chunk-NL7US44X.js +0 -171
  352. package/Build/Workers/chunk-NOJAQPXU.js +0 -102
  353. package/Build/Workers/chunk-NSRZZEHH.js +0 -455
  354. package/Build/Workers/chunk-NUMQ72QV.js +0 -55
  355. package/Build/Workers/chunk-NXZJKIYD.js +0 -97
  356. package/Build/Workers/chunk-O224ZEA5.js +0 -58
  357. package/Build/Workers/chunk-O4MZOV3C.js +0 -414
  358. package/Build/Workers/chunk-O5ICO3AS.js +0 -682
  359. package/Build/Workers/chunk-O5QH7XD5.js +0 -629
  360. package/Build/Workers/chunk-O6T3T3V3.js +0 -97
  361. package/Build/Workers/chunk-OAFZ26QL.js +0 -837
  362. package/Build/Workers/chunk-OBM2JYMG.js +0 -75
  363. package/Build/Workers/chunk-OBQVOEPZ.js +0 -124
  364. package/Build/Workers/chunk-OC63Z35M.js +0 -280
  365. package/Build/Workers/chunk-OD7UYXFV.js +0 -352
  366. package/Build/Workers/chunk-ODZZZGXK.js +0 -219
  367. package/Build/Workers/chunk-OEAC5XUG.js +0 -73
  368. package/Build/Workers/chunk-OFTWEOW2.js +0 -1483
  369. package/Build/Workers/chunk-OIJH6LAY.js +0 -497
  370. package/Build/Workers/chunk-OJFVD5ZS.js +0 -778
  371. package/Build/Workers/chunk-OJNPKCEL.js +0 -73
  372. package/Build/Workers/chunk-OOIZ7CHP.js +0 -114
  373. package/Build/Workers/chunk-OQK27J4J.js +0 -139
  374. package/Build/Workers/chunk-OTDNJAYJ.js +0 -55
  375. package/Build/Workers/chunk-OX4DGIUJ.js +0 -788
  376. package/Build/Workers/chunk-PEEYBEL5.js +0 -2058
  377. package/Build/Workers/chunk-PEUDXOFI.js +0 -241
  378. package/Build/Workers/chunk-PGYA2CMO.js +0 -642
  379. package/Build/Workers/chunk-PKXFFIEZ.js +0 -57
  380. package/Build/Workers/chunk-PQLZOYZE.js +0 -642
  381. package/Build/Workers/chunk-PSDWIJMU.js +0 -219
  382. package/Build/Workers/chunk-PU44PXY2.js +0 -75
  383. package/Build/Workers/chunk-PW3GQAXA.js +0 -3514
  384. package/Build/Workers/chunk-Q2X2Z7JH.js +0 -241
  385. package/Build/Workers/chunk-Q2YRPH7V.js +0 -1067
  386. package/Build/Workers/chunk-Q36VXWGP.js +0 -57
  387. package/Build/Workers/chunk-Q4XPVYXJ.js +0 -476
  388. package/Build/Workers/chunk-QEGQDFX2.js +0 -1045
  389. package/Build/Workers/chunk-QFN5B75P.js +0 -1054
  390. package/Build/Workers/chunk-QGXE4VZ3.js +0 -55
  391. package/Build/Workers/chunk-QIEHP7O4.js +0 -280
  392. package/Build/Workers/chunk-QOLOPE4O.js +0 -1317
  393. package/Build/Workers/chunk-QY55DT53.js +0 -97
  394. package/Build/Workers/chunk-R2AFDOIY.js +0 -778
  395. package/Build/Workers/chunk-R3PTQZ6H.js +0 -44
  396. package/Build/Workers/chunk-R5U3MYPS.js +0 -198
  397. package/Build/Workers/chunk-RBLCJVK6.js +0 -73
  398. package/Build/Workers/chunk-RGD6RGTH.js +0 -138
  399. package/Build/Workers/chunk-RJ564LVX.js +0 -398
  400. package/Build/Workers/chunk-RJIH4MDC.js +0 -241
  401. package/Build/Workers/chunk-RJVB3K2X.js +0 -511
  402. package/Build/Workers/chunk-RNZ5L3W4.js +0 -387
  403. package/Build/Workers/chunk-RO7SDGOD.js +0 -352
  404. package/Build/Workers/chunk-RORZNBGJ.js +0 -299
  405. package/Build/Workers/chunk-RRBGLANL.js +0 -55
  406. package/Build/Workers/chunk-RT7PY6BH.js +0 -2719
  407. package/Build/Workers/chunk-RTJ6L5O4.js +0 -163
  408. package/Build/Workers/chunk-SAD42JSM.js +0 -102
  409. package/Build/Workers/chunk-SBR7MW44.js +0 -139
  410. package/Build/Workers/chunk-SCF2OVAZ.js +0 -219
  411. package/Build/Workers/chunk-SCNCHSTQ.js +0 -642
  412. package/Build/Workers/chunk-SFM3GNS2.js +0 -682
  413. package/Build/Workers/chunk-SG56ZOPD.js +0 -788
  414. package/Build/Workers/chunk-SHQEATE2.js +0 -1045
  415. package/Build/Workers/chunk-SJX7UJNW.js +0 -241
  416. package/Build/Workers/chunk-SKXE77AM.js +0 -139
  417. package/Build/Workers/chunk-SLYUIIFB.js +0 -455
  418. package/Build/Workers/chunk-SPL7JK6K.js +0 -1054
  419. package/Build/Workers/chunk-SPPYSEH2.js +0 -1460
  420. package/Build/Workers/chunk-SQSWONTJ.js +0 -241
  421. package/Build/Workers/chunk-SRLJWNU2.js +0 -368
  422. package/Build/Workers/chunk-SSE2O2SB.js +0 -1460
  423. package/Build/Workers/chunk-SX6GJD6B.js +0 -837
  424. package/Build/Workers/chunk-SXISWCV7.js +0 -58
  425. package/Build/Workers/chunk-SYCWSSRX.js +0 -1443
  426. package/Build/Workers/chunk-SZELHE7Q.js +0 -163
  427. package/Build/Workers/chunk-SZQC2TUH.js +0 -368
  428. package/Build/Workers/chunk-T4LDJBKR.js +0 -124
  429. package/Build/Workers/chunk-TAWVKT4B.js +0 -58
  430. package/Build/Workers/chunk-TBASKFFL.js +0 -124
  431. package/Build/Workers/chunk-TBEKWAR5.js +0 -73
  432. package/Build/Workers/chunk-TDGGEIZE.js +0 -398
  433. package/Build/Workers/chunk-TE277WT3.js +0 -280
  434. package/Build/Workers/chunk-TEZGNCXH.js +0 -8366
  435. package/Build/Workers/chunk-TFL2ZV77.js +0 -692
  436. package/Build/Workers/chunk-THWXTO7B.js +0 -57
  437. package/Build/Workers/chunk-TIQZUI5N.js +0 -44
  438. package/Build/Workers/chunk-TKJHRY4V.js +0 -511
  439. package/Build/Workers/chunk-TLXEQ5QY.js +0 -778
  440. package/Build/Workers/chunk-TQ63SH2Z.js +0 -352
  441. package/Build/Workers/chunk-TSNKYHSC.js +0 -305
  442. package/Build/Workers/chunk-TYQ7MNMK.js +0 -37
  443. package/Build/Workers/chunk-U267N6IJ.js +0 -299
  444. package/Build/Workers/chunk-U3VI26GL.js +0 -162
  445. package/Build/Workers/chunk-U77FLUQF.js +0 -368
  446. package/Build/Workers/chunk-UIMHSWDJ.js +0 -455
  447. package/Build/Workers/chunk-UIYQEJ5H.js +0 -1054
  448. package/Build/Workers/chunk-UJ72JOGF.js +0 -511
  449. package/Build/Workers/chunk-ULWO6TCN.js +0 -352
  450. package/Build/Workers/chunk-UO3AWZR3.js +0 -352
  451. package/Build/Workers/chunk-UQSQNTEF.js +0 -368
  452. package/Build/Workers/chunk-USWXYJRX.js +0 -1045
  453. package/Build/Workers/chunk-UTDSEOTC.js +0 -288
  454. package/Build/Workers/chunk-UTXXZ7XH.js +0 -940
  455. package/Build/Workers/chunk-UUKLWTJC.js +0 -2719
  456. package/Build/Workers/chunk-UY7I27VQ.js +0 -1800
  457. package/Build/Workers/chunk-UZXJSLDO.js +0 -3514
  458. package/Build/Workers/chunk-V2TRFTCU.js +0 -1317
  459. package/Build/Workers/chunk-V4I3IKAK.js +0 -1460
  460. package/Build/Workers/chunk-V7QHEF6O.js +0 -1317
  461. package/Build/Workers/chunk-VFC54WB7.js +0 -940
  462. package/Build/Workers/chunk-VG7NX64T.js +0 -37
  463. package/Build/Workers/chunk-VIMRGSM5.js +0 -256
  464. package/Build/Workers/chunk-VL4QTEZC.js +0 -138
  465. package/Build/Workers/chunk-VLB25GGE.js +0 -439
  466. package/Build/Workers/chunk-VP2OAU4C.js +0 -124
  467. package/Build/Workers/chunk-VVKDT4J7.js +0 -837
  468. package/Build/Workers/chunk-VXDOONLH.js +0 -162
  469. package/Build/Workers/chunk-W2EK42GB.js +0 -75
  470. package/Build/Workers/chunk-W2OMUTYA.js +0 -1800
  471. package/Build/Workers/chunk-W3LNGBJU.js +0 -44
  472. package/Build/Workers/chunk-W4DV7TAL.js +0 -8366
  473. package/Build/Workers/chunk-WDMHDACX.js +0 -1800
  474. package/Build/Workers/chunk-WF224D4A.js +0 -642
  475. package/Build/Workers/chunk-WFTPZ3ZX.js +0 -788
  476. package/Build/Workers/chunk-WHOEQFL4.js +0 -682
  477. package/Build/Workers/chunk-WLIQ26XU.js +0 -455
  478. package/Build/Workers/chunk-WOEPS2UA.js +0 -171
  479. package/Build/Workers/chunk-WWLWTSMV.js +0 -55
  480. package/Build/Workers/chunk-WX2ZANQC.js +0 -940
  481. package/Build/Workers/chunk-WZJEAPEP.js +0 -629
  482. package/Build/Workers/chunk-XEB4GEXW.js +0 -629
  483. package/Build/Workers/chunk-XFKTM6GN.js +0 -2058
  484. package/Build/Workers/chunk-XHGB5IOL.js +0 -1045
  485. package/Build/Workers/chunk-XHNWVOIJ.js +0 -219
  486. package/Build/Workers/chunk-XKBR7TJB.js +0 -398
  487. package/Build/Workers/chunk-XMIENZET.js +0 -256
  488. package/Build/Workers/chunk-XNKQLSHI.js +0 -629
  489. package/Build/Workers/chunk-XOXF37BU.js +0 -1317
  490. package/Build/Workers/chunk-XXD3TQVI.js +0 -837
  491. package/Build/Workers/chunk-XYRT4RDI.js +0 -1045
  492. package/Build/Workers/chunk-XZINQPR6.js +0 -124
  493. package/Build/Workers/chunk-XZN7KCY3.js +0 -1054
  494. package/Build/Workers/chunk-YC6PFDXQ.js +0 -8366
  495. package/Build/Workers/chunk-YCTK62TY.js +0 -1483
  496. package/Build/Workers/chunk-YFJB3US4.js +0 -102
  497. package/Build/Workers/chunk-YLKTSY65.js +0 -414
  498. package/Build/Workers/chunk-YLSZYTTO.js +0 -102
  499. package/Build/Workers/chunk-YMXATXRN.js +0 -57
  500. package/Build/Workers/chunk-YQXKIGXX.js +0 -414
  501. package/Build/Workers/chunk-YR3LX3PR.js +0 -497
  502. package/Build/Workers/chunk-YVRD2PO5.js +0 -124
  503. package/Build/Workers/chunk-YWPKCFKZ.js +0 -1443
  504. package/Build/Workers/chunk-YWSB7PZP.js +0 -511
  505. package/Build/Workers/chunk-Z24A5EMJ.js +0 -387
  506. package/Build/Workers/chunk-Z4IW5XUY.js +0 -788
  507. package/Build/Workers/chunk-Z5MHVJGN.js +0 -778
  508. package/Build/Workers/chunk-ZBRVFEGF.js +0 -256
  509. package/Build/Workers/chunk-ZCPCQJBX.js +0 -198
  510. package/Build/Workers/chunk-ZEEVOFG2.js +0 -256
  511. package/Build/Workers/chunk-ZFHCP7RN.js +0 -692
  512. package/Build/Workers/chunk-ZHHEFNHL.js +0 -37
  513. package/Build/Workers/chunk-ZI5GDNEV.js +0 -305
  514. package/Build/Workers/chunk-ZS7KQSEM.js +0 -439
  515. package/Build/Workers/chunk-ZVXETFPZ.js +0 -1067
  516. package/Build/Workers/chunk-ZXZTWDTN.js +0 -682
  517. package/Build/Workers/chunk-ZYTMDBCR.js +0 -1443
@@ -1,2719 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 0.0.6
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
- AttributeCompression_default
28
- } from "./chunk-VLB25GGE.js";
29
- import {
30
- EncodedCartesian3_default
31
- } from "./chunk-SAD42JSM.js";
32
- import {
33
- IntersectionTests_default
34
- } from "./chunk-EJVGOIOW.js";
35
- import {
36
- Plane_default
37
- } from "./chunk-ERYOZBVC.js";
38
- import {
39
- IndexDatatype_default
40
- } from "./chunk-E5BSDIGY.js";
41
- import {
42
- GeometryAttribute_default,
43
- GeometryType_default,
44
- Geometry_default,
45
- PrimitiveType_default
46
- } from "./chunk-4FEDW3WT.js";
47
- import {
48
- BoundingSphere_default,
49
- GeographicProjection_default
50
- } from "./chunk-WX2ZANQC.js";
51
- import {
52
- Intersect_default
53
- } from "./chunk-FSYQE5XE.js";
54
- import {
55
- Cartesian4_default,
56
- Matrix4_default
57
- } from "./chunk-XFKTM6GN.js";
58
- import {
59
- ComponentDatatype_default
60
- } from "./chunk-IXM65GBF.js";
61
- import {
62
- Cartesian2_default,
63
- Cartographic_default
64
- } from "./chunk-4DIL24GG.js";
65
- import {
66
- Cartesian3_default,
67
- Frozen_default,
68
- Matrix3_default
69
- } from "./chunk-GZMTBQM2.js";
70
- import {
71
- Math_default
72
- } from "./chunk-DIA4J2DB.js";
73
- import {
74
- Check_default,
75
- DeveloperError_default
76
- } from "./chunk-SZELHE7Q.js";
77
- import {
78
- defined_default
79
- } from "./chunk-OBM2JYMG.js";
80
-
81
- // packages/engine/Source/Core/barycentricCoordinates.js
82
- var scratchCartesian1 = new Cartesian3_default();
83
- var scratchCartesian2 = new Cartesian3_default();
84
- var scratchCartesian3 = new Cartesian3_default();
85
- function barycentricCoordinates(point, p0, p1, p2, result) {
86
- Check_default.defined("point", point);
87
- Check_default.defined("p0", p0);
88
- Check_default.defined("p1", p1);
89
- Check_default.defined("p2", p2);
90
- if (!defined_default(result)) {
91
- result = new Cartesian3_default();
92
- }
93
- let v02;
94
- let v12;
95
- let v22;
96
- let dot00;
97
- let dot01;
98
- let dot02;
99
- let dot11;
100
- let dot12;
101
- if (!defined_default(p0.z)) {
102
- if (Cartesian2_default.equalsEpsilon(point, p0, Math_default.EPSILON14)) {
103
- return Cartesian3_default.clone(Cartesian3_default.UNIT_X, result);
104
- }
105
- if (Cartesian2_default.equalsEpsilon(point, p1, Math_default.EPSILON14)) {
106
- return Cartesian3_default.clone(Cartesian3_default.UNIT_Y, result);
107
- }
108
- if (Cartesian2_default.equalsEpsilon(point, p2, Math_default.EPSILON14)) {
109
- return Cartesian3_default.clone(Cartesian3_default.UNIT_Z, result);
110
- }
111
- v02 = Cartesian2_default.subtract(p1, p0, scratchCartesian1);
112
- v12 = Cartesian2_default.subtract(p2, p0, scratchCartesian2);
113
- v22 = Cartesian2_default.subtract(point, p0, scratchCartesian3);
114
- dot00 = Cartesian2_default.dot(v02, v02);
115
- dot01 = Cartesian2_default.dot(v02, v12);
116
- dot02 = Cartesian2_default.dot(v02, v22);
117
- dot11 = Cartesian2_default.dot(v12, v12);
118
- dot12 = Cartesian2_default.dot(v12, v22);
119
- } else {
120
- if (Cartesian3_default.equalsEpsilon(point, p0, Math_default.EPSILON14)) {
121
- return Cartesian3_default.clone(Cartesian3_default.UNIT_X, result);
122
- }
123
- if (Cartesian3_default.equalsEpsilon(point, p1, Math_default.EPSILON14)) {
124
- return Cartesian3_default.clone(Cartesian3_default.UNIT_Y, result);
125
- }
126
- if (Cartesian3_default.equalsEpsilon(point, p2, Math_default.EPSILON14)) {
127
- return Cartesian3_default.clone(Cartesian3_default.UNIT_Z, result);
128
- }
129
- v02 = Cartesian3_default.subtract(p1, p0, scratchCartesian1);
130
- v12 = Cartesian3_default.subtract(p2, p0, scratchCartesian2);
131
- v22 = Cartesian3_default.subtract(point, p0, scratchCartesian3);
132
- dot00 = Cartesian3_default.dot(v02, v02);
133
- dot01 = Cartesian3_default.dot(v02, v12);
134
- dot02 = Cartesian3_default.dot(v02, v22);
135
- dot11 = Cartesian3_default.dot(v12, v12);
136
- dot12 = Cartesian3_default.dot(v12, v22);
137
- }
138
- result.y = dot11 * dot02 - dot01 * dot12;
139
- result.z = dot00 * dot12 - dot01 * dot02;
140
- const q = dot00 * dot11 - dot01 * dot01;
141
- if (q === 0) {
142
- return void 0;
143
- }
144
- result.y /= q;
145
- result.z /= q;
146
- result.x = 1 - result.y - result.z;
147
- return result;
148
- }
149
- var barycentricCoordinates_default = barycentricCoordinates;
150
-
151
- // packages/engine/Source/Core/Tipsify.js
152
- var Tipsify = {};
153
- Tipsify.calculateACMR = function(options) {
154
- options = options ?? Frozen_default.EMPTY_OBJECT;
155
- const indices = options.indices;
156
- let maximumIndex = options.maximumIndex;
157
- const cacheSize = options.cacheSize ?? 24;
158
- if (!defined_default(indices)) {
159
- throw new DeveloperError_default("indices is required.");
160
- }
161
- const numIndices = indices.length;
162
- if (numIndices < 3 || numIndices % 3 !== 0) {
163
- throw new DeveloperError_default("indices length must be a multiple of three.");
164
- }
165
- if (maximumIndex <= 0) {
166
- throw new DeveloperError_default("maximumIndex must be greater than zero.");
167
- }
168
- if (cacheSize < 3) {
169
- throw new DeveloperError_default("cacheSize must be greater than two.");
170
- }
171
- if (!defined_default(maximumIndex)) {
172
- maximumIndex = 0;
173
- let currentIndex = 0;
174
- let intoIndices = indices[currentIndex];
175
- while (currentIndex < numIndices) {
176
- if (intoIndices > maximumIndex) {
177
- maximumIndex = intoIndices;
178
- }
179
- ++currentIndex;
180
- intoIndices = indices[currentIndex];
181
- }
182
- }
183
- const vertexTimeStamps = [];
184
- for (let i = 0; i < maximumIndex + 1; i++) {
185
- vertexTimeStamps[i] = 0;
186
- }
187
- let s = cacheSize + 1;
188
- for (let j = 0; j < numIndices; ++j) {
189
- if (s - vertexTimeStamps[indices[j]] > cacheSize) {
190
- vertexTimeStamps[indices[j]] = s;
191
- ++s;
192
- }
193
- }
194
- return (s - cacheSize + 1) / (numIndices / 3);
195
- };
196
- Tipsify.tipsify = function(options) {
197
- options = options ?? Frozen_default.EMPTY_OBJECT;
198
- const indices = options.indices;
199
- const maximumIndex = options.maximumIndex;
200
- const cacheSize = options.cacheSize ?? 24;
201
- let cursor;
202
- function skipDeadEnd(vertices2, deadEnd2, indices2, maximumIndexPlusOne2) {
203
- while (deadEnd2.length >= 1) {
204
- const d = deadEnd2[deadEnd2.length - 1];
205
- deadEnd2.splice(deadEnd2.length - 1, 1);
206
- if (vertices2[d].numLiveTriangles > 0) {
207
- return d;
208
- }
209
- }
210
- while (cursor < maximumIndexPlusOne2) {
211
- if (vertices2[cursor].numLiveTriangles > 0) {
212
- ++cursor;
213
- return cursor - 1;
214
- }
215
- ++cursor;
216
- }
217
- return -1;
218
- }
219
- function getNextVertex(indices2, cacheSize2, oneRing2, vertices2, s2, deadEnd2, maximumIndexPlusOne2) {
220
- let n = -1;
221
- let p;
222
- let m = -1;
223
- let itOneRing = 0;
224
- while (itOneRing < oneRing2.length) {
225
- const index2 = oneRing2[itOneRing];
226
- if (vertices2[index2].numLiveTriangles) {
227
- p = 0;
228
- if (s2 - vertices2[index2].timeStamp + 2 * vertices2[index2].numLiveTriangles <= cacheSize2) {
229
- p = s2 - vertices2[index2].timeStamp;
230
- }
231
- if (p > m || m === -1) {
232
- m = p;
233
- n = index2;
234
- }
235
- }
236
- ++itOneRing;
237
- }
238
- if (n === -1) {
239
- return skipDeadEnd(vertices2, deadEnd2, indices2, maximumIndexPlusOne2);
240
- }
241
- return n;
242
- }
243
- if (!defined_default(indices)) {
244
- throw new DeveloperError_default("indices is required.");
245
- }
246
- const numIndices = indices.length;
247
- if (numIndices < 3 || numIndices % 3 !== 0) {
248
- throw new DeveloperError_default("indices length must be a multiple of three.");
249
- }
250
- if (maximumIndex <= 0) {
251
- throw new DeveloperError_default("maximumIndex must be greater than zero.");
252
- }
253
- if (cacheSize < 3) {
254
- throw new DeveloperError_default("cacheSize must be greater than two.");
255
- }
256
- let maximumIndexPlusOne = 0;
257
- let currentIndex = 0;
258
- let intoIndices = indices[currentIndex];
259
- const endIndex = numIndices;
260
- if (defined_default(maximumIndex)) {
261
- maximumIndexPlusOne = maximumIndex + 1;
262
- } else {
263
- while (currentIndex < endIndex) {
264
- if (intoIndices > maximumIndexPlusOne) {
265
- maximumIndexPlusOne = intoIndices;
266
- }
267
- ++currentIndex;
268
- intoIndices = indices[currentIndex];
269
- }
270
- if (maximumIndexPlusOne === -1) {
271
- return 0;
272
- }
273
- ++maximumIndexPlusOne;
274
- }
275
- const vertices = [];
276
- let i;
277
- for (i = 0; i < maximumIndexPlusOne; i++) {
278
- vertices[i] = {
279
- numLiveTriangles: 0,
280
- timeStamp: 0,
281
- vertexTriangles: []
282
- };
283
- }
284
- currentIndex = 0;
285
- let triangle = 0;
286
- while (currentIndex < endIndex) {
287
- vertices[indices[currentIndex]].vertexTriangles.push(triangle);
288
- ++vertices[indices[currentIndex]].numLiveTriangles;
289
- vertices[indices[currentIndex + 1]].vertexTriangles.push(triangle);
290
- ++vertices[indices[currentIndex + 1]].numLiveTriangles;
291
- vertices[indices[currentIndex + 2]].vertexTriangles.push(triangle);
292
- ++vertices[indices[currentIndex + 2]].numLiveTriangles;
293
- ++triangle;
294
- currentIndex += 3;
295
- }
296
- let f = 0;
297
- let s = cacheSize + 1;
298
- cursor = 1;
299
- let oneRing = [];
300
- const deadEnd = [];
301
- let vertex;
302
- let intoVertices;
303
- let currentOutputIndex = 0;
304
- const outputIndices = [];
305
- const numTriangles = numIndices / 3;
306
- const triangleEmitted = [];
307
- for (i = 0; i < numTriangles; i++) {
308
- triangleEmitted[i] = false;
309
- }
310
- let index;
311
- let limit;
312
- while (f !== -1) {
313
- oneRing = [];
314
- intoVertices = vertices[f];
315
- limit = intoVertices.vertexTriangles.length;
316
- for (let k = 0; k < limit; ++k) {
317
- triangle = intoVertices.vertexTriangles[k];
318
- if (!triangleEmitted[triangle]) {
319
- triangleEmitted[triangle] = true;
320
- currentIndex = triangle + triangle + triangle;
321
- for (let j = 0; j < 3; ++j) {
322
- index = indices[currentIndex];
323
- oneRing.push(index);
324
- deadEnd.push(index);
325
- outputIndices[currentOutputIndex] = index;
326
- ++currentOutputIndex;
327
- vertex = vertices[index];
328
- --vertex.numLiveTriangles;
329
- if (s - vertex.timeStamp > cacheSize) {
330
- vertex.timeStamp = s;
331
- ++s;
332
- }
333
- ++currentIndex;
334
- }
335
- }
336
- }
337
- f = getNextVertex(
338
- indices,
339
- cacheSize,
340
- oneRing,
341
- vertices,
342
- s,
343
- deadEnd,
344
- maximumIndexPlusOne
345
- );
346
- }
347
- return outputIndices;
348
- };
349
- var Tipsify_default = Tipsify;
350
-
351
- // packages/engine/Source/Core/GeometryPipeline.js
352
- var GeometryPipeline = {};
353
- function addTriangle(lines, index, i0, i1, i2) {
354
- lines[index++] = i0;
355
- lines[index++] = i1;
356
- lines[index++] = i1;
357
- lines[index++] = i2;
358
- lines[index++] = i2;
359
- lines[index] = i0;
360
- }
361
- function trianglesToLines(triangles) {
362
- const count = triangles.length;
363
- const size = count / 3 * 6;
364
- const lines = IndexDatatype_default.createTypedArray(count, size);
365
- let index = 0;
366
- for (let i = 0; i < count; i += 3, index += 6) {
367
- addTriangle(lines, index, triangles[i], triangles[i + 1], triangles[i + 2]);
368
- }
369
- return lines;
370
- }
371
- function triangleStripToLines(triangles) {
372
- const count = triangles.length;
373
- if (count >= 3) {
374
- const size = (count - 2) * 6;
375
- const lines = IndexDatatype_default.createTypedArray(count, size);
376
- addTriangle(lines, 0, triangles[0], triangles[1], triangles[2]);
377
- let index = 6;
378
- for (let i = 3; i < count; ++i, index += 6) {
379
- addTriangle(
380
- lines,
381
- index,
382
- triangles[i - 1],
383
- triangles[i],
384
- triangles[i - 2]
385
- );
386
- }
387
- return lines;
388
- }
389
- return new Uint16Array();
390
- }
391
- function triangleFanToLines(triangles) {
392
- if (triangles.length > 0) {
393
- const count = triangles.length - 1;
394
- const size = (count - 1) * 6;
395
- const lines = IndexDatatype_default.createTypedArray(count, size);
396
- const base = triangles[0];
397
- let index = 0;
398
- for (let i = 1; i < count; ++i, index += 6) {
399
- addTriangle(lines, index, base, triangles[i], triangles[i + 1]);
400
- }
401
- return lines;
402
- }
403
- return new Uint16Array();
404
- }
405
- GeometryPipeline.toWireframe = function(geometry) {
406
- if (!defined_default(geometry)) {
407
- throw new DeveloperError_default("geometry is required.");
408
- }
409
- const indices = geometry.indices;
410
- if (defined_default(indices)) {
411
- switch (geometry.primitiveType) {
412
- case PrimitiveType_default.TRIANGLES:
413
- geometry.indices = trianglesToLines(indices);
414
- break;
415
- case PrimitiveType_default.TRIANGLE_STRIP:
416
- geometry.indices = triangleStripToLines(indices);
417
- break;
418
- case PrimitiveType_default.TRIANGLE_FAN:
419
- geometry.indices = triangleFanToLines(indices);
420
- break;
421
- //>>includeStart('debug', pragmas.debug);
422
- default:
423
- throw new DeveloperError_default(
424
- "geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN."
425
- );
426
- }
427
- geometry.primitiveType = PrimitiveType_default.LINES;
428
- }
429
- return geometry;
430
- };
431
- GeometryPipeline.createLineSegmentsForVectors = function(geometry, attributeName, length) {
432
- attributeName = attributeName ?? "normal";
433
- if (!defined_default(geometry)) {
434
- throw new DeveloperError_default("geometry is required.");
435
- }
436
- if (!defined_default(geometry.attributes.position)) {
437
- throw new DeveloperError_default("geometry.attributes.position is required.");
438
- }
439
- if (!defined_default(geometry.attributes[attributeName])) {
440
- throw new DeveloperError_default(
441
- `geometry.attributes must have an attribute with the same name as the attributeName parameter, ${attributeName}.`
442
- );
443
- }
444
- length = length ?? 1e4;
445
- const positions = geometry.attributes.position.values;
446
- const vectors = geometry.attributes[attributeName].values;
447
- const positionsLength = positions.length;
448
- const newPositions = new Float64Array(2 * positionsLength);
449
- let j = 0;
450
- for (let i = 0; i < positionsLength; i += 3) {
451
- newPositions[j++] = positions[i];
452
- newPositions[j++] = positions[i + 1];
453
- newPositions[j++] = positions[i + 2];
454
- newPositions[j++] = positions[i] + vectors[i] * length;
455
- newPositions[j++] = positions[i + 1] + vectors[i + 1] * length;
456
- newPositions[j++] = positions[i + 2] + vectors[i + 2] * length;
457
- }
458
- let newBoundingSphere;
459
- const bs = geometry.boundingSphere;
460
- if (defined_default(bs)) {
461
- newBoundingSphere = new BoundingSphere_default(bs.center, bs.radius + length);
462
- }
463
- return new Geometry_default({
464
- attributes: {
465
- position: new GeometryAttribute_default({
466
- componentDatatype: ComponentDatatype_default.DOUBLE,
467
- componentsPerAttribute: 3,
468
- values: newPositions
469
- })
470
- },
471
- primitiveType: PrimitiveType_default.LINES,
472
- boundingSphere: newBoundingSphere
473
- });
474
- };
475
- GeometryPipeline.createAttributeLocations = function(geometry) {
476
- if (!defined_default(geometry)) {
477
- throw new DeveloperError_default("geometry is required.");
478
- }
479
- const semantics = [
480
- "position",
481
- "positionHigh",
482
- "positionLow",
483
- // From VertexFormat.position - after 2D projection and high-precision encoding
484
- "position3DHigh",
485
- "position3DLow",
486
- "position2DHigh",
487
- "position2DLow",
488
- // From Primitive
489
- "pickColor",
490
- // From VertexFormat
491
- "normal",
492
- "st",
493
- "tangent",
494
- "bitangent",
495
- // For shadow volumes
496
- "extrudeDirection",
497
- // From compressing texture coordinates and normals
498
- "compressedAttributes"
499
- ];
500
- const attributes = geometry.attributes;
501
- const indices = {};
502
- let j = 0;
503
- let i;
504
- const len = semantics.length;
505
- for (i = 0; i < len; ++i) {
506
- const semantic = semantics[i];
507
- if (defined_default(attributes[semantic])) {
508
- indices[semantic] = j++;
509
- }
510
- }
511
- for (const name in attributes) {
512
- if (attributes.hasOwnProperty(name) && !defined_default(indices[name])) {
513
- indices[name] = j++;
514
- }
515
- }
516
- return indices;
517
- };
518
- GeometryPipeline.reorderForPreVertexCache = function(geometry) {
519
- if (!defined_default(geometry)) {
520
- throw new DeveloperError_default("geometry is required.");
521
- }
522
- const numVertices = Geometry_default.computeNumberOfVertices(geometry);
523
- const indices = geometry.indices;
524
- if (defined_default(indices)) {
525
- const indexCrossReferenceOldToNew = new Int32Array(numVertices);
526
- for (let i = 0; i < numVertices; i++) {
527
- indexCrossReferenceOldToNew[i] = -1;
528
- }
529
- const indicesIn = indices;
530
- const numIndices = indicesIn.length;
531
- const indicesOut = IndexDatatype_default.createTypedArray(numVertices, numIndices);
532
- let intoIndicesIn = 0;
533
- let intoIndicesOut = 0;
534
- let nextIndex = 0;
535
- let tempIndex;
536
- while (intoIndicesIn < numIndices) {
537
- tempIndex = indexCrossReferenceOldToNew[indicesIn[intoIndicesIn]];
538
- if (tempIndex !== -1) {
539
- indicesOut[intoIndicesOut] = tempIndex;
540
- } else {
541
- tempIndex = indicesIn[intoIndicesIn];
542
- indexCrossReferenceOldToNew[tempIndex] = nextIndex;
543
- indicesOut[intoIndicesOut] = nextIndex;
544
- ++nextIndex;
545
- }
546
- ++intoIndicesIn;
547
- ++intoIndicesOut;
548
- }
549
- geometry.indices = indicesOut;
550
- const attributes = geometry.attributes;
551
- for (const property in attributes) {
552
- if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
553
- const attribute = attributes[property];
554
- const elementsIn = attribute.values;
555
- let intoElementsIn = 0;
556
- const numComponents = attribute.componentsPerAttribute;
557
- const elementsOut = ComponentDatatype_default.createTypedArray(
558
- attribute.componentDatatype,
559
- nextIndex * numComponents
560
- );
561
- while (intoElementsIn < numVertices) {
562
- const temp = indexCrossReferenceOldToNew[intoElementsIn];
563
- if (temp !== -1) {
564
- for (let j = 0; j < numComponents; j++) {
565
- elementsOut[numComponents * temp + j] = elementsIn[numComponents * intoElementsIn + j];
566
- }
567
- }
568
- ++intoElementsIn;
569
- }
570
- attribute.values = elementsOut;
571
- }
572
- }
573
- }
574
- return geometry;
575
- };
576
- GeometryPipeline.reorderForPostVertexCache = function(geometry, cacheCapacity) {
577
- if (!defined_default(geometry)) {
578
- throw new DeveloperError_default("geometry is required.");
579
- }
580
- const indices = geometry.indices;
581
- if (geometry.primitiveType === PrimitiveType_default.TRIANGLES && defined_default(indices)) {
582
- const numIndices = indices.length;
583
- let maximumIndex = 0;
584
- for (let j = 0; j < numIndices; j++) {
585
- if (indices[j] > maximumIndex) {
586
- maximumIndex = indices[j];
587
- }
588
- }
589
- geometry.indices = Tipsify_default.tipsify({
590
- indices,
591
- maximumIndex,
592
- cacheSize: cacheCapacity
593
- });
594
- }
595
- return geometry;
596
- };
597
- function copyAttributesDescriptions(attributes) {
598
- const newAttributes = {};
599
- for (const attribute in attributes) {
600
- if (attributes.hasOwnProperty(attribute) && defined_default(attributes[attribute]) && defined_default(attributes[attribute].values)) {
601
- const attr = attributes[attribute];
602
- newAttributes[attribute] = new GeometryAttribute_default({
603
- componentDatatype: attr.componentDatatype,
604
- componentsPerAttribute: attr.componentsPerAttribute,
605
- normalize: attr.normalize,
606
- values: []
607
- });
608
- }
609
- }
610
- return newAttributes;
611
- }
612
- function copyVertex(destinationAttributes, sourceAttributes, index) {
613
- for (const attribute in sourceAttributes) {
614
- if (sourceAttributes.hasOwnProperty(attribute) && defined_default(sourceAttributes[attribute]) && defined_default(sourceAttributes[attribute].values)) {
615
- const attr = sourceAttributes[attribute];
616
- for (let k = 0; k < attr.componentsPerAttribute; ++k) {
617
- destinationAttributes[attribute].values.push(
618
- attr.values[index * attr.componentsPerAttribute + k]
619
- );
620
- }
621
- }
622
- }
623
- }
624
- GeometryPipeline.fitToUnsignedShortIndices = function(geometry) {
625
- if (!defined_default(geometry)) {
626
- throw new DeveloperError_default("geometry is required.");
627
- }
628
- if (defined_default(geometry.indices) && geometry.primitiveType !== PrimitiveType_default.TRIANGLES && geometry.primitiveType !== PrimitiveType_default.LINES && geometry.primitiveType !== PrimitiveType_default.POINTS) {
629
- throw new DeveloperError_default(
630
- "geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS."
631
- );
632
- }
633
- const geometries = [];
634
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
635
- if (defined_default(geometry.indices) && numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
636
- let oldToNewIndex = [];
637
- let newIndices = [];
638
- let currentIndex = 0;
639
- let newAttributes = copyAttributesDescriptions(geometry.attributes);
640
- const originalIndices = geometry.indices;
641
- const numberOfIndices = originalIndices.length;
642
- let indicesPerPrimitive;
643
- if (geometry.primitiveType === PrimitiveType_default.TRIANGLES) {
644
- indicesPerPrimitive = 3;
645
- } else if (geometry.primitiveType === PrimitiveType_default.LINES) {
646
- indicesPerPrimitive = 2;
647
- } else if (geometry.primitiveType === PrimitiveType_default.POINTS) {
648
- indicesPerPrimitive = 1;
649
- }
650
- for (let j = 0; j < numberOfIndices; j += indicesPerPrimitive) {
651
- for (let k = 0; k < indicesPerPrimitive; ++k) {
652
- const x = originalIndices[j + k];
653
- let i = oldToNewIndex[x];
654
- if (!defined_default(i)) {
655
- i = currentIndex++;
656
- oldToNewIndex[x] = i;
657
- copyVertex(newAttributes, geometry.attributes, x);
658
- }
659
- newIndices.push(i);
660
- }
661
- if (currentIndex + indicesPerPrimitive >= Math_default.SIXTY_FOUR_KILOBYTES) {
662
- geometries.push(
663
- new Geometry_default({
664
- attributes: newAttributes,
665
- indices: newIndices,
666
- primitiveType: geometry.primitiveType,
667
- boundingSphere: geometry.boundingSphere,
668
- boundingSphereCV: geometry.boundingSphereCV
669
- })
670
- );
671
- oldToNewIndex = [];
672
- newIndices = [];
673
- currentIndex = 0;
674
- newAttributes = copyAttributesDescriptions(geometry.attributes);
675
- }
676
- }
677
- if (newIndices.length !== 0) {
678
- geometries.push(
679
- new Geometry_default({
680
- attributes: newAttributes,
681
- indices: newIndices,
682
- primitiveType: geometry.primitiveType,
683
- boundingSphere: geometry.boundingSphere,
684
- boundingSphereCV: geometry.boundingSphereCV
685
- })
686
- );
687
- }
688
- } else {
689
- geometries.push(geometry);
690
- }
691
- return geometries;
692
- };
693
- var scratchProjectTo2DCartesian3 = new Cartesian3_default();
694
- var scratchProjectTo2DCartographic = new Cartographic_default();
695
- GeometryPipeline.projectTo2D = function(geometry, attributeName, attributeName3D, attributeName2D, projection) {
696
- if (!defined_default(geometry)) {
697
- throw new DeveloperError_default("geometry is required.");
698
- }
699
- if (!defined_default(attributeName)) {
700
- throw new DeveloperError_default("attributeName is required.");
701
- }
702
- if (!defined_default(attributeName3D)) {
703
- throw new DeveloperError_default("attributeName3D is required.");
704
- }
705
- if (!defined_default(attributeName2D)) {
706
- throw new DeveloperError_default("attributeName2D is required.");
707
- }
708
- if (!defined_default(geometry.attributes[attributeName])) {
709
- throw new DeveloperError_default(
710
- `geometry must have attribute matching the attributeName argument: ${attributeName}.`
711
- );
712
- }
713
- if (geometry.attributes[attributeName].componentDatatype !== ComponentDatatype_default.DOUBLE) {
714
- throw new DeveloperError_default(
715
- "The attribute componentDatatype must be ComponentDatatype.DOUBLE."
716
- );
717
- }
718
- const attribute = geometry.attributes[attributeName];
719
- projection = defined_default(projection) ? projection : new GeographicProjection_default();
720
- const ellipsoid = projection.ellipsoid;
721
- const values3D = attribute.values;
722
- const projectedValues = new Float64Array(values3D.length);
723
- let index = 0;
724
- for (let i = 0; i < values3D.length; i += 3) {
725
- const value = Cartesian3_default.fromArray(
726
- values3D,
727
- i,
728
- scratchProjectTo2DCartesian3
729
- );
730
- const lonLat = ellipsoid.cartesianToCartographic(
731
- value,
732
- scratchProjectTo2DCartographic
733
- );
734
- if (!defined_default(lonLat)) {
735
- throw new DeveloperError_default(
736
- `Could not project point (${value.x}, ${value.y}, ${value.z}) to 2D.`
737
- );
738
- }
739
- const projectedLonLat = projection.project(
740
- lonLat,
741
- scratchProjectTo2DCartesian3
742
- );
743
- projectedValues[index++] = projectedLonLat.x;
744
- projectedValues[index++] = projectedLonLat.y;
745
- projectedValues[index++] = projectedLonLat.z;
746
- }
747
- geometry.attributes[attributeName3D] = attribute;
748
- geometry.attributes[attributeName2D] = new GeometryAttribute_default({
749
- componentDatatype: ComponentDatatype_default.DOUBLE,
750
- componentsPerAttribute: 3,
751
- values: projectedValues
752
- });
753
- delete geometry.attributes[attributeName];
754
- return geometry;
755
- };
756
- var encodedResult = {
757
- high: 0,
758
- low: 0
759
- };
760
- GeometryPipeline.encodeAttribute = function(geometry, attributeName, attributeHighName, attributeLowName) {
761
- if (!defined_default(geometry)) {
762
- throw new DeveloperError_default("geometry is required.");
763
- }
764
- if (!defined_default(attributeName)) {
765
- throw new DeveloperError_default("attributeName is required.");
766
- }
767
- if (!defined_default(attributeHighName)) {
768
- throw new DeveloperError_default("attributeHighName is required.");
769
- }
770
- if (!defined_default(attributeLowName)) {
771
- throw new DeveloperError_default("attributeLowName is required.");
772
- }
773
- if (!defined_default(geometry.attributes[attributeName])) {
774
- throw new DeveloperError_default(
775
- `geometry must have attribute matching the attributeName argument: ${attributeName}.`
776
- );
777
- }
778
- if (geometry.attributes[attributeName].componentDatatype !== ComponentDatatype_default.DOUBLE) {
779
- throw new DeveloperError_default(
780
- "The attribute componentDatatype must be ComponentDatatype.DOUBLE."
781
- );
782
- }
783
- const attribute = geometry.attributes[attributeName];
784
- const values = attribute.values;
785
- const length = values.length;
786
- const highValues = new Float32Array(length);
787
- const lowValues = new Float32Array(length);
788
- for (let i = 0; i < length; ++i) {
789
- EncodedCartesian3_default.encode(values[i], encodedResult);
790
- highValues[i] = encodedResult.high;
791
- lowValues[i] = encodedResult.low;
792
- }
793
- const componentsPerAttribute = attribute.componentsPerAttribute;
794
- geometry.attributes[attributeHighName] = new GeometryAttribute_default({
795
- componentDatatype: ComponentDatatype_default.FLOAT,
796
- componentsPerAttribute,
797
- values: highValues
798
- });
799
- geometry.attributes[attributeLowName] = new GeometryAttribute_default({
800
- componentDatatype: ComponentDatatype_default.FLOAT,
801
- componentsPerAttribute,
802
- values: lowValues
803
- });
804
- delete geometry.attributes[attributeName];
805
- return geometry;
806
- };
807
- var scratchCartesian32 = new Cartesian3_default();
808
- function transformPoint(matrix, attribute) {
809
- if (defined_default(attribute)) {
810
- const values = attribute.values;
811
- const length = values.length;
812
- for (let i = 0; i < length; i += 3) {
813
- Cartesian3_default.unpack(values, i, scratchCartesian32);
814
- Matrix4_default.multiplyByPoint(matrix, scratchCartesian32, scratchCartesian32);
815
- Cartesian3_default.pack(scratchCartesian32, values, i);
816
- }
817
- }
818
- }
819
- function transformVector(matrix, attribute) {
820
- if (defined_default(attribute)) {
821
- const values = attribute.values;
822
- const length = values.length;
823
- for (let i = 0; i < length; i += 3) {
824
- Cartesian3_default.unpack(values, i, scratchCartesian32);
825
- Matrix3_default.multiplyByVector(matrix, scratchCartesian32, scratchCartesian32);
826
- scratchCartesian32 = Cartesian3_default.normalize(
827
- scratchCartesian32,
828
- scratchCartesian32
829
- );
830
- Cartesian3_default.pack(scratchCartesian32, values, i);
831
- }
832
- }
833
- }
834
- var inverseTranspose = new Matrix4_default();
835
- var normalMatrix = new Matrix3_default();
836
- GeometryPipeline.transformToWorldCoordinates = function(instance) {
837
- if (!defined_default(instance)) {
838
- throw new DeveloperError_default("instance is required.");
839
- }
840
- const modelMatrix = instance.modelMatrix;
841
- if (Matrix4_default.equals(modelMatrix, Matrix4_default.IDENTITY)) {
842
- return instance;
843
- }
844
- const attributes = instance.geometry.attributes;
845
- transformPoint(modelMatrix, attributes.position);
846
- transformPoint(modelMatrix, attributes.prevPosition);
847
- transformPoint(modelMatrix, attributes.nextPosition);
848
- if (defined_default(attributes.normal) || defined_default(attributes.tangent) || defined_default(attributes.bitangent)) {
849
- Matrix4_default.inverse(modelMatrix, inverseTranspose);
850
- Matrix4_default.transpose(inverseTranspose, inverseTranspose);
851
- Matrix4_default.getMatrix3(inverseTranspose, normalMatrix);
852
- transformVector(normalMatrix, attributes.normal);
853
- transformVector(normalMatrix, attributes.tangent);
854
- transformVector(normalMatrix, attributes.bitangent);
855
- }
856
- const boundingSphere = instance.geometry.boundingSphere;
857
- if (defined_default(boundingSphere)) {
858
- instance.geometry.boundingSphere = BoundingSphere_default.transform(
859
- boundingSphere,
860
- modelMatrix,
861
- boundingSphere
862
- );
863
- }
864
- instance.modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
865
- return instance;
866
- };
867
- function findAttributesInAllGeometries(instances, propertyName) {
868
- const length = instances.length;
869
- const attributesInAllGeometries = {};
870
- const attributes0 = instances[0][propertyName].attributes;
871
- let name;
872
- for (name in attributes0) {
873
- if (attributes0.hasOwnProperty(name) && defined_default(attributes0[name]) && defined_default(attributes0[name].values)) {
874
- const attribute = attributes0[name];
875
- let numberOfComponents = attribute.values.length;
876
- let inAllGeometries = true;
877
- for (let i = 1; i < length; ++i) {
878
- const otherAttribute = instances[i][propertyName].attributes[name];
879
- if (!defined_default(otherAttribute) || attribute.componentDatatype !== otherAttribute.componentDatatype || attribute.componentsPerAttribute !== otherAttribute.componentsPerAttribute || attribute.normalize !== otherAttribute.normalize) {
880
- inAllGeometries = false;
881
- break;
882
- }
883
- numberOfComponents += otherAttribute.values.length;
884
- }
885
- if (inAllGeometries) {
886
- attributesInAllGeometries[name] = new GeometryAttribute_default({
887
- componentDatatype: attribute.componentDatatype,
888
- componentsPerAttribute: attribute.componentsPerAttribute,
889
- normalize: attribute.normalize,
890
- values: ComponentDatatype_default.createTypedArray(
891
- attribute.componentDatatype,
892
- numberOfComponents
893
- )
894
- });
895
- }
896
- }
897
- }
898
- return attributesInAllGeometries;
899
- }
900
- var tempScratch = new Cartesian3_default();
901
- function combineGeometries(instances, propertyName) {
902
- const length = instances.length;
903
- let name;
904
- let i;
905
- let j;
906
- let k;
907
- const m = instances[0].modelMatrix;
908
- const haveIndices = defined_default(instances[0][propertyName].indices);
909
- const primitiveType = instances[0][propertyName].primitiveType;
910
- for (i = 1; i < length; ++i) {
911
- if (!Matrix4_default.equals(instances[i].modelMatrix, m)) {
912
- throw new DeveloperError_default("All instances must have the same modelMatrix.");
913
- }
914
- if (defined_default(instances[i][propertyName].indices) !== haveIndices) {
915
- throw new DeveloperError_default(
916
- "All instance geometries must have an indices or not have one."
917
- );
918
- }
919
- if (instances[i][propertyName].primitiveType !== primitiveType) {
920
- throw new DeveloperError_default(
921
- "All instance geometries must have the same primitiveType."
922
- );
923
- }
924
- }
925
- const attributes = findAttributesInAllGeometries(instances, propertyName);
926
- let values;
927
- let sourceValues;
928
- let sourceValuesLength;
929
- for (name in attributes) {
930
- if (attributes.hasOwnProperty(name)) {
931
- values = attributes[name].values;
932
- k = 0;
933
- for (i = 0; i < length; ++i) {
934
- sourceValues = instances[i][propertyName].attributes[name].values;
935
- sourceValuesLength = sourceValues.length;
936
- for (j = 0; j < sourceValuesLength; ++j) {
937
- values[k++] = sourceValues[j];
938
- }
939
- }
940
- }
941
- }
942
- let indices;
943
- if (haveIndices) {
944
- let numberOfIndices = 0;
945
- for (i = 0; i < length; ++i) {
946
- numberOfIndices += instances[i][propertyName].indices.length;
947
- }
948
- const numberOfVertices = Geometry_default.computeNumberOfVertices(
949
- new Geometry_default({
950
- attributes,
951
- primitiveType: PrimitiveType_default.POINTS
952
- })
953
- );
954
- const destIndices = IndexDatatype_default.createTypedArray(
955
- numberOfVertices,
956
- numberOfIndices
957
- );
958
- let destOffset = 0;
959
- let offset = 0;
960
- for (i = 0; i < length; ++i) {
961
- const sourceIndices = instances[i][propertyName].indices;
962
- const sourceIndicesLen = sourceIndices.length;
963
- for (k = 0; k < sourceIndicesLen; ++k) {
964
- destIndices[destOffset++] = offset + sourceIndices[k];
965
- }
966
- offset += Geometry_default.computeNumberOfVertices(instances[i][propertyName]);
967
- }
968
- indices = destIndices;
969
- }
970
- let center = new Cartesian3_default();
971
- let radius = 0;
972
- let bs;
973
- for (i = 0; i < length; ++i) {
974
- bs = instances[i][propertyName].boundingSphere;
975
- if (!defined_default(bs)) {
976
- center = void 0;
977
- break;
978
- }
979
- Cartesian3_default.add(bs.center, center, center);
980
- }
981
- if (defined_default(center)) {
982
- Cartesian3_default.divideByScalar(center, length, center);
983
- for (i = 0; i < length; ++i) {
984
- bs = instances[i][propertyName].boundingSphere;
985
- const tempRadius = Cartesian3_default.magnitude(
986
- Cartesian3_default.subtract(bs.center, center, tempScratch)
987
- ) + bs.radius;
988
- if (tempRadius > radius) {
989
- radius = tempRadius;
990
- }
991
- }
992
- }
993
- return new Geometry_default({
994
- attributes,
995
- indices,
996
- primitiveType,
997
- boundingSphere: defined_default(center) ? new BoundingSphere_default(center, radius) : void 0
998
- });
999
- }
1000
- GeometryPipeline.combineInstances = function(instances) {
1001
- if (!defined_default(instances) || instances.length < 1) {
1002
- throw new DeveloperError_default(
1003
- "instances is required and must have length greater than zero."
1004
- );
1005
- }
1006
- const instanceGeometry = [];
1007
- const instanceSplitGeometry = [];
1008
- const length = instances.length;
1009
- for (let i = 0; i < length; ++i) {
1010
- const instance = instances[i];
1011
- if (defined_default(instance.geometry)) {
1012
- instanceGeometry.push(instance);
1013
- } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
1014
- instanceSplitGeometry.push(instance);
1015
- }
1016
- }
1017
- const geometries = [];
1018
- if (instanceGeometry.length > 0) {
1019
- geometries.push(combineGeometries(instanceGeometry, "geometry"));
1020
- }
1021
- if (instanceSplitGeometry.length > 0) {
1022
- geometries.push(
1023
- combineGeometries(instanceSplitGeometry, "westHemisphereGeometry")
1024
- );
1025
- geometries.push(
1026
- combineGeometries(instanceSplitGeometry, "eastHemisphereGeometry")
1027
- );
1028
- }
1029
- return geometries;
1030
- };
1031
- var normal = new Cartesian3_default();
1032
- var v0 = new Cartesian3_default();
1033
- var v1 = new Cartesian3_default();
1034
- var v2 = new Cartesian3_default();
1035
- GeometryPipeline.computeNormal = function(geometry) {
1036
- if (!defined_default(geometry)) {
1037
- throw new DeveloperError_default("geometry is required.");
1038
- }
1039
- if (!defined_default(geometry.attributes.position) || !defined_default(geometry.attributes.position.values)) {
1040
- throw new DeveloperError_default(
1041
- "geometry.attributes.position.values is required."
1042
- );
1043
- }
1044
- if (!defined_default(geometry.indices)) {
1045
- throw new DeveloperError_default("geometry.indices is required.");
1046
- }
1047
- if (geometry.indices.length < 2 || geometry.indices.length % 3 !== 0) {
1048
- throw new DeveloperError_default(
1049
- "geometry.indices length must be greater than 0 and be a multiple of 3."
1050
- );
1051
- }
1052
- if (geometry.primitiveType !== PrimitiveType_default.TRIANGLES) {
1053
- throw new DeveloperError_default(
1054
- "geometry.primitiveType must be PrimitiveType.TRIANGLES."
1055
- );
1056
- }
1057
- const indices = geometry.indices;
1058
- const attributes = geometry.attributes;
1059
- const vertices = attributes.position.values;
1060
- const numVertices = attributes.position.values.length / 3;
1061
- const numIndices = indices.length;
1062
- const normalsPerVertex = new Array(numVertices);
1063
- const normalsPerTriangle = new Array(numIndices / 3);
1064
- const normalIndices = new Array(numIndices);
1065
- let i;
1066
- for (i = 0; i < numVertices; i++) {
1067
- normalsPerVertex[i] = {
1068
- indexOffset: 0,
1069
- count: 0,
1070
- currentCount: 0
1071
- };
1072
- }
1073
- let j = 0;
1074
- for (i = 0; i < numIndices; i += 3) {
1075
- const i0 = indices[i];
1076
- const i1 = indices[i + 1];
1077
- const i2 = indices[i + 2];
1078
- const i03 = i0 * 3;
1079
- const i13 = i1 * 3;
1080
- const i23 = i2 * 3;
1081
- v0.x = vertices[i03];
1082
- v0.y = vertices[i03 + 1];
1083
- v0.z = vertices[i03 + 2];
1084
- v1.x = vertices[i13];
1085
- v1.y = vertices[i13 + 1];
1086
- v1.z = vertices[i13 + 2];
1087
- v2.x = vertices[i23];
1088
- v2.y = vertices[i23 + 1];
1089
- v2.z = vertices[i23 + 2];
1090
- normalsPerVertex[i0].count++;
1091
- normalsPerVertex[i1].count++;
1092
- normalsPerVertex[i2].count++;
1093
- Cartesian3_default.subtract(v1, v0, v1);
1094
- Cartesian3_default.subtract(v2, v0, v2);
1095
- normalsPerTriangle[j] = Cartesian3_default.cross(v1, v2, new Cartesian3_default());
1096
- j++;
1097
- }
1098
- let indexOffset = 0;
1099
- for (i = 0; i < numVertices; i++) {
1100
- normalsPerVertex[i].indexOffset += indexOffset;
1101
- indexOffset += normalsPerVertex[i].count;
1102
- }
1103
- j = 0;
1104
- let vertexNormalData;
1105
- for (i = 0; i < numIndices; i += 3) {
1106
- vertexNormalData = normalsPerVertex[indices[i]];
1107
- let index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
1108
- normalIndices[index] = j;
1109
- vertexNormalData.currentCount++;
1110
- vertexNormalData = normalsPerVertex[indices[i + 1]];
1111
- index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
1112
- normalIndices[index] = j;
1113
- vertexNormalData.currentCount++;
1114
- vertexNormalData = normalsPerVertex[indices[i + 2]];
1115
- index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
1116
- normalIndices[index] = j;
1117
- vertexNormalData.currentCount++;
1118
- j++;
1119
- }
1120
- const normalValues = new Float32Array(numVertices * 3);
1121
- for (i = 0; i < numVertices; i++) {
1122
- const i3 = i * 3;
1123
- vertexNormalData = normalsPerVertex[i];
1124
- Cartesian3_default.clone(Cartesian3_default.ZERO, normal);
1125
- if (vertexNormalData.count > 0) {
1126
- for (j = 0; j < vertexNormalData.count; j++) {
1127
- Cartesian3_default.add(
1128
- normal,
1129
- normalsPerTriangle[normalIndices[vertexNormalData.indexOffset + j]],
1130
- normal
1131
- );
1132
- }
1133
- if (Cartesian3_default.equalsEpsilon(Cartesian3_default.ZERO, normal, Math_default.EPSILON10)) {
1134
- Cartesian3_default.clone(
1135
- normalsPerTriangle[normalIndices[vertexNormalData.indexOffset]],
1136
- normal
1137
- );
1138
- }
1139
- }
1140
- if (Cartesian3_default.equalsEpsilon(Cartesian3_default.ZERO, normal, Math_default.EPSILON10)) {
1141
- normal.z = 1;
1142
- }
1143
- Cartesian3_default.normalize(normal, normal);
1144
- normalValues[i3] = normal.x;
1145
- normalValues[i3 + 1] = normal.y;
1146
- normalValues[i3 + 2] = normal.z;
1147
- }
1148
- geometry.attributes.normal = new GeometryAttribute_default({
1149
- componentDatatype: ComponentDatatype_default.FLOAT,
1150
- componentsPerAttribute: 3,
1151
- values: normalValues
1152
- });
1153
- return geometry;
1154
- };
1155
- var normalScratch = new Cartesian3_default();
1156
- var normalScale = new Cartesian3_default();
1157
- var tScratch = new Cartesian3_default();
1158
- GeometryPipeline.computeTangentAndBitangent = function(geometry) {
1159
- if (!defined_default(geometry)) {
1160
- throw new DeveloperError_default("geometry is required.");
1161
- }
1162
- const attributes = geometry.attributes;
1163
- const indices = geometry.indices;
1164
- if (!defined_default(attributes.position) || !defined_default(attributes.position.values)) {
1165
- throw new DeveloperError_default(
1166
- "geometry.attributes.position.values is required."
1167
- );
1168
- }
1169
- if (!defined_default(attributes.normal) || !defined_default(attributes.normal.values)) {
1170
- throw new DeveloperError_default("geometry.attributes.normal.values is required.");
1171
- }
1172
- if (!defined_default(attributes.st) || !defined_default(attributes.st.values)) {
1173
- throw new DeveloperError_default("geometry.attributes.st.values is required.");
1174
- }
1175
- if (!defined_default(indices)) {
1176
- throw new DeveloperError_default("geometry.indices is required.");
1177
- }
1178
- if (indices.length < 2 || indices.length % 3 !== 0) {
1179
- throw new DeveloperError_default(
1180
- "geometry.indices length must be greater than 0 and be a multiple of 3."
1181
- );
1182
- }
1183
- if (geometry.primitiveType !== PrimitiveType_default.TRIANGLES) {
1184
- throw new DeveloperError_default(
1185
- "geometry.primitiveType must be PrimitiveType.TRIANGLES."
1186
- );
1187
- }
1188
- const vertices = geometry.attributes.position.values;
1189
- const normals = geometry.attributes.normal.values;
1190
- const st = geometry.attributes.st.values;
1191
- const numVertices = geometry.attributes.position.values.length / 3;
1192
- const numIndices = indices.length;
1193
- const tan1 = new Array(numVertices * 3);
1194
- let i;
1195
- for (i = 0; i < tan1.length; i++) {
1196
- tan1[i] = 0;
1197
- }
1198
- let i03;
1199
- let i13;
1200
- let i23;
1201
- for (i = 0; i < numIndices; i += 3) {
1202
- const i0 = indices[i];
1203
- const i1 = indices[i + 1];
1204
- const i2 = indices[i + 2];
1205
- i03 = i0 * 3;
1206
- i13 = i1 * 3;
1207
- i23 = i2 * 3;
1208
- const i02 = i0 * 2;
1209
- const i12 = i1 * 2;
1210
- const i22 = i2 * 2;
1211
- const ux = vertices[i03];
1212
- const uy = vertices[i03 + 1];
1213
- const uz = vertices[i03 + 2];
1214
- const wx = st[i02];
1215
- const wy = st[i02 + 1];
1216
- const t1 = st[i12 + 1] - wy;
1217
- const t2 = st[i22 + 1] - wy;
1218
- const r = 1 / ((st[i12] - wx) * t2 - (st[i22] - wx) * t1);
1219
- const sdirx = (t2 * (vertices[i13] - ux) - t1 * (vertices[i23] - ux)) * r;
1220
- const sdiry = (t2 * (vertices[i13 + 1] - uy) - t1 * (vertices[i23 + 1] - uy)) * r;
1221
- const sdirz = (t2 * (vertices[i13 + 2] - uz) - t1 * (vertices[i23 + 2] - uz)) * r;
1222
- tan1[i03] += sdirx;
1223
- tan1[i03 + 1] += sdiry;
1224
- tan1[i03 + 2] += sdirz;
1225
- tan1[i13] += sdirx;
1226
- tan1[i13 + 1] += sdiry;
1227
- tan1[i13 + 2] += sdirz;
1228
- tan1[i23] += sdirx;
1229
- tan1[i23 + 1] += sdiry;
1230
- tan1[i23 + 2] += sdirz;
1231
- }
1232
- const tangentValues = new Float32Array(numVertices * 3);
1233
- const bitangentValues = new Float32Array(numVertices * 3);
1234
- for (i = 0; i < numVertices; i++) {
1235
- i03 = i * 3;
1236
- i13 = i03 + 1;
1237
- i23 = i03 + 2;
1238
- const n = Cartesian3_default.fromArray(normals, i03, normalScratch);
1239
- const t = Cartesian3_default.fromArray(tan1, i03, tScratch);
1240
- const scalar = Cartesian3_default.dot(n, t);
1241
- Cartesian3_default.multiplyByScalar(n, scalar, normalScale);
1242
- Cartesian3_default.normalize(Cartesian3_default.subtract(t, normalScale, t), t);
1243
- tangentValues[i03] = t.x;
1244
- tangentValues[i13] = t.y;
1245
- tangentValues[i23] = t.z;
1246
- Cartesian3_default.normalize(Cartesian3_default.cross(n, t, t), t);
1247
- bitangentValues[i03] = t.x;
1248
- bitangentValues[i13] = t.y;
1249
- bitangentValues[i23] = t.z;
1250
- }
1251
- geometry.attributes.tangent = new GeometryAttribute_default({
1252
- componentDatatype: ComponentDatatype_default.FLOAT,
1253
- componentsPerAttribute: 3,
1254
- values: tangentValues
1255
- });
1256
- geometry.attributes.bitangent = new GeometryAttribute_default({
1257
- componentDatatype: ComponentDatatype_default.FLOAT,
1258
- componentsPerAttribute: 3,
1259
- values: bitangentValues
1260
- });
1261
- return geometry;
1262
- };
1263
- var scratchCartesian22 = new Cartesian2_default();
1264
- var toEncode1 = new Cartesian3_default();
1265
- var toEncode2 = new Cartesian3_default();
1266
- var toEncode3 = new Cartesian3_default();
1267
- var encodeResult2 = new Cartesian2_default();
1268
- GeometryPipeline.compressVertices = function(geometry) {
1269
- if (!defined_default(geometry)) {
1270
- throw new DeveloperError_default("geometry is required.");
1271
- }
1272
- const extrudeAttribute = geometry.attributes.extrudeDirection;
1273
- let i;
1274
- let numVertices;
1275
- if (defined_default(extrudeAttribute)) {
1276
- const extrudeDirections = extrudeAttribute.values;
1277
- numVertices = extrudeDirections.length / 3;
1278
- const compressedDirections = new Float32Array(numVertices * 2);
1279
- let i2 = 0;
1280
- for (i = 0; i < numVertices; ++i) {
1281
- Cartesian3_default.fromArray(extrudeDirections, i * 3, toEncode1);
1282
- if (Cartesian3_default.equals(toEncode1, Cartesian3_default.ZERO)) {
1283
- i2 += 2;
1284
- continue;
1285
- }
1286
- encodeResult2 = AttributeCompression_default.octEncodeInRange(
1287
- toEncode1,
1288
- 65535,
1289
- encodeResult2
1290
- );
1291
- compressedDirections[i2++] = encodeResult2.x;
1292
- compressedDirections[i2++] = encodeResult2.y;
1293
- }
1294
- geometry.attributes.compressedAttributes = new GeometryAttribute_default({
1295
- componentDatatype: ComponentDatatype_default.FLOAT,
1296
- componentsPerAttribute: 2,
1297
- values: compressedDirections
1298
- });
1299
- delete geometry.attributes.extrudeDirection;
1300
- return geometry;
1301
- }
1302
- const normalAttribute = geometry.attributes.normal;
1303
- const stAttribute = geometry.attributes.st;
1304
- const hasNormal = defined_default(normalAttribute);
1305
- const hasSt = defined_default(stAttribute);
1306
- if (!hasNormal && !hasSt) {
1307
- return geometry;
1308
- }
1309
- const tangentAttribute = geometry.attributes.tangent;
1310
- const bitangentAttribute = geometry.attributes.bitangent;
1311
- const hasTangent = defined_default(tangentAttribute);
1312
- const hasBitangent = defined_default(bitangentAttribute);
1313
- let normals;
1314
- let st;
1315
- let tangents;
1316
- let bitangents;
1317
- if (hasNormal) {
1318
- normals = normalAttribute.values;
1319
- }
1320
- if (hasSt) {
1321
- st = stAttribute.values;
1322
- }
1323
- if (hasTangent) {
1324
- tangents = tangentAttribute.values;
1325
- }
1326
- if (hasBitangent) {
1327
- bitangents = bitangentAttribute.values;
1328
- }
1329
- const length = hasNormal ? normals.length : st.length;
1330
- const numComponents = hasNormal ? 3 : 2;
1331
- numVertices = length / numComponents;
1332
- let compressedLength = numVertices;
1333
- let numCompressedComponents = hasSt && hasNormal ? 2 : 1;
1334
- numCompressedComponents += hasTangent || hasBitangent ? 1 : 0;
1335
- compressedLength *= numCompressedComponents;
1336
- const compressedAttributes = new Float32Array(compressedLength);
1337
- let normalIndex = 0;
1338
- for (i = 0; i < numVertices; ++i) {
1339
- if (hasSt) {
1340
- Cartesian2_default.fromArray(st, i * 2, scratchCartesian22);
1341
- compressedAttributes[normalIndex++] = AttributeCompression_default.compressTextureCoordinates(scratchCartesian22);
1342
- }
1343
- const index = i * 3;
1344
- if (hasNormal && defined_default(tangents) && defined_default(bitangents)) {
1345
- Cartesian3_default.fromArray(normals, index, toEncode1);
1346
- Cartesian3_default.fromArray(tangents, index, toEncode2);
1347
- Cartesian3_default.fromArray(bitangents, index, toEncode3);
1348
- AttributeCompression_default.octPack(
1349
- toEncode1,
1350
- toEncode2,
1351
- toEncode3,
1352
- scratchCartesian22
1353
- );
1354
- compressedAttributes[normalIndex++] = scratchCartesian22.x;
1355
- compressedAttributes[normalIndex++] = scratchCartesian22.y;
1356
- } else {
1357
- if (hasNormal) {
1358
- Cartesian3_default.fromArray(normals, index, toEncode1);
1359
- compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
1360
- }
1361
- if (hasTangent) {
1362
- Cartesian3_default.fromArray(tangents, index, toEncode1);
1363
- compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
1364
- }
1365
- if (hasBitangent) {
1366
- Cartesian3_default.fromArray(bitangents, index, toEncode1);
1367
- compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
1368
- }
1369
- }
1370
- }
1371
- geometry.attributes.compressedAttributes = new GeometryAttribute_default({
1372
- componentDatatype: ComponentDatatype_default.FLOAT,
1373
- componentsPerAttribute: numCompressedComponents,
1374
- values: compressedAttributes
1375
- });
1376
- if (hasNormal) {
1377
- delete geometry.attributes.normal;
1378
- }
1379
- if (hasSt) {
1380
- delete geometry.attributes.st;
1381
- }
1382
- if (hasBitangent) {
1383
- delete geometry.attributes.bitangent;
1384
- }
1385
- if (hasTangent) {
1386
- delete geometry.attributes.tangent;
1387
- }
1388
- return geometry;
1389
- };
1390
- function indexTriangles(geometry) {
1391
- if (defined_default(geometry.indices)) {
1392
- return geometry;
1393
- }
1394
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1395
- if (numberOfVertices < 3) {
1396
- throw new DeveloperError_default("The number of vertices must be at least three.");
1397
- }
1398
- if (numberOfVertices % 3 !== 0) {
1399
- throw new DeveloperError_default(
1400
- "The number of vertices must be a multiple of three."
1401
- );
1402
- }
1403
- const indices = IndexDatatype_default.createTypedArray(
1404
- numberOfVertices,
1405
- numberOfVertices
1406
- );
1407
- for (let i = 0; i < numberOfVertices; ++i) {
1408
- indices[i] = i;
1409
- }
1410
- geometry.indices = indices;
1411
- return geometry;
1412
- }
1413
- function indexTriangleFan(geometry) {
1414
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1415
- if (numberOfVertices < 3) {
1416
- throw new DeveloperError_default("The number of vertices must be at least three.");
1417
- }
1418
- const indices = IndexDatatype_default.createTypedArray(
1419
- numberOfVertices,
1420
- (numberOfVertices - 2) * 3
1421
- );
1422
- indices[0] = 1;
1423
- indices[1] = 0;
1424
- indices[2] = 2;
1425
- let indicesIndex = 3;
1426
- for (let i = 3; i < numberOfVertices; ++i) {
1427
- indices[indicesIndex++] = i - 1;
1428
- indices[indicesIndex++] = 0;
1429
- indices[indicesIndex++] = i;
1430
- }
1431
- geometry.indices = indices;
1432
- geometry.primitiveType = PrimitiveType_default.TRIANGLES;
1433
- return geometry;
1434
- }
1435
- function indexTriangleStrip(geometry) {
1436
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1437
- if (numberOfVertices < 3) {
1438
- throw new DeveloperError_default("The number of vertices must be at least 3.");
1439
- }
1440
- const indices = IndexDatatype_default.createTypedArray(
1441
- numberOfVertices,
1442
- (numberOfVertices - 2) * 3
1443
- );
1444
- indices[0] = 0;
1445
- indices[1] = 1;
1446
- indices[2] = 2;
1447
- if (numberOfVertices > 3) {
1448
- indices[3] = 0;
1449
- indices[4] = 2;
1450
- indices[5] = 3;
1451
- }
1452
- let indicesIndex = 6;
1453
- for (let i = 3; i < numberOfVertices - 1; i += 2) {
1454
- indices[indicesIndex++] = i;
1455
- indices[indicesIndex++] = i - 1;
1456
- indices[indicesIndex++] = i + 1;
1457
- if (i + 2 < numberOfVertices) {
1458
- indices[indicesIndex++] = i;
1459
- indices[indicesIndex++] = i + 1;
1460
- indices[indicesIndex++] = i + 2;
1461
- }
1462
- }
1463
- geometry.indices = indices;
1464
- geometry.primitiveType = PrimitiveType_default.TRIANGLES;
1465
- return geometry;
1466
- }
1467
- function indexLines(geometry) {
1468
- if (defined_default(geometry.indices)) {
1469
- return geometry;
1470
- }
1471
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1472
- if (numberOfVertices < 2) {
1473
- throw new DeveloperError_default("The number of vertices must be at least two.");
1474
- }
1475
- if (numberOfVertices % 2 !== 0) {
1476
- throw new DeveloperError_default("The number of vertices must be a multiple of 2.");
1477
- }
1478
- const indices = IndexDatatype_default.createTypedArray(
1479
- numberOfVertices,
1480
- numberOfVertices
1481
- );
1482
- for (let i = 0; i < numberOfVertices; ++i) {
1483
- indices[i] = i;
1484
- }
1485
- geometry.indices = indices;
1486
- return geometry;
1487
- }
1488
- function indexLineStrip(geometry) {
1489
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1490
- if (numberOfVertices < 2) {
1491
- throw new DeveloperError_default("The number of vertices must be at least two.");
1492
- }
1493
- const indices = IndexDatatype_default.createTypedArray(
1494
- numberOfVertices,
1495
- (numberOfVertices - 1) * 2
1496
- );
1497
- indices[0] = 0;
1498
- indices[1] = 1;
1499
- let indicesIndex = 2;
1500
- for (let i = 2; i < numberOfVertices; ++i) {
1501
- indices[indicesIndex++] = i - 1;
1502
- indices[indicesIndex++] = i;
1503
- }
1504
- geometry.indices = indices;
1505
- geometry.primitiveType = PrimitiveType_default.LINES;
1506
- return geometry;
1507
- }
1508
- function indexLineLoop(geometry) {
1509
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1510
- if (numberOfVertices < 2) {
1511
- throw new DeveloperError_default("The number of vertices must be at least two.");
1512
- }
1513
- const indices = IndexDatatype_default.createTypedArray(
1514
- numberOfVertices,
1515
- numberOfVertices * 2
1516
- );
1517
- indices[0] = 0;
1518
- indices[1] = 1;
1519
- let indicesIndex = 2;
1520
- for (let i = 2; i < numberOfVertices; ++i) {
1521
- indices[indicesIndex++] = i - 1;
1522
- indices[indicesIndex++] = i;
1523
- }
1524
- indices[indicesIndex++] = numberOfVertices - 1;
1525
- indices[indicesIndex] = 0;
1526
- geometry.indices = indices;
1527
- geometry.primitiveType = PrimitiveType_default.LINES;
1528
- return geometry;
1529
- }
1530
- function indexPrimitive(geometry) {
1531
- switch (geometry.primitiveType) {
1532
- case PrimitiveType_default.TRIANGLE_FAN:
1533
- return indexTriangleFan(geometry);
1534
- case PrimitiveType_default.TRIANGLE_STRIP:
1535
- return indexTriangleStrip(geometry);
1536
- case PrimitiveType_default.TRIANGLES:
1537
- return indexTriangles(geometry);
1538
- case PrimitiveType_default.LINE_STRIP:
1539
- return indexLineStrip(geometry);
1540
- case PrimitiveType_default.LINE_LOOP:
1541
- return indexLineLoop(geometry);
1542
- case PrimitiveType_default.LINES:
1543
- return indexLines(geometry);
1544
- }
1545
- return geometry;
1546
- }
1547
- function offsetPointFromXZPlane(p, isBehind) {
1548
- if (Math.abs(p.y) < Math_default.EPSILON6) {
1549
- if (isBehind) {
1550
- p.y = -Math_default.EPSILON6;
1551
- } else {
1552
- p.y = Math_default.EPSILON6;
1553
- }
1554
- }
1555
- }
1556
- function offsetTriangleFromXZPlane(p0, p1, p2) {
1557
- if (p0.y !== 0 && p1.y !== 0 && p2.y !== 0) {
1558
- offsetPointFromXZPlane(p0, p0.y < 0);
1559
- offsetPointFromXZPlane(p1, p1.y < 0);
1560
- offsetPointFromXZPlane(p2, p2.y < 0);
1561
- return;
1562
- }
1563
- const p0y = Math.abs(p0.y);
1564
- const p1y = Math.abs(p1.y);
1565
- const p2y = Math.abs(p2.y);
1566
- let sign;
1567
- if (p0y > p1y) {
1568
- if (p0y > p2y) {
1569
- sign = Math_default.sign(p0.y);
1570
- } else {
1571
- sign = Math_default.sign(p2.y);
1572
- }
1573
- } else if (p1y > p2y) {
1574
- sign = Math_default.sign(p1.y);
1575
- } else {
1576
- sign = Math_default.sign(p2.y);
1577
- }
1578
- const isBehind = sign < 0;
1579
- offsetPointFromXZPlane(p0, isBehind);
1580
- offsetPointFromXZPlane(p1, isBehind);
1581
- offsetPointFromXZPlane(p2, isBehind);
1582
- }
1583
- var c3 = new Cartesian3_default();
1584
- function getXZIntersectionOffsetPoints(p, p1, u12, v12) {
1585
- Cartesian3_default.add(
1586
- p,
1587
- Cartesian3_default.multiplyByScalar(
1588
- Cartesian3_default.subtract(p1, p, c3),
1589
- p.y / (p.y - p1.y),
1590
- c3
1591
- ),
1592
- u12
1593
- );
1594
- Cartesian3_default.clone(u12, v12);
1595
- offsetPointFromXZPlane(u12, true);
1596
- offsetPointFromXZPlane(v12, false);
1597
- }
1598
- var u1 = new Cartesian3_default();
1599
- var u2 = new Cartesian3_default();
1600
- var q1 = new Cartesian3_default();
1601
- var q2 = new Cartesian3_default();
1602
- var splitTriangleResult = {
1603
- positions: new Array(7),
1604
- indices: new Array(3 * 3)
1605
- };
1606
- function splitTriangle(p0, p1, p2) {
1607
- if (p0.x >= 0 || p1.x >= 0 || p2.x >= 0) {
1608
- return void 0;
1609
- }
1610
- offsetTriangleFromXZPlane(p0, p1, p2);
1611
- const p0Behind = p0.y < 0;
1612
- const p1Behind = p1.y < 0;
1613
- const p2Behind = p2.y < 0;
1614
- let numBehind = 0;
1615
- numBehind += p0Behind ? 1 : 0;
1616
- numBehind += p1Behind ? 1 : 0;
1617
- numBehind += p2Behind ? 1 : 0;
1618
- const indices = splitTriangleResult.indices;
1619
- if (numBehind === 1) {
1620
- indices[1] = 3;
1621
- indices[2] = 4;
1622
- indices[5] = 6;
1623
- indices[7] = 6;
1624
- indices[8] = 5;
1625
- if (p0Behind) {
1626
- getXZIntersectionOffsetPoints(p0, p1, u1, q1);
1627
- getXZIntersectionOffsetPoints(p0, p2, u2, q2);
1628
- indices[0] = 0;
1629
- indices[3] = 1;
1630
- indices[4] = 2;
1631
- indices[6] = 1;
1632
- } else if (p1Behind) {
1633
- getXZIntersectionOffsetPoints(p1, p2, u1, q1);
1634
- getXZIntersectionOffsetPoints(p1, p0, u2, q2);
1635
- indices[0] = 1;
1636
- indices[3] = 2;
1637
- indices[4] = 0;
1638
- indices[6] = 2;
1639
- } else if (p2Behind) {
1640
- getXZIntersectionOffsetPoints(p2, p0, u1, q1);
1641
- getXZIntersectionOffsetPoints(p2, p1, u2, q2);
1642
- indices[0] = 2;
1643
- indices[3] = 0;
1644
- indices[4] = 1;
1645
- indices[6] = 0;
1646
- }
1647
- } else if (numBehind === 2) {
1648
- indices[2] = 4;
1649
- indices[4] = 4;
1650
- indices[5] = 3;
1651
- indices[7] = 5;
1652
- indices[8] = 6;
1653
- if (!p0Behind) {
1654
- getXZIntersectionOffsetPoints(p0, p1, u1, q1);
1655
- getXZIntersectionOffsetPoints(p0, p2, u2, q2);
1656
- indices[0] = 1;
1657
- indices[1] = 2;
1658
- indices[3] = 1;
1659
- indices[6] = 0;
1660
- } else if (!p1Behind) {
1661
- getXZIntersectionOffsetPoints(p1, p2, u1, q1);
1662
- getXZIntersectionOffsetPoints(p1, p0, u2, q2);
1663
- indices[0] = 2;
1664
- indices[1] = 0;
1665
- indices[3] = 2;
1666
- indices[6] = 1;
1667
- } else if (!p2Behind) {
1668
- getXZIntersectionOffsetPoints(p2, p0, u1, q1);
1669
- getXZIntersectionOffsetPoints(p2, p1, u2, q2);
1670
- indices[0] = 0;
1671
- indices[1] = 1;
1672
- indices[3] = 0;
1673
- indices[6] = 2;
1674
- }
1675
- }
1676
- const positions = splitTriangleResult.positions;
1677
- positions[0] = p0;
1678
- positions[1] = p1;
1679
- positions[2] = p2;
1680
- positions.length = 3;
1681
- if (numBehind === 1 || numBehind === 2) {
1682
- positions[3] = u1;
1683
- positions[4] = u2;
1684
- positions[5] = q1;
1685
- positions[6] = q2;
1686
- positions.length = 7;
1687
- }
1688
- return splitTriangleResult;
1689
- }
1690
- function updateGeometryAfterSplit(geometry, computeBoundingSphere) {
1691
- const attributes = geometry.attributes;
1692
- if (attributes.position.values.length === 0) {
1693
- return void 0;
1694
- }
1695
- for (const property in attributes) {
1696
- if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
1697
- const attribute = attributes[property];
1698
- attribute.values = ComponentDatatype_default.createTypedArray(
1699
- attribute.componentDatatype,
1700
- attribute.values
1701
- );
1702
- }
1703
- }
1704
- const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
1705
- geometry.indices = IndexDatatype_default.createTypedArray(
1706
- numberOfVertices,
1707
- geometry.indices
1708
- );
1709
- if (computeBoundingSphere) {
1710
- geometry.boundingSphere = BoundingSphere_default.fromVertices(
1711
- attributes.position.values
1712
- );
1713
- }
1714
- return geometry;
1715
- }
1716
- function copyGeometryForSplit(geometry) {
1717
- const attributes = geometry.attributes;
1718
- const copiedAttributes = {};
1719
- for (const property in attributes) {
1720
- if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
1721
- const attribute = attributes[property];
1722
- copiedAttributes[property] = new GeometryAttribute_default({
1723
- componentDatatype: attribute.componentDatatype,
1724
- componentsPerAttribute: attribute.componentsPerAttribute,
1725
- normalize: attribute.normalize,
1726
- values: []
1727
- });
1728
- }
1729
- }
1730
- return new Geometry_default({
1731
- attributes: copiedAttributes,
1732
- indices: [],
1733
- primitiveType: geometry.primitiveType
1734
- });
1735
- }
1736
- function updateInstanceAfterSplit(instance, westGeometry, eastGeometry) {
1737
- const computeBoundingSphere = defined_default(instance.geometry.boundingSphere);
1738
- westGeometry = updateGeometryAfterSplit(westGeometry, computeBoundingSphere);
1739
- eastGeometry = updateGeometryAfterSplit(eastGeometry, computeBoundingSphere);
1740
- if (defined_default(eastGeometry) && !defined_default(westGeometry)) {
1741
- instance.geometry = eastGeometry;
1742
- } else if (!defined_default(eastGeometry) && defined_default(westGeometry)) {
1743
- instance.geometry = westGeometry;
1744
- } else {
1745
- instance.westHemisphereGeometry = westGeometry;
1746
- instance.eastHemisphereGeometry = eastGeometry;
1747
- instance.geometry = void 0;
1748
- }
1749
- }
1750
- function generateBarycentricInterpolateFunction(CartesianType, numberOfComponents) {
1751
- const v0Scratch = new CartesianType();
1752
- const v1Scratch = new CartesianType();
1753
- const v2Scratch = new CartesianType();
1754
- return function(i0, i1, i2, coords, sourceValues, currentValues, insertedIndex, normalize) {
1755
- const v02 = CartesianType.fromArray(
1756
- sourceValues,
1757
- i0 * numberOfComponents,
1758
- v0Scratch
1759
- );
1760
- const v12 = CartesianType.fromArray(
1761
- sourceValues,
1762
- i1 * numberOfComponents,
1763
- v1Scratch
1764
- );
1765
- const v22 = CartesianType.fromArray(
1766
- sourceValues,
1767
- i2 * numberOfComponents,
1768
- v2Scratch
1769
- );
1770
- CartesianType.multiplyByScalar(v02, coords.x, v02);
1771
- CartesianType.multiplyByScalar(v12, coords.y, v12);
1772
- CartesianType.multiplyByScalar(v22, coords.z, v22);
1773
- const value = CartesianType.add(v02, v12, v02);
1774
- CartesianType.add(value, v22, value);
1775
- if (normalize) {
1776
- CartesianType.normalize(value, value);
1777
- }
1778
- CartesianType.pack(
1779
- value,
1780
- currentValues,
1781
- insertedIndex * numberOfComponents
1782
- );
1783
- };
1784
- }
1785
- var interpolateAndPackCartesian4 = generateBarycentricInterpolateFunction(
1786
- Cartesian4_default,
1787
- 4
1788
- );
1789
- var interpolateAndPackCartesian3 = generateBarycentricInterpolateFunction(
1790
- Cartesian3_default,
1791
- 3
1792
- );
1793
- var interpolateAndPackCartesian2 = generateBarycentricInterpolateFunction(
1794
- Cartesian2_default,
1795
- 2
1796
- );
1797
- var interpolateAndPackBoolean = function(i0, i1, i2, coords, sourceValues, currentValues, insertedIndex) {
1798
- const v12 = sourceValues[i0] * coords.x;
1799
- const v22 = sourceValues[i1] * coords.y;
1800
- const v3 = sourceValues[i2] * coords.z;
1801
- currentValues[insertedIndex] = v12 + v22 + v3 > Math_default.EPSILON6 ? 1 : 0;
1802
- };
1803
- var p0Scratch = new Cartesian3_default();
1804
- var p1Scratch = new Cartesian3_default();
1805
- var p2Scratch = new Cartesian3_default();
1806
- var barycentricScratch = new Cartesian3_default();
1807
- function computeTriangleAttributes(i0, i1, i2, point, positions, normals, tangents, bitangents, texCoords, extrudeDirections, applyOffset, currentAttributes, customAttributeNames, customAttributesLength, allAttributes, insertedIndex) {
1808
- if (!defined_default(normals) && !defined_default(tangents) && !defined_default(bitangents) && !defined_default(texCoords) && !defined_default(extrudeDirections) && customAttributesLength === 0) {
1809
- return;
1810
- }
1811
- const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
1812
- const p1 = Cartesian3_default.fromArray(positions, i1 * 3, p1Scratch);
1813
- const p2 = Cartesian3_default.fromArray(positions, i2 * 3, p2Scratch);
1814
- const coords = barycentricCoordinates_default(point, p0, p1, p2, barycentricScratch);
1815
- if (!defined_default(coords)) {
1816
- return;
1817
- }
1818
- if (defined_default(normals)) {
1819
- interpolateAndPackCartesian3(
1820
- i0,
1821
- i1,
1822
- i2,
1823
- coords,
1824
- normals,
1825
- currentAttributes.normal.values,
1826
- insertedIndex,
1827
- true
1828
- );
1829
- }
1830
- if (defined_default(extrudeDirections)) {
1831
- const d0 = Cartesian3_default.fromArray(extrudeDirections, i0 * 3, p0Scratch);
1832
- const d1 = Cartesian3_default.fromArray(extrudeDirections, i1 * 3, p1Scratch);
1833
- const d2 = Cartesian3_default.fromArray(extrudeDirections, i2 * 3, p2Scratch);
1834
- Cartesian3_default.multiplyByScalar(d0, coords.x, d0);
1835
- Cartesian3_default.multiplyByScalar(d1, coords.y, d1);
1836
- Cartesian3_default.multiplyByScalar(d2, coords.z, d2);
1837
- let direction;
1838
- if (!Cartesian3_default.equals(d0, Cartesian3_default.ZERO) || !Cartesian3_default.equals(d1, Cartesian3_default.ZERO) || !Cartesian3_default.equals(d2, Cartesian3_default.ZERO)) {
1839
- direction = Cartesian3_default.add(d0, d1, d0);
1840
- Cartesian3_default.add(direction, d2, direction);
1841
- Cartesian3_default.normalize(direction, direction);
1842
- } else {
1843
- direction = p0Scratch;
1844
- direction.x = 0;
1845
- direction.y = 0;
1846
- direction.z = 0;
1847
- }
1848
- Cartesian3_default.pack(
1849
- direction,
1850
- currentAttributes.extrudeDirection.values,
1851
- insertedIndex * 3
1852
- );
1853
- }
1854
- if (defined_default(applyOffset)) {
1855
- interpolateAndPackBoolean(
1856
- i0,
1857
- i1,
1858
- i2,
1859
- coords,
1860
- applyOffset,
1861
- currentAttributes.applyOffset.values,
1862
- insertedIndex
1863
- );
1864
- }
1865
- if (defined_default(tangents)) {
1866
- interpolateAndPackCartesian3(
1867
- i0,
1868
- i1,
1869
- i2,
1870
- coords,
1871
- tangents,
1872
- currentAttributes.tangent.values,
1873
- insertedIndex,
1874
- true
1875
- );
1876
- }
1877
- if (defined_default(bitangents)) {
1878
- interpolateAndPackCartesian3(
1879
- i0,
1880
- i1,
1881
- i2,
1882
- coords,
1883
- bitangents,
1884
- currentAttributes.bitangent.values,
1885
- insertedIndex,
1886
- true
1887
- );
1888
- }
1889
- if (defined_default(texCoords)) {
1890
- interpolateAndPackCartesian2(
1891
- i0,
1892
- i1,
1893
- i2,
1894
- coords,
1895
- texCoords,
1896
- currentAttributes.st.values,
1897
- insertedIndex
1898
- );
1899
- }
1900
- if (customAttributesLength > 0) {
1901
- for (let i = 0; i < customAttributesLength; i++) {
1902
- const attributeName = customAttributeNames[i];
1903
- genericInterpolate(
1904
- i0,
1905
- i1,
1906
- i2,
1907
- coords,
1908
- insertedIndex,
1909
- allAttributes[attributeName],
1910
- currentAttributes[attributeName]
1911
- );
1912
- }
1913
- }
1914
- }
1915
- function genericInterpolate(i0, i1, i2, coords, insertedIndex, sourceAttribute, currentAttribute) {
1916
- const componentsPerAttribute = sourceAttribute.componentsPerAttribute;
1917
- const sourceValues = sourceAttribute.values;
1918
- const currentValues = currentAttribute.values;
1919
- switch (componentsPerAttribute) {
1920
- case 4:
1921
- interpolateAndPackCartesian4(
1922
- i0,
1923
- i1,
1924
- i2,
1925
- coords,
1926
- sourceValues,
1927
- currentValues,
1928
- insertedIndex,
1929
- false
1930
- );
1931
- break;
1932
- case 3:
1933
- interpolateAndPackCartesian3(
1934
- i0,
1935
- i1,
1936
- i2,
1937
- coords,
1938
- sourceValues,
1939
- currentValues,
1940
- insertedIndex,
1941
- false
1942
- );
1943
- break;
1944
- case 2:
1945
- interpolateAndPackCartesian2(
1946
- i0,
1947
- i1,
1948
- i2,
1949
- coords,
1950
- sourceValues,
1951
- currentValues,
1952
- insertedIndex,
1953
- false
1954
- );
1955
- break;
1956
- default:
1957
- currentValues[insertedIndex] = sourceValues[i0] * coords.x + sourceValues[i1] * coords.y + sourceValues[i2] * coords.z;
1958
- }
1959
- }
1960
- function insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices, currentIndex, point) {
1961
- const insertIndex = currentAttributes.position.values.length / 3;
1962
- if (currentIndex !== -1) {
1963
- const prevIndex = indices[currentIndex];
1964
- const newIndex = currentIndexMap[prevIndex];
1965
- if (newIndex === -1) {
1966
- currentIndexMap[prevIndex] = insertIndex;
1967
- currentAttributes.position.values.push(point.x, point.y, point.z);
1968
- currentIndices.push(insertIndex);
1969
- return insertIndex;
1970
- }
1971
- currentIndices.push(newIndex);
1972
- return newIndex;
1973
- }
1974
- currentAttributes.position.values.push(point.x, point.y, point.z);
1975
- currentIndices.push(insertIndex);
1976
- return insertIndex;
1977
- }
1978
- var NAMED_ATTRIBUTES = {
1979
- position: true,
1980
- normal: true,
1981
- bitangent: true,
1982
- tangent: true,
1983
- st: true,
1984
- extrudeDirection: true,
1985
- applyOffset: true
1986
- };
1987
- function splitLongitudeTriangles(instance) {
1988
- const geometry = instance.geometry;
1989
- const attributes = geometry.attributes;
1990
- const positions = attributes.position.values;
1991
- const normals = defined_default(attributes.normal) ? attributes.normal.values : void 0;
1992
- const bitangents = defined_default(attributes.bitangent) ? attributes.bitangent.values : void 0;
1993
- const tangents = defined_default(attributes.tangent) ? attributes.tangent.values : void 0;
1994
- const texCoords = defined_default(attributes.st) ? attributes.st.values : void 0;
1995
- const extrudeDirections = defined_default(attributes.extrudeDirection) ? attributes.extrudeDirection.values : void 0;
1996
- const applyOffset = defined_default(attributes.applyOffset) ? attributes.applyOffset.values : void 0;
1997
- const indices = geometry.indices;
1998
- const customAttributeNames = [];
1999
- for (const attributeName in attributes) {
2000
- if (attributes.hasOwnProperty(attributeName) && !NAMED_ATTRIBUTES[attributeName] && defined_default(attributes[attributeName])) {
2001
- customAttributeNames.push(attributeName);
2002
- }
2003
- }
2004
- const customAttributesLength = customAttributeNames.length;
2005
- const eastGeometry = copyGeometryForSplit(geometry);
2006
- const westGeometry = copyGeometryForSplit(geometry);
2007
- let currentAttributes;
2008
- let currentIndices;
2009
- let currentIndexMap;
2010
- let insertedIndex;
2011
- let i;
2012
- const westGeometryIndexMap = [];
2013
- westGeometryIndexMap.length = positions.length / 3;
2014
- const eastGeometryIndexMap = [];
2015
- eastGeometryIndexMap.length = positions.length / 3;
2016
- for (i = 0; i < westGeometryIndexMap.length; ++i) {
2017
- westGeometryIndexMap[i] = -1;
2018
- eastGeometryIndexMap[i] = -1;
2019
- }
2020
- const len = indices.length;
2021
- for (i = 0; i < len; i += 3) {
2022
- const i0 = indices[i];
2023
- const i1 = indices[i + 1];
2024
- const i2 = indices[i + 2];
2025
- let p0 = Cartesian3_default.fromArray(positions, i0 * 3);
2026
- let p1 = Cartesian3_default.fromArray(positions, i1 * 3);
2027
- let p2 = Cartesian3_default.fromArray(positions, i2 * 3);
2028
- const result = splitTriangle(p0, p1, p2);
2029
- if (defined_default(result) && result.positions.length > 3) {
2030
- const resultPositions = result.positions;
2031
- const resultIndices = result.indices;
2032
- const resultLength = resultIndices.length;
2033
- for (let j = 0; j < resultLength; ++j) {
2034
- const resultIndex = resultIndices[j];
2035
- const point = resultPositions[resultIndex];
2036
- if (point.y < 0) {
2037
- currentAttributes = westGeometry.attributes;
2038
- currentIndices = westGeometry.indices;
2039
- currentIndexMap = westGeometryIndexMap;
2040
- } else {
2041
- currentAttributes = eastGeometry.attributes;
2042
- currentIndices = eastGeometry.indices;
2043
- currentIndexMap = eastGeometryIndexMap;
2044
- }
2045
- insertedIndex = insertSplitPoint(
2046
- currentAttributes,
2047
- currentIndices,
2048
- currentIndexMap,
2049
- indices,
2050
- resultIndex < 3 ? i + resultIndex : -1,
2051
- point
2052
- );
2053
- computeTriangleAttributes(
2054
- i0,
2055
- i1,
2056
- i2,
2057
- point,
2058
- positions,
2059
- normals,
2060
- tangents,
2061
- bitangents,
2062
- texCoords,
2063
- extrudeDirections,
2064
- applyOffset,
2065
- currentAttributes,
2066
- customAttributeNames,
2067
- customAttributesLength,
2068
- attributes,
2069
- insertedIndex
2070
- );
2071
- }
2072
- } else {
2073
- if (defined_default(result)) {
2074
- p0 = result.positions[0];
2075
- p1 = result.positions[1];
2076
- p2 = result.positions[2];
2077
- }
2078
- if (p0.y < 0) {
2079
- currentAttributes = westGeometry.attributes;
2080
- currentIndices = westGeometry.indices;
2081
- currentIndexMap = westGeometryIndexMap;
2082
- } else {
2083
- currentAttributes = eastGeometry.attributes;
2084
- currentIndices = eastGeometry.indices;
2085
- currentIndexMap = eastGeometryIndexMap;
2086
- }
2087
- insertedIndex = insertSplitPoint(
2088
- currentAttributes,
2089
- currentIndices,
2090
- currentIndexMap,
2091
- indices,
2092
- i,
2093
- p0
2094
- );
2095
- computeTriangleAttributes(
2096
- i0,
2097
- i1,
2098
- i2,
2099
- p0,
2100
- positions,
2101
- normals,
2102
- tangents,
2103
- bitangents,
2104
- texCoords,
2105
- extrudeDirections,
2106
- applyOffset,
2107
- currentAttributes,
2108
- customAttributeNames,
2109
- customAttributesLength,
2110
- attributes,
2111
- insertedIndex
2112
- );
2113
- insertedIndex = insertSplitPoint(
2114
- currentAttributes,
2115
- currentIndices,
2116
- currentIndexMap,
2117
- indices,
2118
- i + 1,
2119
- p1
2120
- );
2121
- computeTriangleAttributes(
2122
- i0,
2123
- i1,
2124
- i2,
2125
- p1,
2126
- positions,
2127
- normals,
2128
- tangents,
2129
- bitangents,
2130
- texCoords,
2131
- extrudeDirections,
2132
- applyOffset,
2133
- currentAttributes,
2134
- customAttributeNames,
2135
- customAttributesLength,
2136
- attributes,
2137
- insertedIndex
2138
- );
2139
- insertedIndex = insertSplitPoint(
2140
- currentAttributes,
2141
- currentIndices,
2142
- currentIndexMap,
2143
- indices,
2144
- i + 2,
2145
- p2
2146
- );
2147
- computeTriangleAttributes(
2148
- i0,
2149
- i1,
2150
- i2,
2151
- p2,
2152
- positions,
2153
- normals,
2154
- tangents,
2155
- bitangents,
2156
- texCoords,
2157
- extrudeDirections,
2158
- applyOffset,
2159
- currentAttributes,
2160
- customAttributeNames,
2161
- customAttributesLength,
2162
- attributes,
2163
- insertedIndex
2164
- );
2165
- }
2166
- }
2167
- updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
2168
- }
2169
- var xzPlane = Plane_default.fromPointNormal(Cartesian3_default.ZERO, Cartesian3_default.UNIT_Y);
2170
- var offsetScratch = new Cartesian3_default();
2171
- var offsetPointScratch = new Cartesian3_default();
2172
- function computeLineAttributes(i0, i1, point, positions, insertIndex, currentAttributes, applyOffset) {
2173
- if (!defined_default(applyOffset)) {
2174
- return;
2175
- }
2176
- const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
2177
- if (Cartesian3_default.equalsEpsilon(p0, point, Math_default.EPSILON10)) {
2178
- currentAttributes.applyOffset.values[insertIndex] = applyOffset[i0];
2179
- } else {
2180
- currentAttributes.applyOffset.values[insertIndex] = applyOffset[i1];
2181
- }
2182
- }
2183
- function splitLongitudeLines(instance) {
2184
- const geometry = instance.geometry;
2185
- const attributes = geometry.attributes;
2186
- const positions = attributes.position.values;
2187
- const applyOffset = defined_default(attributes.applyOffset) ? attributes.applyOffset.values : void 0;
2188
- const indices = geometry.indices;
2189
- const eastGeometry = copyGeometryForSplit(geometry);
2190
- const westGeometry = copyGeometryForSplit(geometry);
2191
- let i;
2192
- const length = indices.length;
2193
- const westGeometryIndexMap = [];
2194
- westGeometryIndexMap.length = positions.length / 3;
2195
- const eastGeometryIndexMap = [];
2196
- eastGeometryIndexMap.length = positions.length / 3;
2197
- for (i = 0; i < westGeometryIndexMap.length; ++i) {
2198
- westGeometryIndexMap[i] = -1;
2199
- eastGeometryIndexMap[i] = -1;
2200
- }
2201
- for (i = 0; i < length; i += 2) {
2202
- const i0 = indices[i];
2203
- const i1 = indices[i + 1];
2204
- const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
2205
- const p1 = Cartesian3_default.fromArray(positions, i1 * 3, p1Scratch);
2206
- let insertIndex;
2207
- if (Math.abs(p0.y) < Math_default.EPSILON6) {
2208
- if (p0.y < 0) {
2209
- p0.y = -Math_default.EPSILON6;
2210
- } else {
2211
- p0.y = Math_default.EPSILON6;
2212
- }
2213
- }
2214
- if (Math.abs(p1.y) < Math_default.EPSILON6) {
2215
- if (p1.y < 0) {
2216
- p1.y = -Math_default.EPSILON6;
2217
- } else {
2218
- p1.y = Math_default.EPSILON6;
2219
- }
2220
- }
2221
- let p0Attributes = eastGeometry.attributes;
2222
- let p0Indices = eastGeometry.indices;
2223
- let p0IndexMap = eastGeometryIndexMap;
2224
- let p1Attributes = westGeometry.attributes;
2225
- let p1Indices = westGeometry.indices;
2226
- let p1IndexMap = westGeometryIndexMap;
2227
- const intersection = IntersectionTests_default.lineSegmentPlane(
2228
- p0,
2229
- p1,
2230
- xzPlane,
2231
- p2Scratch
2232
- );
2233
- if (defined_default(intersection)) {
2234
- const offset = Cartesian3_default.multiplyByScalar(
2235
- Cartesian3_default.UNIT_Y,
2236
- 5 * Math_default.EPSILON9,
2237
- offsetScratch
2238
- );
2239
- if (p0.y < 0) {
2240
- Cartesian3_default.negate(offset, offset);
2241
- p0Attributes = westGeometry.attributes;
2242
- p0Indices = westGeometry.indices;
2243
- p0IndexMap = westGeometryIndexMap;
2244
- p1Attributes = eastGeometry.attributes;
2245
- p1Indices = eastGeometry.indices;
2246
- p1IndexMap = eastGeometryIndexMap;
2247
- }
2248
- const offsetPoint = Cartesian3_default.add(
2249
- intersection,
2250
- offset,
2251
- offsetPointScratch
2252
- );
2253
- insertIndex = insertSplitPoint(
2254
- p0Attributes,
2255
- p0Indices,
2256
- p0IndexMap,
2257
- indices,
2258
- i,
2259
- p0
2260
- );
2261
- computeLineAttributes(
2262
- i0,
2263
- i1,
2264
- p0,
2265
- positions,
2266
- insertIndex,
2267
- p0Attributes,
2268
- applyOffset
2269
- );
2270
- insertIndex = insertSplitPoint(
2271
- p0Attributes,
2272
- p0Indices,
2273
- p0IndexMap,
2274
- indices,
2275
- -1,
2276
- offsetPoint
2277
- );
2278
- computeLineAttributes(
2279
- i0,
2280
- i1,
2281
- offsetPoint,
2282
- positions,
2283
- insertIndex,
2284
- p0Attributes,
2285
- applyOffset
2286
- );
2287
- Cartesian3_default.negate(offset, offset);
2288
- Cartesian3_default.add(intersection, offset, offsetPoint);
2289
- insertIndex = insertSplitPoint(
2290
- p1Attributes,
2291
- p1Indices,
2292
- p1IndexMap,
2293
- indices,
2294
- -1,
2295
- offsetPoint
2296
- );
2297
- computeLineAttributes(
2298
- i0,
2299
- i1,
2300
- offsetPoint,
2301
- positions,
2302
- insertIndex,
2303
- p1Attributes,
2304
- applyOffset
2305
- );
2306
- insertIndex = insertSplitPoint(
2307
- p1Attributes,
2308
- p1Indices,
2309
- p1IndexMap,
2310
- indices,
2311
- i + 1,
2312
- p1
2313
- );
2314
- computeLineAttributes(
2315
- i0,
2316
- i1,
2317
- p1,
2318
- positions,
2319
- insertIndex,
2320
- p1Attributes,
2321
- applyOffset
2322
- );
2323
- } else {
2324
- let currentAttributes;
2325
- let currentIndices;
2326
- let currentIndexMap;
2327
- if (p0.y < 0) {
2328
- currentAttributes = westGeometry.attributes;
2329
- currentIndices = westGeometry.indices;
2330
- currentIndexMap = westGeometryIndexMap;
2331
- } else {
2332
- currentAttributes = eastGeometry.attributes;
2333
- currentIndices = eastGeometry.indices;
2334
- currentIndexMap = eastGeometryIndexMap;
2335
- }
2336
- insertIndex = insertSplitPoint(
2337
- currentAttributes,
2338
- currentIndices,
2339
- currentIndexMap,
2340
- indices,
2341
- i,
2342
- p0
2343
- );
2344
- computeLineAttributes(
2345
- i0,
2346
- i1,
2347
- p0,
2348
- positions,
2349
- insertIndex,
2350
- currentAttributes,
2351
- applyOffset
2352
- );
2353
- insertIndex = insertSplitPoint(
2354
- currentAttributes,
2355
- currentIndices,
2356
- currentIndexMap,
2357
- indices,
2358
- i + 1,
2359
- p1
2360
- );
2361
- computeLineAttributes(
2362
- i0,
2363
- i1,
2364
- p1,
2365
- positions,
2366
- insertIndex,
2367
- currentAttributes,
2368
- applyOffset
2369
- );
2370
- }
2371
- }
2372
- updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
2373
- }
2374
- var cartesian2Scratch0 = new Cartesian2_default();
2375
- var cartesian2Scratch1 = new Cartesian2_default();
2376
- var cartesian3Scratch0 = new Cartesian3_default();
2377
- var cartesian3Scratch2 = new Cartesian3_default();
2378
- var cartesian3Scratch3 = new Cartesian3_default();
2379
- var cartesian3Scratch4 = new Cartesian3_default();
2380
- var cartesian3Scratch5 = new Cartesian3_default();
2381
- var cartesian3Scratch6 = new Cartesian3_default();
2382
- var cartesian4Scratch0 = new Cartesian4_default();
2383
- function updateAdjacencyAfterSplit(geometry) {
2384
- const attributes = geometry.attributes;
2385
- const positions = attributes.position.values;
2386
- const prevPositions = attributes.prevPosition.values;
2387
- const nextPositions = attributes.nextPosition.values;
2388
- const length = positions.length;
2389
- for (let j = 0; j < length; j += 3) {
2390
- const position = Cartesian3_default.unpack(positions, j, cartesian3Scratch0);
2391
- if (position.x > 0) {
2392
- continue;
2393
- }
2394
- const prevPosition = Cartesian3_default.unpack(
2395
- prevPositions,
2396
- j,
2397
- cartesian3Scratch2
2398
- );
2399
- if (position.y < 0 && prevPosition.y > 0 || position.y > 0 && prevPosition.y < 0) {
2400
- if (j - 3 > 0) {
2401
- prevPositions[j] = positions[j - 3];
2402
- prevPositions[j + 1] = positions[j - 2];
2403
- prevPositions[j + 2] = positions[j - 1];
2404
- } else {
2405
- Cartesian3_default.pack(position, prevPositions, j);
2406
- }
2407
- }
2408
- const nextPosition = Cartesian3_default.unpack(
2409
- nextPositions,
2410
- j,
2411
- cartesian3Scratch3
2412
- );
2413
- if (position.y < 0 && nextPosition.y > 0 || position.y > 0 && nextPosition.y < 0) {
2414
- if (j + 3 < length) {
2415
- nextPositions[j] = positions[j + 3];
2416
- nextPositions[j + 1] = positions[j + 4];
2417
- nextPositions[j + 2] = positions[j + 5];
2418
- } else {
2419
- Cartesian3_default.pack(position, nextPositions, j);
2420
- }
2421
- }
2422
- }
2423
- }
2424
- var offsetScalar = 5 * Math_default.EPSILON9;
2425
- var coplanarOffset = Math_default.EPSILON6;
2426
- function splitLongitudePolyline(instance) {
2427
- const geometry = instance.geometry;
2428
- const attributes = geometry.attributes;
2429
- const positions = attributes.position.values;
2430
- const prevPositions = attributes.prevPosition.values;
2431
- const nextPositions = attributes.nextPosition.values;
2432
- const expandAndWidths = attributes.expandAndWidth.values;
2433
- const texCoords = defined_default(attributes.st) ? attributes.st.values : void 0;
2434
- const colors = defined_default(attributes.color) ? attributes.color.values : void 0;
2435
- const eastGeometry = copyGeometryForSplit(geometry);
2436
- const westGeometry = copyGeometryForSplit(geometry);
2437
- let i;
2438
- let j;
2439
- let index;
2440
- let intersectionFound = false;
2441
- const length = positions.length / 3;
2442
- for (i = 0; i < length; i += 4) {
2443
- const i0 = i;
2444
- const i2 = i + 2;
2445
- const p0 = Cartesian3_default.fromArray(positions, i0 * 3, cartesian3Scratch0);
2446
- const p2 = Cartesian3_default.fromArray(positions, i2 * 3, cartesian3Scratch2);
2447
- if (Math.abs(p0.y) < coplanarOffset) {
2448
- p0.y = coplanarOffset * (p2.y < 0 ? -1 : 1);
2449
- positions[i * 3 + 1] = p0.y;
2450
- positions[(i + 1) * 3 + 1] = p0.y;
2451
- for (j = i0 * 3; j < i0 * 3 + 4 * 3; j += 3) {
2452
- prevPositions[j] = positions[i * 3];
2453
- prevPositions[j + 1] = positions[i * 3 + 1];
2454
- prevPositions[j + 2] = positions[i * 3 + 2];
2455
- }
2456
- }
2457
- if (Math.abs(p2.y) < coplanarOffset) {
2458
- p2.y = coplanarOffset * (p0.y < 0 ? -1 : 1);
2459
- positions[(i + 2) * 3 + 1] = p2.y;
2460
- positions[(i + 3) * 3 + 1] = p2.y;
2461
- for (j = i0 * 3; j < i0 * 3 + 4 * 3; j += 3) {
2462
- nextPositions[j] = positions[(i + 2) * 3];
2463
- nextPositions[j + 1] = positions[(i + 2) * 3 + 1];
2464
- nextPositions[j + 2] = positions[(i + 2) * 3 + 2];
2465
- }
2466
- }
2467
- let p0Attributes = eastGeometry.attributes;
2468
- let p0Indices = eastGeometry.indices;
2469
- let p2Attributes = westGeometry.attributes;
2470
- let p2Indices = westGeometry.indices;
2471
- const intersection = IntersectionTests_default.lineSegmentPlane(
2472
- p0,
2473
- p2,
2474
- xzPlane,
2475
- cartesian3Scratch4
2476
- );
2477
- if (defined_default(intersection)) {
2478
- intersectionFound = true;
2479
- const offset = Cartesian3_default.multiplyByScalar(
2480
- Cartesian3_default.UNIT_Y,
2481
- offsetScalar,
2482
- cartesian3Scratch5
2483
- );
2484
- if (p0.y < 0) {
2485
- Cartesian3_default.negate(offset, offset);
2486
- p0Attributes = westGeometry.attributes;
2487
- p0Indices = westGeometry.indices;
2488
- p2Attributes = eastGeometry.attributes;
2489
- p2Indices = eastGeometry.indices;
2490
- }
2491
- const offsetPoint = Cartesian3_default.add(
2492
- intersection,
2493
- offset,
2494
- cartesian3Scratch6
2495
- );
2496
- p0Attributes.position.values.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z);
2497
- p0Attributes.position.values.push(
2498
- offsetPoint.x,
2499
- offsetPoint.y,
2500
- offsetPoint.z
2501
- );
2502
- p0Attributes.position.values.push(
2503
- offsetPoint.x,
2504
- offsetPoint.y,
2505
- offsetPoint.z
2506
- );
2507
- p0Attributes.prevPosition.values.push(
2508
- prevPositions[i0 * 3],
2509
- prevPositions[i0 * 3 + 1],
2510
- prevPositions[i0 * 3 + 2]
2511
- );
2512
- p0Attributes.prevPosition.values.push(
2513
- prevPositions[i0 * 3 + 3],
2514
- prevPositions[i0 * 3 + 4],
2515
- prevPositions[i0 * 3 + 5]
2516
- );
2517
- p0Attributes.prevPosition.values.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z);
2518
- p0Attributes.nextPosition.values.push(
2519
- offsetPoint.x,
2520
- offsetPoint.y,
2521
- offsetPoint.z
2522
- );
2523
- p0Attributes.nextPosition.values.push(
2524
- offsetPoint.x,
2525
- offsetPoint.y,
2526
- offsetPoint.z
2527
- );
2528
- p0Attributes.nextPosition.values.push(
2529
- offsetPoint.x,
2530
- offsetPoint.y,
2531
- offsetPoint.z
2532
- );
2533
- p0Attributes.nextPosition.values.push(
2534
- offsetPoint.x,
2535
- offsetPoint.y,
2536
- offsetPoint.z
2537
- );
2538
- Cartesian3_default.negate(offset, offset);
2539
- Cartesian3_default.add(intersection, offset, offsetPoint);
2540
- p2Attributes.position.values.push(
2541
- offsetPoint.x,
2542
- offsetPoint.y,
2543
- offsetPoint.z
2544
- );
2545
- p2Attributes.position.values.push(
2546
- offsetPoint.x,
2547
- offsetPoint.y,
2548
- offsetPoint.z
2549
- );
2550
- p2Attributes.position.values.push(p2.x, p2.y, p2.z, p2.x, p2.y, p2.z);
2551
- p2Attributes.prevPosition.values.push(
2552
- offsetPoint.x,
2553
- offsetPoint.y,
2554
- offsetPoint.z
2555
- );
2556
- p2Attributes.prevPosition.values.push(
2557
- offsetPoint.x,
2558
- offsetPoint.y,
2559
- offsetPoint.z
2560
- );
2561
- p2Attributes.prevPosition.values.push(
2562
- offsetPoint.x,
2563
- offsetPoint.y,
2564
- offsetPoint.z
2565
- );
2566
- p2Attributes.prevPosition.values.push(
2567
- offsetPoint.x,
2568
- offsetPoint.y,
2569
- offsetPoint.z
2570
- );
2571
- p2Attributes.nextPosition.values.push(p2.x, p2.y, p2.z, p2.x, p2.y, p2.z);
2572
- p2Attributes.nextPosition.values.push(
2573
- nextPositions[i2 * 3],
2574
- nextPositions[i2 * 3 + 1],
2575
- nextPositions[i2 * 3 + 2]
2576
- );
2577
- p2Attributes.nextPosition.values.push(
2578
- nextPositions[i2 * 3 + 3],
2579
- nextPositions[i2 * 3 + 4],
2580
- nextPositions[i2 * 3 + 5]
2581
- );
2582
- const ew0 = Cartesian2_default.fromArray(
2583
- expandAndWidths,
2584
- i0 * 2,
2585
- cartesian2Scratch0
2586
- );
2587
- const width = Math.abs(ew0.y);
2588
- p0Attributes.expandAndWidth.values.push(-1, width, 1, width);
2589
- p0Attributes.expandAndWidth.values.push(-1, -width, 1, -width);
2590
- p2Attributes.expandAndWidth.values.push(-1, width, 1, width);
2591
- p2Attributes.expandAndWidth.values.push(-1, -width, 1, -width);
2592
- let t = Cartesian3_default.magnitudeSquared(
2593
- Cartesian3_default.subtract(intersection, p0, cartesian3Scratch3)
2594
- );
2595
- t /= Cartesian3_default.magnitudeSquared(
2596
- Cartesian3_default.subtract(p2, p0, cartesian3Scratch3)
2597
- );
2598
- if (defined_default(colors)) {
2599
- const c0 = Cartesian4_default.fromArray(colors, i0 * 4, cartesian4Scratch0);
2600
- const c2 = Cartesian4_default.fromArray(colors, i2 * 4, cartesian4Scratch0);
2601
- const r = Math_default.lerp(c0.x, c2.x, t);
2602
- const g = Math_default.lerp(c0.y, c2.y, t);
2603
- const b = Math_default.lerp(c0.z, c2.z, t);
2604
- const a = Math_default.lerp(c0.w, c2.w, t);
2605
- for (j = i0 * 4; j < i0 * 4 + 2 * 4; ++j) {
2606
- p0Attributes.color.values.push(colors[j]);
2607
- }
2608
- p0Attributes.color.values.push(r, g, b, a);
2609
- p0Attributes.color.values.push(r, g, b, a);
2610
- p2Attributes.color.values.push(r, g, b, a);
2611
- p2Attributes.color.values.push(r, g, b, a);
2612
- for (j = i2 * 4; j < i2 * 4 + 2 * 4; ++j) {
2613
- p2Attributes.color.values.push(colors[j]);
2614
- }
2615
- }
2616
- if (defined_default(texCoords)) {
2617
- const s0 = Cartesian2_default.fromArray(texCoords, i0 * 2, cartesian2Scratch0);
2618
- const s3 = Cartesian2_default.fromArray(
2619
- texCoords,
2620
- (i + 3) * 2,
2621
- cartesian2Scratch1
2622
- );
2623
- const sx = Math_default.lerp(s0.x, s3.x, t);
2624
- for (j = i0 * 2; j < i0 * 2 + 2 * 2; ++j) {
2625
- p0Attributes.st.values.push(texCoords[j]);
2626
- }
2627
- p0Attributes.st.values.push(sx, s0.y);
2628
- p0Attributes.st.values.push(sx, s3.y);
2629
- p2Attributes.st.values.push(sx, s0.y);
2630
- p2Attributes.st.values.push(sx, s3.y);
2631
- for (j = i2 * 2; j < i2 * 2 + 2 * 2; ++j) {
2632
- p2Attributes.st.values.push(texCoords[j]);
2633
- }
2634
- }
2635
- index = p0Attributes.position.values.length / 3 - 4;
2636
- p0Indices.push(index, index + 2, index + 1);
2637
- p0Indices.push(index + 1, index + 2, index + 3);
2638
- index = p2Attributes.position.values.length / 3 - 4;
2639
- p2Indices.push(index, index + 2, index + 1);
2640
- p2Indices.push(index + 1, index + 2, index + 3);
2641
- } else {
2642
- let currentAttributes;
2643
- let currentIndices;
2644
- if (p0.y < 0) {
2645
- currentAttributes = westGeometry.attributes;
2646
- currentIndices = westGeometry.indices;
2647
- } else {
2648
- currentAttributes = eastGeometry.attributes;
2649
- currentIndices = eastGeometry.indices;
2650
- }
2651
- currentAttributes.position.values.push(p0.x, p0.y, p0.z);
2652
- currentAttributes.position.values.push(p0.x, p0.y, p0.z);
2653
- currentAttributes.position.values.push(p2.x, p2.y, p2.z);
2654
- currentAttributes.position.values.push(p2.x, p2.y, p2.z);
2655
- for (j = i * 3; j < i * 3 + 4 * 3; ++j) {
2656
- currentAttributes.prevPosition.values.push(prevPositions[j]);
2657
- currentAttributes.nextPosition.values.push(nextPositions[j]);
2658
- }
2659
- for (j = i * 2; j < i * 2 + 4 * 2; ++j) {
2660
- currentAttributes.expandAndWidth.values.push(expandAndWidths[j]);
2661
- if (defined_default(texCoords)) {
2662
- currentAttributes.st.values.push(texCoords[j]);
2663
- }
2664
- }
2665
- if (defined_default(colors)) {
2666
- for (j = i * 4; j < i * 4 + 4 * 4; ++j) {
2667
- currentAttributes.color.values.push(colors[j]);
2668
- }
2669
- }
2670
- index = currentAttributes.position.values.length / 3 - 4;
2671
- currentIndices.push(index, index + 2, index + 1);
2672
- currentIndices.push(index + 1, index + 2, index + 3);
2673
- }
2674
- }
2675
- if (intersectionFound) {
2676
- updateAdjacencyAfterSplit(westGeometry);
2677
- updateAdjacencyAfterSplit(eastGeometry);
2678
- }
2679
- updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
2680
- }
2681
- GeometryPipeline.splitLongitude = function(instance) {
2682
- if (!defined_default(instance)) {
2683
- throw new DeveloperError_default("instance is required.");
2684
- }
2685
- const geometry = instance.geometry;
2686
- const boundingSphere = geometry.boundingSphere;
2687
- if (defined_default(boundingSphere)) {
2688
- const minX = boundingSphere.center.x - boundingSphere.radius;
2689
- if (minX > 0 || BoundingSphere_default.intersectPlane(boundingSphere, Plane_default.ORIGIN_ZX_PLANE) !== Intersect_default.INTERSECTING) {
2690
- return instance;
2691
- }
2692
- }
2693
- if (geometry.geometryType !== GeometryType_default.NONE) {
2694
- switch (geometry.geometryType) {
2695
- case GeometryType_default.POLYLINES:
2696
- splitLongitudePolyline(instance);
2697
- break;
2698
- case GeometryType_default.TRIANGLES:
2699
- splitLongitudeTriangles(instance);
2700
- break;
2701
- case GeometryType_default.LINES:
2702
- splitLongitudeLines(instance);
2703
- break;
2704
- }
2705
- } else {
2706
- indexPrimitive(geometry);
2707
- if (geometry.primitiveType === PrimitiveType_default.TRIANGLES) {
2708
- splitLongitudeTriangles(instance);
2709
- } else if (geometry.primitiveType === PrimitiveType_default.LINES) {
2710
- splitLongitudeLines(instance);
2711
- }
2712
- }
2713
- return instance;
2714
- };
2715
- var GeometryPipeline_default = GeometryPipeline;
2716
-
2717
- export {
2718
- GeometryPipeline_default
2719
- };