@gmgis/gm-sdk 1.12.5 → 2.0.2

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 (159) hide show
  1. package/dist/dist/index.js +1848 -0
  2. package/dist/gm.min.js +16983 -16483
  3. package/dist/index.js +1436 -1434
  4. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  5. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  7. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  8. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  9. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  10. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  11. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  12. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  13. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  14. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  15. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  16. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  17. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  18. package/dist/resources/Workers/{chunk-I2ITFFPX.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-PRGYLLJT.js → chunk-ARG42DC4.js} +2 -31
  21. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  22. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  23. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  24. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  25. package/dist/resources/Workers/{chunk-DI5NGJUP.js → chunk-D6AA5QVT.js} +2 -20
  26. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  27. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  28. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  29. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  30. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  31. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  32. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  33. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  34. package/dist/resources/Workers/{chunk-7JO7GPJN.js → chunk-GBYLG25F.js} +2 -15
  35. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  36. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  37. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  38. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  39. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  40. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  41. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  42. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  43. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  44. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  45. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  46. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  47. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  48. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  49. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  50. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  51. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  52. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  53. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  54. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  55. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  56. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  57. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  58. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  59. package/dist/resources/Workers/{chunk-6CHGCNMW.js → chunk-WZDE3RYP.js} +4 -34
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -40
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -32
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -209
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -175
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -121
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -481
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -199
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1237
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -542
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -34
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -205
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -45
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -38
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -33
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -35
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -32
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -210
  78. package/dist/resources/Workers/createGeometry.js +2 -144
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1582
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -198
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -98
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1381
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -509
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -470
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -354
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -251
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1246
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -453
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -374
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -92
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -92
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -466
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -361
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -359
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -236
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -539
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2252
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -729
  101. package/dist/resources/Workers/createWallGeometry.js +2 -464
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -312
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2642
  105. package/dist/resources/Workers/decodeI3S.js +2 -1319
  106. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  107. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  108. package/dist/resources/Workers/transcodeKTX2.js +29 -3360
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -793
  111. package/package.json +74 -74
  112. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  113. package/dist/resources/Workers/chunk-26GA3JAM.js +0 -139
  114. package/dist/resources/Workers/chunk-27HUZ7SA.js +0 -305
  115. package/dist/resources/Workers/chunk-2ZGOQXYU.js +0 -171
  116. package/dist/resources/Workers/chunk-3Q2L65QU.js +0 -1258
  117. package/dist/resources/Workers/chunk-472HQ3EH.js +0 -100
  118. package/dist/resources/Workers/chunk-5ODQSF26.js +0 -101
  119. package/dist/resources/Workers/chunk-5OOFQLKF.js +0 -634
  120. package/dist/resources/Workers/chunk-5PTXS2GO.js +0 -10390
  121. package/dist/resources/Workers/chunk-76BYBWHP.js +0 -122
  122. package/dist/resources/Workers/chunk-7BMOHCPM.js +0 -390
  123. package/dist/resources/Workers/chunk-7KTQP4VB.js +0 -59
  124. package/dist/resources/Workers/chunk-7O373FFS.js +0 -665
  125. package/dist/resources/Workers/chunk-AD63PIY6.js +0 -163
  126. package/dist/resources/Workers/chunk-BHQJ2NT7.js +0 -353
  127. package/dist/resources/Workers/chunk-C6YYBQXW.js +0 -102
  128. package/dist/resources/Workers/chunk-CKY7HOHV.js +0 -287
  129. package/dist/resources/Workers/chunk-DHYHSFFJ.js +0 -73
  130. package/dist/resources/Workers/chunk-E27BLMDD.js +0 -115
  131. package/dist/resources/Workers/chunk-E63IIM5T.js +0 -75
  132. package/dist/resources/Workers/chunk-E6V6SQZW.js +0 -456
  133. package/dist/resources/Workers/chunk-EJZTDTUH.js +0 -138
  134. package/dist/resources/Workers/chunk-FDOV2LBJ.js +0 -220
  135. package/dist/resources/Workers/chunk-FIGIZHAQ.js +0 -684
  136. package/dist/resources/Workers/chunk-GESF4OXQ.js +0 -1800
  137. package/dist/resources/Workers/chunk-GGZJN2TI.js +0 -2717
  138. package/dist/resources/Workers/chunk-GNBFYG7F.js +0 -1481
  139. package/dist/resources/Workers/chunk-GWCFU2SA.js +0 -300
  140. package/dist/resources/Workers/chunk-IBLIYJZR.js +0 -196
  141. package/dist/resources/Workers/chunk-JW4FOI6M.js +0 -476
  142. package/dist/resources/Workers/chunk-K4GQUNB5.js +0 -262
  143. package/dist/resources/Workers/chunk-M3GMB5OP.js +0 -834
  144. package/dist/resources/Workers/chunk-MXIZJAPH.js +0 -629
  145. package/dist/resources/Workers/chunk-N5KJGGCM.js +0 -1073
  146. package/dist/resources/Workers/chunk-NGPPMXRM.js +0 -435
  147. package/dist/resources/Workers/chunk-O3E4OAOE.js +0 -511
  148. package/dist/resources/Workers/chunk-PGRPDNHG.js +0 -1048
  149. package/dist/resources/Workers/chunk-S6MRMMQU.js +0 -157
  150. package/dist/resources/Workers/chunk-SMDOP47J.js +0 -945
  151. package/dist/resources/Workers/chunk-TGONEMZO.js +0 -421
  152. package/dist/resources/Workers/chunk-TKVT5GQM.js +0 -781
  153. package/dist/resources/Workers/chunk-U72QNFOJ.js +0 -758
  154. package/dist/resources/Workers/chunk-VJZB3WAV.js +0 -963
  155. package/dist/resources/Workers/chunk-VU2MNO7L.js +0 -239
  156. package/dist/resources/Workers/chunk-XY4BATBS.js +0 -500
  157. package/dist/resources/Workers/chunk-YFXQECWV.js +0 -2857
  158. package/dist/resources/Workers/chunk-YSGTGQQO.js +0 -398
  159. package/dist/resources/Workers/chunk-YZ733KKS.js +0 -368
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
4
+ * Version 1.132
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -23,1239 +23,4 @@
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
25
 
