@cesium/engine 3.0.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-2U6EBIRX.js +757 -0
  5. package/Build/Workers/chunk-2ZI7FZ3Q.js +58 -0
  6. package/Build/Workers/chunk-3TSHZWOZ.js +1860 -0
  7. package/Build/Workers/chunk-44B6FQSJ.js +684 -0
  8. package/Build/Workers/chunk-4AJR66C5.js +368 -0
  9. package/Build/Workers/chunk-4HN3N5SE.js +501 -0
  10. package/Build/Workers/chunk-4QGPYV3W.js +102 -0
  11. package/Build/Workers/chunk-4RKE4B3G.js +476 -0
  12. package/Build/Workers/chunk-5E3V7Y4R.js +196 -0
  13. package/Build/Workers/chunk-6EHT6GS3.js +163 -0
  14. package/Build/Workers/chunk-6I22NWKQ.js +171 -0
  15. package/Build/Workers/chunk-7N67FBLW.js +1054 -0
  16. package/Build/Workers/chunk-AQQGAFKX.js +124 -0
  17. package/Build/Workers/chunk-CROU4RHL.js +138 -0
  18. package/Build/Workers/chunk-CTJCECTX.js +258 -0
  19. package/Build/Workers/chunk-DWJZFZ67.js +781 -0
  20. package/Build/Workers/chunk-EHJQEARC.js +59 -0
  21. package/Build/Workers/chunk-EVLKHUAE.js +1477 -0
  22. package/Build/Workers/chunk-FOOYJER7.js +834 -0
  23. package/Build/Workers/chunk-GLCRFDOB.js +73 -0
  24. package/Build/Workers/chunk-GPO47TW4.js +39 -0
  25. package/Build/Workers/chunk-H5Q2JKIA.js +1075 -0
  26. package/Build/Workers/chunk-HIDSEUWS.js +2041 -0
  27. package/Build/Workers/chunk-HV67ARO7.js +302 -0
  28. package/Build/Workers/chunk-IC7G4BX2.js +421 -0
  29. package/Build/Workers/chunk-IQN2LMGD.js +55 -0
  30. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  31. package/Build/Workers/chunk-K3VEWONC.js +289 -0
  32. package/Build/Workers/chunk-KZFXE35V.js +117 -0
  33. package/Build/Workers/chunk-MG2TXIO5.js +400 -0
  34. package/Build/Workers/chunk-MRCFDEKH.js +138 -0
  35. package/Build/Workers/chunk-MYDS6HBL.js +3273 -0
  36. package/Build/Workers/chunk-OCIX2CQ7.js +305 -0
  37. package/Build/Workers/chunk-P32XMW4I.js +2716 -0
  38. package/Build/Workers/chunk-PEVZYZBQ.js +157 -0
  39. package/Build/Workers/chunk-PMDLIBEQ.js +218 -0
  40. package/Build/Workers/chunk-QDUOGCCO.js +1009 -0
  41. package/Build/Workers/chunk-QUCJGBCK.js +430 -0
  42. package/Build/Workers/chunk-RCI7BSOM.js +452 -0
  43. package/Build/Workers/chunk-SVTSC7FX.js +390 -0
  44. package/Build/Workers/chunk-TXOGSFHZ.js +77 -0
  45. package/Build/Workers/chunk-TXYJOVQK.js +629 -0
  46. package/Build/Workers/chunk-UFIT5XDI.js +1258 -0
  47. package/Build/Workers/chunk-ULLMQNFQ.js +73 -0
  48. package/Build/Workers/chunk-UM7FIUQW.js +101 -0
  49. package/Build/Workers/{package.js → chunk-UMLTOPAE.js} +13 -2
  50. package/Build/Workers/chunk-V5S5N2IS.js +8644 -0
  51. package/Build/Workers/chunk-VN2IHJKM.js +513 -0
  52. package/Build/Workers/chunk-VWSD2XV5.js +669 -0
  53. package/Build/Workers/chunk-X2KIWBTW.js +100 -0
  54. package/Build/Workers/chunk-Y24CDOJC.js +353 -0
  55. package/Build/Workers/chunk-YLMDWSXO.js +44 -0
  56. package/Build/Workers/chunk-YNZ4DMR7.js +634 -0
  57. package/Build/Workers/chunk-Z2MP3UBE.js +236 -0
  58. package/Build/Workers/combineGeometry.js +65 -15
  59. package/Build/Workers/createBoxGeometry.js +55 -10
  60. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  61. package/Build/Workers/createCircleGeometry.js +185 -202
  62. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  65. package/Build/Workers/createCorridorGeometry.js +1163 -1307
  66. package/Build/Workers/createCorridorOutlineGeometry.js +534 -569
  67. package/Build/Workers/createCylinderGeometry.js +57 -10
  68. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  69. package/Build/Workers/createEllipseGeometry.js +68 -12
  70. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  71. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  73. package/Build/Workers/createFrustumGeometry.js +55 -10
  74. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  75. package/Build/Workers/createGeometry.js +143 -48
  76. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2012
  77. package/Build/Workers/createPlaneGeometry.js +216 -243
  78. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  79. package/Build/Workers/createPolygonGeometry.js +1437 -1314
  80. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  81. package/Build/Workers/createPolylineGeometry.js +471 -547
  82. package/Build/Workers/createPolylineVolumeGeometry.js +354 -384
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -295
  84. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  85. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  86. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  87. package/Build/Workers/createSphereGeometry.js +112 -118
  88. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  89. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  90. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  91. package/Build/Workers/createVectorTileGeometries.js +377 -436
  92. package/Build/Workers/createVectorTilePoints.js +110 -77
  93. package/Build/Workers/createVectorTilePolygons.js +369 -391
  94. package/Build/Workers/createVectorTilePolylines.js +252 -244
  95. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  96. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  97. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  98. package/Build/Workers/createWallGeometry.js +459 -593
  99. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  100. package/Build/Workers/decodeDraco.js +327 -347
  101. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  102. package/Build/Workers/decodeI3S.js +765 -970
  103. package/Build/Workers/transcodeKTX2.js +3351 -1473
  104. package/Build/Workers/transferTypedArrayTest.js +3 -4
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  106. package/LICENSE.md +0 -12
  107. package/Source/Core/CesiumTerrainProvider.js +1 -2
  108. package/Source/Core/Credit.js +7 -1
  109. package/Source/Core/FeatureDetection.js +9 -0
  110. package/Source/Core/GoogleMaps.js +1 -2
  111. package/Source/Core/Ion.js +1 -2
  112. package/Source/Core/KTX2Transcoder.js +7 -3
  113. package/Source/Core/PolygonGeometry.js +340 -27
  114. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  115. package/Source/Core/Stereographic.js +247 -0
  116. package/Source/Core/TaskProcessor.js +185 -168
  117. package/Source/Core/Transforms.js +2 -2
  118. package/Source/Core/buildModuleUrl.js +6 -5
  119. package/Source/Core/sampleTerrain.js +43 -10
  120. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  121. package/Source/Scene/ArcGisMapService.js +1 -2
  122. package/Source/Scene/Billboard.js +7 -0
  123. package/Source/Scene/Cesium3DTilePass.js +1 -1
  124. package/Source/Scene/Cesium3DTileset.js +38 -81
  125. package/Source/Scene/CreditDisplay.js +2 -2
  126. package/Source/Scene/DracoLoader.js +26 -3
  127. package/Source/Scene/I3SDataProvider.js +0 -27
  128. package/Source/Scene/I3SDecoder.js +127 -0
  129. package/Source/Scene/I3SNode.js +32 -110
  130. package/Source/Scene/Implicit3DTileContent.js +13 -0
  131. package/Source/Scene/ImplicitTileset.js +5 -0
  132. package/Source/Scene/LabelCollection.js +3 -1
  133. package/Source/Scene/Model/I3dmLoader.js +5 -1
  134. package/Source/Scene/Model/Model.js +20 -23
  135. package/Source/Scene/OpenStreetMapImageryProvider.js +4 -1
  136. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  137. package/Source/Scene/PrimitiveCollection.js +39 -0
  138. package/Source/Scene/Scene.js +3 -0
  139. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  140. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  141. package/Source/Widget/CesiumWidget.js +2 -1
  142. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  143. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  144. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  145. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  146. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  147. package/Source/Workers/transferTypedArrayTest.js +0 -6
  148. package/index.d.ts +69 -35
  149. package/index.js +189 -187
  150. package/package.json +2 -1
  151. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  152. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  153. package/Build/Workers/AxisAlignedBoundingBox-a03420b1.js +0 -258
  154. package/Build/Workers/BoundingRectangle-32fa8a4a.js +0 -369
  155. package/Build/Workers/BoxGeometry-cd550612.js +0 -884
  156. package/Build/Workers/Check-6ede7e26.js +0 -290
  157. package/Build/Workers/Color-571a6085.js +0 -2262
  158. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  159. package/Build/Workers/CoplanarPolygonGeometryLibrary-488b1a9f.js +0 -132
  160. package/Build/Workers/CorridorGeometryLibrary-fc4ff147.js +0 -498
  161. package/Build/Workers/CylinderGeometry-bc26926d.js +0 -467
  162. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  163. package/Build/Workers/EllipseGeometry-89533a10.js +0 -1304
  164. package/Build/Workers/EllipseGeometryLibrary-b0d7df17.js +0 -366
  165. package/Build/Workers/EllipseOutlineGeometry-63ff7a87.js +0 -443
  166. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  167. package/Build/Workers/EllipsoidGeometry-07e99d2d.js +0 -637
  168. package/Build/Workers/EllipsoidOutlineGeometry-ba5c7ee2.js +0 -454
  169. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  170. package/Build/Workers/EllipsoidTangentPlane-65d41b3e.js +0 -373
  171. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  172. package/Build/Workers/FrustumGeometry-4a7589ed.js +0 -2540
  173. package/Build/Workers/GeometryAttribute-a5b6275b.js +0 -619
  174. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  175. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  176. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  177. package/Build/Workers/GeometryPipeline-fa9e6ffc.js +0 -3690
  178. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  179. package/Build/Workers/IntersectionTests-feace3da.js +0 -1836
  180. package/Build/Workers/Math-0a2ac845.js +0 -1340
  181. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  182. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  183. package/Build/Workers/OrientedBoundingBox-6b94d955.js +0 -1259
  184. package/Build/Workers/Plane-4c3d403b.js +0 -309
  185. package/Build/Workers/PolygonGeometryLibrary-4ffc457d.js +0 -1074
  186. package/Build/Workers/PolygonPipeline-d5e66350.js +0 -1344
  187. package/Build/Workers/PolylinePipeline-83410f0c.js +0 -573
  188. package/Build/Workers/PolylineVolumeGeometryLibrary-290e7aec.js +0 -781
  189. package/Build/Workers/PrimitivePipeline-6081d138.js +0 -966
  190. package/Build/Workers/RectangleGeometryLibrary-986710d8.js +0 -280
  191. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  192. package/Build/Workers/TerrainEncoding-528e1d68.js +0 -1227
  193. package/Build/Workers/Transforms-b527bb09.js +0 -14714
  194. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  195. package/Build/Workers/WallGeometryLibrary-faf583f8.js +0 -211
  196. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  197. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  198. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  199. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  200. package/Build/Workers/combine-d9581036.js +0 -82
  201. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  202. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  203. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  204. package/Source/Workers/package.json +0 -1
  205. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  235. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  236. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  237. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  238. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  239. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  240. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  241. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  242. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  243. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  244. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  245. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  246. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,176 +1,215 @@
1
- define(['./arrayRemoveDuplicates-d2061e85', './Transforms-b527bb09', './Matrix3-41c58dde', './Check-6ede7e26', './ComponentDatatype-cf1fa08e', './PolylineVolumeGeometryLibrary-290e7aec', './CorridorGeometryLibrary-fc4ff147', './defaultValue-fe22d8c0', './GeometryAttribute-a5b6275b', './GeometryAttributes-ad136444', './GeometryOffsetAttribute-9ad0019c', './IndexDatatype-2643aa47', './Math-0a2ac845', './PolygonPipeline-d5e66350', './Matrix2-e1298525', './VertexFormat-030f11ff', './combine-d9581036', './RuntimeError-ef395448', './WebGLConstants-0b1ce7ba', './EllipsoidTangentPlane-65d41b3e', './AxisAlignedBoundingBox-a03420b1', './IntersectionTests-feace3da', './Plane-4c3d403b', './PolylinePipeline-83410f0c', './EllipsoidGeodesic-5b3623dc', './EllipsoidRhumbLine-ef872433'], (function (arrayRemoveDuplicates, Transforms, Matrix3, Check, ComponentDatatype, PolylineVolumeGeometryLibrary, CorridorGeometryLibrary, defaultValue, GeometryAttribute, GeometryAttributes, GeometryOffsetAttribute, IndexDatatype, Math$1, PolygonPipeline, Matrix2, VertexFormat, combine$1, RuntimeError, WebGLConstants, EllipsoidTangentPlane, AxisAlignedBoundingBox, IntersectionTests, Plane, PolylinePipeline, EllipsoidGeodesic, EllipsoidRhumbLine) { 'use strict';
2
-
3
- const cartesian1 = new Matrix3.Cartesian3();
4
- const cartesian2 = new Matrix3.Cartesian3();
5
- const cartesian3 = new Matrix3.Cartesian3();
6
- const cartesian4 = new Matrix3.Cartesian3();
7
- const cartesian5 = new Matrix3.Cartesian3();
8
- const cartesian6 = new Matrix3.Cartesian3();
9
-
10
- const scratch1 = new Matrix3.Cartesian3();
11
- const scratch2 = new Matrix3.Cartesian3();
12
-
13
- function scaleToSurface(positions, ellipsoid) {
14
- for (let i = 0; i < positions.length; i++) {
15
- positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
16
- }
17
- return positions;
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.110
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
+ CorridorGeometryLibrary_default
28
+ } from "./chunk-4RKE4B3G.js";
29
+ import {
30
+ CornerType_default
31
+ } from "./chunk-VWSD2XV5.js";
32
+ import "./chunk-J2FHYK2Z.js";
33
+ import "./chunk-IC7G4BX2.js";
34
+ import "./chunk-Y24CDOJC.js";
35
+ import {
36
+ GeometryOffsetAttribute_default
37
+ } from "./chunk-UMLTOPAE.js";
38
+ import {
39
+ VertexFormat_default
40
+ } from "./chunk-MRCFDEKH.js";
41
+ import "./chunk-K3VEWONC.js";
42
+ import "./chunk-PEVZYZBQ.js";
43
+ import {
44
+ PolygonPipeline_default
45
+ } from "./chunk-QDUOGCCO.js";
46
+ import {
47
+ arrayRemoveDuplicates_default
48
+ } from "./chunk-X2KIWBTW.js";
49
+ import "./chunk-RCI7BSOM.js";
50
+ import "./chunk-UFIT5XDI.js";
51
+ import "./chunk-6I22NWKQ.js";
52
+ import {
53
+ IndexDatatype_default
54
+ } from "./chunk-CROU4RHL.js";
55
+ import {
56
+ GeometryAttributes_default
57
+ } from "./chunk-YLMDWSXO.js";
58
+ import {
59
+ GeometryAttribute_default,
60
+ Geometry_default,
61
+ PrimitiveType_default
62
+ } from "./chunk-HV67ARO7.js";
63
+ import {
64
+ BoundingSphere_default
65
+ } from "./chunk-V5S5N2IS.js";
66
+ import "./chunk-ULLMQNFQ.js";
67
+ import {
68
+ Rectangle_default
69
+ } from "./chunk-MYDS6HBL.js";
70
+ import {
71
+ ComponentDatatype_default
72
+ } from "./chunk-CTJCECTX.js";
73
+ import {
74
+ Cartesian3_default,
75
+ Cartographic_default,
76
+ Ellipsoid_default
77
+ } from "./chunk-HIDSEUWS.js";
78
+ import {
79
+ Math_default
80
+ } from "./chunk-4HN3N5SE.js";
81
+ import "./chunk-TXYJOVQK.js";
82
+ import "./chunk-2ZI7FZ3Q.js";
83
+ import {
84
+ defaultValue_default
85
+ } from "./chunk-GPO47TW4.js";
86
+ import {
87
+ Check_default
88
+ } from "./chunk-6EHT6GS3.js";
89
+ import {
90
+ defined_default
91
+ } from "./chunk-TXOGSFHZ.js";
92
+
93
+ // packages/engine/Source/Core/CorridorGeometry.js
94
+ var cartesian1 = new Cartesian3_default();
95
+ var cartesian2 = new Cartesian3_default();
96
+ var cartesian3 = new Cartesian3_default();
97
+ var cartesian4 = new Cartesian3_default();
98
+ var cartesian5 = new Cartesian3_default();
99
+ var cartesian6 = new Cartesian3_default();
100
+ var scratch1 = new Cartesian3_default();
101
+ var scratch2 = new Cartesian3_default();
102
+ function scaleToSurface(positions, ellipsoid) {
103
+ for (let i = 0; i < positions.length; i++) {
104
+ positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
18
105
  }
19
-
20
- function addNormals(attr, normal, left, front, back, vertexFormat) {
21
- const normals = attr.normals;
22
- const tangents = attr.tangents;
23
- const bitangents = attr.bitangents;
24
- const forward = Matrix3.Cartesian3.normalize(
25
- Matrix3.Cartesian3.cross(left, normal, scratch1),
26
- scratch1
27
- );
28
- if (vertexFormat.normal) {
29
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(normals, normal, front, back);
30
- }
31
- if (vertexFormat.tangent) {
32
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(tangents, forward, front, back);
33
- }
34
- if (vertexFormat.bitangent) {
35
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(bitangents, left, front, back);
36
- }
106
+ return positions;
107
+ }
108
+ function addNormals(attr, normal, left, front, back, vertexFormat) {
109
+ const normals = attr.normals;
110
+ const tangents = attr.tangents;
111
+ const bitangents = attr.bitangents;
112
+ const forward = Cartesian3_default.normalize(
113
+ Cartesian3_default.cross(left, normal, scratch1),
114
+ scratch1
115
+ );
116
+ if (vertexFormat.normal) {
117
+ CorridorGeometryLibrary_default.addAttribute(normals, normal, front, back);
37
118
  }
38
-
39
- function combine(computedPositions, vertexFormat, ellipsoid) {
40
- const positions = computedPositions.positions;
41
- const corners = computedPositions.corners;
42
- const endPositions = computedPositions.endPositions;
43
- const computedLefts = computedPositions.lefts;
44
- const computedNormals = computedPositions.normals;
45
- const attributes = new GeometryAttributes.GeometryAttributes();
46
- let corner;
47
- let leftCount = 0;
48
- let rightCount = 0;
49
- let i;
50
- let indicesLength = 0;
51
- let length;
52
- for (i = 0; i < positions.length; i += 2) {
53
- length = positions[i].length - 3;
54
- leftCount += length; //subtracting 3 to account for duplicate points at corners
55
- indicesLength += length * 2;
56
- rightCount += positions[i + 1].length - 3;
57
- }
58
- leftCount += 3; //add back count for end positions
59
- rightCount += 3;
60
- for (i = 0; i < corners.length; i++) {
61
- corner = corners[i];
62
- const leftSide = corners[i].leftPositions;
63
- if (defaultValue.defined(leftSide)) {
64
- length = leftSide.length;
65
- leftCount += length;
66
- indicesLength += length;
67
- } else {
68
- length = corners[i].rightPositions.length;
69
- rightCount += length;
70
- indicesLength += length;
71
- }
72
- }
73
-
74
- const addEndPositions = defaultValue.defined(endPositions);
75
- let endPositionLength;
76
- if (addEndPositions) {
77
- endPositionLength = endPositions[0].length - 3;
78
- leftCount += endPositionLength;
79
- rightCount += endPositionLength;
80
- endPositionLength /= 3;
81
- indicesLength += endPositionLength * 6;
82
- }
83
- const size = leftCount + rightCount;
84
- const finalPositions = new Float64Array(size);
85
- const normals = vertexFormat.normal ? new Float32Array(size) : undefined;
86
- const tangents = vertexFormat.tangent ? new Float32Array(size) : undefined;
87
- const bitangents = vertexFormat.bitangent
88
- ? new Float32Array(size)
89
- : undefined;
90
- const attr = {
91
- normals: normals,
92
- tangents: tangents,
93
- bitangents: bitangents,
94
- };
95
- let front = 0;
96
- let back = size - 1;
97
- let UL, LL, UR, LR;
98
- let normal = cartesian1;
99
- let left = cartesian2;
100
- let rightPos, leftPos;
101
- const halfLength = endPositionLength / 2;
102
-
103
- const indices = IndexDatatype.IndexDatatype.createTypedArray(size / 3, indicesLength);
104
- let index = 0;
105
- if (addEndPositions) {
106
- // add rounded end
107
- leftPos = cartesian3;
108
- rightPos = cartesian4;
109
- const firstEndPositions = endPositions[0];
110
- normal = Matrix3.Cartesian3.fromArray(computedNormals, 0, normal);
111
- left = Matrix3.Cartesian3.fromArray(computedLefts, 0, left);
112
- for (i = 0; i < halfLength; i++) {
113
- leftPos = Matrix3.Cartesian3.fromArray(
114
- firstEndPositions,
115
- (halfLength - 1 - i) * 3,
116
- leftPos
117
- );
118
- rightPos = Matrix3.Cartesian3.fromArray(
119
- firstEndPositions,
120
- (halfLength + i) * 3,
121
- rightPos
122
- );
123
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(finalPositions, rightPos, front);
124
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
125
- finalPositions,
126
- leftPos,
127
- undefined,
128
- back
129
- );
130
- addNormals(attr, normal, left, front, back, vertexFormat);
131
-
132
- LL = front / 3;
133
- LR = LL + 1;
134
- UL = (back - 2) / 3;
135
- UR = UL - 1;
136
- indices[index++] = UL;
137
- indices[index++] = LL;
138
- indices[index++] = UR;
139
- indices[index++] = UR;
140
- indices[index++] = LL;
141
- indices[index++] = LR;
142
-
143
- front += 3;
144
- back -= 3;
145
- }
119
+ if (vertexFormat.tangent) {
120
+ CorridorGeometryLibrary_default.addAttribute(tangents, forward, front, back);
121
+ }
122
+ if (vertexFormat.bitangent) {
123
+ CorridorGeometryLibrary_default.addAttribute(bitangents, left, front, back);
124
+ }
125
+ }
126
+ function combine(computedPositions, vertexFormat, ellipsoid) {
127
+ const positions = computedPositions.positions;
128
+ const corners = computedPositions.corners;
129
+ const endPositions = computedPositions.endPositions;
130
+ const computedLefts = computedPositions.lefts;
131
+ const computedNormals = computedPositions.normals;
132
+ const attributes = new GeometryAttributes_default();
133
+ let corner;
134
+ let leftCount = 0;
135
+ let rightCount = 0;
136
+ let i;
137
+ let indicesLength = 0;
138
+ let length;
139
+ for (i = 0; i < positions.length; i += 2) {
140
+ length = positions[i].length - 3;
141
+ leftCount += length;
142
+ indicesLength += length * 2;
143
+ rightCount += positions[i + 1].length - 3;
144
+ }
145
+ leftCount += 3;
146
+ rightCount += 3;
147
+ for (i = 0; i < corners.length; i++) {
148
+ corner = corners[i];
149
+ const leftSide = corners[i].leftPositions;
150
+ if (defined_default(leftSide)) {
151
+ length = leftSide.length;
152
+ leftCount += length;
153
+ indicesLength += length;
154
+ } else {
155
+ length = corners[i].rightPositions.length;
156
+ rightCount += length;
157
+ indicesLength += length;
146
158
  }
147
-
148
- let posIndex = 0;
149
- let compIndex = 0;
150
- let rightEdge = positions[posIndex++]; //add first two edges
151
- let leftEdge = positions[posIndex++];
152
- finalPositions.set(rightEdge, front);
153
- finalPositions.set(leftEdge, back - leftEdge.length + 1);
154
-
155
- left = Matrix3.Cartesian3.fromArray(computedLefts, compIndex, left);
156
- let rightNormal;
157
- let leftNormal;
158
- length = leftEdge.length - 3;
159
- for (i = 0; i < length; i += 3) {
160
- rightNormal = ellipsoid.geodeticSurfaceNormal(
161
- Matrix3.Cartesian3.fromArray(rightEdge, i, scratch1),
162
- scratch1
159
+ }
160
+ const addEndPositions = defined_default(endPositions);
161
+ let endPositionLength;
162
+ if (addEndPositions) {
163
+ endPositionLength = endPositions[0].length - 3;
164
+ leftCount += endPositionLength;
165
+ rightCount += endPositionLength;
166
+ endPositionLength /= 3;
167
+ indicesLength += endPositionLength * 6;
168
+ }
169
+ const size = leftCount + rightCount;
170
+ const finalPositions = new Float64Array(size);
171
+ const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
172
+ const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
173
+ const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
174
+ const attr = {
175
+ normals,
176
+ tangents,
177
+ bitangents
178
+ };
179
+ let front = 0;
180
+ let back = size - 1;
181
+ let UL, LL, UR, LR;
182
+ let normal = cartesian1;
183
+ let left = cartesian2;
184
+ let rightPos, leftPos;
185
+ const halfLength = endPositionLength / 2;
186
+ const indices = IndexDatatype_default.createTypedArray(size / 3, indicesLength);
187
+ let index = 0;
188
+ if (addEndPositions) {
189
+ leftPos = cartesian3;
190
+ rightPos = cartesian4;
191
+ const firstEndPositions = endPositions[0];
192
+ normal = Cartesian3_default.fromArray(computedNormals, 0, normal);
193
+ left = Cartesian3_default.fromArray(computedLefts, 0, left);
194
+ for (i = 0; i < halfLength; i++) {
195
+ leftPos = Cartesian3_default.fromArray(
196
+ firstEndPositions,
197
+ (halfLength - 1 - i) * 3,
198
+ leftPos
163
199
  );
164
- leftNormal = ellipsoid.geodeticSurfaceNormal(
165
- Matrix3.Cartesian3.fromArray(leftEdge, length - i, scratch2),
166
- scratch2
200
+ rightPos = Cartesian3_default.fromArray(
201
+ firstEndPositions,
202
+ (halfLength + i) * 3,
203
+ rightPos
167
204
  );
168
- normal = Matrix3.Cartesian3.normalize(
169
- Matrix3.Cartesian3.add(rightNormal, leftNormal, normal),
170
- normal
205
+ CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
206
+ CorridorGeometryLibrary_default.addAttribute(
207
+ finalPositions,
208
+ leftPos,
209
+ void 0,
210
+ back
171
211
  );
172
212
  addNormals(attr, normal, left, front, back, vertexFormat);
173
-
174
213
  LL = front / 3;
175
214
  LR = LL + 1;
176
215
  UL = (back - 2) / 3;
@@ -181,1227 +220,1044 @@ define(['./arrayRemoveDuplicates-d2061e85', './Transforms-b527bb09', './Matrix3-
181
220
  indices[index++] = UR;
182
221
  indices[index++] = LL;
183
222
  indices[index++] = LR;
184
-
185
223
  front += 3;
186
224
  back -= 3;
187
225
  }
188
-
226
+ }
227
+ let posIndex = 0;
228
+ let compIndex = 0;
229
+ let rightEdge = positions[posIndex++];
230
+ let leftEdge = positions[posIndex++];
231
+ finalPositions.set(rightEdge, front);
232
+ finalPositions.set(leftEdge, back - leftEdge.length + 1);
233
+ left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
234
+ let rightNormal;
235
+ let leftNormal;
236
+ length = leftEdge.length - 3;
237
+ for (i = 0; i < length; i += 3) {
189
238
  rightNormal = ellipsoid.geodeticSurfaceNormal(
190
- Matrix3.Cartesian3.fromArray(rightEdge, length, scratch1),
239
+ Cartesian3_default.fromArray(rightEdge, i, scratch1),
191
240
  scratch1
192
241
  );
193
242
  leftNormal = ellipsoid.geodeticSurfaceNormal(
194
- Matrix3.Cartesian3.fromArray(leftEdge, length, scratch2),
243
+ Cartesian3_default.fromArray(leftEdge, length - i, scratch2),
195
244
  scratch2
196
245
  );
197
- normal = Matrix3.Cartesian3.normalize(
198
- Matrix3.Cartesian3.add(rightNormal, leftNormal, normal),
246
+ normal = Cartesian3_default.normalize(
247
+ Cartesian3_default.add(rightNormal, leftNormal, normal),
199
248
  normal
200
249
  );
201
- compIndex += 3;
202
- for (i = 0; i < corners.length; i++) {
203
- let j;
204
- corner = corners[i];
205
- const l = corner.leftPositions;
206
- const r = corner.rightPositions;
207
- let pivot;
208
- let start;
209
- let outsidePoint = cartesian6;
210
- let previousPoint = cartesian3;
211
- let nextPoint = cartesian4;
212
- normal = Matrix3.Cartesian3.fromArray(computedNormals, compIndex, normal);
213
- if (defaultValue.defined(l)) {
214
- addNormals(attr, normal, left, undefined, back, vertexFormat);
215
- back -= 3;
216
- pivot = LR;
217
- start = UR;
218
- for (j = 0; j < l.length / 3; j++) {
219
- outsidePoint = Matrix3.Cartesian3.fromArray(l, j * 3, outsidePoint);
220
- indices[index++] = pivot;
221
- indices[index++] = start - j - 1;
222
- indices[index++] = start - j;
223
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
224
- finalPositions,
225
- outsidePoint,
226
- undefined,
227
- back
228
- );
229
- previousPoint = Matrix3.Cartesian3.fromArray(
230
- finalPositions,
231
- (start - j - 1) * 3,
232
- previousPoint
233
- );
234
- nextPoint = Matrix3.Cartesian3.fromArray(finalPositions, pivot * 3, nextPoint);
235
- left = Matrix3.Cartesian3.normalize(
236
- Matrix3.Cartesian3.subtract(previousPoint, nextPoint, left),
237
- left
238
- );
239
- addNormals(attr, normal, left, undefined, back, vertexFormat);
240
- back -= 3;
241
- }
242
- outsidePoint = Matrix3.Cartesian3.fromArray(
250
+ addNormals(attr, normal, left, front, back, vertexFormat);
251
+ LL = front / 3;
252
+ LR = LL + 1;
253
+ UL = (back - 2) / 3;
254
+ UR = UL - 1;
255
+ indices[index++] = UL;
256
+ indices[index++] = LL;
257
+ indices[index++] = UR;
258
+ indices[index++] = UR;
259
+ indices[index++] = LL;
260
+ indices[index++] = LR;
261
+ front += 3;
262
+ back -= 3;
263
+ }
264
+ rightNormal = ellipsoid.geodeticSurfaceNormal(
265
+ Cartesian3_default.fromArray(rightEdge, length, scratch1),
266
+ scratch1
267
+ );
268
+ leftNormal = ellipsoid.geodeticSurfaceNormal(
269
+ Cartesian3_default.fromArray(leftEdge, length, scratch2),
270
+ scratch2
271
+ );
272
+ normal = Cartesian3_default.normalize(
273
+ Cartesian3_default.add(rightNormal, leftNormal, normal),
274
+ normal
275
+ );
276
+ compIndex += 3;
277
+ for (i = 0; i < corners.length; i++) {
278
+ let j;
279
+ corner = corners[i];
280
+ const l = corner.leftPositions;
281
+ const r = corner.rightPositions;
282
+ let pivot;
283
+ let start;
284
+ let outsidePoint = cartesian6;
285
+ let previousPoint = cartesian3;
286
+ let nextPoint = cartesian4;
287
+ normal = Cartesian3_default.fromArray(computedNormals, compIndex, normal);
288
+ if (defined_default(l)) {
289
+ addNormals(attr, normal, left, void 0, back, vertexFormat);
290
+ back -= 3;
291
+ pivot = LR;
292
+ start = UR;
293
+ for (j = 0; j < l.length / 3; j++) {
294
+ outsidePoint = Cartesian3_default.fromArray(l, j * 3, outsidePoint);
295
+ indices[index++] = pivot;
296
+ indices[index++] = start - j - 1;
297
+ indices[index++] = start - j;
298
+ CorridorGeometryLibrary_default.addAttribute(
243
299
  finalPositions,
244
- pivot * 3,
245
- outsidePoint
246
- );
247
- previousPoint = Matrix3.Cartesian3.subtract(
248
- Matrix3.Cartesian3.fromArray(finalPositions, start * 3, previousPoint),
249
300
  outsidePoint,
250
- previousPoint
301
+ void 0,
302
+ back
251
303
  );
252
- nextPoint = Matrix3.Cartesian3.subtract(
253
- Matrix3.Cartesian3.fromArray(finalPositions, (start - j) * 3, nextPoint),
254
- outsidePoint,
255
- nextPoint
304
+ previousPoint = Cartesian3_default.fromArray(
305
+ finalPositions,
306
+ (start - j - 1) * 3,
307
+ previousPoint
256
308
  );
257
- left = Matrix3.Cartesian3.normalize(
258
- Matrix3.Cartesian3.add(previousPoint, nextPoint, left),
309
+ nextPoint = Cartesian3_default.fromArray(finalPositions, pivot * 3, nextPoint);
310
+ left = Cartesian3_default.normalize(
311
+ Cartesian3_default.subtract(previousPoint, nextPoint, left),
259
312
  left
260
313
  );
261
- addNormals(attr, normal, left, front, undefined, vertexFormat);
262
- front += 3;
263
- } else {
264
- addNormals(attr, normal, left, front, undefined, vertexFormat);
265
- front += 3;
266
- pivot = UR;
267
- start = LR;
268
- for (j = 0; j < r.length / 3; j++) {
269
- outsidePoint = Matrix3.Cartesian3.fromArray(r, j * 3, outsidePoint);
270
- indices[index++] = pivot;
271
- indices[index++] = start + j;
272
- indices[index++] = start + j + 1;
273
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
274
- finalPositions,
275
- outsidePoint,
276
- front
277
- );
278
- previousPoint = Matrix3.Cartesian3.fromArray(
279
- finalPositions,
280
- pivot * 3,
281
- previousPoint
282
- );
283
- nextPoint = Matrix3.Cartesian3.fromArray(
284
- finalPositions,
285
- (start + j) * 3,
286
- nextPoint
287
- );
288
- left = Matrix3.Cartesian3.normalize(
289
- Matrix3.Cartesian3.subtract(previousPoint, nextPoint, left),
290
- left
291
- );
292
- addNormals(attr, normal, left, front, undefined, vertexFormat);
293
- front += 3;
294
- }
295
- outsidePoint = Matrix3.Cartesian3.fromArray(
314
+ addNormals(attr, normal, left, void 0, back, vertexFormat);
315
+ back -= 3;
316
+ }
317
+ outsidePoint = Cartesian3_default.fromArray(
318
+ finalPositions,
319
+ pivot * 3,
320
+ outsidePoint
321
+ );
322
+ previousPoint = Cartesian3_default.subtract(
323
+ Cartesian3_default.fromArray(finalPositions, start * 3, previousPoint),
324
+ outsidePoint,
325
+ previousPoint
326
+ );
327
+ nextPoint = Cartesian3_default.subtract(
328
+ Cartesian3_default.fromArray(finalPositions, (start - j) * 3, nextPoint),
329
+ outsidePoint,
330
+ nextPoint
331
+ );
332
+ left = Cartesian3_default.normalize(
333
+ Cartesian3_default.add(previousPoint, nextPoint, left),
334
+ left
335
+ );
336
+ addNormals(attr, normal, left, front, void 0, vertexFormat);
337
+ front += 3;
338
+ } else {
339
+ addNormals(attr, normal, left, front, void 0, vertexFormat);
340
+ front += 3;
341
+ pivot = UR;
342
+ start = LR;
343
+ for (j = 0; j < r.length / 3; j++) {
344
+ outsidePoint = Cartesian3_default.fromArray(r, j * 3, outsidePoint);
345
+ indices[index++] = pivot;
346
+ indices[index++] = start + j;
347
+ indices[index++] = start + j + 1;
348
+ CorridorGeometryLibrary_default.addAttribute(
296
349
  finalPositions,
297
- pivot * 3,
298
- outsidePoint
299
- );
300
- previousPoint = Matrix3.Cartesian3.subtract(
301
- Matrix3.Cartesian3.fromArray(finalPositions, (start + j) * 3, previousPoint),
302
350
  outsidePoint,
351
+ front
352
+ );
353
+ previousPoint = Cartesian3_default.fromArray(
354
+ finalPositions,
355
+ pivot * 3,
303
356
  previousPoint
304
357
  );
305
- nextPoint = Matrix3.Cartesian3.subtract(
306
- Matrix3.Cartesian3.fromArray(finalPositions, start * 3, nextPoint),
307
- outsidePoint,
358
+ nextPoint = Cartesian3_default.fromArray(
359
+ finalPositions,
360
+ (start + j) * 3,
308
361
  nextPoint
309
362
  );
310
- left = Matrix3.Cartesian3.normalize(
311
- Matrix3.Cartesian3.negate(Matrix3.Cartesian3.add(nextPoint, previousPoint, left), left),
363
+ left = Cartesian3_default.normalize(
364
+ Cartesian3_default.subtract(previousPoint, nextPoint, left),
312
365
  left
313
366
  );
314
- addNormals(attr, normal, left, undefined, back, vertexFormat);
315
- back -= 3;
316
- }
317
- rightEdge = positions[posIndex++];
318
- leftEdge = positions[posIndex++];
319
- rightEdge.splice(0, 3); //remove duplicate points added by corner
320
- leftEdge.splice(leftEdge.length - 3, 3);
321
- finalPositions.set(rightEdge, front);
322
- finalPositions.set(leftEdge, back - leftEdge.length + 1);
323
- length = leftEdge.length - 3;
324
-
325
- compIndex += 3;
326
- left = Matrix3.Cartesian3.fromArray(computedLefts, compIndex, left);
327
- for (j = 0; j < leftEdge.length; j += 3) {
328
- rightNormal = ellipsoid.geodeticSurfaceNormal(
329
- Matrix3.Cartesian3.fromArray(rightEdge, j, scratch1),
330
- scratch1
331
- );
332
- leftNormal = ellipsoid.geodeticSurfaceNormal(
333
- Matrix3.Cartesian3.fromArray(leftEdge, length - j, scratch2),
334
- scratch2
335
- );
336
- normal = Matrix3.Cartesian3.normalize(
337
- Matrix3.Cartesian3.add(rightNormal, leftNormal, normal),
338
- normal
339
- );
340
- addNormals(attr, normal, left, front, back, vertexFormat);
341
-
342
- LR = front / 3;
343
- LL = LR - 1;
344
- UR = (back - 2) / 3;
345
- UL = UR + 1;
346
- indices[index++] = UL;
347
- indices[index++] = LL;
348
- indices[index++] = UR;
349
- indices[index++] = UR;
350
- indices[index++] = LL;
351
- indices[index++] = LR;
352
-
367
+ addNormals(attr, normal, left, front, void 0, vertexFormat);
353
368
  front += 3;
354
- back -= 3;
355
369
  }
356
- front -= 3;
357
- back += 3;
370
+ outsidePoint = Cartesian3_default.fromArray(
371
+ finalPositions,
372
+ pivot * 3,
373
+ outsidePoint
374
+ );
375
+ previousPoint = Cartesian3_default.subtract(
376
+ Cartesian3_default.fromArray(finalPositions, (start + j) * 3, previousPoint),
377
+ outsidePoint,
378
+ previousPoint
379
+ );
380
+ nextPoint = Cartesian3_default.subtract(
381
+ Cartesian3_default.fromArray(finalPositions, start * 3, nextPoint),
382
+ outsidePoint,
383
+ nextPoint
384
+ );
385
+ left = Cartesian3_default.normalize(
386
+ Cartesian3_default.negate(Cartesian3_default.add(nextPoint, previousPoint, left), left),
387
+ left
388
+ );
389
+ addNormals(attr, normal, left, void 0, back, vertexFormat);
390
+ back -= 3;
358
391
  }
359
- normal = Matrix3.Cartesian3.fromArray(
360
- computedNormals,
361
- computedNormals.length - 3,
362
- normal
363
- );
364
- addNormals(attr, normal, left, front, back, vertexFormat);
365
-
366
- if (addEndPositions) {
367
- // add rounded end
392
+ rightEdge = positions[posIndex++];
393
+ leftEdge = positions[posIndex++];
394
+ rightEdge.splice(0, 3);
395
+ leftEdge.splice(leftEdge.length - 3, 3);
396
+ finalPositions.set(rightEdge, front);
397
+ finalPositions.set(leftEdge, back - leftEdge.length + 1);
398
+ length = leftEdge.length - 3;
399
+ compIndex += 3;
400
+ left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
401
+ for (j = 0; j < leftEdge.length; j += 3) {
402
+ rightNormal = ellipsoid.geodeticSurfaceNormal(
403
+ Cartesian3_default.fromArray(rightEdge, j, scratch1),
404
+ scratch1
405
+ );
406
+ leftNormal = ellipsoid.geodeticSurfaceNormal(
407
+ Cartesian3_default.fromArray(leftEdge, length - j, scratch2),
408
+ scratch2
409
+ );
410
+ normal = Cartesian3_default.normalize(
411
+ Cartesian3_default.add(rightNormal, leftNormal, normal),
412
+ normal
413
+ );
414
+ addNormals(attr, normal, left, front, back, vertexFormat);
415
+ LR = front / 3;
416
+ LL = LR - 1;
417
+ UR = (back - 2) / 3;
418
+ UL = UR + 1;
419
+ indices[index++] = UL;
420
+ indices[index++] = LL;
421
+ indices[index++] = UR;
422
+ indices[index++] = UR;
423
+ indices[index++] = LL;
424
+ indices[index++] = LR;
368
425
  front += 3;
369
426
  back -= 3;
370
- leftPos = cartesian3;
371
- rightPos = cartesian4;
372
- const lastEndPositions = endPositions[1];
373
- for (i = 0; i < halfLength; i++) {
374
- leftPos = Matrix3.Cartesian3.fromArray(
375
- lastEndPositions,
376
- (endPositionLength - i - 1) * 3,
377
- leftPos
378
- );
379
- rightPos = Matrix3.Cartesian3.fromArray(lastEndPositions, i * 3, rightPos);
380
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
381
- finalPositions,
382
- leftPos,
383
- undefined,
384
- back
385
- );
386
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(finalPositions, rightPos, front);
387
- addNormals(attr, normal, left, front, back, vertexFormat);
388
-
389
- LR = front / 3;
390
- LL = LR - 1;
391
- UR = (back - 2) / 3;
392
- UL = UR + 1;
393
- indices[index++] = UL;
394
- indices[index++] = LL;
395
- indices[index++] = UR;
396
- indices[index++] = UR;
397
- indices[index++] = LL;
398
- indices[index++] = LR;
399
-
400
- front += 3;
401
- back -= 3;
427
+ }
428
+ front -= 3;
429
+ back += 3;
430
+ }
431
+ normal = Cartesian3_default.fromArray(
432
+ computedNormals,
433
+ computedNormals.length - 3,
434
+ normal
435
+ );
436
+ addNormals(attr, normal, left, front, back, vertexFormat);
437
+ if (addEndPositions) {
438
+ front += 3;
439
+ back -= 3;
440
+ leftPos = cartesian3;
441
+ rightPos = cartesian4;
442
+ const lastEndPositions = endPositions[1];
443
+ for (i = 0; i < halfLength; i++) {
444
+ leftPos = Cartesian3_default.fromArray(
445
+ lastEndPositions,
446
+ (endPositionLength - i - 1) * 3,
447
+ leftPos
448
+ );
449
+ rightPos = Cartesian3_default.fromArray(lastEndPositions, i * 3, rightPos);
450
+ CorridorGeometryLibrary_default.addAttribute(
451
+ finalPositions,
452
+ leftPos,
453
+ void 0,
454
+ back
455
+ );
456
+ CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
457
+ addNormals(attr, normal, left, front, back, vertexFormat);
458
+ LR = front / 3;
459
+ LL = LR - 1;
460
+ UR = (back - 2) / 3;
461
+ UL = UR + 1;
462
+ indices[index++] = UL;
463
+ indices[index++] = LL;
464
+ indices[index++] = UR;
465
+ indices[index++] = UR;
466
+ indices[index++] = LL;
467
+ indices[index++] = LR;
468
+ front += 3;
469
+ back -= 3;
470
+ }
471
+ }
472
+ attributes.position = new GeometryAttribute_default({
473
+ componentDatatype: ComponentDatatype_default.DOUBLE,
474
+ componentsPerAttribute: 3,
475
+ values: finalPositions
476
+ });
477
+ if (vertexFormat.st) {
478
+ const st = new Float32Array(size / 3 * 2);
479
+ let rightSt;
480
+ let leftSt;
481
+ let stIndex = 0;
482
+ if (addEndPositions) {
483
+ leftCount /= 3;
484
+ rightCount /= 3;
485
+ const theta = Math.PI / (endPositionLength + 1);
486
+ leftSt = 1 / (leftCount - endPositionLength + 1);
487
+ rightSt = 1 / (rightCount - endPositionLength + 1);
488
+ let a;
489
+ const halfEndPos = endPositionLength / 2;
490
+ for (i = halfEndPos + 1; i < endPositionLength + 1; i++) {
491
+ a = Math_default.PI_OVER_TWO + theta * i;
492
+ st[stIndex++] = rightSt * (1 + Math.cos(a));
493
+ st[stIndex++] = 0.5 * (1 + Math.sin(a));
494
+ }
495
+ for (i = 1; i < rightCount - endPositionLength + 1; i++) {
496
+ st[stIndex++] = i * rightSt;
497
+ st[stIndex++] = 0;
498
+ }
499
+ for (i = endPositionLength; i > halfEndPos; i--) {
500
+ a = Math_default.PI_OVER_TWO - i * theta;
501
+ st[stIndex++] = 1 - rightSt * (1 + Math.cos(a));
502
+ st[stIndex++] = 0.5 * (1 + Math.sin(a));
503
+ }
504
+ for (i = halfEndPos; i > 0; i--) {
505
+ a = Math_default.PI_OVER_TWO - theta * i;
506
+ st[stIndex++] = 1 - leftSt * (1 + Math.cos(a));
507
+ st[stIndex++] = 0.5 * (1 + Math.sin(a));
508
+ }
509
+ for (i = leftCount - endPositionLength; i > 0; i--) {
510
+ st[stIndex++] = i * leftSt;
511
+ st[stIndex++] = 1;
512
+ }
513
+ for (i = 1; i < halfEndPos + 1; i++) {
514
+ a = Math_default.PI_OVER_TWO + theta * i;
515
+ st[stIndex++] = leftSt * (1 + Math.cos(a));
516
+ st[stIndex++] = 0.5 * (1 + Math.sin(a));
517
+ }
518
+ } else {
519
+ leftCount /= 3;
520
+ rightCount /= 3;
521
+ leftSt = 1 / (leftCount - 1);
522
+ rightSt = 1 / (rightCount - 1);
523
+ for (i = 0; i < rightCount; i++) {
524
+ st[stIndex++] = i * rightSt;
525
+ st[stIndex++] = 0;
526
+ }
527
+ for (i = leftCount; i > 0; i--) {
528
+ st[stIndex++] = (i - 1) * leftSt;
529
+ st[stIndex++] = 1;
402
530
  }
403
531
  }
404
-
405
- attributes.position = new GeometryAttribute.GeometryAttribute({
406
- componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
532
+ attributes.st = new GeometryAttribute_default({
533
+ componentDatatype: ComponentDatatype_default.FLOAT,
534
+ componentsPerAttribute: 2,
535
+ values: st
536
+ });
537
+ }
538
+ if (vertexFormat.normal) {
539
+ attributes.normal = new GeometryAttribute_default({
540
+ componentDatatype: ComponentDatatype_default.FLOAT,
407
541
  componentsPerAttribute: 3,
408
- values: finalPositions,
542
+ values: attr.normals
409
543
  });
410
-
411
- if (vertexFormat.st) {
412
- const st = new Float32Array((size / 3) * 2);
413
- let rightSt;
414
- let leftSt;
415
- let stIndex = 0;
416
- if (addEndPositions) {
417
- leftCount /= 3;
418
- rightCount /= 3;
419
- const theta = Math.PI / (endPositionLength + 1);
420
- leftSt = 1 / (leftCount - endPositionLength + 1);
421
- rightSt = 1 / (rightCount - endPositionLength + 1);
422
- let a;
423
- const halfEndPos = endPositionLength / 2;
424
- for (i = halfEndPos + 1; i < endPositionLength + 1; i++) {
425
- // lower left rounded end
426
- a = Math$1.CesiumMath.PI_OVER_TWO + theta * i;
427
- st[stIndex++] = rightSt * (1 + Math.cos(a));
428
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
429
- }
430
- for (i = 1; i < rightCount - endPositionLength + 1; i++) {
431
- // bottom edge
432
- st[stIndex++] = i * rightSt;
433
- st[stIndex++] = 0;
434
- }
435
- for (i = endPositionLength; i > halfEndPos; i--) {
436
- // lower right rounded end
437
- a = Math$1.CesiumMath.PI_OVER_TWO - i * theta;
438
- st[stIndex++] = 1 - rightSt * (1 + Math.cos(a));
439
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
440
- }
441
- for (i = halfEndPos; i > 0; i--) {
442
- // upper right rounded end
443
- a = Math$1.CesiumMath.PI_OVER_TWO - theta * i;
444
- st[stIndex++] = 1 - leftSt * (1 + Math.cos(a));
445
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
446
- }
447
- for (i = leftCount - endPositionLength; i > 0; i--) {
448
- // top edge
449
- st[stIndex++] = i * leftSt;
450
- st[stIndex++] = 1;
451
- }
452
- for (i = 1; i < halfEndPos + 1; i++) {
453
- // upper left rounded end
454
- a = Math$1.CesiumMath.PI_OVER_TWO + theta * i;
455
- st[stIndex++] = leftSt * (1 + Math.cos(a));
456
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
457
- }
458
- } else {
459
- leftCount /= 3;
460
- rightCount /= 3;
461
- leftSt = 1 / (leftCount - 1);
462
- rightSt = 1 / (rightCount - 1);
463
- for (i = 0; i < rightCount; i++) {
464
- // bottom edge
465
- st[stIndex++] = i * rightSt;
466
- st[stIndex++] = 0;
467
- }
468
- for (i = leftCount; i > 0; i--) {
469
- // top edge
470
- st[stIndex++] = (i - 1) * leftSt;
471
- st[stIndex++] = 1;
472
- }
473
- }
474
-
475
- attributes.st = new GeometryAttribute.GeometryAttribute({
476
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
477
- componentsPerAttribute: 2,
478
- values: st,
479
- });
480
- }
481
-
482
- if (vertexFormat.normal) {
483
- attributes.normal = new GeometryAttribute.GeometryAttribute({
484
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
485
- componentsPerAttribute: 3,
486
- values: attr.normals,
487
- });
488
- }
489
-
490
- if (vertexFormat.tangent) {
491
- attributes.tangent = new GeometryAttribute.GeometryAttribute({
492
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
493
- componentsPerAttribute: 3,
494
- values: attr.tangents,
495
- });
496
- }
497
-
498
- if (vertexFormat.bitangent) {
499
- attributes.bitangent = new GeometryAttribute.GeometryAttribute({
500
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
501
- componentsPerAttribute: 3,
502
- values: attr.bitangents,
503
- });
504
- }
505
-
506
- return {
507
- attributes: attributes,
508
- indices: indices,
509
- };
510
544
  }
511
-
512
- function extrudedAttributes(attributes, vertexFormat) {
513
- if (
514
- !vertexFormat.normal &&
515
- !vertexFormat.tangent &&
516
- !vertexFormat.bitangent &&
517
- !vertexFormat.st
518
- ) {
519
- return attributes;
520
- }
521
- const positions = attributes.position.values;
522
- let topNormals;
523
- let topBitangents;
524
- if (vertexFormat.normal || vertexFormat.bitangent) {
525
- topNormals = attributes.normal.values;
526
- topBitangents = attributes.bitangent.values;
527
- }
528
- const size = attributes.position.values.length / 18;
529
- const threeSize = size * 3;
530
- const twoSize = size * 2;
531
- const sixSize = threeSize * 2;
532
- let i;
533
- if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
534
- const normals = vertexFormat.normal
535
- ? new Float32Array(threeSize * 6)
536
- : undefined;
537
- const tangents = vertexFormat.tangent
538
- ? new Float32Array(threeSize * 6)
539
- : undefined;
540
- const bitangents = vertexFormat.bitangent
541
- ? new Float32Array(threeSize * 6)
542
- : undefined;
543
- let topPosition = cartesian1;
544
- let bottomPosition = cartesian2;
545
- let previousPosition = cartesian3;
546
- let normal = cartesian4;
547
- let tangent = cartesian5;
548
- let bitangent = cartesian6;
549
- let attrIndex = sixSize;
550
- for (i = 0; i < threeSize; i += 3) {
551
- const attrIndexOffset = attrIndex + sixSize;
552
- topPosition = Matrix3.Cartesian3.fromArray(positions, i, topPosition);
553
- bottomPosition = Matrix3.Cartesian3.fromArray(
554
- positions,
555
- i + threeSize,
556
- bottomPosition
557
- );
558
- previousPosition = Matrix3.Cartesian3.fromArray(
559
- positions,
560
- (i + 3) % threeSize,
561
- previousPosition
562
- );
563
- bottomPosition = Matrix3.Cartesian3.subtract(
564
- bottomPosition,
565
- topPosition,
566
- bottomPosition
567
- );
568
- previousPosition = Matrix3.Cartesian3.subtract(
569
- previousPosition,
570
- topPosition,
571
- previousPosition
572
- );
573
- normal = Matrix3.Cartesian3.normalize(
574
- Matrix3.Cartesian3.cross(bottomPosition, previousPosition, normal),
575
- normal
545
+ if (vertexFormat.tangent) {
546
+ attributes.tangent = new GeometryAttribute_default({
547
+ componentDatatype: ComponentDatatype_default.FLOAT,
548
+ componentsPerAttribute: 3,
549
+ values: attr.tangents
550
+ });
551
+ }
552
+ if (vertexFormat.bitangent) {
553
+ attributes.bitangent = new GeometryAttribute_default({
554
+ componentDatatype: ComponentDatatype_default.FLOAT,
555
+ componentsPerAttribute: 3,
556
+ values: attr.bitangents
557
+ });
558
+ }
559
+ return {
560
+ attributes,
561
+ indices
562
+ };
563
+ }
564
+ function extrudedAttributes(attributes, vertexFormat) {
565
+ if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
566
+ return attributes;
567
+ }
568
+ const positions = attributes.position.values;
569
+ let topNormals;
570
+ let topBitangents;
571
+ if (vertexFormat.normal || vertexFormat.bitangent) {
572
+ topNormals = attributes.normal.values;
573
+ topBitangents = attributes.bitangent.values;
574
+ }
575
+ const size = attributes.position.values.length / 18;
576
+ const threeSize = size * 3;
577
+ const twoSize = size * 2;
578
+ const sixSize = threeSize * 2;
579
+ let i;
580
+ if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
581
+ const normals = vertexFormat.normal ? new Float32Array(threeSize * 6) : void 0;
582
+ const tangents = vertexFormat.tangent ? new Float32Array(threeSize * 6) : void 0;
583
+ const bitangents = vertexFormat.bitangent ? new Float32Array(threeSize * 6) : void 0;
584
+ let topPosition = cartesian1;
585
+ let bottomPosition = cartesian2;
586
+ let previousPosition = cartesian3;
587
+ let normal = cartesian4;
588
+ let tangent = cartesian5;
589
+ let bitangent = cartesian6;
590
+ let attrIndex = sixSize;
591
+ for (i = 0; i < threeSize; i += 3) {
592
+ const attrIndexOffset = attrIndex + sixSize;
593
+ topPosition = Cartesian3_default.fromArray(positions, i, topPosition);
594
+ bottomPosition = Cartesian3_default.fromArray(
595
+ positions,
596
+ i + threeSize,
597
+ bottomPosition
598
+ );
599
+ previousPosition = Cartesian3_default.fromArray(
600
+ positions,
601
+ (i + 3) % threeSize,
602
+ previousPosition
603
+ );
604
+ bottomPosition = Cartesian3_default.subtract(
605
+ bottomPosition,
606
+ topPosition,
607
+ bottomPosition
608
+ );
609
+ previousPosition = Cartesian3_default.subtract(
610
+ previousPosition,
611
+ topPosition,
612
+ previousPosition
613
+ );
614
+ normal = Cartesian3_default.normalize(
615
+ Cartesian3_default.cross(bottomPosition, previousPosition, normal),
616
+ normal
617
+ );
618
+ if (vertexFormat.normal) {
619
+ CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndexOffset);
620
+ CorridorGeometryLibrary_default.addAttribute(
621
+ normals,
622
+ normal,
623
+ attrIndexOffset + 3
576
624
  );
577
- if (vertexFormat.normal) {
578
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(normals, normal, attrIndexOffset);
579
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
580
- normals,
581
- normal,
625
+ CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex);
626
+ CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex + 3);
627
+ }
628
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
629
+ bitangent = Cartesian3_default.fromArray(topNormals, i, bitangent);
630
+ if (vertexFormat.bitangent) {
631
+ CorridorGeometryLibrary_default.addAttribute(
632
+ bitangents,
633
+ bitangent,
634
+ attrIndexOffset
635
+ );
636
+ CorridorGeometryLibrary_default.addAttribute(
637
+ bitangents,
638
+ bitangent,
582
639
  attrIndexOffset + 3
583
640
  );
584
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(normals, normal, attrIndex);
585
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(normals, normal, attrIndex + 3);
586
- }
587
- if (vertexFormat.tangent || vertexFormat.bitangent) {
588
- bitangent = Matrix3.Cartesian3.fromArray(topNormals, i, bitangent);
589
- if (vertexFormat.bitangent) {
590
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
591
- bitangents,
592
- bitangent,
593
- attrIndexOffset
594
- );
595
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
596
- bitangents,
597
- bitangent,
598
- attrIndexOffset + 3
599
- );
600
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
601
- bitangents,
602
- bitangent,
603
- attrIndex
604
- );
605
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
606
- bitangents,
607
- bitangent,
608
- attrIndex + 3
609
- );
610
- }
611
-
612
- if (vertexFormat.tangent) {
613
- tangent = Matrix3.Cartesian3.normalize(
614
- Matrix3.Cartesian3.cross(bitangent, normal, tangent),
615
- tangent
616
- );
617
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
618
- tangents,
619
- tangent,
620
- attrIndexOffset
621
- );
622
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
623
- tangents,
624
- tangent,
625
- attrIndexOffset + 3
626
- );
627
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(tangents, tangent, attrIndex);
628
- CorridorGeometryLibrary.CorridorGeometryLibrary.addAttribute(
629
- tangents,
630
- tangent,
631
- attrIndex + 3
632
- );
633
- }
641
+ CorridorGeometryLibrary_default.addAttribute(
642
+ bitangents,
643
+ bitangent,
644
+ attrIndex
645
+ );
646
+ CorridorGeometryLibrary_default.addAttribute(
647
+ bitangents,
648
+ bitangent,
649
+ attrIndex + 3
650
+ );
634
651
  }
635
- attrIndex += 6;
636
- }
637
-
638
- if (vertexFormat.normal) {
639
- normals.set(topNormals); //top
640
- for (i = 0; i < threeSize; i += 3) {
641
- //bottom normals
642
- normals[i + threeSize] = -topNormals[i];
643
- normals[i + threeSize + 1] = -topNormals[i + 1];
644
- normals[i + threeSize + 2] = -topNormals[i + 2];
652
+ if (vertexFormat.tangent) {
653
+ tangent = Cartesian3_default.normalize(
654
+ Cartesian3_default.cross(bitangent, normal, tangent),
655
+ tangent
656
+ );
657
+ CorridorGeometryLibrary_default.addAttribute(
658
+ tangents,
659
+ tangent,
660
+ attrIndexOffset
661
+ );
662
+ CorridorGeometryLibrary_default.addAttribute(
663
+ tangents,
664
+ tangent,
665
+ attrIndexOffset + 3
666
+ );
667
+ CorridorGeometryLibrary_default.addAttribute(tangents, tangent, attrIndex);
668
+ CorridorGeometryLibrary_default.addAttribute(
669
+ tangents,
670
+ tangent,
671
+ attrIndex + 3
672
+ );
645
673
  }
646
- attributes.normal.values = normals;
647
- } else {
648
- attributes.normal = undefined;
649
- }
650
-
651
- if (vertexFormat.bitangent) {
652
- bitangents.set(topBitangents); //top
653
- bitangents.set(topBitangents, threeSize); //bottom
654
- attributes.bitangent.values = bitangents;
655
- } else {
656
- attributes.bitangent = undefined;
657
- }
658
-
659
- if (vertexFormat.tangent) {
660
- const topTangents = attributes.tangent.values;
661
- tangents.set(topTangents); //top
662
- tangents.set(topTangents, threeSize); //bottom
663
- attributes.tangent.values = tangents;
664
674
  }
675
+ attrIndex += 6;
665
676
  }
666
- if (vertexFormat.st) {
667
- const topSt = attributes.st.values;
668
- const st = new Float32Array(twoSize * 6);
669
- st.set(topSt); //top
670
- st.set(topSt, twoSize); //bottom
671
- let index = twoSize * 2;
672
-
673
- for (let j = 0; j < 2; j++) {
674
- st[index++] = topSt[0];
675
- st[index++] = topSt[1];
676
- for (i = 2; i < twoSize; i += 2) {
677
- const s = topSt[i];
678
- const t = topSt[i + 1];
679
- st[index++] = s;
680
- st[index++] = t;
681
- st[index++] = s;
682
- st[index++] = t;
683
- }
684
- st[index++] = topSt[0];
685
- st[index++] = topSt[1];
677
+ if (vertexFormat.normal) {
678
+ normals.set(topNormals);
679
+ for (i = 0; i < threeSize; i += 3) {
680
+ normals[i + threeSize] = -topNormals[i];
681
+ normals[i + threeSize + 1] = -topNormals[i + 1];
682
+ normals[i + threeSize + 2] = -topNormals[i + 2];
686
683
  }
687
- attributes.st.values = st;
684
+ attributes.normal.values = normals;
685
+ } else {
686
+ attributes.normal = void 0;
688
687
  }
689
-
690
- return attributes;
691
- }
692
-
693
- function addWallPositions(positions, index, wallPositions) {
694
- wallPositions[index++] = positions[0];
695
- wallPositions[index++] = positions[1];
696
- wallPositions[index++] = positions[2];
697
- for (let i = 3; i < positions.length; i += 3) {
698
- const x = positions[i];
699
- const y = positions[i + 1];
700
- const z = positions[i + 2];
701
- wallPositions[index++] = x;
702
- wallPositions[index++] = y;
703
- wallPositions[index++] = z;
704
- wallPositions[index++] = x;
705
- wallPositions[index++] = y;
706
- wallPositions[index++] = z;
688
+ if (vertexFormat.bitangent) {
689
+ bitangents.set(topBitangents);
690
+ bitangents.set(topBitangents, threeSize);
691
+ attributes.bitangent.values = bitangents;
692
+ } else {
693
+ attributes.bitangent = void 0;
694
+ }
695
+ if (vertexFormat.tangent) {
696
+ const topTangents = attributes.tangent.values;
697
+ tangents.set(topTangents);
698
+ tangents.set(topTangents, threeSize);
699
+ attributes.tangent.values = tangents;
707
700
  }
708
- wallPositions[index++] = positions[0];
709
- wallPositions[index++] = positions[1];
710
- wallPositions[index++] = positions[2];
711
-
712
- return wallPositions;
713
701
  }
714
-
715
- function computePositionsExtruded(params, vertexFormat) {
716
- const topVertexFormat = new VertexFormat.VertexFormat({
717
- position: vertexFormat.position,
718
- normal:
719
- vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
720
- tangent: vertexFormat.tangent,
721
- bitangent: vertexFormat.normal || vertexFormat.bitangent,
722
- st: vertexFormat.st,
723
- });
724
- const ellipsoid = params.ellipsoid;
725
- const computedPositions = CorridorGeometryLibrary.CorridorGeometryLibrary.computePositions(params);
726
- const attr = combine(computedPositions, topVertexFormat, ellipsoid);
727
- const height = params.height;
728
- const extrudedHeight = params.extrudedHeight;
729
- let attributes = attr.attributes;
730
- const indices = attr.indices;
731
- let positions = attributes.position.values;
732
- let length = positions.length;
733
- const newPositions = new Float64Array(length * 6);
734
- let extrudedPositions = new Float64Array(length);
735
- extrudedPositions.set(positions);
736
- let wallPositions = new Float64Array(length * 4);
737
-
738
- positions = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
739
- positions,
740
- height,
741
- ellipsoid
742
- );
743
- wallPositions = addWallPositions(positions, 0, wallPositions);
744
- extrudedPositions = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
745
- extrudedPositions,
746
- extrudedHeight,
747
- ellipsoid
748
- );
749
- wallPositions = addWallPositions(
750
- extrudedPositions,
751
- length * 2,
752
- wallPositions
753
- );
754
- newPositions.set(positions);
755
- newPositions.set(extrudedPositions, length);
756
- newPositions.set(wallPositions, length * 2);
757
- attributes.position.values = newPositions;
758
-
759
- attributes = extrudedAttributes(attributes, vertexFormat);
760
- let i;
761
- const size = length / 3;
762
- if (params.shadowVolume) {
763
- const topNormals = attributes.normal.values;
764
- length = topNormals.length;
765
-
766
- let extrudeNormals = new Float32Array(length * 6);
767
- for (i = 0; i < length; i++) {
768
- topNormals[i] = -topNormals[i];
769
- }
770
- //only get normals for bottom layer that's going to be pushed down
771
- extrudeNormals.set(topNormals, length); //bottom face
772
- extrudeNormals = addWallPositions(topNormals, length * 4, extrudeNormals); //bottom wall
773
- attributes.extrudeDirection = new GeometryAttribute.GeometryAttribute({
774
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
775
- componentsPerAttribute: 3,
776
- values: extrudeNormals,
777
- });
778
- if (!vertexFormat.normal) {
779
- attributes.normal = undefined;
702
+ if (vertexFormat.st) {
703
+ const topSt = attributes.st.values;
704
+ const st = new Float32Array(twoSize * 6);
705
+ st.set(topSt);
706
+ st.set(topSt, twoSize);
707
+ let index = twoSize * 2;
708
+ for (let j = 0; j < 2; j++) {
709
+ st[index++] = topSt[0];
710
+ st[index++] = topSt[1];
711
+ for (i = 2; i < twoSize; i += 2) {
712
+ const s = topSt[i];
713
+ const t = topSt[i + 1];
714
+ st[index++] = s;
715
+ st[index++] = t;
716
+ st[index++] = s;
717
+ st[index++] = t;
780
718
  }
719
+ st[index++] = topSt[0];
720
+ st[index++] = topSt[1];
781
721
  }
782
- if (defaultValue.defined(params.offsetAttribute)) {
783
- let applyOffset = new Uint8Array(size * 6);
784
- if (params.offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.TOP) {
785
- applyOffset = applyOffset
786
- .fill(1, 0, size) // top face
787
- .fill(1, size * 2, size * 4); // top wall
788
- } else {
789
- const applyOffsetValue =
790
- params.offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE ? 0 : 1;
791
- applyOffset = applyOffset.fill(applyOffsetValue);
792
- }
793
- attributes.applyOffset = new GeometryAttribute.GeometryAttribute({
794
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
795
- componentsPerAttribute: 1,
796
- values: applyOffset,
797
- });
722
+ attributes.st.values = st;
723
+ }
724
+ return attributes;
725
+ }
726
+ function addWallPositions(positions, index, wallPositions) {
727
+ wallPositions[index++] = positions[0];
728
+ wallPositions[index++] = positions[1];
729
+ wallPositions[index++] = positions[2];
730
+ for (let i = 3; i < positions.length; i += 3) {
731
+ const x = positions[i];
732
+ const y = positions[i + 1];
733
+ const z = positions[i + 2];
734
+ wallPositions[index++] = x;
735
+ wallPositions[index++] = y;
736
+ wallPositions[index++] = z;
737
+ wallPositions[index++] = x;
738
+ wallPositions[index++] = y;
739
+ wallPositions[index++] = z;
740
+ }
741
+ wallPositions[index++] = positions[0];
742
+ wallPositions[index++] = positions[1];
743
+ wallPositions[index++] = positions[2];
744
+ return wallPositions;
745
+ }
746
+ function computePositionsExtruded(params, vertexFormat) {
747
+ const topVertexFormat = new VertexFormat_default({
748
+ position: vertexFormat.position,
749
+ normal: vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
750
+ tangent: vertexFormat.tangent,
751
+ bitangent: vertexFormat.normal || vertexFormat.bitangent,
752
+ st: vertexFormat.st
753
+ });
754
+ const ellipsoid = params.ellipsoid;
755
+ const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
756
+ const attr = combine(computedPositions, topVertexFormat, ellipsoid);
757
+ const height = params.height;
758
+ const extrudedHeight = params.extrudedHeight;
759
+ let attributes = attr.attributes;
760
+ const indices = attr.indices;
761
+ let positions = attributes.position.values;
762
+ let length = positions.length;
763
+ const newPositions = new Float64Array(length * 6);
764
+ let extrudedPositions = new Float64Array(length);
765
+ extrudedPositions.set(positions);
766
+ let wallPositions = new Float64Array(length * 4);
767
+ positions = PolygonPipeline_default.scaleToGeodeticHeight(
768
+ positions,
769
+ height,
770
+ ellipsoid
771
+ );
772
+ wallPositions = addWallPositions(positions, 0, wallPositions);
773
+ extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
774
+ extrudedPositions,
775
+ extrudedHeight,
776
+ ellipsoid
777
+ );
778
+ wallPositions = addWallPositions(
779
+ extrudedPositions,
780
+ length * 2,
781
+ wallPositions
782
+ );
783
+ newPositions.set(positions);
784
+ newPositions.set(extrudedPositions, length);
785
+ newPositions.set(wallPositions, length * 2);
786
+ attributes.position.values = newPositions;
787
+ attributes = extrudedAttributes(attributes, vertexFormat);
788
+ let i;
789
+ const size = length / 3;
790
+ if (params.shadowVolume) {
791
+ const topNormals = attributes.normal.values;
792
+ length = topNormals.length;
793
+ let extrudeNormals = new Float32Array(length * 6);
794
+ for (i = 0; i < length; i++) {
795
+ topNormals[i] = -topNormals[i];
798
796
  }
799
-
800
- const iLength = indices.length;
801
- const twoSize = size + size;
802
- const newIndices = IndexDatatype.IndexDatatype.createTypedArray(
803
- newPositions.length / 3,
804
- iLength * 2 + twoSize * 3
805
- );
806
- newIndices.set(indices);
807
- let index = iLength;
808
- for (i = 0; i < iLength; i += 3) {
809
- // bottom indices
810
- const v0 = indices[i];
811
- const v1 = indices[i + 1];
812
- const v2 = indices[i + 2];
813
- newIndices[index++] = v2 + size;
814
- newIndices[index++] = v1 + size;
815
- newIndices[index++] = v0 + size;
797
+ extrudeNormals.set(topNormals, length);
798
+ extrudeNormals = addWallPositions(topNormals, length * 4, extrudeNormals);
799
+ attributes.extrudeDirection = new GeometryAttribute_default({
800
+ componentDatatype: ComponentDatatype_default.FLOAT,
801
+ componentsPerAttribute: 3,
802
+ values: extrudeNormals
803
+ });
804
+ if (!vertexFormat.normal) {
805
+ attributes.normal = void 0;
816
806
  }
817
-
818
- let UL, LL, UR, LR;
819
-
820
- for (i = 0; i < twoSize; i += 2) {
821
- //wall indices
822
- UL = i + twoSize;
823
- LL = UL + twoSize;
824
- UR = UL + 1;
825
- LR = LL + 1;
826
- newIndices[index++] = UL;
827
- newIndices[index++] = LL;
828
- newIndices[index++] = UR;
829
- newIndices[index++] = UR;
830
- newIndices[index++] = LL;
831
- newIndices[index++] = LR;
807
+ }
808
+ if (defined_default(params.offsetAttribute)) {
809
+ let applyOffset = new Uint8Array(size * 6);
810
+ if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
811
+ applyOffset = applyOffset.fill(1, 0, size).fill(1, size * 2, size * 4);
812
+ } else {
813
+ const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
814
+ applyOffset = applyOffset.fill(applyOffsetValue);
832
815
  }
833
-
834
- return {
835
- attributes: attributes,
836
- indices: newIndices,
837
- };
816
+ attributes.applyOffset = new GeometryAttribute_default({
817
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
818
+ componentsPerAttribute: 1,
819
+ values: applyOffset
820
+ });
838
821
  }
839
-
840
- const scratchCartesian1 = new Matrix3.Cartesian3();
841
- const scratchCartesian2 = new Matrix3.Cartesian3();
842
- const scratchCartographic = new Matrix3.Cartographic();
843
-
844
- function computeOffsetPoints(
845
- position1,
822
+ const iLength = indices.length;
823
+ const twoSize = size + size;
824
+ const newIndices = IndexDatatype_default.createTypedArray(
825
+ newPositions.length / 3,
826
+ iLength * 2 + twoSize * 3
827
+ );
828
+ newIndices.set(indices);
829
+ let index = iLength;
830
+ for (i = 0; i < iLength; i += 3) {
831
+ const v0 = indices[i];
832
+ const v1 = indices[i + 1];
833
+ const v2 = indices[i + 2];
834
+ newIndices[index++] = v2 + size;
835
+ newIndices[index++] = v1 + size;
836
+ newIndices[index++] = v0 + size;
837
+ }
838
+ let UL, LL, UR, LR;
839
+ for (i = 0; i < twoSize; i += 2) {
840
+ UL = i + twoSize;
841
+ LL = UL + twoSize;
842
+ UR = UL + 1;
843
+ LR = LL + 1;
844
+ newIndices[index++] = UL;
845
+ newIndices[index++] = LL;
846
+ newIndices[index++] = UR;
847
+ newIndices[index++] = UR;
848
+ newIndices[index++] = LL;
849
+ newIndices[index++] = LR;
850
+ }
851
+ return {
852
+ attributes,
853
+ indices: newIndices
854
+ };
855
+ }
856
+ var scratchCartesian1 = new Cartesian3_default();
857
+ var scratchCartesian2 = new Cartesian3_default();
858
+ var scratchCartographic = new Cartographic_default();
859
+ function computeOffsetPoints(position1, position2, ellipsoid, halfWidth, min, max) {
860
+ const direction = Cartesian3_default.subtract(
846
861
  position2,
847
- ellipsoid,
848
- halfWidth,
849
- min,
850
- max
851
- ) {
852
- // Compute direction of offset the point
853
- const direction = Matrix3.Cartesian3.subtract(
854
- position2,
855
- position1,
856
- scratchCartesian1
862
+ position1,
863
+ scratchCartesian1
864
+ );
865
+ Cartesian3_default.normalize(direction, direction);
866
+ const normal = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian2);
867
+ const offsetDirection = Cartesian3_default.cross(
868
+ direction,
869
+ normal,
870
+ scratchCartesian1
871
+ );
872
+ Cartesian3_default.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
873
+ let minLat = min.latitude;
874
+ let minLon = min.longitude;
875
+ let maxLat = max.latitude;
876
+ let maxLon = max.longitude;
877
+ Cartesian3_default.add(position1, offsetDirection, scratchCartesian2);
878
+ ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
879
+ let lat = scratchCartographic.latitude;
880
+ let lon = scratchCartographic.longitude;
881
+ minLat = Math.min(minLat, lat);
882
+ minLon = Math.min(minLon, lon);
883
+ maxLat = Math.max(maxLat, lat);
884
+ maxLon = Math.max(maxLon, lon);
885
+ Cartesian3_default.subtract(position1, offsetDirection, scratchCartesian2);
886
+ ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
887
+ lat = scratchCartographic.latitude;
888
+ lon = scratchCartographic.longitude;
889
+ minLat = Math.min(minLat, lat);
890
+ minLon = Math.min(minLon, lon);
891
+ maxLat = Math.max(maxLat, lat);
892
+ maxLon = Math.max(maxLon, lon);
893
+ min.latitude = minLat;
894
+ min.longitude = minLon;
895
+ max.latitude = maxLat;
896
+ max.longitude = maxLon;
897
+ }
898
+ var scratchCartesianOffset = new Cartesian3_default();
899
+ var scratchCartesianEnds = new Cartesian3_default();
900
+ var scratchCartographicMin = new Cartographic_default();
901
+ var scratchCartographicMax = new Cartographic_default();
902
+ function computeRectangle(positions, ellipsoid, width, cornerType, result) {
903
+ positions = scaleToSurface(positions, ellipsoid);
904
+ const cleanPositions = arrayRemoveDuplicates_default(
905
+ positions,
906
+ Cartesian3_default.equalsEpsilon
907
+ );
908
+ const length = cleanPositions.length;
909
+ if (length < 2 || width <= 0) {
910
+ return new Rectangle_default();
911
+ }
912
+ const halfWidth = width * 0.5;
913
+ scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
914
+ scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
915
+ scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
916
+ scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
917
+ let lat, lon;
918
+ if (cornerType === CornerType_default.ROUNDED) {
919
+ const first = cleanPositions[0];
920
+ Cartesian3_default.subtract(first, cleanPositions[1], scratchCartesianOffset);
921
+ Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
922
+ Cartesian3_default.multiplyByScalar(
923
+ scratchCartesianOffset,
924
+ halfWidth,
925
+ scratchCartesianOffset
857
926
  );
858
- Matrix3.Cartesian3.normalize(direction, direction);
859
- const normal = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian2);
860
- const offsetDirection = Matrix3.Cartesian3.cross(
861
- direction,
862
- normal,
863
- scratchCartesian1
927
+ Cartesian3_default.add(first, scratchCartesianOffset, scratchCartesianEnds);
928
+ ellipsoid.cartesianToCartographic(
929
+ scratchCartesianEnds,
930
+ scratchCartographic
864
931
  );
865
- Matrix3.Cartesian3.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
866
-
867
- let minLat = min.latitude;
868
- let minLon = min.longitude;
869
- let maxLat = max.latitude;
870
- let maxLon = max.longitude;
871
-
872
- // Compute 2 offset points
873
- Matrix3.Cartesian3.add(position1, offsetDirection, scratchCartesian2);
874
- ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
875
-
876
- let lat = scratchCartographic.latitude;
877
- let lon = scratchCartographic.longitude;
878
- minLat = Math.min(minLat, lat);
879
- minLon = Math.min(minLon, lon);
880
- maxLat = Math.max(maxLat, lat);
881
- maxLon = Math.max(maxLon, lon);
882
-
883
- Matrix3.Cartesian3.subtract(position1, offsetDirection, scratchCartesian2);
884
- ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
885
-
886
932
  lat = scratchCartographic.latitude;
887
933
  lon = scratchCartographic.longitude;
888
- minLat = Math.min(minLat, lat);
889
- minLon = Math.min(minLon, lon);
890
- maxLat = Math.max(maxLat, lat);
891
- maxLon = Math.max(maxLon, lon);
892
-
893
- min.latitude = minLat;
894
- min.longitude = minLon;
895
- max.latitude = maxLat;
896
- max.longitude = maxLon;
897
- }
898
-
899
- const scratchCartesianOffset = new Matrix3.Cartesian3();
900
- const scratchCartesianEnds = new Matrix3.Cartesian3();
901
- const scratchCartographicMin = new Matrix3.Cartographic();
902
- const scratchCartographicMax = new Matrix3.Cartographic();
903
-
904
- function computeRectangle(positions, ellipsoid, width, cornerType, result) {
905
- positions = scaleToSurface(positions, ellipsoid);
906
- const cleanPositions = arrayRemoveDuplicates.arrayRemoveDuplicates(
907
- positions,
908
- Matrix3.Cartesian3.equalsEpsilon
934
+ scratchCartographicMin.latitude = Math.min(
935
+ scratchCartographicMin.latitude,
936
+ lat
909
937
  );
910
- const length = cleanPositions.length;
911
- if (length < 2 || width <= 0) {
912
- return new Matrix2.Rectangle();
913
- }
914
- const halfWidth = width * 0.5;
915
-
916
- scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
917
- scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
918
- scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
919
- scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
920
-
921
- let lat, lon;
922
- if (cornerType === PolylineVolumeGeometryLibrary.CornerType.ROUNDED) {
923
- // Compute start cap
924
- const first = cleanPositions[0];
925
- Matrix3.Cartesian3.subtract(first, cleanPositions[1], scratchCartesianOffset);
926
- Matrix3.Cartesian3.normalize(scratchCartesianOffset, scratchCartesianOffset);
927
- Matrix3.Cartesian3.multiplyByScalar(
928
- scratchCartesianOffset,
929
- halfWidth,
930
- scratchCartesianOffset
931
- );
932
- Matrix3.Cartesian3.add(first, scratchCartesianOffset, scratchCartesianEnds);
933
-
934
- ellipsoid.cartesianToCartographic(
935
- scratchCartesianEnds,
936
- scratchCartographic
937
- );
938
- lat = scratchCartographic.latitude;
939
- lon = scratchCartographic.longitude;
940
- scratchCartographicMin.latitude = Math.min(
941
- scratchCartographicMin.latitude,
942
- lat
943
- );
944
- scratchCartographicMin.longitude = Math.min(
945
- scratchCartographicMin.longitude,
946
- lon
947
- );
948
- scratchCartographicMax.latitude = Math.max(
949
- scratchCartographicMax.latitude,
950
- lat
951
- );
952
- scratchCartographicMax.longitude = Math.max(
953
- scratchCartographicMax.longitude,
954
- lon
955
- );
956
- }
957
-
958
- // Compute the rest
959
- for (let i = 0; i < length - 1; ++i) {
960
- computeOffsetPoints(
961
- cleanPositions[i],
962
- cleanPositions[i + 1],
963
- ellipsoid,
964
- halfWidth,
965
- scratchCartographicMin,
966
- scratchCartographicMax
967
- );
968
- }
969
-
970
- // Compute ending point
971
- const last = cleanPositions[length - 1];
972
- Matrix3.Cartesian3.subtract(last, cleanPositions[length - 2], scratchCartesianOffset);
973
- Matrix3.Cartesian3.normalize(scratchCartesianOffset, scratchCartesianOffset);
974
- Matrix3.Cartesian3.multiplyByScalar(
975
- scratchCartesianOffset,
976
- halfWidth,
977
- scratchCartesianOffset
938
+ scratchCartographicMin.longitude = Math.min(
939
+ scratchCartographicMin.longitude,
940
+ lon
941
+ );
942
+ scratchCartographicMax.latitude = Math.max(
943
+ scratchCartographicMax.latitude,
944
+ lat
978
945
  );
979
- Matrix3.Cartesian3.add(last, scratchCartesianOffset, scratchCartesianEnds);
946
+ scratchCartographicMax.longitude = Math.max(
947
+ scratchCartographicMax.longitude,
948
+ lon
949
+ );
950
+ }
951
+ for (let i = 0; i < length - 1; ++i) {
980
952
  computeOffsetPoints(
981
- last,
982
- scratchCartesianEnds,
953
+ cleanPositions[i],
954
+ cleanPositions[i + 1],
983
955
  ellipsoid,
984
956
  halfWidth,
985
957
  scratchCartographicMin,
986
958
  scratchCartographicMax
987
959
  );
988
-
989
- if (cornerType === PolylineVolumeGeometryLibrary.CornerType.ROUNDED) {
990
- // Compute end cap
991
- ellipsoid.cartesianToCartographic(
992
- scratchCartesianEnds,
993
- scratchCartographic
994
- );
995
- lat = scratchCartographic.latitude;
996
- lon = scratchCartographic.longitude;
997
- scratchCartographicMin.latitude = Math.min(
998
- scratchCartographicMin.latitude,
999
- lat
1000
- );
1001
- scratchCartographicMin.longitude = Math.min(
1002
- scratchCartographicMin.longitude,
1003
- lon
1004
- );
1005
- scratchCartographicMax.latitude = Math.max(
1006
- scratchCartographicMax.latitude,
1007
- lat
1008
- );
1009
- scratchCartographicMax.longitude = Math.max(
1010
- scratchCartographicMax.longitude,
1011
- lon
1012
- );
1013
- }
1014
-
1015
- const rectangle = defaultValue.defined(result) ? result : new Matrix2.Rectangle();
1016
- rectangle.north = scratchCartographicMax.latitude;
1017
- rectangle.south = scratchCartographicMin.latitude;
1018
- rectangle.east = scratchCartographicMax.longitude;
1019
- rectangle.west = scratchCartographicMin.longitude;
1020
-
1021
- return rectangle;
1022
960
  }
1023
-
1024
- /**
1025
- * A description of a corridor. Corridor geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
1026
- *
1027
- * @alias CorridorGeometry
1028
- * @constructor
1029
- *
1030
- * @param {object} options Object with the following properties:
1031
- * @param {Cartesian3[]} options.positions An array of positions that define the center of the corridor.
1032
- * @param {number} options.width The distance between the edges of the corridor in meters.
1033
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
1034
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
1035
- * @param {number} [options.height=0] The distance in meters between the ellipsoid surface and the positions.
1036
- * @param {number} [options.extrudedHeight] The distance in meters between the ellipsoid surface and the extruded face.
1037
- * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
1038
- * @param {CornerType} [options.cornerType=CornerType.ROUNDED] Determines the style of the corners.
1039
- *
1040
- * @see CorridorGeometry.createGeometry
1041
- * @see Packable
1042
- *
1043
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo}
1044
- *
1045
- * @example
1046
- * const corridor = new Cesium.CorridorGeometry({
1047
- * vertexFormat : Cesium.VertexFormat.POSITION_ONLY,
1048
- * positions : Cesium.Cartesian3.fromDegreesArray([-72.0, 40.0, -70.0, 35.0]),
1049
- * width : 100000
1050
- * });
1051
- */
1052
- function CorridorGeometry(options) {
1053
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1054
- const positions = options.positions;
1055
- const width = options.width;
1056
-
1057
- //>>includeStart('debug', pragmas.debug);
1058
- Check.Check.defined("options.positions", positions);
1059
- Check.Check.defined("options.width", width);
1060
- //>>includeEnd('debug');
1061
-
1062
- const height = defaultValue.defaultValue(options.height, 0.0);
1063
- const extrudedHeight = defaultValue.defaultValue(options.extrudedHeight, height);
1064
-
1065
- this._positions = positions;
1066
- this._ellipsoid = Matrix3.Ellipsoid.clone(
1067
- defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84)
961
+ const last = cleanPositions[length - 1];
962
+ Cartesian3_default.subtract(last, cleanPositions[length - 2], scratchCartesianOffset);
963
+ Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
964
+ Cartesian3_default.multiplyByScalar(
965
+ scratchCartesianOffset,
966
+ halfWidth,
967
+ scratchCartesianOffset
968
+ );
969
+ Cartesian3_default.add(last, scratchCartesianOffset, scratchCartesianEnds);
970
+ computeOffsetPoints(
971
+ last,
972
+ scratchCartesianEnds,
973
+ ellipsoid,
974
+ halfWidth,
975
+ scratchCartographicMin,
976
+ scratchCartographicMax
977
+ );
978
+ if (cornerType === CornerType_default.ROUNDED) {
979
+ ellipsoid.cartesianToCartographic(
980
+ scratchCartesianEnds,
981
+ scratchCartographic
1068
982
  );
1069
- this._vertexFormat = VertexFormat.VertexFormat.clone(
1070
- defaultValue.defaultValue(options.vertexFormat, VertexFormat.VertexFormat.DEFAULT)
983
+ lat = scratchCartographic.latitude;
984
+ lon = scratchCartographic.longitude;
985
+ scratchCartographicMin.latitude = Math.min(
986
+ scratchCartographicMin.latitude,
987
+ lat
1071
988
  );
1072
- this._width = width;
1073
- this._height = Math.max(height, extrudedHeight);
1074
- this._extrudedHeight = Math.min(height, extrudedHeight);
1075
- this._cornerType = defaultValue.defaultValue(options.cornerType, PolylineVolumeGeometryLibrary.CornerType.ROUNDED);
1076
- this._granularity = defaultValue.defaultValue(
1077
- options.granularity,
1078
- Math$1.CesiumMath.RADIANS_PER_DEGREE
989
+ scratchCartographicMin.longitude = Math.min(
990
+ scratchCartographicMin.longitude,
991
+ lon
992
+ );
993
+ scratchCartographicMax.latitude = Math.max(
994
+ scratchCartographicMax.latitude,
995
+ lat
996
+ );
997
+ scratchCartographicMax.longitude = Math.max(
998
+ scratchCartographicMax.longitude,
999
+ lon
1079
1000
  );
1080
- this._shadowVolume = defaultValue.defaultValue(options.shadowVolume, false);
1081
- this._workerName = "createCorridorGeometry";
1082
- this._offsetAttribute = options.offsetAttribute;
1083
- this._rectangle = undefined;
1084
-
1085
- /**
1086
- * The number of elements used to pack the object into an array.
1087
- * @type {number}
1088
- */
1089
- this.packedLength =
1090
- 1 +
1091
- positions.length * Matrix3.Cartesian3.packedLength +
1092
- Matrix3.Ellipsoid.packedLength +
1093
- VertexFormat.VertexFormat.packedLength +
1094
- 7;
1095
1001
  }
1096
-
1097
- /**
1098
- * Stores the provided instance into the provided array.
1099
- *
1100
- * @param {CorridorGeometry} value The value to pack.
1101
- * @param {number[]} array The array to pack into.
1102
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
1103
- *
1104
- * @returns {number[]} The array that was packed into
1105
- */
1106
- CorridorGeometry.pack = function (value, array, startingIndex) {
1107
- //>>includeStart('debug', pragmas.debug);
1108
- Check.Check.defined("value", value);
1109
- Check.Check.defined("array", array);
1110
- //>>includeEnd('debug');
1111
-
1112
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
1113
-
1114
- const positions = value._positions;
1115
- const length = positions.length;
1116
- array[startingIndex++] = length;
1117
-
1118
- for (let i = 0; i < length; ++i, startingIndex += Matrix3.Cartesian3.packedLength) {
1119
- Matrix3.Cartesian3.pack(positions[i], array, startingIndex);
1120
- }
1121
-
1122
- Matrix3.Ellipsoid.pack(value._ellipsoid, array, startingIndex);
1123
- startingIndex += Matrix3.Ellipsoid.packedLength;
1124
-
1125
- VertexFormat.VertexFormat.pack(value._vertexFormat, array, startingIndex);
1126
- startingIndex += VertexFormat.VertexFormat.packedLength;
1127
-
1128
- array[startingIndex++] = value._width;
1129
- array[startingIndex++] = value._height;
1130
- array[startingIndex++] = value._extrudedHeight;
1131
- array[startingIndex++] = value._cornerType;
1132
- array[startingIndex++] = value._granularity;
1133
- array[startingIndex++] = value._shadowVolume ? 1.0 : 0.0;
1134
- array[startingIndex] = defaultValue.defaultValue(value._offsetAttribute, -1);
1135
-
1136
- return array;
1137
- };
1138
-
1139
- const scratchEllipsoid = Matrix3.Ellipsoid.clone(Matrix3.Ellipsoid.UNIT_SPHERE);
1140
- const scratchVertexFormat = new VertexFormat.VertexFormat();
1141
- const scratchOptions = {
1142
- positions: undefined,
1143
- ellipsoid: scratchEllipsoid,
1144
- vertexFormat: scratchVertexFormat,
1145
- width: undefined,
1146
- height: undefined,
1147
- extrudedHeight: undefined,
1148
- cornerType: undefined,
1149
- granularity: undefined,
1150
- shadowVolume: undefined,
1151
- offsetAttribute: undefined,
1002
+ const rectangle = defined_default(result) ? result : new Rectangle_default();
1003
+ rectangle.north = scratchCartographicMax.latitude;
1004
+ rectangle.south = scratchCartographicMin.latitude;
1005
+ rectangle.east = scratchCartographicMax.longitude;
1006
+ rectangle.west = scratchCartographicMin.longitude;
1007
+ return rectangle;
1008
+ }
1009
+ function CorridorGeometry(options) {
1010
+ options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
1011
+ const positions = options.positions;
1012
+ const width = options.width;
1013
+ Check_default.defined("options.positions", positions);
1014
+ Check_default.defined("options.width", width);
1015
+ const height = defaultValue_default(options.height, 0);
1016
+ const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
1017
+ this._positions = positions;
1018
+ this._ellipsoid = Ellipsoid_default.clone(
1019
+ defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
1020
+ );
1021
+ this._vertexFormat = VertexFormat_default.clone(
1022
+ defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
1023
+ );
1024
+ this._width = width;
1025
+ this._height = Math.max(height, extrudedHeight);
1026
+ this._extrudedHeight = Math.min(height, extrudedHeight);
1027
+ this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
1028
+ this._granularity = defaultValue_default(
1029
+ options.granularity,
1030
+ Math_default.RADIANS_PER_DEGREE
1031
+ );
1032
+ this._shadowVolume = defaultValue_default(options.shadowVolume, false);
1033
+ this._workerName = "createCorridorGeometry";
1034
+ this._offsetAttribute = options.offsetAttribute;
1035
+ this._rectangle = void 0;
1036
+ this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
1037
+ }
1038
+ CorridorGeometry.pack = function(value, array, startingIndex) {
1039
+ Check_default.defined("value", value);
1040
+ Check_default.defined("array", array);
1041
+ startingIndex = defaultValue_default(startingIndex, 0);
1042
+ const positions = value._positions;
1043
+ const length = positions.length;
1044
+ array[startingIndex++] = length;
1045
+ for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
1046
+ Cartesian3_default.pack(positions[i], array, startingIndex);
1047
+ }
1048
+ Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
1049
+ startingIndex += Ellipsoid_default.packedLength;
1050
+ VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
1051
+ startingIndex += VertexFormat_default.packedLength;
1052
+ array[startingIndex++] = value._width;
1053
+ array[startingIndex++] = value._height;
1054
+ array[startingIndex++] = value._extrudedHeight;
1055
+ array[startingIndex++] = value._cornerType;
1056
+ array[startingIndex++] = value._granularity;
1057
+ array[startingIndex++] = value._shadowVolume ? 1 : 0;
1058
+ array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
1059
+ return array;
1060
+ };
1061
+ var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
1062
+ var scratchVertexFormat = new VertexFormat_default();
1063
+ var scratchOptions = {
1064
+ positions: void 0,
1065
+ ellipsoid: scratchEllipsoid,
1066
+ vertexFormat: scratchVertexFormat,
1067
+ width: void 0,
1068
+ height: void 0,
1069
+ extrudedHeight: void 0,
1070
+ cornerType: void 0,
1071
+ granularity: void 0,
1072
+ shadowVolume: void 0,
1073
+ offsetAttribute: void 0
1074
+ };
1075
+ CorridorGeometry.unpack = function(array, startingIndex, result) {
1076
+ Check_default.defined("array", array);
1077
+ startingIndex = defaultValue_default(startingIndex, 0);
1078
+ const length = array[startingIndex++];
1079
+ const positions = new Array(length);
1080
+ for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
1081
+ positions[i] = Cartesian3_default.unpack(array, startingIndex);
1082
+ }
1083
+ const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
1084
+ startingIndex += Ellipsoid_default.packedLength;
1085
+ const vertexFormat = VertexFormat_default.unpack(
1086
+ array,
1087
+ startingIndex,
1088
+ scratchVertexFormat
1089
+ );
1090
+ startingIndex += VertexFormat_default.packedLength;
1091
+ const width = array[startingIndex++];
1092
+ const height = array[startingIndex++];
1093
+ const extrudedHeight = array[startingIndex++];
1094
+ const cornerType = array[startingIndex++];
1095
+ const granularity = array[startingIndex++];
1096
+ const shadowVolume = array[startingIndex++] === 1;
1097
+ const offsetAttribute = array[startingIndex];
1098
+ if (!defined_default(result)) {
1099
+ scratchOptions.positions = positions;
1100
+ scratchOptions.width = width;
1101
+ scratchOptions.height = height;
1102
+ scratchOptions.extrudedHeight = extrudedHeight;
1103
+ scratchOptions.cornerType = cornerType;
1104
+ scratchOptions.granularity = granularity;
1105
+ scratchOptions.shadowVolume = shadowVolume;
1106
+ scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1107
+ return new CorridorGeometry(scratchOptions);
1108
+ }
1109
+ result._positions = positions;
1110
+ result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
1111
+ result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
1112
+ result._width = width;
1113
+ result._height = height;
1114
+ result._extrudedHeight = extrudedHeight;
1115
+ result._cornerType = cornerType;
1116
+ result._granularity = granularity;
1117
+ result._shadowVolume = shadowVolume;
1118
+ result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1119
+ return result;
1120
+ };
1121
+ CorridorGeometry.computeRectangle = function(options, result) {
1122
+ options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
1123
+ const positions = options.positions;
1124
+ const width = options.width;
1125
+ Check_default.defined("options.positions", positions);
1126
+ Check_default.defined("options.width", width);
1127
+ const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
1128
+ const cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
1129
+ return computeRectangle(positions, ellipsoid, width, cornerType, result);
1130
+ };
1131
+ CorridorGeometry.createGeometry = function(corridorGeometry) {
1132
+ let positions = corridorGeometry._positions;
1133
+ const width = corridorGeometry._width;
1134
+ const ellipsoid = corridorGeometry._ellipsoid;
1135
+ positions = scaleToSurface(positions, ellipsoid);
1136
+ const cleanPositions = arrayRemoveDuplicates_default(
1137
+ positions,
1138
+ Cartesian3_default.equalsEpsilon
1139
+ );
1140
+ if (cleanPositions.length < 2 || width <= 0) {
1141
+ return;
1142
+ }
1143
+ const height = corridorGeometry._height;
1144
+ const extrudedHeight = corridorGeometry._extrudedHeight;
1145
+ const extrude = !Math_default.equalsEpsilon(
1146
+ height,
1147
+ extrudedHeight,
1148
+ 0,
1149
+ Math_default.EPSILON2
1150
+ );
1151
+ const vertexFormat = corridorGeometry._vertexFormat;
1152
+ const params = {
1153
+ ellipsoid,
1154
+ positions: cleanPositions,
1155
+ width,
1156
+ cornerType: corridorGeometry._cornerType,
1157
+ granularity: corridorGeometry._granularity,
1158
+ saveAttributes: true
1152
1159
  };
1153
-
1154
- /**
1155
- * Retrieves an instance from a packed array.
1156
- *
1157
- * @param {number[]} array The packed array.
1158
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
1159
- * @param {CorridorGeometry} [result] The object into which to store the result.
1160
- * @returns {CorridorGeometry} The modified result parameter or a new CorridorGeometry instance if one was not provided.
1161
- */
1162
- CorridorGeometry.unpack = function (array, startingIndex, result) {
1163
- //>>includeStart('debug', pragmas.debug);
1164
- Check.Check.defined("array", array);
1165
- //>>includeEnd('debug');
1166
-
1167
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
1168
-
1169
- const length = array[startingIndex++];
1170
- const positions = new Array(length);
1171
-
1172
- for (let i = 0; i < length; ++i, startingIndex += Matrix3.Cartesian3.packedLength) {
1173
- positions[i] = Matrix3.Cartesian3.unpack(array, startingIndex);
1174
- }
1175
-
1176
- const ellipsoid = Matrix3.Ellipsoid.unpack(array, startingIndex, scratchEllipsoid);
1177
- startingIndex += Matrix3.Ellipsoid.packedLength;
1178
-
1179
- const vertexFormat = VertexFormat.VertexFormat.unpack(
1180
- array,
1181
- startingIndex,
1182
- scratchVertexFormat
1160
+ let attr;
1161
+ if (extrude) {
1162
+ params.height = height;
1163
+ params.extrudedHeight = extrudedHeight;
1164
+ params.shadowVolume = corridorGeometry._shadowVolume;
1165
+ params.offsetAttribute = corridorGeometry._offsetAttribute;
1166
+ attr = computePositionsExtruded(params, vertexFormat);
1167
+ } else {
1168
+ const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
1169
+ attr = combine(computedPositions, vertexFormat, ellipsoid);
1170
+ attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1171
+ attr.attributes.position.values,
1172
+ height,
1173
+ ellipsoid
1183
1174
  );
1184
- startingIndex += VertexFormat.VertexFormat.packedLength;
1185
-
1186
- const width = array[startingIndex++];
1187
- const height = array[startingIndex++];
1188
- const extrudedHeight = array[startingIndex++];
1189
- const cornerType = array[startingIndex++];
1190
- const granularity = array[startingIndex++];
1191
- const shadowVolume = array[startingIndex++] === 1.0;
1192
- const offsetAttribute = array[startingIndex];
1193
-
1194
- if (!defaultValue.defined(result)) {
1195
- scratchOptions.positions = positions;
1196
- scratchOptions.width = width;
1197
- scratchOptions.height = height;
1198
- scratchOptions.extrudedHeight = extrudedHeight;
1199
- scratchOptions.cornerType = cornerType;
1200
- scratchOptions.granularity = granularity;
1201
- scratchOptions.shadowVolume = shadowVolume;
1202
- scratchOptions.offsetAttribute =
1203
- offsetAttribute === -1 ? undefined : offsetAttribute;
1204
-
1205
- return new CorridorGeometry(scratchOptions);
1175
+ if (defined_default(corridorGeometry._offsetAttribute)) {
1176
+ const applyOffsetValue = corridorGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
1177
+ const length = attr.attributes.position.values.length;
1178
+ const applyOffset = new Uint8Array(length / 3).fill(applyOffsetValue);
1179
+ attr.attributes.applyOffset = new GeometryAttribute_default({
1180
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
1181
+ componentsPerAttribute: 1,
1182
+ values: applyOffset
1183
+ });
1206
1184
  }
1207
-
1208
- result._positions = positions;
1209
- result._ellipsoid = Matrix3.Ellipsoid.clone(ellipsoid, result._ellipsoid);
1210
- result._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat, result._vertexFormat);
1211
- result._width = width;
1212
- result._height = height;
1213
- result._extrudedHeight = extrudedHeight;
1214
- result._cornerType = cornerType;
1215
- result._granularity = granularity;
1216
- result._shadowVolume = shadowVolume;
1217
- result._offsetAttribute =
1218
- offsetAttribute === -1 ? undefined : offsetAttribute;
1219
-
1220
- return result;
1221
- };
1222
-
1223
- /**
1224
- * Computes the bounding rectangle given the provided options
1225
- *
1226
- * @param {object} options Object with the following properties:
1227
- * @param {Cartesian3[]} options.positions An array of positions that define the center of the corridor.
1228
- * @param {number} options.width The distance between the edges of the corridor in meters.
1229
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
1230
- * @param {CornerType} [options.cornerType=CornerType.ROUNDED] Determines the style of the corners.
1231
- * @param {Rectangle} [result] An object in which to store the result.
1232
- *
1233
- * @returns {Rectangle} The result rectangle.
1234
- */
1235
- CorridorGeometry.computeRectangle = function (options, result) {
1236
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1237
- const positions = options.positions;
1238
- const width = options.width;
1239
-
1240
- //>>includeStart('debug', pragmas.debug);
1241
- Check.Check.defined("options.positions", positions);
1242
- Check.Check.defined("options.width", width);
1243
- //>>includeEnd('debug');
1244
-
1245
- const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
1246
- const cornerType = defaultValue.defaultValue(options.cornerType, PolylineVolumeGeometryLibrary.CornerType.ROUNDED);
1247
-
1248
- return computeRectangle(positions, ellipsoid, width, cornerType, result);
1249
- };
1250
-
1185
+ }
1186
+ const attributes = attr.attributes;
1187
+ const boundingSphere = BoundingSphere_default.fromVertices(
1188
+ attributes.position.values,
1189
+ void 0,
1190
+ 3
1191
+ );
1192
+ if (!vertexFormat.position) {
1193
+ attr.attributes.position.values = void 0;
1194
+ }
1195
+ return new Geometry_default({
1196
+ attributes,
1197
+ indices: attr.indices,
1198
+ primitiveType: PrimitiveType_default.TRIANGLES,
1199
+ boundingSphere,
1200
+ offsetAttribute: corridorGeometry._offsetAttribute
1201
+ });
1202
+ };
1203
+ CorridorGeometry.createShadowVolume = function(corridorGeometry, minHeightFunc, maxHeightFunc) {
1204
+ const granularity = corridorGeometry._granularity;
1205
+ const ellipsoid = corridorGeometry._ellipsoid;
1206
+ const minHeight = minHeightFunc(granularity, ellipsoid);
1207
+ const maxHeight = maxHeightFunc(granularity, ellipsoid);
1208
+ return new CorridorGeometry({
1209
+ positions: corridorGeometry._positions,
1210
+ width: corridorGeometry._width,
1211
+ cornerType: corridorGeometry._cornerType,
1212
+ ellipsoid,
1213
+ granularity,
1214
+ extrudedHeight: minHeight,
1215
+ height: maxHeight,
1216
+ vertexFormat: VertexFormat_default.POSITION_ONLY,
1217
+ shadowVolume: true
1218
+ });
1219
+ };
1220
+ Object.defineProperties(CorridorGeometry.prototype, {
1251
1221
  /**
1252
- * Computes the geometric representation of a corridor, including its vertices, indices, and a bounding sphere.
1253
- *
1254
- * @param {CorridorGeometry} corridorGeometry A description of the corridor.
1255
- * @returns {Geometry|undefined} The computed vertices and indices.
1222
+ * @private
1256
1223
  */
1257
- CorridorGeometry.createGeometry = function (corridorGeometry) {
1258
- let positions = corridorGeometry._positions;
1259
- const width = corridorGeometry._width;
1260
- const ellipsoid = corridorGeometry._ellipsoid;
1261
-
1262
- positions = scaleToSurface(positions, ellipsoid);
1263
- const cleanPositions = arrayRemoveDuplicates.arrayRemoveDuplicates(
1264
- positions,
1265
- Matrix3.Cartesian3.equalsEpsilon
1266
- );
1267
-
1268
- if (cleanPositions.length < 2 || width <= 0) {
1269
- return;
1270
- }
1271
-
1272
- const height = corridorGeometry._height;
1273
- const extrudedHeight = corridorGeometry._extrudedHeight;
1274
- const extrude = !Math$1.CesiumMath.equalsEpsilon(
1275
- height,
1276
- extrudedHeight,
1277
- 0,
1278
- Math$1.CesiumMath.EPSILON2
1279
- );
1280
-
1281
- const vertexFormat = corridorGeometry._vertexFormat;
1282
- const params = {
1283
- ellipsoid: ellipsoid,
1284
- positions: cleanPositions,
1285
- width: width,
1286
- cornerType: corridorGeometry._cornerType,
1287
- granularity: corridorGeometry._granularity,
1288
- saveAttributes: true,
1289
- };
1290
- let attr;
1291
- if (extrude) {
1292
- params.height = height;
1293
- params.extrudedHeight = extrudedHeight;
1294
- params.shadowVolume = corridorGeometry._shadowVolume;
1295
- params.offsetAttribute = corridorGeometry._offsetAttribute;
1296
- attr = computePositionsExtruded(params, vertexFormat);
1297
- } else {
1298
- const computedPositions = CorridorGeometryLibrary.CorridorGeometryLibrary.computePositions(params);
1299
- attr = combine(computedPositions, vertexFormat, ellipsoid);
1300
- attr.attributes.position.values = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
1301
- attr.attributes.position.values,
1302
- height,
1303
- ellipsoid
1304
- );
1305
-
1306
- if (defaultValue.defined(corridorGeometry._offsetAttribute)) {
1307
- const applyOffsetValue =
1308
- corridorGeometry._offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE
1309
- ? 0
1310
- : 1;
1311
- const length = attr.attributes.position.values.length;
1312
- const applyOffset = new Uint8Array(length / 3).fill(applyOffsetValue);
1313
- attr.attributes.applyOffset = new GeometryAttribute.GeometryAttribute({
1314
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
1315
- componentsPerAttribute: 1,
1316
- values: applyOffset,
1317
- });
1224
+ rectangle: {
1225
+ get: function() {
1226
+ if (!defined_default(this._rectangle)) {
1227
+ this._rectangle = computeRectangle(
1228
+ this._positions,
1229
+ this._ellipsoid,
1230
+ this._width,
1231
+ this._cornerType
1232
+ );
1318
1233
  }
1234
+ return this._rectangle;
1319
1235
  }
1320
- const attributes = attr.attributes;
1321
- const boundingSphere = Transforms.BoundingSphere.fromVertices(
1322
- attributes.position.values,
1323
- undefined,
1324
- 3
1325
- );
1326
- if (!vertexFormat.position) {
1327
- attr.attributes.position.values = undefined;
1328
- }
1329
-
1330
- return new GeometryAttribute.Geometry({
1331
- attributes: attributes,
1332
- indices: attr.indices,
1333
- primitiveType: GeometryAttribute.PrimitiveType.TRIANGLES,
1334
- boundingSphere: boundingSphere,
1335
- offsetAttribute: corridorGeometry._offsetAttribute,
1336
- });
1337
- };
1338
-
1236
+ },
1339
1237
  /**
1238
+ * For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
1239
+ *
1240
+ * Corridors don't support stRotation,
1241
+ * so just return the corners of the original system.
1340
1242
  * @private
1341
1243
  */
1342
- CorridorGeometry.createShadowVolume = function (
1343
- corridorGeometry,
1344
- minHeightFunc,
1345
- maxHeightFunc
1346
- ) {
1347
- const granularity = corridorGeometry._granularity;
1348
- const ellipsoid = corridorGeometry._ellipsoid;
1349
-
1350
- const minHeight = minHeightFunc(granularity, ellipsoid);
1351
- const maxHeight = maxHeightFunc(granularity, ellipsoid);
1352
-
1353
- return new CorridorGeometry({
1354
- positions: corridorGeometry._positions,
1355
- width: corridorGeometry._width,
1356
- cornerType: corridorGeometry._cornerType,
1357
- ellipsoid: ellipsoid,
1358
- granularity: granularity,
1359
- extrudedHeight: minHeight,
1360
- height: maxHeight,
1361
- vertexFormat: VertexFormat.VertexFormat.POSITION_ONLY,
1362
- shadowVolume: true,
1363
- });
1364
- };
1365
-
1366
- Object.defineProperties(CorridorGeometry.prototype, {
1367
- /**
1368
- * @private
1369
- */
1370
- rectangle: {
1371
- get: function () {
1372
- if (!defaultValue.defined(this._rectangle)) {
1373
- this._rectangle = computeRectangle(
1374
- this._positions,
1375
- this._ellipsoid,
1376
- this._width,
1377
- this._cornerType
1378
- );
1379
- }
1380
- return this._rectangle;
1381
- },
1382
- },
1383
- /**
1384
- * For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
1385
- *
1386
- * Corridors don't support stRotation,
1387
- * so just return the corners of the original system.
1388
- * @private
1389
- */
1390
- textureCoordinateRotationPoints: {
1391
- get: function () {
1392
- return [0, 0, 0, 1, 1, 0];
1393
- },
1394
- },
1395
- });
1396
-
1397
- function createCorridorGeometry(corridorGeometry, offset) {
1398
- if (defaultValue.defined(offset)) {
1399
- corridorGeometry = CorridorGeometry.unpack(corridorGeometry, offset);
1244
+ textureCoordinateRotationPoints: {
1245
+ get: function() {
1246
+ return [0, 0, 0, 1, 1, 0];
1400
1247
  }
1401
- corridorGeometry._ellipsoid = Matrix3.Ellipsoid.clone(corridorGeometry._ellipsoid);
1402
- return CorridorGeometry.createGeometry(corridorGeometry);
1403
1248
  }
1249
+ });
1250
+ var CorridorGeometry_default = CorridorGeometry;
1404
1251
 
1405
- return createCorridorGeometry;
1406
-
1407
- }));
1252
+ // packages/engine/Source/Workers/createCorridorGeometry.js
1253
+ function createCorridorGeometry(corridorGeometry, offset) {
1254
+ if (defined_default(offset)) {
1255
+ corridorGeometry = CorridorGeometry_default.unpack(corridorGeometry, offset);
1256
+ }
1257
+ corridorGeometry._ellipsoid = Ellipsoid_default.clone(corridorGeometry._ellipsoid);
1258
+ return CorridorGeometry_default.createGeometry(corridorGeometry);
1259
+ }
1260
+ var createCorridorGeometry_default = createCorridorGeometry;
1261
+ export {
1262
+ createCorridorGeometry_default as default
1263
+ };