26
- import {
27
- CorridorGeometryLibrary_default
28
- } from "./chunk-JW4FOI6M.js";
29
- import {
30
- CornerType_default
31
- } from "./chunk-7O373FFS.js";
32
- import "./chunk-TGONEMZO.js";
33
- import "./chunk-BHQJ2NT7.js";
34
- import {
35
- GeometryOffsetAttribute_default
36
- } from "./chunk-I2ITFFPX.js";
37
- import {
38
- VertexFormat_default
39
- } from "./chunk-EJZTDTUH.js";
40
- import "./chunk-CKY7HOHV.js";
41
- import "./chunk-S6MRMMQU.js";
42
- import {
43
- PolygonPipeline_default
44
- } from "./chunk-SMDOP47J.js";
45
- import {
46
- arrayRemoveDuplicates_default
47
- } from "./chunk-472HQ3EH.js";
48
- import "./chunk-E6V6SQZW.js";
49
- import "./chunk-3Q2L65QU.js";
50
- import "./chunk-2ZGOQXYU.js";
51
- import {
52
- IndexDatatype_default
53
- } from "./chunk-26GA3JAM.js";
54
- import {
55
- GeometryAttributes_default
56
- } from "./chunk-DI5NGJUP.js";
57
- import {
58
- GeometryAttribute_default,
59
- Geometry_default,
60
- PrimitiveType_default
61
- } from "./chunk-GWCFU2SA.js";
62
- import {
63
- BoundingSphere_default
64
- } from "./chunk-VJZB3WAV.js";
65
- import {
66
- Rectangle_default
67
- } from "./chunk-5PTXS2GO.js";
68
- import {
69
- ComponentDatatype_default
70
- } from "./chunk-K4GQUNB5.js";
71
- import {
72
- Cartesian3_default,
73
- Cartographic_default,
74
- Ellipsoid_default
75
- } from "./chunk-YFXQECWV.js";
76
- import {
77
- Math_default
78
- } from "./chunk-XY4BATBS.js";
79
- import "./chunk-MXIZJAPH.js";
80
- import "./chunk-6CHGCNMW.js";
81
- import {
82
- defaultValue_default
83
- } from "./chunk-7JO7GPJN.js";
84
- import {
85
- Check_default
86
- } from "./chunk-AD63PIY6.js";
87
- import {
88
- defined_default
89
- } from "./chunk-E63IIM5T.js";
90
-
91
- // packages/engine/Source/Core/CorridorGeometry.js
92
- var cartesian1 = new Cartesian3_default();
93
- var cartesian2 = new Cartesian3_default();
94
- var cartesian3 = new Cartesian3_default();
95
- var cartesian4 = new Cartesian3_default();
96
- var cartesian5 = new Cartesian3_default();
97
- var cartesian6 = new Cartesian3_default();
98
- var scratch1 = new Cartesian3_default();
99
- var scratch2 = new Cartesian3_default();
100
- function scaleToSurface(positions, ellipsoid) {
101
- for (let i = 0; i < positions.length; i++) {
102
- positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
103
- }
104
- return positions;
105
- }
106
- function addNormals(attr, normal, left, front, back, vertexFormat) {
107
- const normals = attr.normals;
108
- const tangents = attr.tangents;
109
- const bitangents = attr.bitangents;
110
- const forward = Cartesian3_default.normalize(
111
- Cartesian3_default.cross(left, normal, scratch1),
112
- scratch1
113
- );
114
- if (vertexFormat.normal) {
115
- CorridorGeometryLibrary_default.addAttribute(normals, normal, front, back);
116
- }
117
- if (vertexFormat.tangent) {
118
- CorridorGeometryLibrary_default.addAttribute(tangents, forward, front, back);
119
- }
120
- if (vertexFormat.bitangent) {
121
- CorridorGeometryLibrary_default.addAttribute(bitangents, left, front, back);
122
- }
123
- }
124
- function combine(computedPositions, vertexFormat, ellipsoid) {
125
- const positions = computedPositions.positions;
126
- const corners = computedPositions.corners;
127
- const endPositions = computedPositions.endPositions;
128
- const computedLefts = computedPositions.lefts;
129
- const computedNormals = computedPositions.normals;
130
- const attributes = new GeometryAttributes_default();
131
- let corner;
132
- let leftCount = 0;
133
- let rightCount = 0;
134
- let i;
135
- let indicesLength = 0;
136
- let length;
137
- for (i = 0; i < positions.length; i += 2) {
138
- length = positions[i].length - 3;
139
- leftCount += length;
140
- indicesLength += length * 2;
141
- rightCount += positions[i + 1].length - 3;
142
- }
143
- leftCount += 3;
144
- rightCount += 3;
145
- for (i = 0; i < corners.length; i++) {
146
- corner = corners[i];
147
- const leftSide = corners[i].leftPositions;
148
- if (defined_default(leftSide)) {
149
- length = leftSide.length;
150
- leftCount += length;
151
- indicesLength += length;
152
- } else {
153
- length = corners[i].rightPositions.length;
154
- rightCount += length;
155
- indicesLength += length;
156
- }
157
- }
158
- const addEndPositions = defined_default(endPositions);
159
- let endPositionLength;
160
- if (addEndPositions) {
161
- endPositionLength = endPositions[0].length - 3;
162
- leftCount += endPositionLength;
163
- rightCount += endPositionLength;
164
- endPositionLength /= 3;
165
- indicesLength += endPositionLength * 6;
166
- }
167
- const size = leftCount + rightCount;
168
- const finalPositions = new Float64Array(size);
169
- const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
170
- const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
171
- const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
172
- const attr = {
173
- normals,
174
- tangents,
175
- bitangents
176
- };
177
- let front = 0;
178
- let back = size - 1;
179
- let UL, LL, UR, LR;
180
- let normal = cartesian1;
181
- let left = cartesian2;
182
- let rightPos, leftPos;
183
- const halfLength = endPositionLength / 2;
184
- const indices = IndexDatatype_default.createTypedArray(size / 3, indicesLength);
185
- let index = 0;
186
- if (addEndPositions) {
187
- leftPos = cartesian3;
188
- rightPos = cartesian4;
189
- const firstEndPositions = endPositions[0];
190
- normal = Cartesian3_default.fromArray(computedNormals, 0, normal);
191
- left = Cartesian3_default.fromArray(computedLefts, 0, left);
192
- for (i = 0; i < halfLength; i++) {
193
- leftPos = Cartesian3_default.fromArray(
194
- firstEndPositions,
195
- (halfLength - 1 - i) * 3,
196
- leftPos
197
- );
198
- rightPos = Cartesian3_default.fromArray(
199
- firstEndPositions,
200
- (halfLength + i) * 3,
201
- rightPos
202
- );
203
- CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
204
- CorridorGeometryLibrary_default.addAttribute(
205
- finalPositions,
206
- leftPos,
207
- void 0,
208
- back
209
- );
210
- addNormals(attr, normal, left, front, back, vertexFormat);
211
- LL = front / 3;
212
- LR = LL + 1;
213
- UL = (back - 2) / 3;
214
- UR = UL - 1;
215
- indices[index++] = UL;
216
- indices[index++] = LL;
217
- indices[index++] = UR;
218
- indices[index++] = UR;
219
- indices[index++] = LL;
220
- indices[index++] = LR;
221
- front += 3;
222
- back -= 3;
223
- }
224
- }
225
- let posIndex = 0;
226
- let compIndex = 0;
227
- let rightEdge = positions[posIndex++];
228
- let leftEdge = positions[posIndex++];
229
- finalPositions.set(rightEdge, front);
230
- finalPositions.set(leftEdge, back - leftEdge.length + 1);
231
- left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
232
- let rightNormal;
233
- let leftNormal;
234
- length = leftEdge.length - 3;
235
- for (i = 0; i < length; i += 3) {
236
- rightNormal = ellipsoid.geodeticSurfaceNormal(
237
- Cartesian3_default.fromArray(rightEdge, i, scratch1),
238
- scratch1
239
- );
240
- leftNormal = ellipsoid.geodeticSurfaceNormal(
241
- Cartesian3_default.fromArray(leftEdge, length - i, scratch2),
242
- scratch2
243
- );
244
- normal = Cartesian3_default.normalize(
245
- Cartesian3_default.add(rightNormal, leftNormal, normal),
246
- normal
247
- );
248
- addNormals(attr, normal, left, front, back, vertexFormat);
249
- LL = front / 3;
250
- LR = LL + 1;
251
- UL = (back - 2) / 3;
252
- UR = UL - 1;
253
- indices[index++] = UL;
254
- indices[index++] = LL;
255
- indices[index++] = UR;
256
- indices[index++] = UR;
257
- indices[index++] = LL;
258
- indices[index++] = LR;
259
- front += 3;
260
- back -= 3;
261
- }
262
- rightNormal = ellipsoid.geodeticSurfaceNormal(
263
- Cartesian3_default.fromArray(rightEdge, length, scratch1),
264
- scratch1
265
- );
266
- leftNormal = ellipsoid.geodeticSurfaceNormal(
267
- Cartesian3_default.fromArray(leftEdge, length, scratch2),
268
- scratch2
269
- );
270
- normal = Cartesian3_default.normalize(
271
- Cartesian3_default.add(rightNormal, leftNormal, normal),
272
- normal
273
- );
274
- compIndex += 3;
275
- for (i = 0; i < corners.length; i++) {
276
- let j;
277
- corner = corners[i];
278
- const l = corner.leftPositions;
279
- const r = corner.rightPositions;
280
- let pivot;
281
- let start;
282
- let outsidePoint = cartesian6;
283
- let previousPoint = cartesian3;
284
- let nextPoint = cartesian4;
285
- normal = Cartesian3_default.fromArray(computedNormals, compIndex, normal);
286
- if (defined_default(l)) {
287
- addNormals(attr, normal, left, void 0, back, vertexFormat);
288
- back -= 3;
289
- pivot = LR;
290
- start = UR;
291
- for (j = 0; j < l.length / 3; j++) {
292
- outsidePoint = Cartesian3_default.fromArray(l, j * 3, outsidePoint);
293
- indices[index++] = pivot;
294
- indices[index++] = start - j - 1;
295
- indices[index++] = start - j;
296
- CorridorGeometryLibrary_default.addAttribute(
297
- finalPositions,
298
- outsidePoint,
299
- void 0,
300
- back
301
- );
302
- previousPoint = Cartesian3_default.fromArray(
303
- finalPositions,
304
- (start - j - 1) * 3,
305
- previousPoint
306
- );
307
- nextPoint = Cartesian3_default.fromArray(finalPositions, pivot * 3, nextPoint);
308
- left = Cartesian3_default.normalize(
309
- Cartesian3_default.subtract(previousPoint, nextPoint, left),
310
- left
311
- );
312
- addNormals(attr, normal, left, void 0, back, vertexFormat);
313
- back -= 3;
314
- }
315
- outsidePoint = Cartesian3_default.fromArray(
316
- finalPositions,
317
- pivot * 3,
318
- outsidePoint
319
- );
320
- previousPoint = Cartesian3_default.subtract(
321
- Cartesian3_default.fromArray(finalPositions, start * 3, previousPoint),
322
- outsidePoint,
323
- previousPoint
324
- );
325
- nextPoint = Cartesian3_default.subtract(
326
- Cartesian3_default.fromArray(finalPositions, (start - j) * 3, nextPoint),
327
- outsidePoint,
328
- nextPoint
329
- );
330
- left = Cartesian3_default.normalize(
331
- Cartesian3_default.add(previousPoint, nextPoint, left),
332
- left
333
- );
334
- addNormals(attr, normal, left, front, void 0, vertexFormat);
335
- front += 3;
336
- } else {
337
- addNormals(attr, normal, left, front, void 0, vertexFormat);
338
- front += 3;
339
- pivot = UR;
340
- start = LR;
341
- for (j = 0; j < r.length / 3; j++) {
342
- outsidePoint = Cartesian3_default.fromArray(r, j * 3, outsidePoint);
343
- indices[index++] = pivot;
344
- indices[index++] = start + j;
345
- indices[index++] = start + j + 1;
346
- CorridorGeometryLibrary_default.addAttribute(
347
- finalPositions,
348
- outsidePoint,
349
- front
350
- );
351
- previousPoint = Cartesian3_default.fromArray(
352
- finalPositions,
353
- pivot * 3,
354
- previousPoint
355
- );
356
- nextPoint = Cartesian3_default.fromArray(
357
- finalPositions,
358
- (start + j) * 3,
359
- nextPoint
360
- );
361
- left = Cartesian3_default.normalize(
362
- Cartesian3_default.subtract(previousPoint, nextPoint, left),
363
- left
364
- );
365
- addNormals(attr, normal, left, front, void 0, vertexFormat);
366
- front += 3;
367
- }
368
- outsidePoint = Cartesian3_default.fromArray(
369
- finalPositions,
370
- pivot * 3,
371
- outsidePoint
372
- );
373
- previousPoint = Cartesian3_default.subtract(
374
- Cartesian3_default.fromArray(finalPositions, (start + j) * 3, previousPoint),
375
- outsidePoint,
376
- previousPoint
377
- );
378
- nextPoint = Cartesian3_default.subtract(
379
- Cartesian3_default.fromArray(finalPositions, start * 3, nextPoint),
380
- outsidePoint,
381
- nextPoint
382
- );
383
- left = Cartesian3_default.normalize(
384
- Cartesian3_default.negate(Cartesian3_default.add(nextPoint, previousPoint, left), left),
385
- left
386
- );
387
- addNormals(attr, normal, left, void 0, back, vertexFormat);
388
- back -= 3;
389
- }
390
- rightEdge = positions[posIndex++];
391
- leftEdge = positions[posIndex++];
392
- rightEdge.splice(0, 3);
393
- leftEdge.splice(leftEdge.length - 3, 3);
394
- finalPositions.set(rightEdge, front);
395
- finalPositions.set(leftEdge, back - leftEdge.length + 1);
396
- length = leftEdge.length - 3;
397
- compIndex += 3;
398
- left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
399
- for (j = 0; j < leftEdge.length; j += 3) {
400
- rightNormal = ellipsoid.geodeticSurfaceNormal(
401
- Cartesian3_default.fromArray(rightEdge, j, scratch1),
402
- scratch1
403
- );
404
- leftNormal = ellipsoid.geodeticSurfaceNormal(
405
- Cartesian3_default.fromArray(leftEdge, length - j, scratch2),
406
- scratch2
407
- );
408
- normal = Cartesian3_default.normalize(
409
- Cartesian3_default.add(rightNormal, leftNormal, normal),
410
- normal
411
- );
412
- addNormals(attr, normal, left, front, back, vertexFormat);
413
- LR = front / 3;
414
- LL = LR - 1;
415
- UR = (back - 2) / 3;
416
- UL = UR + 1;
417
- indices[index++] = UL;
418
- indices[index++] = LL;
419
- indices[index++] = UR;
420
- indices[index++] = UR;
421
- indices[index++] = LL;
422
- indices[index++] = LR;
423
- front += 3;
424
- back -= 3;
425
- }
426
- front -= 3;
427
- back += 3;
428
- }
429
- normal = Cartesian3_default.fromArray(
430
- computedNormals,
431
- computedNormals.length - 3,
432
- normal
433
- );
434
- addNormals(attr, normal, left, front, back, vertexFormat);
435
- if (addEndPositions) {
436
- front += 3;
437
- back -= 3;
438
- leftPos = cartesian3;
439
- rightPos = cartesian4;
440
- const lastEndPositions = endPositions[1];
441
- for (i = 0; i < halfLength; i++) {
442
- leftPos = Cartesian3_default.fromArray(
443
- lastEndPositions,
444
- (endPositionLength - i - 1) * 3,
445
- leftPos
446
- );
447
- rightPos = Cartesian3_default.fromArray(lastEndPositions, i * 3, rightPos);
448
- CorridorGeometryLibrary_default.addAttribute(
449
- finalPositions,
450
- leftPos,
451
- void 0,
452
- back
453
- );
454
- CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
455
- addNormals(attr, normal, left, front, back, vertexFormat);
456
- LR = front / 3;
457
- LL = LR - 1;
458
- UR = (back - 2) / 3;
459
- UL = UR + 1;
460
- indices[index++] = UL;
461
- indices[index++] = LL;
462
- indices[index++] = UR;
463
- indices[index++] = UR;
464
- indices[index++] = LL;
465
- indices[index++] = LR;
466
- front += 3;
467
- back -= 3;
468
- }
469
- }
470
- attributes.position = new GeometryAttribute_default({
471
- componentDatatype: ComponentDatatype_default.DOUBLE,
472
- componentsPerAttribute: 3,
473
- values: finalPositions
474
- });
475
- if (vertexFormat.st) {
476
- const st = new Float32Array(size / 3 * 2);
477
- let rightSt;
478
- let leftSt;
479
- let stIndex = 0;
480
- if (addEndPositions) {
481
- leftCount /= 3;
482
- rightCount /= 3;
483
- const theta = Math.PI / (endPositionLength + 1);
484
- leftSt = 1 / (leftCount - endPositionLength + 1);
485
- rightSt = 1 / (rightCount - endPositionLength + 1);
486
- let a;
487
- const halfEndPos = endPositionLength / 2;
488
- for (i = halfEndPos + 1; i < endPositionLength + 1; i++) {
489
- a = Math_default.PI_OVER_TWO + theta * i;
490
- st[stIndex++] = rightSt * (1 + Math.cos(a));
491
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
492
- }
493
- for (i = 1; i < rightCount - endPositionLength + 1; i++) {
494
- st[stIndex++] = i * rightSt;
495
- st[stIndex++] = 0;
496
- }
497
- for (i = endPositionLength; i > halfEndPos; i--) {
498
- a = Math_default.PI_OVER_TWO - i * theta;
499
- st[stIndex++] = 1 - rightSt * (1 + Math.cos(a));
500
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
501
- }
502
- for (i = halfEndPos; i > 0; i--) {
503
- a = Math_default.PI_OVER_TWO - theta * i;
504
- st[stIndex++] = 1 - leftSt * (1 + Math.cos(a));
505
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
506
- }
507
- for (i = leftCount - endPositionLength; i > 0; i--) {
508
- st[stIndex++] = i * leftSt;
509
- st[stIndex++] = 1;
510
- }
511
- for (i = 1; i < halfEndPos + 1; i++) {
512
- a = Math_default.PI_OVER_TWO + theta * i;
513
- st[stIndex++] = leftSt * (1 + Math.cos(a));
514
- st[stIndex++] = 0.5 * (1 + Math.sin(a));
515
- }
516
- } else {
517
- leftCount /= 3;
518
- rightCount /= 3;
519
- leftSt = 1 / (leftCount - 1);
520
- rightSt = 1 / (rightCount - 1);
521
- for (i = 0; i < rightCount; i++) {
522
- st[stIndex++] = i * rightSt;
523
- st[stIndex++] = 0;
524
- }
525
- for (i = leftCount; i > 0; i--) {
526
- st[stIndex++] = (i - 1) * leftSt;
527
- st[stIndex++] = 1;
528
- }
529
- }
530
- attributes.st = new GeometryAttribute_default({
531
- componentDatatype: ComponentDatatype_default.FLOAT,
532
- componentsPerAttribute: 2,
533
- values: st
534
- });
535
- }
536
- if (vertexFormat.normal) {
537
- attributes.normal = new GeometryAttribute_default({
538
- componentDatatype: ComponentDatatype_default.FLOAT,
539
- componentsPerAttribute: 3,
540
- values: attr.normals
541
- });
542
- }
543
- if (vertexFormat.tangent) {
544
- attributes.tangent = new GeometryAttribute_default({
545
- componentDatatype: ComponentDatatype_default.FLOAT,
546
- componentsPerAttribute: 3,
547
- values: attr.tangents
548
- });
549
- }
550
- if (vertexFormat.bitangent) {
551
- attributes.bitangent = new GeometryAttribute_default({
552
- componentDatatype: ComponentDatatype_default.FLOAT,
553
- componentsPerAttribute: 3,
554
- values: attr.bitangents
555
- });
556
- }
557
- return {
558
- attributes,
559
- indices
560
- };
561
- }
562
- function extrudedAttributes(attributes, vertexFormat) {
563
- if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
564
- return attributes;
565
- }
566
- const positions = attributes.position.values;
567
- let topNormals;
568
- let topBitangents;
569
- if (vertexFormat.normal || vertexFormat.bitangent) {
570
- topNormals = attributes.normal.values;
571
- topBitangents = attributes.bitangent.values;
572
- }
573
- const size = attributes.position.values.length / 18;
574
- const threeSize = size * 3;
575
- const twoSize = size * 2;
576
- const sixSize = threeSize * 2;
577
- let i;
578
- if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
579
- const normals = vertexFormat.normal ? new Float32Array(threeSize * 6) : void 0;
580
- const tangents = vertexFormat.tangent ? new Float32Array(threeSize * 6) : void 0;
581
- const bitangents = vertexFormat.bitangent ? new Float32Array(threeSize * 6) : void 0;
582
- let topPosition = cartesian1;
583
- let bottomPosition = cartesian2;
584
- let previousPosition = cartesian3;
585
- let normal = cartesian4;
586
- let tangent = cartesian5;
587
- let bitangent = cartesian6;
588
- let attrIndex = sixSize;
589
- for (i = 0; i < threeSize; i += 3) {
590
- const attrIndexOffset = attrIndex + sixSize;
591
- topPosition = Cartesian3_default.fromArray(positions, i, topPosition);
592
- bottomPosition = Cartesian3_default.fromArray(
593
- positions,
594
- i + threeSize,
595
- bottomPosition
596
- );
597
- previousPosition = Cartesian3_default.fromArray(
598
- positions,
599
- (i + 3) % threeSize,
600
- previousPosition
601
- );
602
- bottomPosition = Cartesian3_default.subtract(
603
- bottomPosition,
604
- topPosition,
605
- bottomPosition
606
- );
607
- previousPosition = Cartesian3_default.subtract(
608
- previousPosition,
609
- topPosition,
610
- previousPosition
611
- );
612
- normal = Cartesian3_default.normalize(
613
- Cartesian3_default.cross(bottomPosition, previousPosition, normal),
614
- normal
615
- );
616
- if (vertexFormat.normal) {
617
- CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndexOffset);
618
- CorridorGeometryLibrary_default.addAttribute(
619
- normals,
620
- normal,
621
- attrIndexOffset + 3
622
- );
623
- CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex);
624
- CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex + 3);
625
- }
626
- if (vertexFormat.tangent || vertexFormat.bitangent) {
627
- bitangent = Cartesian3_default.fromArray(topNormals, i, bitangent);
628
- if (vertexFormat.bitangent) {
629
- CorridorGeometryLibrary_default.addAttribute(
630
- bitangents,
631
- bitangent,
632
- attrIndexOffset
633
- );
634
- CorridorGeometryLibrary_default.addAttribute(
635
- bitangents,
636
- bitangent,
637
- attrIndexOffset + 3
638
- );
639
- CorridorGeometryLibrary_default.addAttribute(
640
- bitangents,
641
- bitangent,
642
- attrIndex
643
- );
644
- CorridorGeometryLibrary_default.addAttribute(
645
- bitangents,
646
- bitangent,
647
- attrIndex + 3
648
- );
649
- }
650
- if (vertexFormat.tangent) {
651
- tangent = Cartesian3_default.normalize(
652
- Cartesian3_default.cross(bitangent, normal, tangent),
653
- tangent
654
- );
655
- CorridorGeometryLibrary_default.addAttribute(
656
- tangents,
657
- tangent,
658
- attrIndexOffset
659
- );
660
- CorridorGeometryLibrary_default.addAttribute(
661
- tangents,
662
- tangent,
663
- attrIndexOffset + 3
664
- );
665
- CorridorGeometryLibrary_default.addAttribute(tangents, tangent, attrIndex);
666
- CorridorGeometryLibrary_default.addAttribute(
667
- tangents,
668
- tangent,
669
- attrIndex + 3
670
- );
671
- }
672
- }
673
- attrIndex += 6;
674
- }
675
- if (vertexFormat.normal) {
676
- normals.set(topNormals);
677
- for (i = 0; i < threeSize; i += 3) {
678
- normals[i + threeSize] = -topNormals[i];
679
- normals[i + threeSize + 1] = -topNormals[i + 1];
680
- normals[i + threeSize + 2] = -topNormals[i + 2];
681
- }
682
- attributes.normal.values = normals;
683
- } else {
684
- attributes.normal = void 0;
685
- }
686
- if (vertexFormat.bitangent) {
687
- bitangents.set(topBitangents);
688
- bitangents.set(topBitangents, threeSize);
689
- attributes.bitangent.values = bitangents;
690
- } else {
691
- attributes.bitangent = void 0;
692
- }
693
- if (vertexFormat.tangent) {
694
- const topTangents = attributes.tangent.values;
695
- tangents.set(topTangents);
696
- tangents.set(topTangents, threeSize);
697
- attributes.tangent.values = tangents;
698
- }
699
- }
700
- if (vertexFormat.st) {
701
- const topSt = attributes.st.values;
702
- const st = new Float32Array(twoSize * 6);
703
- st.set(topSt);
704
- st.set(topSt, twoSize);
705
- let index = twoSize * 2;
706
- for (let j = 0; j < 2; j++) {
707
- st[index++] = topSt[0];
708
- st[index++] = topSt[1];
709
- for (i = 2; i < twoSize; i += 2) {
710
- const s = topSt[i];
711
- const t = topSt[i + 1];
712
- st[index++] = s;
713
- st[index++] = t;
714
- st[index++] = s;
715
- st[index++] = t;
716
- }
717
- st[index++] = topSt[0];
718
- st[index++] = topSt[1];
719
- }
720
- attributes.st.values = st;
721
- }
722
- return attributes;
723
- }
724
- function addWallPositions(positions, index, wallPositions) {
725
- wallPositions[index++] = positions[0];
726
- wallPositions[index++] = positions[1];
727
- wallPositions[index++] = positions[2];
728
- for (let i = 3; i < positions.length; i += 3) {
729
- const x = positions[i];
730
- const y = positions[i + 1];
731
- const z = positions[i + 2];
732
- wallPositions[index++] = x;
733
- wallPositions[index++] = y;
734
- wallPositions[index++] = z;
735
- wallPositions[index++] = x;
736
- wallPositions[index++] = y;
737
- wallPositions[index++] = z;
738
- }
739
- wallPositions[index++] = positions[0];
740
- wallPositions[index++] = positions[1];
741
- wallPositions[index++] = positions[2];
742
- return wallPositions;
743
- }
744
- function computePositionsExtruded(params, vertexFormat) {
745
- const topVertexFormat = new VertexFormat_default({
746
- position: vertexFormat.position,
747
- normal: vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
748
- tangent: vertexFormat.tangent,
749
- bitangent: vertexFormat.normal || vertexFormat.bitangent,
750
- st: vertexFormat.st
751
- });
752
- const ellipsoid = params.ellipsoid;
753
- const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
754
- const attr = combine(computedPositions, topVertexFormat, ellipsoid);
755
- const height = params.height;
756
- const extrudedHeight = params.extrudedHeight;
757
- let attributes = attr.attributes;
758
- const indices = attr.indices;
759
- let positions = attributes.position.values;
760
- let length = positions.length;
761
- const newPositions = new Float64Array(length * 6);
762
- let extrudedPositions = new Float64Array(length);
763
- extrudedPositions.set(positions);
764
- let wallPositions = new Float64Array(length * 4);
765
- positions = PolygonPipeline_default.scaleToGeodeticHeight(
766
- positions,
767
- height,
768
- ellipsoid
769
- );
770
- wallPositions = addWallPositions(positions, 0, wallPositions);
771
- extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
772
- extrudedPositions,
773
- extrudedHeight,
774
- ellipsoid
775
- );
776
- wallPositions = addWallPositions(
777
- extrudedPositions,
778
- length * 2,
779
- wallPositions
780
- );
781
- newPositions.set(positions);
782
- newPositions.set(extrudedPositions, length);
783
- newPositions.set(wallPositions, length * 2);
784
- attributes.position.values = newPositions;
785
- attributes = extrudedAttributes(attributes, vertexFormat);
786
- let i;
787
- const size = length / 3;
788
- if (params.shadowVolume) {
789
- const topNormals = attributes.normal.values;
790
- length = topNormals.length;
791
- let extrudeNormals = new Float32Array(length * 6);
792
- for (i = 0; i < length; i++) {
793
- topNormals[i] = -topNormals[i];
794
- }
795
- extrudeNormals.set(topNormals, length);
796
- extrudeNormals = addWallPositions(topNormals, length * 4, extrudeNormals);
797
- attributes.extrudeDirection = new GeometryAttribute_default({
798
- componentDatatype: ComponentDatatype_default.FLOAT,
799
- componentsPerAttribute: 3,
800
- values: extrudeNormals
801
- });
802
- if (!vertexFormat.normal) {
803
- attributes.normal = void 0;
804
- }
805
- }
806
- if (defined_default(params.offsetAttribute)) {
807
- let applyOffset = new Uint8Array(size * 6);
808
- if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
809
- applyOffset = applyOffset.fill(1, 0, size).fill(1, size * 2, size * 4);
810
- } else {
811
- const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
812
- applyOffset = applyOffset.fill(applyOffsetValue);
813
- }
814
- attributes.applyOffset = new GeometryAttribute_default({
815
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
816
- componentsPerAttribute: 1,
817
- values: applyOffset
818
- });
819
- }
820
- const iLength = indices.length;
821
- const twoSize = size + size;
822
- const newIndices = IndexDatatype_default.createTypedArray(
823
- newPositions.length / 3,
824
- iLength * 2 + twoSize * 3
825
- );
826
- newIndices.set(indices);
827
- let index = iLength;
828
- for (i = 0; i < iLength; i += 3) {
829
- const v0 = indices[i];
830
- const v1 = indices[i + 1];
831
- const v2 = indices[i + 2];
832
- newIndices[index++] = v2 + size;
833
- newIndices[index++] = v1 + size;
834
- newIndices[index++] = v0 + size;
835
- }
836
- let UL, LL, UR, LR;
837
- for (i = 0; i < twoSize; i += 2) {
838
- UL = i + twoSize;
839
- LL = UL + twoSize;
840
- UR = UL + 1;
841
- LR = LL + 1;
842
- newIndices[index++] = UL;
843
- newIndices[index++] = LL;
844
- newIndices[index++] = UR;
845
- newIndices[index++] = UR;
846
- newIndices[index++] = LL;
847
- newIndices[index++] = LR;
848
- }
849
- return {
850
- attributes,
851
- indices: newIndices
852
- };
853
- }
854
- var scratchCartesian1 = new Cartesian3_default();
855
- var scratchCartesian2 = new Cartesian3_default();
856
- var scratchCartographic = new Cartographic_default();
857
- function computeOffsetPoints(position1, position2, ellipsoid, halfWidth, min, max) {
858
- const direction = Cartesian3_default.subtract(
859
- position2,
860
- position1,
861
- scratchCartesian1
862
- );
863
- Cartesian3_default.normalize(direction, direction);
864
- const normal = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian2);
865
- const offsetDirection = Cartesian3_default.cross(
866
- direction,
867
- normal,
868
- scratchCartesian1
869
- );
870
- Cartesian3_default.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
871
- let minLat = min.latitude;
872
- let minLon = min.longitude;
873
- let maxLat = max.latitude;
874
- let maxLon = max.longitude;
875
- Cartesian3_default.add(position1, offsetDirection, scratchCartesian2);
876
- ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
877
- let lat = scratchCartographic.latitude;
878
- let lon = scratchCartographic.longitude;
879
- minLat = Math.min(minLat, lat);
880
- minLon = Math.min(minLon, lon);
881
- maxLat = Math.max(maxLat, lat);
882
- maxLon = Math.max(maxLon, lon);
883
- Cartesian3_default.subtract(position1, offsetDirection, scratchCartesian2);
884
- ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
885
- lat = scratchCartographic.latitude;
886
- lon = scratchCartographic.longitude;
887
- minLat = Math.min(minLat, lat);
888
- minLon = Math.min(minLon, lon);
889
- maxLat = Math.max(maxLat, lat);
890
- maxLon = Math.max(maxLon, lon);
891
- min.latitude = minLat;
892
- min.longitude = minLon;
893
- max.latitude = maxLat;
894
- max.longitude = maxLon;
895
- }
896
- var scratchCartesianOffset = new Cartesian3_default();
897
- var scratchCartesianEnds = new Cartesian3_default();
898
- var scratchCartographicMin = new Cartographic_default();
899
- var scratchCartographicMax = new Cartographic_default();
900
- function computeRectangle(positions, ellipsoid, width, cornerType, result) {
901
- positions = scaleToSurface(positions, ellipsoid);
902
- const cleanPositions = arrayRemoveDuplicates_default(
903
- positions,
904
- Cartesian3_default.equalsEpsilon
905
- );
906
- const length = cleanPositions.length;
907
- if (length < 2 || width <= 0) {
908
- return new Rectangle_default();
909
- }
910
- const halfWidth = width * 0.5;
911
- scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
912
- scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
913
- scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
914
- scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
915
- let lat, lon;
916
- if (cornerType === CornerType_default.ROUNDED) {
917
- const first = cleanPositions[0];
918
- Cartesian3_default.subtract(first, cleanPositions[1], scratchCartesianOffset);
919
- Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
920
- Cartesian3_default.multiplyByScalar(
921
- scratchCartesianOffset,
922
- halfWidth,
923
- scratchCartesianOffset
924
- );
925
- Cartesian3_default.add(first, scratchCartesianOffset, scratchCartesianEnds);
926
- ellipsoid.cartesianToCartographic(
927
- scratchCartesianEnds,
928
- scratchCartographic
929
- );
930
- lat = scratchCartographic.latitude;
931
- lon = scratchCartographic.longitude;
932
- scratchCartographicMin.latitude = Math.min(
933
- scratchCartographicMin.latitude,
934
- lat
935
- );
936
- scratchCartographicMin.longitude = Math.min(
937
- scratchCartographicMin.longitude,
938
- lon
939
- );
940
- scratchCartographicMax.latitude = Math.max(
941
- scratchCartographicMax.latitude,
942
- lat
943
- );
944
- scratchCartographicMax.longitude = Math.max(
945
- scratchCartographicMax.longitude,
946
- lon
947
- );
948
- }
949
- for (let i = 0; i < length - 1; ++i) {
950
- computeOffsetPoints(
951
- cleanPositions[i],
952
- cleanPositions[i + 1],
953
- ellipsoid,
954
- halfWidth,
955
- scratchCartographicMin,
956
- scratchCartographicMax
957
- );
958
- }
959
- const last = cleanPositions[length - 1];
960
- Cartesian3_default.subtract(last, cleanPositions[length - 2], scratchCartesianOffset);
961
- Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
962
- Cartesian3_default.multiplyByScalar(
963
- scratchCartesianOffset,
964
- halfWidth,
965
- scratchCartesianOffset
966
- );
967
- Cartesian3_default.add(last, scratchCartesianOffset, scratchCartesianEnds);
968
- computeOffsetPoints(
969
- last,
970
- scratchCartesianEnds,
971
- ellipsoid,
972
- halfWidth,
973
- scratchCartographicMin,
974
- scratchCartographicMax
975
- );
976
- if (cornerType === CornerType_default.ROUNDED) {
977
- ellipsoid.cartesianToCartographic(
978
- scratchCartesianEnds,
979
- scratchCartographic
980
- );
981
- lat = scratchCartographic.latitude;
982
- lon = scratchCartographic.longitude;
983
- scratchCartographicMin.latitude = Math.min(
984
- scratchCartographicMin.latitude,
985
- lat
986
- );
987
- scratchCartographicMin.longitude = Math.min(
988
- scratchCartographicMin.longitude,
989
- lon
990
- );
991
- scratchCartographicMax.latitude = Math.max(
992
- scratchCartographicMax.latitude,
993
- lat
994
- );
995
- scratchCartographicMax.longitude = Math.max(
996
- scratchCartographicMax.longitude,
997
- lon
998
- );
999
- }
1000
- const rectangle = defined_default(result) ? result : new Rectangle_default();
1001
- rectangle.north = scratchCartographicMax.latitude;
1002
- rectangle.south = scratchCartographicMin.latitude;
1003
- rectangle.east = scratchCartographicMax.longitude;
1004
- rectangle.west = scratchCartographicMin.longitude;
1005
- return rectangle;
1006
- }
1007
- function CorridorGeometry(options) {
1008
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
1009
- const positions = options.positions;
1010
- const width = options.width;
1011
- Check_default.defined("options.positions", positions);
1012
- Check_default.defined("options.width", width);
1013
- const height = defaultValue_default(options.height, 0);
1014
- const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
1015
- this._positions = positions;
1016
- this._ellipsoid = Ellipsoid_default.clone(
1017
- defaultValue_default(options.ellipsoid, Ellipsoid_default.default)
1018
- );
1019
- this._vertexFormat = VertexFormat_default.clone(
1020
- defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
1021
- );
1022
- this._width = width;
1023
- this._height = Math.max(height, extrudedHeight);
1024
- this._extrudedHeight = Math.min(height, extrudedHeight);
1025
- this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
1026
- this._granularity = defaultValue_default(
1027
- options.granularity,
1028
- Math_default.RADIANS_PER_DEGREE
1029
- );
1030
- this._shadowVolume = defaultValue_default(options.shadowVolume, false);
1031
- this._workerName = "createCorridorGeometry";
1032
- this._offsetAttribute = options.offsetAttribute;
1033
- this._rectangle = void 0;
1034
- this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
1035
- }
1036
- CorridorGeometry.pack = function(value, array, startingIndex) {
1037
- Check_default.defined("value", value);
1038
- Check_default.defined("array", array);
1039
- startingIndex = defaultValue_default(startingIndex, 0);
1040
- const positions = value._positions;
1041
- const length = positions.length;
1042
- array[startingIndex++] = length;
1043
- for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
1044
- Cartesian3_default.pack(positions[i], array, startingIndex);
1045
- }
1046
- Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
1047
- startingIndex += Ellipsoid_default.packedLength;
1048
- VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
1049
- startingIndex += VertexFormat_default.packedLength;
1050
- array[startingIndex++] = value._width;
1051
- array[startingIndex++] = value._height;
1052
- array[startingIndex++] = value._extrudedHeight;
1053
- array[startingIndex++] = value._cornerType;
1054
- array[startingIndex++] = value._granularity;
1055
- array[startingIndex++] = value._shadowVolume ? 1 : 0;
1056
- array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
1057
- return array;
1058
- };
1059
- var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
1060
- var scratchVertexFormat = new VertexFormat_default();
1061
- var scratchOptions = {
1062
- positions: void 0,
1063
- ellipsoid: scratchEllipsoid,
1064
- vertexFormat: scratchVertexFormat,
1065
- width: void 0,
1066
- height: void 0,
1067
- extrudedHeight: void 0,
1068
- cornerType: void 0,
1069
- granularity: void 0,
1070
- shadowVolume: void 0,
1071
- offsetAttribute: void 0
1072
- };
1073
- CorridorGeometry.unpack = function(array, startingIndex, result) {
1074
- Check_default.defined("array", array);
1075
- startingIndex = defaultValue_default(startingIndex, 0);
1076
- const length = array[startingIndex++];
1077
- const positions = new Array(length);
1078
- for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
1079
- positions[i] = Cartesian3_default.unpack(array, startingIndex);
1080
- }
1081
- const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
1082
- startingIndex += Ellipsoid_default.packedLength;
1083
- const vertexFormat = VertexFormat_default.unpack(
1084
- array,
1085
- startingIndex,
1086
- scratchVertexFormat
1087
- );
1088
- startingIndex += VertexFormat_default.packedLength;
1089
- const width = array[startingIndex++];
1090
- const height = array[startingIndex++];
1091
- const extrudedHeight = array[startingIndex++];
1092
- const cornerType = array[startingIndex++];
1093
- const granularity = array[startingIndex++];
1094
- const shadowVolume = array[startingIndex++] === 1;
1095
- const offsetAttribute = array[startingIndex];
1096
- if (!defined_default(result)) {
1097
- scratchOptions.positions = positions;
1098
- scratchOptions.width = width;
1099
- scratchOptions.height = height;
1100
- scratchOptions.extrudedHeight = extrudedHeight;
1101
- scratchOptions.cornerType = cornerType;
1102
- scratchOptions.granularity = granularity;
1103
- scratchOptions.shadowVolume = shadowVolume;
1104
- scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1105
- return new CorridorGeometry(scratchOptions);
1106
- }
1107
- result._positions = positions;
1108
- result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
1109
- result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
1110
- result._width = width;
1111
- result._height = height;
1112
- result._extrudedHeight = extrudedHeight;
1113
- result._cornerType = cornerType;
1114
- result._granularity = granularity;
1115
- result._shadowVolume = shadowVolume;
1116
- result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1117
- return result;
1118
- };
1119
- CorridorGeometry.computeRectangle = function(options, result) {
1120
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
1121
- const positions = options.positions;
1122
- const width = options.width;
1123
- Check_default.defined("options.positions", positions);
1124
- Check_default.defined("options.width", width);
1125
- const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
1126
- const cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
1127
- return computeRectangle(positions, ellipsoid, width, cornerType, result);
1128
- };
1129
- CorridorGeometry.createGeometry = function(corridorGeometry) {
1130
- let positions = corridorGeometry._positions;
1131
- const width = corridorGeometry._width;
1132
- const ellipsoid = corridorGeometry._ellipsoid;
1133
- positions = scaleToSurface(positions, ellipsoid);
1134
- const cleanPositions = arrayRemoveDuplicates_default(
1135
- positions,
1136
- Cartesian3_default.equalsEpsilon
1137
- );
1138
- if (cleanPositions.length < 2 || width <= 0) {
1139
- return;
1140
- }
1141
- const height = corridorGeometry._height;
1142
- const extrudedHeight = corridorGeometry._extrudedHeight;
1143
- const extrude = !Math_default.equalsEpsilon(
1144
- height,
1145
- extrudedHeight,
1146
- 0,
1147
- Math_default.EPSILON2
1148
- );
1149
- const vertexFormat = corridorGeometry._vertexFormat;
1150
- const params = {
1151
- ellipsoid,
1152
- positions: cleanPositions,
1153
- width,
1154
- cornerType: corridorGeometry._cornerType,
1155
- granularity: corridorGeometry._granularity,
1156
- saveAttributes: true
1157
- };
1158
- let attr;
1159
- if (extrude) {
1160
- params.height = height;
1161
- params.extrudedHeight = extrudedHeight;
1162
- params.shadowVolume = corridorGeometry._shadowVolume;
1163
- params.offsetAttribute = corridorGeometry._offsetAttribute;
1164
- attr = computePositionsExtruded(params, vertexFormat);
1165
- } else {
1166
- const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
1167
- attr = combine(computedPositions, vertexFormat, ellipsoid);
1168
- attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1169
- attr.attributes.position.values,
1170
- height,
1171
- ellipsoid
1172
- );
1173
- if (defined_default(corridorGeometry._offsetAttribute)) {
1174
- const applyOffsetValue = corridorGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
1175
- const length = attr.attributes.position.values.length;
1176
- const applyOffset = new Uint8Array(length / 3).fill(applyOffsetValue);
1177
- attr.attributes.applyOffset = new GeometryAttribute_default({
1178
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
1179
- componentsPerAttribute: 1,
1180
- values: applyOffset
1181
- });
1182
- }
1183
- }
1184
- const attributes = attr.attributes;
1185
- const boundingSphere = BoundingSphere_default.fromVertices(
1186
- attributes.position.values,
1187
- void 0,
1188
- 3
1189
- );
1190
- if (!vertexFormat.position) {
1191
- attr.attributes.position.values = void 0;
1192
- }
1193
- return new Geometry_default({
1194
- attributes,
1195
- indices: attr.indices,
1196
- primitiveType: PrimitiveType_default.TRIANGLES,
1197
- boundingSphere,
1198
- offsetAttribute: corridorGeometry._offsetAttribute
1199
- });
1200
- };
1201
- CorridorGeometry.createShadowVolume = function(corridorGeometry, minHeightFunc, maxHeightFunc) {
1202
- const granularity = corridorGeometry._granularity;
1203
- const ellipsoid = corridorGeometry._ellipsoid;
1204
- const minHeight = minHeightFunc(granularity, ellipsoid);
1205
- const maxHeight = maxHeightFunc(granularity, ellipsoid);
1206
- return new CorridorGeometry({
1207
- positions: corridorGeometry._positions,
1208
- width: corridorGeometry._width,
1209
- cornerType: corridorGeometry._cornerType,
1210
- ellipsoid,
1211
- granularity,
1212
- extrudedHeight: minHeight,
1213
- height: maxHeight,
1214
- vertexFormat: VertexFormat_default.POSITION_ONLY,
1215
- shadowVolume: true
1216
- });
1217
- };
1218
- Object.defineProperties(CorridorGeometry.prototype, {
1219
- /**
1220
- * @private
1221
- */
1222
- rectangle: {
1223
- get: function() {
1224
- if (!defined_default(this._rectangle)) {
1225
- this._rectangle = computeRectangle(
1226
- this._positions,
1227
- this._ellipsoid,
1228
- this._width,
1229
- this._cornerType
1230
- );
1231
- }
1232
- return this._rectangle;
1233
- }
1234
- },
1235
- /**
1236
- * For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
1237
- *
1238
- * Corridors don't support stRotation,
1239
- * so just return the corners of the original system.
1240
- * @private
1241
- */
1242
- textureCoordinateRotationPoints: {
1243
- get: function() {
1244
- return [0, 0, 0, 1, 1, 0];
1245
- }
1246
- }
1247
- });
1248
- var CorridorGeometry_default = CorridorGeometry;
1249
-
1250
- // packages/engine/Source/Workers/createCorridorGeometry.js
1251
- function createCorridorGeometry(corridorGeometry, offset) {
1252
- if (defined_default(offset)) {
1253
- corridorGeometry = CorridorGeometry_default.unpack(corridorGeometry, offset);
1254
- }
1255
- corridorGeometry._ellipsoid = Ellipsoid_default.clone(corridorGeometry._ellipsoid);
1256
- return CorridorGeometry_default.createGeometry(corridorGeometry);
1257
- }
1258
- var createCorridorGeometry_default = createCorridorGeometry;
1259
- export {
1260
- createCorridorGeometry_default as default
1261
- };
26
+ import{a as M}from"./chunk-WWA5PL4H.js";import{a as ut}from"./chunk-B4AA3ARO.js";import"./chunk-XRL4AVS5.js";import"./chunk-U4IEOH5K.js";import{a as bt}from"./chunk-GBYLG25F.js";import{a as J}from"./chunk-CYCB63OH.js";import"./chunk-TCGIRNHN.js";import"./chunk-N4VJKXZS.js";import{b as _t}from"./chunk-77IHZJJ3.js";import{a as Pt}from"./chunk-3W4GT7KQ.js";import"./chunk-G5AGHVVC.js";import"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as Nt}from"./chunk-OFUUQVMR.js";import{a as Dt}from"./chunk-A56XVLQR.js";import{b as Mt,c as Ct,d as F}from"./chunk-RCV6KWXS.js";import{d as St}from"./chunk-4IW2T6GF.js";import{h as Et}from"./chunk-PSPPBZWI.js";import{a as v}from"./chunk-AU7IKHOH.js";import{a as o,b as At,d as Y,f as Tt}from"./chunk-64RSHJUE.js";import{a as it}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{b as ot}from"./chunk-LEYMRMBK.js";import{e as Q}from"./chunk-VTAIKJXX.js";var Rt=new o,kt=new o,yt=new o,wt=new o,jt=new o,Ht=new o,st=new o,dt=new o;function Ut(t,e){for(let i=0;i<t.length;i++)t[i]=e.scaleToGeodeticSurface(t[i],t[i]);return t}function X(t,e,i,l,d,f){let h=t.normals,O=t.tangents,g=t.bitangents,r=o.normalize(o.cross(i,e,st),st);f.normal&&M.addAttribute(h,e,l,d),f.tangent&&M.addAttribute(O,r,l,d),f.bitangent&&M.addAttribute(g,i,l,d)}function Bt(t,e,i){let l=t.positions,d=t.corners,f=t.endPositions,h=t.lefts,O=t.normals,g=new Dt,r,a=0,s=0,n,A=0,u;for(n=0;n<l.length;n+=2)u=l[n].length-3,a+=u,A+=u*2,s+=l[n+1].length-3;for(a+=3,s+=3,n=0;n<d.length;n++){r=d[n];let c=d[n].leftPositions;Q(c)?(u=c.length,a+=u,A+=u):(u=d[n].rightPositions.length,s+=u,A+=u)}let b=Q(f),p;b&&(p=f[0].length-3,a+=p,s+=p,p/=3,A+=p*6);let z=a+s,m=new Float64Array(z),D=e.normal?new Float32Array(z):void 0,V=e.tangent?new Float32Array(z):void 0,rt=e.bitangent?new Float32Array(z):void 0,R={normals:D,tangents:V,bitangents:rt},y=0,E=z-1,S,C,H,q,P=Rt,w=kt,et,nt,pt=p/2,_=Nt.createTypedArray(z/3,A),T=0;if(b){nt=yt,et=wt;let c=f[0];for(P=o.fromArray(O,0,P),w=o.fromArray(h,0,w),n=0;n<pt;n++)nt=o.fromArray(c,(pt-1-n)*3,nt),et=o.fromArray(c,(pt+n)*3,et),M.addAttribute(m,et,y),M.addAttribute(m,nt,void 0,E),X(R,P,w,y,E,e),C=y/3,q=C+1,S=(E-2)/3,H=S-1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3}let mt=0,ft=0,at=l[mt++],j=l[mt++];m.set(at,y),m.set(j,E-j.length+1),w=o.fromArray(h,ft,w);let lt,ct;for(u=j.length-3,n=0;n<u;n+=3)lt=i.geodeticSurfaceNormal(o.fromArray(at,n,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u-n,dt),dt),P=o.normalize(o.add(lt,ct,P),P),X(R,P,w,y,E,e),C=y/3,q=C+1,S=(E-2)/3,H=S-1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3;for(lt=i.geodeticSurfaceNormal(o.fromArray(at,u,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u,dt),dt),P=o.normalize(o.add(lt,ct,P),P),ft+=3,n=0;n<d.length;n++){let c;r=d[n];let Z=r.leftPositions,$=r.rightPositions,L,U,N=Ht,k=yt,B=wt;if(P=o.fromArray(O,ft,P),Q(Z)){for(X(R,P,w,void 0,E,e),E-=3,L=q,U=H,c=0;c<Z.length/3;c++)N=o.fromArray(Z,c*3,N),_[T++]=L,_[T++]=U-c-1,_[T++]=U-c,M.addAttribute(m,N,void 0,E),k=o.fromArray(m,(U-c-1)*3,k),B=o.fromArray(m,L*3,B),w=o.normalize(o.subtract(k,B,w),w),X(R,P,w,void 0,E,e),E-=3;N=o.fromArray(m,L*3,N),k=o.subtract(o.fromArray(m,U*3,k),N,k),B=o.subtract(o.fromArray(m,(U-c)*3,B),N,B),w=o.normalize(o.add(k,B,w),w),X(R,P,w,y,void 0,e),y+=3}else{for(X(R,P,w,y,void 0,e),y+=3,L=H,U=q,c=0;c<$.length/3;c++)N=o.fromArray($,c*3,N),_[T++]=L,_[T++]=U+c,_[T++]=U+c+1,M.addAttribute(m,N,y),k=o.fromArray(m,L*3,k),B=o.fromArray(m,(U+c)*3,B),w=o.normalize(o.subtract(k,B,w),w),X(R,P,w,y,void 0,e),y+=3;N=o.fromArray(m,L*3,N),k=o.subtract(o.fromArray(m,(U+c)*3,k),N,k),B=o.subtract(o.fromArray(m,U*3,B),N,B),w=o.normalize(o.negate(o.add(B,k,w),w),w),X(R,P,w,void 0,E,e),E-=3}for(at=l[mt++],j=l[mt++],at.splice(0,3),j.splice(j.length-3,3),m.set(at,y),m.set(j,E-j.length+1),u=j.length-3,ft+=3,w=o.fromArray(h,ft,w),c=0;c<j.length;c+=3)lt=i.geodeticSurfaceNormal(o.fromArray(at,c,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u-c,dt),dt),P=o.normalize(o.add(lt,ct,P),P),X(R,P,w,y,E,e),q=y/3,C=q-1,H=(E-2)/3,S=H+1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3;y-=3,E+=3}if(P=o.fromArray(O,O.length-3,P),X(R,P,w,y,E,e),b){y+=3,E-=3,nt=yt,et=wt;let c=f[1];for(n=0;n<pt;n++)nt=o.fromArray(c,(p-n-1)*3,nt),et=o.fromArray(c,n*3,et),M.addAttribute(m,nt,void 0,E),M.addAttribute(m,et,y),X(R,P,w,y,E,e),q=y/3,C=q-1,H=(E-2)/3,S=H+1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3}if(g.position=new F({componentDatatype:v.DOUBLE,componentsPerAttribute:3,values:m}),e.st){let c=new Float32Array(z/3*2),Z,$,L=0;if(b){a/=3,s/=3;let U=Math.PI/(p+1);$=1/(a-p+1),Z=1/(s-p+1);let N,k=p/2;for(n=k+1;n<p+1;n++)N=it.PI_OVER_TWO+U*n,c[L++]=Z*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=1;n<s-p+1;n++)c[L++]=n*Z,c[L++]=0;for(n=p;n>k;n--)N=it.PI_OVER_TWO-n*U,c[L++]=1-Z*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=k;n>0;n--)N=it.PI_OVER_TWO-U*n,c[L++]=1-$*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=a-p;n>0;n--)c[L++]=n*$,c[L++]=1;for(n=1;n<k+1;n++)N=it.PI_OVER_TWO+U*n,c[L++]=$*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N))}else{for(a/=3,s/=3,$=1/(a-1),Z=1/(s-1),n=0;n<s;n++)c[L++]=n*Z,c[L++]=0;for(n=a;n>0;n--)c[L++]=(n-1)*$,c[L++]=1}g.st=new F({componentDatatype:v.FLOAT,componentsPerAttribute:2,values:c})}return e.normal&&(g.normal=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.normals})),e.tangent&&(g.tangent=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.tangents})),e.bitangent&&(g.bitangent=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.bitangents})),{attributes:g,indices:_}}function qt(t,e){if(!e.normal&&!e.tangent&&!e.bitangent&&!e.st)return t;let i=t.position.values,l,d;(e.normal||e.bitangent)&&(l=t.normal.values,d=t.bitangent.values);let f=t.position.values.length/18,h=f*3,O=f*2,g=h*2,r;if(e.normal||e.bitangent||e.tangent){let a=e.normal?new Float32Array(h*6):void 0,s=e.tangent?new Float32Array(h*6):void 0,n=e.bitangent?new Float32Array(h*6):void 0,A=Rt,u=kt,b=yt,p=wt,z=jt,m=Ht,D=g;for(r=0;r<h;r+=3){let V=D+g;A=o.fromArray(i,r,A),u=o.fromArray(i,r+h,u),b=o.fromArray(i,(r+3)%h,b),u=o.subtract(u,A,u),b=o.subtract(b,A,b),p=o.normalize(o.cross(u,b,p),p),e.normal&&(M.addAttribute(a,p,V),M.addAttribute(a,p,V+3),M.addAttribute(a,p,D),M.addAttribute(a,p,D+3)),(e.tangent||e.bitangent)&&(m=o.fromArray(l,r,m),e.bitangent&&(M.addAttribute(n,m,V),M.addAttribute(n,m,V+3),M.addAttribute(n,m,D),M.addAttribute(n,m,D+3)),e.tangent&&(z=o.normalize(o.cross(m,p,z),z),M.addAttribute(s,z,V),M.addAttribute(s,z,V+3),M.addAttribute(s,z,D),M.addAttribute(s,z,D+3))),D+=6}if(e.normal){for(a.set(l),r=0;r<h;r+=3)a[r+h]=-l[r],a[r+h+1]=-l[r+1],a[r+h+2]=-l[r+2];t.normal.values=a}else t.normal=void 0;if(e.bitangent?(n.set(d),n.set(d,h),t.bitangent.values=n):t.bitangent=void 0,e.tangent){let V=t.tangent.values;s.set(V),s.set(V,h),t.tangent.values=s}}if(e.st){let a=t.st.values,s=new Float32Array(O*6);s.set(a),s.set(a,O);let n=O*2;for(let A=0;A<2;A++){for(s[n++]=a[0],s[n++]=a[1],r=2;r<O;r+=2){let u=a[r],b=a[r+1];s[n++]=u,s[n++]=b,s[n++]=u,s[n++]=b}s[n++]=a[0],s[n++]=a[1]}t.st.values=s}return t}function Ot(t,e,i){i[e++]=t[0],i[e++]=t[1],i[e++]=t[2];for(let l=3;l<t.length;l+=3){let d=t[l],f=t[l+1],h=t[l+2];i[e++]=d,i[e++]=f,i[e++]=h,i[e++]=d,i[e++]=f,i[e++]=h}return i[e++]=t[0],i[e++]=t[1],i[e++]=t[2],i}function Jt(t,e){let i=new J({position:e.position,normal:e.normal||e.bitangent||t.shadowVolume,tangent:e.tangent,bitangent:e.normal||e.bitangent,st:e.st}),l=t.ellipsoid,d=M.computePositions(t),f=Bt(d,i,l),h=t.height,O=t.extrudedHeight,g=f.attributes,r=f.indices,a=g.position.values,s=a.length,n=new Float64Array(s*6),A=new Float64Array(s);A.set(a);let u=new Float64Array(s*4);a=_t.scaleToGeodeticHeight(a,h,l),u=Ot(a,0,u),A=_t.scaleToGeodeticHeight(A,O,l),u=Ot(A,s*2,u),n.set(a),n.set(A,s),n.set(u,s*2),g.position.values=n,g=qt(g,e);let b,p=s/3;if(t.shadowVolume){let S=g.normal.values;s=S.length;let C=new Float32Array(s*6);for(b=0;b<s;b++)S[b]=-S[b];C.set(S,s),C=Ot(S,s*4,C),g.extrudeDirection=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:C}),e.normal||(g.normal=void 0)}if(Q(t.offsetAttribute)){let S=new Uint8Array(p*6);if(t.offsetAttribute===bt.TOP)S=S.fill(1,0,p).fill(1,p*2,p*4);else{let C=t.offsetAttribute===bt.NONE?0:1;S=S.fill(C)}g.applyOffset=new F({componentDatatype:v.UNSIGNED_BYTE,componentsPerAttribute:1,values:S})}let z=r.length,m=p+p,D=Nt.createTypedArray(n.length/3,z*2+m*3);D.set(r);let V=z;for(b=0;b<z;b+=3){let S=r[b],C=r[b+1],H=r[b+2];D[V++]=H+p,D[V++]=C+p,D[V++]=S+p}let rt,R,y,E;for(b=0;b<m;b+=2)rt=b+m,R=rt+m,y=rt+1,E=R+1,D[V++]=rt,D[V++]=R,D[V++]=y,D[V++]=y,D[V++]=R,D[V++]=E;return{attributes:g,indices:D}}var Vt=new o,ht=new o,K=new At;function zt(t,e,i,l,d,f){let h=o.subtract(e,t,Vt);o.normalize(h,h);let O=i.geodeticSurfaceNormal(t,ht),g=o.cross(h,O,Vt);o.multiplyByScalar(g,l,g);let r=d.latitude,a=d.longitude,s=f.latitude,n=f.longitude;o.add(t,g,ht),i.cartesianToCartographic(ht,K);let A=K.latitude,u=K.longitude;r=Math.min(r,A),a=Math.min(a,u),s=Math.max(s,A),n=Math.max(n,u),o.subtract(t,g,ht),i.cartesianToCartographic(ht,K),A=K.latitude,u=K.longitude,r=Math.min(r,A),a=Math.min(a,u),s=Math.max(s,A),n=Math.max(n,u),d.latitude=r,d.longitude=a,f.latitude=s,f.longitude=n}var G=new o,gt=new o,I=new At,W=new At;function Yt(t,e,i,l,d){t=Ut(t,e);let f=Pt(t,o.equalsEpsilon),h=f.length;if(h<2||i<=0)return new Et;let O=i*.5;I.latitude=Number.POSITIVE_INFINITY,I.longitude=Number.POSITIVE_INFINITY,W.latitude=Number.NEGATIVE_INFINITY,W.longitude=Number.NEGATIVE_INFINITY;let g,r;if(l===ut.ROUNDED){let n=f[0];o.subtract(n,f[1],G),o.normalize(G,G),o.multiplyByScalar(G,O,G),o.add(n,G,gt),e.cartesianToCartographic(gt,K),g=K.latitude,r=K.longitude,I.latitude=Math.min(I.latitude,g),I.longitude=Math.min(I.longitude,r),W.latitude=Math.max(W.latitude,g),W.longitude=Math.max(W.longitude,r)}for(let n=0;n<h-1;++n)zt(f[n],f[n+1],e,O,I,W);let a=f[h-1];o.subtract(a,f[h-2],G),o.normalize(G,G),o.multiplyByScalar(G,O,G),o.add(a,G,gt),zt(a,gt,e,O,I,W),l===ut.ROUNDED&&(e.cartesianToCartographic(gt,K),g=K.latitude,r=K.longitude,I.latitude=Math.min(I.latitude,g),I.longitude=Math.min(I.longitude,r),W.latitude=Math.max(W.latitude,g),W.longitude=Math.max(W.longitude,r));let s=Q(d)?d:new Et;return s.north=W.latitude,s.south=I.latitude,s.east=W.longitude,s.west=I.longitude,s}function tt(t){t=t??Tt.EMPTY_OBJECT;let e=t.positions,i=t.width;ot.defined("options.positions",e),ot.defined("options.width",i);let l=t.height??0,d=t.extrudedHeight??l;this._positions=e,this._ellipsoid=Y.clone(t.ellipsoid??Y.default),this._vertexFormat=J.clone(t.vertexFormat??J.DEFAULT),this._width=i,this._height=Math.max(l,d),this._extrudedHeight=Math.min(l,d),this._cornerType=t.cornerType??ut.ROUNDED,this._granularity=t.granularity??it.RADIANS_PER_DEGREE,this._shadowVolume=t.shadowVolume??!1,this._workerName="createCorridorGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this.packedLength=1+e.length*o.packedLength+Y.packedLength+J.packedLength+7}tt.pack=function(t,e,i){ot.defined("value",t),ot.defined("array",e),i=i??0;let l=t._positions,d=l.length;e[i++]=d;for(let f=0;f<d;++f,i+=o.packedLength)o.pack(l[f],e,i);return Y.pack(t._ellipsoid,e,i),i+=Y.packedLength,J.pack(t._vertexFormat,e,i),i+=J.packedLength,e[i++]=t._width,e[i++]=t._height,e[i++]=t._extrudedHeight,e[i++]=t._cornerType,e[i++]=t._granularity,e[i++]=t._shadowVolume?1:0,e[i]=t._offsetAttribute??-1,e};var It=Y.clone(Y.UNIT_SPHERE),Wt=new J,x={positions:void 0,ellipsoid:It,vertexFormat:Wt,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};tt.unpack=function(t,e,i){ot.defined("array",t),e=e??0;let l=t[e++],d=new Array(l);for(let u=0;u<l;++u,e+=o.packedLength)d[u]=o.unpack(t,e);let f=Y.unpack(t,e,It);e+=Y.packedLength;let h=J.unpack(t,e,Wt);e+=J.packedLength;let O=t[e++],g=t[e++],r=t[e++],a=t[e++],s=t[e++],n=t[e++]===1,A=t[e];return Q(i)?(i._positions=d,i._ellipsoid=Y.clone(f,i._ellipsoid),i._vertexFormat=J.clone(h,i._vertexFormat),i._width=O,i._height=g,i._extrudedHeight=r,i._cornerType=a,i._granularity=s,i._shadowVolume=n,i._offsetAttribute=A===-1?void 0:A,i):(x.positions=d,x.width=O,x.height=g,x.extrudedHeight=r,x.cornerType=a,x.granularity=s,x.shadowVolume=n,x.offsetAttribute=A===-1?void 0:A,new tt(x))};tt.computeRectangle=function(t,e){t=t??Tt.EMPTY_OBJECT;let i=t.positions,l=t.width;ot.defined("options.positions",i),ot.defined("options.width",l);let d=t.ellipsoid??Y.default,f=t.cornerType??ut.ROUNDED;return Yt(i,d,l,f,e)};tt.createGeometry=function(t){let e=t._positions,i=t._width,l=t._ellipsoid;e=Ut(e,l);let d=Pt(e,o.equalsEpsilon);if(d.length<2||i<=0)return;let f=t._height,h=t._extrudedHeight,O=!it.equalsEpsilon(f,h,0,it.EPSILON2),g=t._vertexFormat,r={ellipsoid:l,positions:d,width:i,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!0},a;if(O)r.height=f,r.extrudedHeight=h,r.shadowVolume=t._shadowVolume,r.offsetAttribute=t._offsetAttribute,a=Jt(r,g);else{let A=M.computePositions(r);if(a=Bt(A,g,l),a.attributes.position.values=_t.scaleToGeodeticHeight(a.attributes.position.values,f,l),Q(t._offsetAttribute)){let u=t._offsetAttribute===bt.NONE?0:1,b=a.attributes.position.values.length,p=new Uint8Array(b/3).fill(u);a.attributes.applyOffset=new F({componentDatatype:v.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}}let s=a.attributes,n=St.fromVertices(s.position.values,void 0,3);return g.position||(a.attributes.position.values=void 0),new Ct({attributes:s,indices:a.indices,primitiveType:Mt.TRIANGLES,boundingSphere:n,offsetAttribute:t._offsetAttribute})};tt.createShadowVolume=function(t,e,i){let l=t._granularity,d=t._ellipsoid,f=e(l,d),h=i(l,d);return new tt({positions:t._positions,width:t._width,cornerType:t._cornerType,ellipsoid:d,granularity:l,extrudedHeight:f,height:h,vertexFormat:J.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(tt.prototype,{rectangle:{get:function(){return Q(this._rectangle)||(this._rectangle=Yt(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var Lt=tt;function Gt(t,e){return Q(e)&&(t=Lt.unpack(t,e)),t._ellipsoid=Y.clone(t._ellipsoid),Lt.createGeometry(t)}var Ae=Gt;export{Ae as default};