@pggis/pg-sdk 3.3.10 → 4.3.3

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 (163) hide show
  1. package/README.md +8 -8
  2. package/dist/index.js +1966 -4
  3. package/dist/pggis.min.css +1 -1
  4. package/dist/pggis.min.js +10980 -7539
  5. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  7. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  8. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  9. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  10. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  11. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  12. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  13. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  14. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  15. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  16. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  17. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  18. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  19. package/dist/resources/Workers/{chunk-F3YA3Y2Z.js → chunk-A56XVLQR.js} +2 -13
  20. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  21. package/dist/resources/Workers/{chunk-EHWHNOEX.js → chunk-ARG42DC4.js} +2 -31
  22. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  23. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  24. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  25. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  26. package/dist/resources/Workers/{chunk-4H7PY4U5.js → chunk-D6AA5QVT.js} +2 -20
  27. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  28. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  29. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  30. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  31. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  32. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  33. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  34. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  35. package/dist/resources/Workers/{chunk-BBWDMCVU.js → chunk-GBYLG25F.js} +2 -15
  36. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  37. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  38. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  39. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  40. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  41. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  42. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  43. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  44. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  45. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  46. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  47. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  48. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  49. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  50. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  51. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  52. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  53. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  54. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  55. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  56. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  57. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  58. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  59. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  60. package/dist/resources/Workers/chunk-WZDE3RYP.js +28 -0
  61. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  62. package/dist/resources/Workers/combineGeometry.js +2 -44
  63. package/dist/resources/Workers/createBoxGeometry.js +2 -34
  64. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -211
  65. package/dist/resources/Workers/createCircleGeometry.js +2 -173
  66. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -123
  67. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -482
  68. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -201
  69. package/dist/resources/Workers/createCorridorGeometry.js +2 -1239
  70. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -544
  71. package/dist/resources/Workers/createCylinderGeometry.js +2 -36
  72. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -207
  73. package/dist/resources/Workers/createEllipseGeometry.js +2 -47
  74. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -40
  75. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -35
  76. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -37
  77. package/dist/resources/Workers/createFrustumGeometry.js +2 -34
  78. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -211
  79. package/dist/resources/Workers/createGeometry.js +2 -147
  80. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1584
  81. package/dist/resources/Workers/createPlaneGeometry.js +2 -200
  82. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -100
  83. package/dist/resources/Workers/createPolygonGeometry.js +2 -1387
  84. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -519
  85. package/dist/resources/Workers/createPolylineGeometry.js +2 -472
  86. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -355
  87. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -253
  88. package/dist/resources/Workers/createRectangleGeometry.js +2 -1250
  89. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -455
  90. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -376
  91. package/dist/resources/Workers/createSphereGeometry.js +2 -94
  92. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -94
  93. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  94. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -468
  95. package/dist/resources/Workers/createVectorTileGeometries.js +2 -363
  96. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  97. package/dist/resources/Workers/createVectorTilePolygons.js +2 -361
  98. package/dist/resources/Workers/createVectorTilePolylines.js +2 -238
  99. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -545
  100. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2254
  101. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -722
  102. package/dist/resources/Workers/createWallGeometry.js +2 -466
  103. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -314
  104. package/dist/resources/Workers/decodeDraco.js +2 -345
  105. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2626
  106. package/dist/resources/Workers/decodeI3S.js +2 -1320
  107. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  108. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  109. package/dist/resources/Workers/transcodeKTX2.js +29 -3398
  110. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  111. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -795
  112. package/package.json +9 -8
  113. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  114. package/dist/resources/Workers/chunk-23UFSGND.js +0 -236
  115. package/dist/resources/Workers/chunk-2A75IWRS.js +0 -218
  116. package/dist/resources/Workers/chunk-2FRVPMCS.js +0 -1258
  117. package/dist/resources/Workers/chunk-2FWRMUTY.js +0 -138
  118. package/dist/resources/Workers/chunk-2UPKWTMJ.js +0 -117
  119. package/dist/resources/Workers/chunk-34FXV7D7.js +0 -73
  120. package/dist/resources/Workers/chunk-3VAZEH7M.js +0 -101
  121. package/dist/resources/Workers/chunk-4DO5W5XZ.js +0 -196
  122. package/dist/resources/Workers/chunk-5QULIR53.js +0 -501
  123. package/dist/resources/Workers/chunk-7TC63SJW.js +0 -302
  124. package/dist/resources/Workers/chunk-7ZFGPDJA.js +0 -122
  125. package/dist/resources/Workers/chunk-A5DWLWCY.js +0 -834
  126. package/dist/resources/Workers/chunk-BG4UCVXN.js +0 -73
  127. package/dist/resources/Workers/chunk-BIKA3NRA.js +0 -59
  128. package/dist/resources/Workers/chunk-BROJAZRZ.js +0 -390
  129. package/dist/resources/Workers/chunk-DDUQAJ4P.js +0 -476
  130. package/dist/resources/Workers/chunk-EERJKOAF.js +0 -305
  131. package/dist/resources/Workers/chunk-EG6PTBY2.js +0 -2716
  132. package/dist/resources/Workers/chunk-F4HFJMGM.js +0 -353
  133. package/dist/resources/Workers/chunk-FJKNFAKQ.js +0 -8219
  134. package/dist/resources/Workers/chunk-FNIRWHJB.js +0 -289
  135. package/dist/resources/Workers/chunk-FZRIVR7Y.js +0 -100
  136. package/dist/resources/Workers/chunk-G43QFN4Q.js +0 -157
  137. package/dist/resources/Workers/chunk-GATZHF3K.js +0 -1860
  138. package/dist/resources/Workers/chunk-GRC2ZTAF.js +0 -398
  139. package/dist/resources/Workers/chunk-HU6N6EXB.js +0 -767
  140. package/dist/resources/Workers/chunk-I46ZRR5W.js +0 -1052
  141. package/dist/resources/Workers/chunk-JURN7NPV.js +0 -1075
  142. package/dist/resources/Workers/chunk-KKCR2YOP.js +0 -421
  143. package/dist/resources/Workers/chunk-LPR3YNP2.js +0 -138
  144. package/dist/resources/Workers/chunk-M7ERACJJ.js +0 -511
  145. package/dist/resources/Workers/chunk-MDWEGWPA.js +0 -1007
  146. package/dist/resources/Workers/chunk-OGXZVPPM.js +0 -2365
  147. package/dist/resources/Workers/chunk-PGSJK77E.js +0 -634
  148. package/dist/resources/Workers/chunk-PPH7OFP3.js +0 -258
  149. package/dist/resources/Workers/chunk-SH5USDPI.js +0 -456
  150. package/dist/resources/Workers/chunk-SOWMRMWA.js +0 -629
  151. package/dist/resources/Workers/chunk-STW2DGFI.js +0 -58
  152. package/dist/resources/Workers/chunk-T3XIFPYR.js +0 -1477
  153. package/dist/resources/Workers/chunk-TTUZP4BO.js +0 -501
  154. package/dist/resources/Workers/chunk-UEXTBDBE.js +0 -693
  155. package/dist/resources/Workers/chunk-VOXYEYJT.js +0 -684
  156. package/dist/resources/Workers/chunk-X4356LRH.js +0 -368
  157. package/dist/resources/Workers/chunk-XGI5BXZY.js +0 -163
  158. package/dist/resources/Workers/chunk-Y2ME2IJV.js +0 -781
  159. package/dist/resources/Workers/chunk-Y5UQJLYE.js +0 -171
  160. package/dist/resources/Workers/chunk-YJEBABKH.js +0 -2977
  161. package/dist/resources/Workers/chunk-YWTJ2B4B.js +0 -77
  162. package/dist/resources/Workers/chunk-Z3TIFFGF.js +0 -430
  163. package/dist/resources/Workers/chunk-ZT7KWISZ.js +0 -102
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.115
4
+ * Version 1.132
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -23,1252 +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
- RectangleGeometryLibrary_default
28
- } from "./chunk-23UFSGND.js";
29
- import {
30
- GeometryInstance_default
31
- } from "./chunk-BIKA3NRA.js";
32
- import {
33
- GeometryPipeline_default
34
- } from "./chunk-EG6PTBY2.js";
35
- import "./chunk-Z3TIFFGF.js";
36
- import "./chunk-ZT7KWISZ.js";
37
- import {
38
- GeometryOffsetAttribute_default
39
- } from "./chunk-F3YA3Y2Z.js";
40
- import {
41
- VertexFormat_default
42
- } from "./chunk-2FWRMUTY.js";
43
- import {
44
- PolygonPipeline_default
45
- } from "./chunk-MDWEGWPA.js";
46
- import "./chunk-SH5USDPI.js";
47
- import "./chunk-2FRVPMCS.js";
48
- import "./chunk-Y5UQJLYE.js";
49
- import {
50
- IndexDatatype_default
51
- } from "./chunk-LPR3YNP2.js";
52
- import {
53
- GeometryAttributes_default
54
- } from "./chunk-4H7PY4U5.js";
55
- import {
56
- GeometryAttribute_default,
57
- Geometry_default,
58
- PrimitiveType_default
59
- } from "./chunk-7TC63SJW.js";
60
- import {
61
- BoundingSphere_default,
62
- Quaternion_default
63
- } from "./chunk-FJKNFAKQ.js";
64
- import "./chunk-TTUZP4BO.js";
65
- import "./chunk-BG4UCVXN.js";
66
- import {
67
- Matrix2_default,
68
- Rectangle_default
69
- } from "./chunk-YJEBABKH.js";
70
- import {
71
- ComponentDatatype_default
72
- } from "./chunk-PPH7OFP3.js";
73
- import {
74
- Cartesian2_default,
75
- Cartesian3_default,
76
- Cartographic_default,
77
- Ellipsoid_default,
78
- Matrix3_default
79
- } from "./chunk-OGXZVPPM.js";
80
- import {
81
- Math_default
82
- } from "./chunk-5QULIR53.js";
83
- import "./chunk-SOWMRMWA.js";
84
- import "./chunk-STW2DGFI.js";
85
- import {
86
- defaultValue_default
87
- } from "./chunk-BBWDMCVU.js";
88
- import {
89
- Check_default,
90
- DeveloperError_default
91
- } from "./chunk-XGI5BXZY.js";
92
- import {
93
- defined_default
94
- } from "./chunk-YWTJ2B4B.js";
95
-
96
- // packages/engine/Source/Core/RectangleGeometry.js
97
- var positionScratch = new Cartesian3_default();
98
- var normalScratch = new Cartesian3_default();
99
- var tangentScratch = new Cartesian3_default();
100
- var bitangentScratch = new Cartesian3_default();
101
- var rectangleScratch = new Rectangle_default();
102
- var stScratch = new Cartesian2_default();
103
- var bottomBoundingSphere = new BoundingSphere_default();
104
- var topBoundingSphere = new BoundingSphere_default();
105
- function createAttributes(vertexFormat, attributes) {
106
- const geo = new Geometry_default({
107
- attributes: new GeometryAttributes_default(),
108
- primitiveType: PrimitiveType_default.TRIANGLES
109
- });
110
- geo.attributes.position = new GeometryAttribute_default({
111
- componentDatatype: ComponentDatatype_default.DOUBLE,
112
- componentsPerAttribute: 3,
113
- values: attributes.positions
114
- });
115
- if (vertexFormat.normal) {
116
- geo.attributes.normal = new GeometryAttribute_default({
117
- componentDatatype: ComponentDatatype_default.FLOAT,
118
- componentsPerAttribute: 3,
119
- values: attributes.normals
120
- });
121
- }
122
- if (vertexFormat.tangent) {
123
- geo.attributes.tangent = new GeometryAttribute_default({
124
- componentDatatype: ComponentDatatype_default.FLOAT,
125
- componentsPerAttribute: 3,
126
- values: attributes.tangents
127
- });
128
- }
129
- if (vertexFormat.bitangent) {
130
- geo.attributes.bitangent = new GeometryAttribute_default({
131
- componentDatatype: ComponentDatatype_default.FLOAT,
132
- componentsPerAttribute: 3,
133
- values: attributes.bitangents
134
- });
135
- }
136
- return geo;
137
- }
138
- function calculateAttributes(positions, vertexFormat, ellipsoid, tangentRotationMatrix) {
139
- const length = positions.length;
140
- const normals = vertexFormat.normal ? new Float32Array(length) : void 0;
141
- const tangents = vertexFormat.tangent ? new Float32Array(length) : void 0;
142
- const bitangents = vertexFormat.bitangent ? new Float32Array(length) : void 0;
143
- let attrIndex = 0;
144
- const bitangent = bitangentScratch;
145
- const tangent = tangentScratch;
146
- let normal = normalScratch;
147
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
148
- for (let i = 0; i < length; i += 3) {
149
- const p = Cartesian3_default.fromArray(positions, i, positionScratch);
150
- const attrIndex1 = attrIndex + 1;
151
- const attrIndex2 = attrIndex + 2;
152
- normal = ellipsoid.geodeticSurfaceNormal(p, normal);
153
- if (vertexFormat.tangent || vertexFormat.bitangent) {
154
- Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent);
155
- Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent);
156
- Cartesian3_default.normalize(tangent, tangent);
157
- if (vertexFormat.bitangent) {
158
- Cartesian3_default.normalize(
159
- Cartesian3_default.cross(normal, tangent, bitangent),
160
- bitangent
161
- );
162
- }
163
- }
164
- if (vertexFormat.normal) {
165
- normals[attrIndex] = normal.x;
166
- normals[attrIndex1] = normal.y;
167
- normals[attrIndex2] = normal.z;
168
- }
169
- if (vertexFormat.tangent) {
170
- tangents[attrIndex] = tangent.x;
171
- tangents[attrIndex1] = tangent.y;
172
- tangents[attrIndex2] = tangent.z;
173
- }
174
- if (vertexFormat.bitangent) {
175
- bitangents[attrIndex] = bitangent.x;
176
- bitangents[attrIndex1] = bitangent.y;
177
- bitangents[attrIndex2] = bitangent.z;
178
- }
179
- attrIndex += 3;
180
- }
181
- }
182
- return createAttributes(vertexFormat, {
183
- positions,
184
- normals,
185
- tangents,
186
- bitangents
187
- });
188
- }
189
- var v1Scratch = new Cartesian3_default();
190
- var v2Scratch = new Cartesian3_default();
191
- function calculateAttributesWall(positions, vertexFormat, ellipsoid) {
192
- const length = positions.length;
193
- const normals = vertexFormat.normal ? new Float32Array(length) : void 0;
194
- const tangents = vertexFormat.tangent ? new Float32Array(length) : void 0;
195
- const bitangents = vertexFormat.bitangent ? new Float32Array(length) : void 0;
196
- let normalIndex = 0;
197
- let tangentIndex = 0;
198
- let bitangentIndex = 0;
199
- let recomputeNormal = true;
200
- let bitangent = bitangentScratch;
201
- let tangent = tangentScratch;
202
- let normal = normalScratch;
203
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
204
- for (let i = 0; i < length; i += 6) {
205
- const p = Cartesian3_default.fromArray(positions, i, positionScratch);
206
- const p1 = Cartesian3_default.fromArray(positions, (i + 6) % length, v1Scratch);
207
- if (recomputeNormal) {
208
- const p2 = Cartesian3_default.fromArray(positions, (i + 3) % length, v2Scratch);
209
- Cartesian3_default.subtract(p1, p, p1);
210
- Cartesian3_default.subtract(p2, p, p2);
211
- normal = Cartesian3_default.normalize(Cartesian3_default.cross(p2, p1, normal), normal);
212
- recomputeNormal = false;
213
- }
214
- if (Cartesian3_default.equalsEpsilon(p1, p, Math_default.EPSILON10)) {
215
- recomputeNormal = true;
216
- }
217
- if (vertexFormat.tangent || vertexFormat.bitangent) {
218
- bitangent = ellipsoid.geodeticSurfaceNormal(p, bitangent);
219
- if (vertexFormat.tangent) {
220
- tangent = Cartesian3_default.normalize(
221
- Cartesian3_default.cross(bitangent, normal, tangent),
222
- tangent
223
- );
224
- }
225
- }
226
- if (vertexFormat.normal) {
227
- normals[normalIndex++] = normal.x;
228
- normals[normalIndex++] = normal.y;
229
- normals[normalIndex++] = normal.z;
230
- normals[normalIndex++] = normal.x;
231
- normals[normalIndex++] = normal.y;
232
- normals[normalIndex++] = normal.z;
233
- }
234
- if (vertexFormat.tangent) {
235
- tangents[tangentIndex++] = tangent.x;
236
- tangents[tangentIndex++] = tangent.y;
237
- tangents[tangentIndex++] = tangent.z;
238
- tangents[tangentIndex++] = tangent.x;
239
- tangents[tangentIndex++] = tangent.y;
240
- tangents[tangentIndex++] = tangent.z;
241
- }
242
- if (vertexFormat.bitangent) {
243
- bitangents[bitangentIndex++] = bitangent.x;
244
- bitangents[bitangentIndex++] = bitangent.y;
245
- bitangents[bitangentIndex++] = bitangent.z;
246
- bitangents[bitangentIndex++] = bitangent.x;
247
- bitangents[bitangentIndex++] = bitangent.y;
248
- bitangents[bitangentIndex++] = bitangent.z;
249
- }
250
- }
251
- }
252
- return createAttributes(vertexFormat, {
253
- positions,
254
- normals,
255
- tangents,
256
- bitangents
257
- });
258
- }
259
- function constructRectangle(rectangleGeometry, computedOptions) {
260
- const vertexFormat = rectangleGeometry._vertexFormat;
261
- const ellipsoid = rectangleGeometry._ellipsoid;
262
- const height = computedOptions.height;
263
- const width = computedOptions.width;
264
- const northCap = computedOptions.northCap;
265
- const southCap = computedOptions.southCap;
266
- let rowStart = 0;
267
- let rowEnd = height;
268
- let rowHeight = height;
269
- let size = 0;
270
- if (northCap) {
271
- rowStart = 1;
272
- rowHeight -= 1;
273
- size += 1;
274
- }
275
- if (southCap) {
276
- rowEnd -= 1;
277
- rowHeight -= 1;
278
- size += 1;
279
- }
280
- size += width * rowHeight;
281
- const positions = vertexFormat.position ? new Float64Array(size * 3) : void 0;
282
- const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
283
- let posIndex = 0;
284
- let stIndex = 0;
285
- const position = positionScratch;
286
- const st = stScratch;
287
- let minX = Number.MAX_VALUE;
288
- let minY = Number.MAX_VALUE;
289
- let maxX = -Number.MAX_VALUE;
290
- let maxY = -Number.MAX_VALUE;
291
- for (let row = rowStart; row < rowEnd; ++row) {
292
- for (let col = 0; col < width; ++col) {
293
- RectangleGeometryLibrary_default.computePosition(
294
- computedOptions,
295
- ellipsoid,
296
- vertexFormat.st,
297
- row,
298
- col,
299
- position,
300
- st
301
- );
302
- positions[posIndex++] = position.x;
303
- positions[posIndex++] = position.y;
304
- positions[posIndex++] = position.z;
305
- if (vertexFormat.st) {
306
- textureCoordinates[stIndex++] = st.x;
307
- textureCoordinates[stIndex++] = st.y;
308
- minX = Math.min(minX, st.x);
309
- minY = Math.min(minY, st.y);
310
- maxX = Math.max(maxX, st.x);
311
- maxY = Math.max(maxY, st.y);
312
- }
313
- }
314
- }
315
- if (northCap) {
316
- RectangleGeometryLibrary_default.computePosition(
317
- computedOptions,
318
- ellipsoid,
319
- vertexFormat.st,
320
- 0,
321
- 0,
322
- position,
323
- st
324
- );
325
- positions[posIndex++] = position.x;
326
- positions[posIndex++] = position.y;
327
- positions[posIndex++] = position.z;
328
- if (vertexFormat.st) {
329
- textureCoordinates[stIndex++] = st.x;
330
- textureCoordinates[stIndex++] = st.y;
331
- minX = st.x;
332
- minY = st.y;
333
- maxX = st.x;
334
- maxY = st.y;
335
- }
336
- }
337
- if (southCap) {
338
- RectangleGeometryLibrary_default.computePosition(
339
- computedOptions,
340
- ellipsoid,
341
- vertexFormat.st,
342
- height - 1,
343
- 0,
344
- position,
345
- st
346
- );
347
- positions[posIndex++] = position.x;
348
- positions[posIndex++] = position.y;
349
- positions[posIndex] = position.z;
350
- if (vertexFormat.st) {
351
- textureCoordinates[stIndex++] = st.x;
352
- textureCoordinates[stIndex] = st.y;
353
- minX = Math.min(minX, st.x);
354
- minY = Math.min(minY, st.y);
355
- maxX = Math.max(maxX, st.x);
356
- maxY = Math.max(maxY, st.y);
357
- }
358
- }
359
- if (vertexFormat.st && (minX < 0 || minY < 0 || maxX > 1 || maxY > 1)) {
360
- for (let k = 0; k < textureCoordinates.length; k += 2) {
361
- textureCoordinates[k] = (textureCoordinates[k] - minX) / (maxX - minX);
362
- textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minY) / (maxY - minY);
363
- }
364
- }
365
- const geo = calculateAttributes(
366
- positions,
367
- vertexFormat,
368
- ellipsoid,
369
- computedOptions.tangentRotationMatrix
370
- );
371
- let indicesSize = 6 * (width - 1) * (rowHeight - 1);
372
- if (northCap) {
373
- indicesSize += 3 * (width - 1);
374
- }
375
- if (southCap) {
376
- indicesSize += 3 * (width - 1);
377
- }
378
- const indices = IndexDatatype_default.createTypedArray(size, indicesSize);
379
- let index = 0;
380
- let indicesIndex = 0;
381
- let i;
382
- for (i = 0; i < rowHeight - 1; ++i) {
383
- for (let j = 0; j < width - 1; ++j) {
384
- const upperLeft = index;
385
- const lowerLeft = upperLeft + width;
386
- const lowerRight = lowerLeft + 1;
387
- const upperRight = upperLeft + 1;
388
- indices[indicesIndex++] = upperLeft;
389
- indices[indicesIndex++] = lowerLeft;
390
- indices[indicesIndex++] = upperRight;
391
- indices[indicesIndex++] = upperRight;
392
- indices[indicesIndex++] = lowerLeft;
393
- indices[indicesIndex++] = lowerRight;
394
- ++index;
395
- }
396
- ++index;
397
- }
398
- if (northCap || southCap) {
399
- let northIndex = size - 1;
400
- const southIndex = size - 1;
401
- if (northCap && southCap) {
402
- northIndex = size - 2;
403
- }
404
- let p1;
405
- let p2;
406
- index = 0;
407
- if (northCap) {
408
- for (i = 0; i < width - 1; i++) {
409
- p1 = index;
410
- p2 = p1 + 1;
411
- indices[indicesIndex++] = northIndex;
412
- indices[indicesIndex++] = p1;
413
- indices[indicesIndex++] = p2;
414
- ++index;
415
- }
416
- }
417
- if (southCap) {
418
- index = (rowHeight - 1) * width;
419
- for (i = 0; i < width - 1; i++) {
420
- p1 = index;
421
- p2 = p1 + 1;
422
- indices[indicesIndex++] = p1;
423
- indices[indicesIndex++] = southIndex;
424
- indices[indicesIndex++] = p2;
425
- ++index;
426
- }
427
- }
428
- }
429
- geo.indices = indices;
430
- if (vertexFormat.st) {
431
- geo.attributes.st = new GeometryAttribute_default({
432
- componentDatatype: ComponentDatatype_default.FLOAT,
433
- componentsPerAttribute: 2,
434
- values: textureCoordinates
435
- });
436
- }
437
- return geo;
438
- }
439
- function addWallPositions(wallPositions, posIndex, i, topPositions, bottomPositions) {
440
- wallPositions[posIndex++] = topPositions[i];
441
- wallPositions[posIndex++] = topPositions[i + 1];
442
- wallPositions[posIndex++] = topPositions[i + 2];
443
- wallPositions[posIndex++] = bottomPositions[i];
444
- wallPositions[posIndex++] = bottomPositions[i + 1];
445
- wallPositions[posIndex] = bottomPositions[i + 2];
446
- return wallPositions;
447
- }
448
- function addWallTextureCoordinates(wallTextures, stIndex, i, st) {
449
- wallTextures[stIndex++] = st[i];
450
- wallTextures[stIndex++] = st[i + 1];
451
- wallTextures[stIndex++] = st[i];
452
- wallTextures[stIndex] = st[i + 1];
453
- return wallTextures;
454
- }
455
- var scratchVertexFormat = new VertexFormat_default();
456
- function constructExtrudedRectangle(rectangleGeometry, computedOptions) {
457
- const shadowVolume = rectangleGeometry._shadowVolume;
458
- const offsetAttributeValue = rectangleGeometry._offsetAttribute;
459
- const vertexFormat = rectangleGeometry._vertexFormat;
460
- const minHeight = rectangleGeometry._extrudedHeight;
461
- const maxHeight = rectangleGeometry._surfaceHeight;
462
- const ellipsoid = rectangleGeometry._ellipsoid;
463
- const height = computedOptions.height;
464
- const width = computedOptions.width;
465
- let i;
466
- if (shadowVolume) {
467
- const newVertexFormat = VertexFormat_default.clone(
468
- vertexFormat,
469
- scratchVertexFormat
470
- );
471
- newVertexFormat.normal = true;
472
- rectangleGeometry._vertexFormat = newVertexFormat;
473
- }
474
- const topBottomGeo = constructRectangle(rectangleGeometry, computedOptions);
475
- if (shadowVolume) {
476
- rectangleGeometry._vertexFormat = vertexFormat;
477
- }
478
- let topPositions = PolygonPipeline_default.scaleToGeodeticHeight(
479
- topBottomGeo.attributes.position.values,
480
- maxHeight,
481
- ellipsoid,
482
- false
483
- );
484
- topPositions = new Float64Array(topPositions);
485
- let length = topPositions.length;
486
- const newLength = length * 2;
487
- const positions = new Float64Array(newLength);
488
- positions.set(topPositions);
489
- const bottomPositions = PolygonPipeline_default.scaleToGeodeticHeight(
490
- topBottomGeo.attributes.position.values,
491
- minHeight,
492
- ellipsoid
493
- );
494
- positions.set(bottomPositions, length);
495
- topBottomGeo.attributes.position.values = positions;
496
- const normals = vertexFormat.normal ? new Float32Array(newLength) : void 0;
497
- const tangents = vertexFormat.tangent ? new Float32Array(newLength) : void 0;
498
- const bitangents = vertexFormat.bitangent ? new Float32Array(newLength) : void 0;
499
- const textures = vertexFormat.st ? new Float32Array(newLength / 3 * 2) : void 0;
500
- let topSt;
501
- let topNormals;
502
- if (vertexFormat.normal) {
503
- topNormals = topBottomGeo.attributes.normal.values;
504
- normals.set(topNormals);
505
- for (i = 0; i < length; i++) {
506
- topNormals[i] = -topNormals[i];
507
- }
508
- normals.set(topNormals, length);
509
- topBottomGeo.attributes.normal.values = normals;
510
- }
511
- if (shadowVolume) {
512
- topNormals = topBottomGeo.attributes.normal.values;
513
- if (!vertexFormat.normal) {
514
- topBottomGeo.attributes.normal = void 0;
515
- }
516
- const extrudeNormals = new Float32Array(newLength);
517
- for (i = 0; i < length; i++) {
518
- topNormals[i] = -topNormals[i];
519
- }
520
- extrudeNormals.set(topNormals, length);
521
- topBottomGeo.attributes.extrudeDirection = new GeometryAttribute_default({
522
- componentDatatype: ComponentDatatype_default.FLOAT,
523
- componentsPerAttribute: 3,
524
- values: extrudeNormals
525
- });
526
- }
527
- let offsetValue;
528
- const hasOffsets = defined_default(offsetAttributeValue);
529
- if (hasOffsets) {
530
- const size = length / 3 * 2;
531
- let offsetAttribute = new Uint8Array(size);
532
- if (offsetAttributeValue === GeometryOffsetAttribute_default.TOP) {
533
- offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
534
- } else {
535
- offsetValue = offsetAttributeValue === GeometryOffsetAttribute_default.NONE ? 0 : 1;
536
- offsetAttribute = offsetAttribute.fill(offsetValue);
537
- }
538
- topBottomGeo.attributes.applyOffset = new GeometryAttribute_default({
539
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
540
- componentsPerAttribute: 1,
541
- values: offsetAttribute
542
- });
543
- }
544
- if (vertexFormat.tangent) {
545
- const topTangents = topBottomGeo.attributes.tangent.values;
546
- tangents.set(topTangents);
547
- for (i = 0; i < length; i++) {
548
- topTangents[i] = -topTangents[i];
549
- }
550
- tangents.set(topTangents, length);
551
- topBottomGeo.attributes.tangent.values = tangents;
552
- }
553
- if (vertexFormat.bitangent) {
554
- const topBitangents = topBottomGeo.attributes.bitangent.values;
555
- bitangents.set(topBitangents);
556
- bitangents.set(topBitangents, length);
557
- topBottomGeo.attributes.bitangent.values = bitangents;
558
- }
559
- if (vertexFormat.st) {
560
- topSt = topBottomGeo.attributes.st.values;
561
- textures.set(topSt);
562
- textures.set(topSt, length / 3 * 2);
563
- topBottomGeo.attributes.st.values = textures;
564
- }
565
- const indices = topBottomGeo.indices;
566
- const indicesLength = indices.length;
567
- const posLength = length / 3;
568
- const newIndices = IndexDatatype_default.createTypedArray(
569
- newLength / 3,
570
- indicesLength * 2
571
- );
572
- newIndices.set(indices);
573
- for (i = 0; i < indicesLength; i += 3) {
574
- newIndices[i + indicesLength] = indices[i + 2] + posLength;
575
- newIndices[i + 1 + indicesLength] = indices[i + 1] + posLength;
576
- newIndices[i + 2 + indicesLength] = indices[i] + posLength;
577
- }
578
- topBottomGeo.indices = newIndices;
579
- const northCap = computedOptions.northCap;
580
- const southCap = computedOptions.southCap;
581
- let rowHeight = height;
582
- let widthMultiplier = 2;
583
- let perimeterPositions = 0;
584
- let corners = 4;
585
- let dupliateCorners = 4;
586
- if (northCap) {
587
- widthMultiplier -= 1;
588
- rowHeight -= 1;
589
- perimeterPositions += 1;
590
- corners -= 2;
591
- dupliateCorners -= 1;
592
- }
593
- if (southCap) {
594
- widthMultiplier -= 1;
595
- rowHeight -= 1;
596
- perimeterPositions += 1;
597
- corners -= 2;
598
- dupliateCorners -= 1;
599
- }
600
- perimeterPositions += widthMultiplier * width + 2 * rowHeight - corners;
601
- const wallCount = (perimeterPositions + dupliateCorners) * 2;
602
- let wallPositions = new Float64Array(wallCount * 3);
603
- const wallExtrudeNormals = shadowVolume ? new Float32Array(wallCount * 3) : void 0;
604
- let wallOffsetAttribute = hasOffsets ? new Uint8Array(wallCount) : void 0;
605
- let wallTextures = vertexFormat.st ? new Float32Array(wallCount * 2) : void 0;
606
- const computeTopOffsets = offsetAttributeValue === GeometryOffsetAttribute_default.TOP;
607
- if (hasOffsets && !computeTopOffsets) {
608
- offsetValue = offsetAttributeValue === GeometryOffsetAttribute_default.ALL ? 1 : 0;
609
- wallOffsetAttribute = wallOffsetAttribute.fill(offsetValue);
610
- }
611
- let posIndex = 0;
612
- let stIndex = 0;
613
- let extrudeNormalIndex = 0;
614
- let wallOffsetIndex = 0;
615
- const area = width * rowHeight;
616
- let threeI;
617
- for (i = 0; i < area; i += width) {
618
- threeI = i * 3;
619
- wallPositions = addWallPositions(
620
- wallPositions,
621
- posIndex,
622
- threeI,
623
- topPositions,
624
- bottomPositions
625
- );
626
- posIndex += 6;
627
- if (vertexFormat.st) {
628
- wallTextures = addWallTextureCoordinates(
629
- wallTextures,
630
- stIndex,
631
- i * 2,
632
- topSt
633
- );
634
- stIndex += 4;
635
- }
636
- if (shadowVolume) {
637
- extrudeNormalIndex += 3;
638
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
639
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
640
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
641
- }
642
- if (computeTopOffsets) {
643
- wallOffsetAttribute[wallOffsetIndex++] = 1;
644
- wallOffsetIndex += 1;
645
- }
646
- }
647
- if (!southCap) {
648
- for (i = area - width; i < area; i++) {
649
- threeI = i * 3;
650
- wallPositions = addWallPositions(
651
- wallPositions,
652
- posIndex,
653
- threeI,
654
- topPositions,
655
- bottomPositions
656
- );
657
- posIndex += 6;
658
- if (vertexFormat.st) {
659
- wallTextures = addWallTextureCoordinates(
660
- wallTextures,
661
- stIndex,
662
- i * 2,
663
- topSt
664
- );
665
- stIndex += 4;
666
- }
667
- if (shadowVolume) {
668
- extrudeNormalIndex += 3;
669
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
670
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
671
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
672
- }
673
- if (computeTopOffsets) {
674
- wallOffsetAttribute[wallOffsetIndex++] = 1;
675
- wallOffsetIndex += 1;
676
- }
677
- }
678
- } else {
679
- const southIndex = northCap ? area + 1 : area;
680
- threeI = southIndex * 3;
681
- for (i = 0; i < 2; i++) {
682
- wallPositions = addWallPositions(
683
- wallPositions,
684
- posIndex,
685
- threeI,
686
- topPositions,
687
- bottomPositions
688
- );
689
- posIndex += 6;
690
- if (vertexFormat.st) {
691
- wallTextures = addWallTextureCoordinates(
692
- wallTextures,
693
- stIndex,
694
- southIndex * 2,
695
- topSt
696
- );
697
- stIndex += 4;
698
- }
699
- if (shadowVolume) {
700
- extrudeNormalIndex += 3;
701
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
702
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
703
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
704
- }
705
- if (computeTopOffsets) {
706
- wallOffsetAttribute[wallOffsetIndex++] = 1;
707
- wallOffsetIndex += 1;
708
- }
709
- }
710
- }
711
- for (i = area - 1; i > 0; i -= width) {
712
- threeI = i * 3;
713
- wallPositions = addWallPositions(
714
- wallPositions,
715
- posIndex,
716
- threeI,
717
- topPositions,
718
- bottomPositions
719
- );
720
- posIndex += 6;
721
- if (vertexFormat.st) {
722
- wallTextures = addWallTextureCoordinates(
723
- wallTextures,
724
- stIndex,
725
- i * 2,
726
- topSt
727
- );
728
- stIndex += 4;
729
- }
730
- if (shadowVolume) {
731
- extrudeNormalIndex += 3;
732
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
733
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
734
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
735
- }
736
- if (computeTopOffsets) {
737
- wallOffsetAttribute[wallOffsetIndex++] = 1;
738
- wallOffsetIndex += 1;
739
- }
740
- }
741
- if (!northCap) {
742
- for (i = width - 1; i >= 0; i--) {
743
- threeI = i * 3;
744
- wallPositions = addWallPositions(
745
- wallPositions,
746
- posIndex,
747
- threeI,
748
- topPositions,
749
- bottomPositions
750
- );
751
- posIndex += 6;
752
- if (vertexFormat.st) {
753
- wallTextures = addWallTextureCoordinates(
754
- wallTextures,
755
- stIndex,
756
- i * 2,
757
- topSt
758
- );
759
- stIndex += 4;
760
- }
761
- if (shadowVolume) {
762
- extrudeNormalIndex += 3;
763
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
764
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
765
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
766
- }
767
- if (computeTopOffsets) {
768
- wallOffsetAttribute[wallOffsetIndex++] = 1;
769
- wallOffsetIndex += 1;
770
- }
771
- }
772
- } else {
773
- const northIndex = area;
774
- threeI = northIndex * 3;
775
- for (i = 0; i < 2; i++) {
776
- wallPositions = addWallPositions(
777
- wallPositions,
778
- posIndex,
779
- threeI,
780
- topPositions,
781
- bottomPositions
782
- );
783
- posIndex += 6;
784
- if (vertexFormat.st) {
785
- wallTextures = addWallTextureCoordinates(
786
- wallTextures,
787
- stIndex,
788
- northIndex * 2,
789
- topSt
790
- );
791
- stIndex += 4;
792
- }
793
- if (shadowVolume) {
794
- extrudeNormalIndex += 3;
795
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
796
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
797
- wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
798
- }
799
- if (computeTopOffsets) {
800
- wallOffsetAttribute[wallOffsetIndex++] = 1;
801
- wallOffsetIndex += 1;
802
- }
803
- }
804
- }
805
- let geo = calculateAttributesWall(wallPositions, vertexFormat, ellipsoid);
806
- if (vertexFormat.st) {
807
- geo.attributes.st = new GeometryAttribute_default({
808
- componentDatatype: ComponentDatatype_default.FLOAT,
809
- componentsPerAttribute: 2,
810
- values: wallTextures
811
- });
812
- }
813
- if (shadowVolume) {
814
- geo.attributes.extrudeDirection = new GeometryAttribute_default({
815
- componentDatatype: ComponentDatatype_default.FLOAT,
816
- componentsPerAttribute: 3,
817
- values: wallExtrudeNormals
818
- });
819
- }
820
- if (hasOffsets) {
821
- geo.attributes.applyOffset = new GeometryAttribute_default({
822
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
823
- componentsPerAttribute: 1,
824
- values: wallOffsetAttribute
825
- });
826
- }
827
- const wallIndices = IndexDatatype_default.createTypedArray(
828
- wallCount,
829
- perimeterPositions * 6
830
- );
831
- let upperLeft;
832
- let lowerLeft;
833
- let lowerRight;
834
- let upperRight;
835
- length = wallPositions.length / 3;
836
- let index = 0;
837
- for (i = 0; i < length - 1; i += 2) {
838
- upperLeft = i;
839
- upperRight = (upperLeft + 2) % length;
840
- const p1 = Cartesian3_default.fromArray(wallPositions, upperLeft * 3, v1Scratch);
841
- const p2 = Cartesian3_default.fromArray(wallPositions, upperRight * 3, v2Scratch);
842
- if (Cartesian3_default.equalsEpsilon(p1, p2, Math_default.EPSILON10)) {
843
- continue;
844
- }
845
- lowerLeft = (upperLeft + 1) % length;
846
- lowerRight = (lowerLeft + 2) % length;
847
- wallIndices[index++] = upperLeft;
848
- wallIndices[index++] = lowerLeft;
849
- wallIndices[index++] = upperRight;
850
- wallIndices[index++] = upperRight;
851
- wallIndices[index++] = lowerLeft;
852
- wallIndices[index++] = lowerRight;
853
- }
854
- geo.indices = wallIndices;
855
- geo = GeometryPipeline_default.combineInstances([
856
- new GeometryInstance_default({
857
- geometry: topBottomGeo
858
- }),
859
- new GeometryInstance_default({
860
- geometry: geo
861
- })
862
- ]);
863
- return geo[0];
864
- }
865
- var scratchRectanglePoints = [
866
- new Cartesian3_default(),
867
- new Cartesian3_default(),
868
- new Cartesian3_default(),
869
- new Cartesian3_default()
870
- ];
871
- var nwScratch = new Cartographic_default();
872
- var stNwScratch = new Cartographic_default();
873
- function computeRectangle(rectangle, granularity, rotation, ellipsoid, result) {
874
- if (rotation === 0) {
875
- return Rectangle_default.clone(rectangle, result);
876
- }
877
- const computedOptions = RectangleGeometryLibrary_default.computeOptions(
878
- rectangle,
879
- granularity,
880
- rotation,
881
- 0,
882
- rectangleScratch,
883
- nwScratch
884
- );
885
- const height = computedOptions.height;
886
- const width = computedOptions.width;
887
- const positions = scratchRectanglePoints;
888
- RectangleGeometryLibrary_default.computePosition(
889
- computedOptions,
890
- ellipsoid,
891
- false,
892
- 0,
893
- 0,
894
- positions[0]
895
- );
896
- RectangleGeometryLibrary_default.computePosition(
897
- computedOptions,
898
- ellipsoid,
899
- false,
900
- 0,
901
- width - 1,
902
- positions[1]
903
- );
904
- RectangleGeometryLibrary_default.computePosition(
905
- computedOptions,
906
- ellipsoid,
907
- false,
908
- height - 1,
909
- 0,
910
- positions[2]
911
- );
912
- RectangleGeometryLibrary_default.computePosition(
913
- computedOptions,
914
- ellipsoid,
915
- false,
916
- height - 1,
917
- width - 1,
918
- positions[3]
919
- );
920
- return Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
921
- }
922
- function RectangleGeometry(options) {
923
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
924
- const rectangle = options.rectangle;
925
- Check_default.typeOf.object("rectangle", rectangle);
926
- Rectangle_default.validate(rectangle);
927
- if (rectangle.north < rectangle.south) {
928
- throw new DeveloperError_default(
929
- "options.rectangle.north must be greater than or equal to options.rectangle.south"
930
- );
931
- }
932
- const height = defaultValue_default(options.height, 0);
933
- const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
934
- this._rectangle = Rectangle_default.clone(rectangle);
935
- this._granularity = defaultValue_default(
936
- options.granularity,
937
- Math_default.RADIANS_PER_DEGREE
938
- );
939
- this._ellipsoid = Ellipsoid_default.clone(
940
- defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
941
- );
942
- this._surfaceHeight = Math.max(height, extrudedHeight);
943
- this._rotation = defaultValue_default(options.rotation, 0);
944
- this._stRotation = defaultValue_default(options.stRotation, 0);
945
- this._vertexFormat = VertexFormat_default.clone(
946
- defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
947
- );
948
- this._extrudedHeight = Math.min(height, extrudedHeight);
949
- this._shadowVolume = defaultValue_default(options.shadowVolume, false);
950
- this._workerName = "createRectangleGeometry";
951
- this._offsetAttribute = options.offsetAttribute;
952
- this._rotatedRectangle = void 0;
953
- this._textureCoordinateRotationPoints = void 0;
954
- }
955
- RectangleGeometry.packedLength = Rectangle_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
956
- RectangleGeometry.pack = function(value, array, startingIndex) {
957
- Check_default.typeOf.object("value", value);
958
- Check_default.defined("array", array);
959
- startingIndex = defaultValue_default(startingIndex, 0);
960
- Rectangle_default.pack(value._rectangle, array, startingIndex);
961
- startingIndex += Rectangle_default.packedLength;
962
- Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
963
- startingIndex += Ellipsoid_default.packedLength;
964
- VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
965
- startingIndex += VertexFormat_default.packedLength;
966
- array[startingIndex++] = value._granularity;
967
- array[startingIndex++] = value._surfaceHeight;
968
- array[startingIndex++] = value._rotation;
969
- array[startingIndex++] = value._stRotation;
970
- array[startingIndex++] = value._extrudedHeight;
971
- array[startingIndex++] = value._shadowVolume ? 1 : 0;
972
- array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
973
- return array;
974
- };
975
- var scratchRectangle = new Rectangle_default();
976
- var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
977
- var scratchOptions = {
978
- rectangle: scratchRectangle,
979
- ellipsoid: scratchEllipsoid,
980
- vertexFormat: scratchVertexFormat,
981
- granularity: void 0,
982
- height: void 0,
983
- rotation: void 0,
984
- stRotation: void 0,
985
- extrudedHeight: void 0,
986
- shadowVolume: void 0,
987
- offsetAttribute: void 0
988
- };
989
- RectangleGeometry.unpack = function(array, startingIndex, result) {
990
- Check_default.defined("array", array);
991
- startingIndex = defaultValue_default(startingIndex, 0);
992
- const rectangle = Rectangle_default.unpack(array, startingIndex, scratchRectangle);
993
- startingIndex += Rectangle_default.packedLength;
994
- const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
995
- startingIndex += Ellipsoid_default.packedLength;
996
- const vertexFormat = VertexFormat_default.unpack(
997
- array,
998
- startingIndex,
999
- scratchVertexFormat
1000
- );
1001
- startingIndex += VertexFormat_default.packedLength;
1002
- const granularity = array[startingIndex++];
1003
- const surfaceHeight = array[startingIndex++];
1004
- const rotation = array[startingIndex++];
1005
- const stRotation = array[startingIndex++];
1006
- const extrudedHeight = array[startingIndex++];
1007
- const shadowVolume = array[startingIndex++] === 1;
1008
- const offsetAttribute = array[startingIndex];
1009
- if (!defined_default(result)) {
1010
- scratchOptions.granularity = granularity;
1011
- scratchOptions.height = surfaceHeight;
1012
- scratchOptions.rotation = rotation;
1013
- scratchOptions.stRotation = stRotation;
1014
- scratchOptions.extrudedHeight = extrudedHeight;
1015
- scratchOptions.shadowVolume = shadowVolume;
1016
- scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1017
- return new RectangleGeometry(scratchOptions);
1018
- }
1019
- result._rectangle = Rectangle_default.clone(rectangle, result._rectangle);
1020
- result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
1021
- result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
1022
- result._granularity = granularity;
1023
- result._surfaceHeight = surfaceHeight;
1024
- result._rotation = rotation;
1025
- result._stRotation = stRotation;
1026
- result._extrudedHeight = extrudedHeight;
1027
- result._shadowVolume = shadowVolume;
1028
- result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1029
- return result;
1030
- };
1031
- RectangleGeometry.computeRectangle = function(options, result) {
1032
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
1033
- const rectangle = options.rectangle;
1034
- Check_default.typeOf.object("rectangle", rectangle);
1035
- Rectangle_default.validate(rectangle);
1036
- if (rectangle.north < rectangle.south) {
1037
- throw new DeveloperError_default(
1038
- "options.rectangle.north must be greater than or equal to options.rectangle.south"
1039
- );
1040
- }
1041
- const granularity = defaultValue_default(
1042
- options.granularity,
1043
- Math_default.RADIANS_PER_DEGREE
1044
- );
1045
- const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
1046
- const rotation = defaultValue_default(options.rotation, 0);
1047
- return computeRectangle(rectangle, granularity, rotation, ellipsoid, result);
1048
- };
1049
- var tangentRotationMatrixScratch = new Matrix3_default();
1050
- var quaternionScratch = new Quaternion_default();
1051
- var centerScratch = new Cartographic_default();
1052
- RectangleGeometry.createGeometry = function(rectangleGeometry) {
1053
- if (Math_default.equalsEpsilon(
1054
- rectangleGeometry._rectangle.north,
1055
- rectangleGeometry._rectangle.south,
1056
- Math_default.EPSILON10
1057
- ) || Math_default.equalsEpsilon(
1058
- rectangleGeometry._rectangle.east,
1059
- rectangleGeometry._rectangle.west,
1060
- Math_default.EPSILON10
1061
- )) {
1062
- return void 0;
1063
- }
1064
- let rectangle = rectangleGeometry._rectangle;
1065
- const ellipsoid = rectangleGeometry._ellipsoid;
1066
- const rotation = rectangleGeometry._rotation;
1067
- const stRotation = rectangleGeometry._stRotation;
1068
- const vertexFormat = rectangleGeometry._vertexFormat;
1069
- const computedOptions = RectangleGeometryLibrary_default.computeOptions(
1070
- rectangle,
1071
- rectangleGeometry._granularity,
1072
- rotation,
1073
- stRotation,
1074
- rectangleScratch,
1075
- nwScratch,
1076
- stNwScratch
1077
- );
1078
- const tangentRotationMatrix = tangentRotationMatrixScratch;
1079
- if (stRotation !== 0 || rotation !== 0) {
1080
- const center = Rectangle_default.center(rectangle, centerScratch);
1081
- const axis = ellipsoid.geodeticSurfaceNormalCartographic(center, v1Scratch);
1082
- Quaternion_default.fromAxisAngle(axis, -stRotation, quaternionScratch);
1083
- Matrix3_default.fromQuaternion(quaternionScratch, tangentRotationMatrix);
1084
- } else {
1085
- Matrix3_default.clone(Matrix3_default.IDENTITY, tangentRotationMatrix);
1086
- }
1087
- const surfaceHeight = rectangleGeometry._surfaceHeight;
1088
- const extrudedHeight = rectangleGeometry._extrudedHeight;
1089
- const extrude = !Math_default.equalsEpsilon(
1090
- surfaceHeight,
1091
- extrudedHeight,
1092
- 0,
1093
- Math_default.EPSILON2
1094
- );
1095
- computedOptions.lonScalar = 1 / rectangleGeometry._rectangle.width;
1096
- computedOptions.latScalar = 1 / rectangleGeometry._rectangle.height;
1097
- computedOptions.tangentRotationMatrix = tangentRotationMatrix;
1098
- let geometry;
1099
- let boundingSphere;
1100
- rectangle = rectangleGeometry._rectangle;
1101
- if (extrude) {
1102
- geometry = constructExtrudedRectangle(rectangleGeometry, computedOptions);
1103
- const topBS = BoundingSphere_default.fromRectangle3D(
1104
- rectangle,
1105
- ellipsoid,
1106
- surfaceHeight,
1107
- topBoundingSphere
1108
- );
1109
- const bottomBS = BoundingSphere_default.fromRectangle3D(
1110
- rectangle,
1111
- ellipsoid,
1112
- extrudedHeight,
1113
- bottomBoundingSphere
1114
- );
1115
- boundingSphere = BoundingSphere_default.union(topBS, bottomBS);
1116
- } else {
1117
- geometry = constructRectangle(rectangleGeometry, computedOptions);
1118
- geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1119
- geometry.attributes.position.values,
1120
- surfaceHeight,
1121
- ellipsoid,
1122
- false
1123
- );
1124
- if (defined_default(rectangleGeometry._offsetAttribute)) {
1125
- const length = geometry.attributes.position.values.length;
1126
- const offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
1127
- const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
1128
- geometry.attributes.applyOffset = new GeometryAttribute_default({
1129
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
1130
- componentsPerAttribute: 1,
1131
- values: applyOffset
1132
- });
1133
- }
1134
- boundingSphere = BoundingSphere_default.fromRectangle3D(
1135
- rectangle,
1136
- ellipsoid,
1137
- surfaceHeight
1138
- );
1139
- }
1140
- if (!vertexFormat.position) {
1141
- delete geometry.attributes.position;
1142
- }
1143
- return new Geometry_default({
1144
- attributes: geometry.attributes,
1145
- indices: geometry.indices,
1146
- primitiveType: geometry.primitiveType,
1147
- boundingSphere,
1148
- offsetAttribute: rectangleGeometry._offsetAttribute
1149
- });
1150
- };
1151
- RectangleGeometry.createShadowVolume = function(rectangleGeometry, minHeightFunc, maxHeightFunc) {
1152
- const granularity = rectangleGeometry._granularity;
1153
- const ellipsoid = rectangleGeometry._ellipsoid;
1154
- const minHeight = minHeightFunc(granularity, ellipsoid);
1155
- const maxHeight = maxHeightFunc(granularity, ellipsoid);
1156
- return new RectangleGeometry({
1157
- rectangle: rectangleGeometry._rectangle,
1158
- rotation: rectangleGeometry._rotation,
1159
- ellipsoid,
1160
- stRotation: rectangleGeometry._stRotation,
1161
- granularity,
1162
- extrudedHeight: maxHeight,
1163
- height: minHeight,
1164
- vertexFormat: VertexFormat_default.POSITION_ONLY,
1165
- shadowVolume: true
1166
- });
1167
- };
1168
- var unrotatedTextureRectangleScratch = new Rectangle_default();
1169
- var points2DScratch = [new Cartesian2_default(), new Cartesian2_default(), new Cartesian2_default()];
1170
- var rotation2DScratch = new Matrix2_default();
1171
- var rectangleCenterScratch = new Cartographic_default();
1172
- function textureCoordinateRotationPoints(rectangleGeometry) {
1173
- if (rectangleGeometry._stRotation === 0) {
1174
- return [0, 0, 0, 1, 1, 0];
1175
- }
1176
- const rectangle = Rectangle_default.clone(
1177
- rectangleGeometry._rectangle,
1178
- unrotatedTextureRectangleScratch
1179
- );
1180
- const granularity = rectangleGeometry._granularity;
1181
- const ellipsoid = rectangleGeometry._ellipsoid;
1182
- const rotation = rectangleGeometry._rotation - rectangleGeometry._stRotation;
1183
- const unrotatedTextureRectangle = computeRectangle(
1184
- rectangle,
1185
- granularity,
1186
- rotation,
1187
- ellipsoid,
1188
- unrotatedTextureRectangleScratch
1189
- );
1190
- const points2D = points2DScratch;
1191
- points2D[0].x = unrotatedTextureRectangle.west;
1192
- points2D[0].y = unrotatedTextureRectangle.south;
1193
- points2D[1].x = unrotatedTextureRectangle.west;
1194
- points2D[1].y = unrotatedTextureRectangle.north;
1195
- points2D[2].x = unrotatedTextureRectangle.east;
1196
- points2D[2].y = unrotatedTextureRectangle.south;
1197
- const boundingRectangle = rectangleGeometry.rectangle;
1198
- const toDesiredInComputed = Matrix2_default.fromRotation(
1199
- rectangleGeometry._stRotation,
1200
- rotation2DScratch
1201
- );
1202
- const boundingRectangleCenter = Rectangle_default.center(
1203
- boundingRectangle,
1204
- rectangleCenterScratch
1205
- );
1206
- for (let i = 0; i < 3; ++i) {
1207
- const point2D = points2D[i];
1208
- point2D.x -= boundingRectangleCenter.longitude;
1209
- point2D.y -= boundingRectangleCenter.latitude;
1210
- Matrix2_default.multiplyByVector(toDesiredInComputed, point2D, point2D);
1211
- point2D.x += boundingRectangleCenter.longitude;
1212
- point2D.y += boundingRectangleCenter.latitude;
1213
- point2D.x = (point2D.x - boundingRectangle.west) / boundingRectangle.width;
1214
- point2D.y = (point2D.y - boundingRectangle.south) / boundingRectangle.height;
1215
- }
1216
- const minXYCorner = points2D[0];
1217
- const maxYCorner = points2D[1];
1218
- const maxXCorner = points2D[2];
1219
- const result = new Array(6);
1220
- Cartesian2_default.pack(minXYCorner, result);
1221
- Cartesian2_default.pack(maxYCorner, result, 2);
1222
- Cartesian2_default.pack(maxXCorner, result, 4);
1223
- return result;
1224
- }
1225
- Object.defineProperties(RectangleGeometry.prototype, {
1226
- /**
1227
- * @private
1228
- */
1229
- rectangle: {
1230
- get: function() {
1231
- if (!defined_default(this._rotatedRectangle)) {
1232
- this._rotatedRectangle = computeRectangle(
1233
- this._rectangle,
1234
- this._granularity,
1235
- this._rotation,
1236
- this._ellipsoid
1237
- );
1238
- }
1239
- return this._rotatedRectangle;
1240
- }
1241
- },
1242
- /**
1243
- * For remapping texture coordinates when rendering RectangleGeometries as GroundPrimitives.
1244
- * This version permits skew in textures by computing offsets directly in cartographic space and
1245
- * more accurately approximates rendering RectangleGeometries with height as standard Primitives.
1246
- * @see Geometry#_textureCoordinateRotationPoints
1247
- * @private
1248
- */
1249
- textureCoordinateRotationPoints: {
1250
- get: function() {
1251
- if (!defined_default(this._textureCoordinateRotationPoints)) {
1252
- this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
1253
- this
1254
- );
1255
- }
1256
- return this._textureCoordinateRotationPoints;
1257
- }
1258
- }
1259
- });
1260
- var RectangleGeometry_default = RectangleGeometry;
1261
-
1262
- // packages/engine/Source/Workers/createRectangleGeometry.js
1263
- function createRectangleGeometry(rectangleGeometry, offset) {
1264
- if (defined_default(offset)) {
1265
- rectangleGeometry = RectangleGeometry_default.unpack(rectangleGeometry, offset);
1266
- }
1267
- rectangleGeometry._ellipsoid = Ellipsoid_default.clone(rectangleGeometry._ellipsoid);
1268
- rectangleGeometry._rectangle = Rectangle_default.clone(rectangleGeometry._rectangle);
1269
- return RectangleGeometry_default.createGeometry(rectangleGeometry);
1270
- }
1271
- var createRectangleGeometry_default = createRectangleGeometry;
1272
- export {
1273
- createRectangleGeometry_default as default
1274
- };
26
+ import{a as W}from"./chunk-5YEWO3HT.js";import{a as Nt}from"./chunk-D6AA5QVT.js";import{a as zt}from"./chunk-VW6VD53G.js";import"./chunk-DEPHB2WM.js";import"./chunk-QOUAJ6TL.js";import{a as ft}from"./chunk-GBYLG25F.js";import{a as q}from"./chunk-CYCB63OH.js";import{b as yt}from"./chunk-77IHZJJ3.js";import"./chunk-G5AGHVVC.js";import"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as At}from"./chunk-OFUUQVMR.js";import{a as Vt}from"./chunk-A56XVLQR.js";import{b as Mt,c as Pt,d as Y}from"./chunk-RCV6KWXS.js";import{d as at}from"./chunk-4IW2T6GF.js";import{f as Lt,h as E,i as bt}from"./chunk-PSPPBZWI.js";import{a as U}from"./chunk-AU7IKHOH.js";import{a as w,b as mt,c as $,d as D,e as lt,f as St}from"./chunk-64RSHJUE.js";import{a as I}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{a as Et,b as ct}from"./chunk-LEYMRMBK.js";import{e as K}from"./chunk-VTAIKJXX.js";var Tt=new w,Bt=new w,Ut=new w,Yt=new w,qt=new E,Zt=new $,Kt=new at,$t=new at;function Xt(t,e){let n=new Pt({attributes:new Vt,primitiveType:Mt.TRIANGLES});return n.attributes.position=new Y({componentDatatype:U.DOUBLE,componentsPerAttribute:3,values:e.positions}),t.normal&&(n.attributes.normal=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:3,values:e.normals})),t.tangent&&(n.attributes.tangent=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:3,values:e.tangents})),t.bitangent&&(n.attributes.bitangent=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:3,values:e.bitangents})),n}function Gt(t,e,n,r){let a=t.length,c=e.normal?new Float32Array(a):void 0,l=e.tangent?new Float32Array(a):void 0,u=e.bitangent?new Float32Array(a):void 0,p=0,d=Yt,o=Ut,i=Bt;if(e.normal||e.tangent||e.bitangent)for(let f=0;f<a;f+=3){let s=w.fromArray(t,f,Tt),h=p+1,g=p+2;i=n.geodeticSurfaceNormal(s,i),(e.tangent||e.bitangent)&&(w.cross(w.UNIT_Z,i,o),lt.multiplyByVector(r,o,o),w.normalize(o,o),e.bitangent&&w.normalize(w.cross(i,o,d),d)),e.normal&&(c[p]=i.x,c[h]=i.y,c[g]=i.z),e.tangent&&(l[p]=o.x,l[h]=o.y,l[g]=o.z),e.bitangent&&(u[p]=d.x,u[h]=d.y,u[g]=d.z),p+=3}return Xt(e,{positions:t,normals:c,tangents:l,bitangents:u})}var Ct=new w,jt=new w;function te(t,e,n){let r=t.length,a=e.normal?new Float32Array(r):void 0,c=e.tangent?new Float32Array(r):void 0,l=e.bitangent?new Float32Array(r):void 0,u=0,p=0,d=0,o=!0,i=Yt,f=Ut,s=Bt;if(e.normal||e.tangent||e.bitangent)for(let h=0;h<r;h+=6){let g=w.fromArray(t,h,Tt),A=w.fromArray(t,(h+6)%r,Ct);if(o){let b=w.fromArray(t,(h+3)%r,jt);w.subtract(A,g,A),w.subtract(b,g,b),s=w.normalize(w.cross(b,A,s),s),o=!1}w.equalsEpsilon(A,g,I.EPSILON10)&&(o=!0),(e.tangent||e.bitangent)&&(i=n.geodeticSurfaceNormal(g,i),e.tangent&&(f=w.normalize(w.cross(i,s,f),f))),e.normal&&(a[u++]=s.x,a[u++]=s.y,a[u++]=s.z,a[u++]=s.x,a[u++]=s.y,a[u++]=s.z),e.tangent&&(c[p++]=f.x,c[p++]=f.y,c[p++]=f.z,c[p++]=f.x,c[p++]=f.y,c[p++]=f.z),e.bitangent&&(l[d++]=i.x,l[d++]=i.y,l[d++]=i.z,l[d++]=i.x,l[d++]=i.y,l[d++]=i.z)}return Xt(e,{positions:t,normals:a,tangents:c,bitangents:l})}function It(t,e){let n=t._vertexFormat,r=t._ellipsoid,a=e.height,c=e.width,l=e.northCap,u=e.southCap,p=0,d=a,o=a,i=0;l&&(p=1,o-=1,i+=1),u&&(d-=1,o-=1,i+=1),i+=c*o;let f=n.position?new Float64Array(i*3):void 0,s=n.st?new Float32Array(i*2):void 0,h=0,g=0,A=Tt,b=Zt,V=Number.MAX_VALUE,z=Number.MAX_VALUE,X=-Number.MAX_VALUE,N=-Number.MAX_VALUE;for(let x=p;x<d;++x)for(let O=0;O<c;++O)W.computePosition(e,r,n.st,x,O,A,b),f[h++]=A.x,f[h++]=A.y,f[h++]=A.z,n.st&&(s[g++]=b.x,s[g++]=b.y,V=Math.min(V,b.x),z=Math.min(z,b.y),X=Math.max(X,b.x),N=Math.max(N,b.y));if(l&&(W.computePosition(e,r,n.st,0,0,A,b),f[h++]=A.x,f[h++]=A.y,f[h++]=A.z,n.st&&(s[g++]=b.x,s[g++]=b.y,V=b.x,z=b.y,X=b.x,N=b.y)),u&&(W.computePosition(e,r,n.st,a-1,0,A,b),f[h++]=A.x,f[h++]=A.y,f[h]=A.z,n.st&&(s[g++]=b.x,s[g]=b.y,V=Math.min(V,b.x),z=Math.min(z,b.y),X=Math.max(X,b.x),N=Math.max(N,b.y))),n.st&&(V<0||z<0||X>1||N>1))for(let x=0;x<s.length;x+=2)s[x]=(s[x]-V)/(X-V),s[x+1]=(s[x+1]-z)/(N-z);let m=Gt(f,n,r,e.tangentRotationMatrix),Z=6*(c-1)*(o-1);l&&(Z+=3*(c-1)),u&&(Z+=3*(c-1));let L=At.createTypedArray(i,Z),C=0,P=0,H;for(H=0;H<o-1;++H){for(let x=0;x<c-1;++x){let O=C,k=O+c,j=k+1,st=O+1;L[P++]=O,L[P++]=k,L[P++]=st,L[P++]=st,L[P++]=k,L[P++]=j,++C}++C}if(l||u){let x=i-1,O=i-1;l&&u&&(x=i-2);let k,j;if(C=0,l)for(H=0;H<c-1;H++)k=C,j=k+1,L[P++]=x,L[P++]=k,L[P++]=j,++C;if(u)for(C=(o-1)*c,H=0;H<c-1;H++)k=C,j=k+1,L[P++]=k,L[P++]=O,L[P++]=j,++C}return m.indices=L,n.st&&(m.attributes.st=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:2,values:s})),m}function ut(t,e,n,r,a){return t[e++]=r[n],t[e++]=r[n+1],t[e++]=r[n+2],t[e++]=a[n],t[e++]=a[n+1],t[e]=a[n+2],t}function ht(t,e,n,r){return t[e++]=r[n],t[e++]=r[n+1],t[e++]=r[n],t[e]=r[n+1],t}var Dt=new q;function ee(t,e){let n=t._shadowVolume,r=t._offsetAttribute,a=t._vertexFormat,c=t._extrudedHeight,l=t._surfaceHeight,u=t._ellipsoid,p=e.height,d=e.width,o;if(n){let R=q.clone(a,Dt);R.normal=!0,t._vertexFormat=R}let i=It(t,e);n&&(t._vertexFormat=a);let f=yt.scaleToGeodeticHeight(i.attributes.position.values,l,u,!1);f=new Float64Array(f);let s=f.length,h=s*2,g=new Float64Array(h);g.set(f);let A=yt.scaleToGeodeticHeight(i.attributes.position.values,c,u);g.set(A,s),i.attributes.position.values=g;let b=a.normal?new Float32Array(h):void 0,V=a.tangent?new Float32Array(h):void 0,z=a.bitangent?new Float32Array(h):void 0,X=a.st?new Float32Array(h/3*2):void 0,N,m;if(a.normal){for(m=i.attributes.normal.values,b.set(m),o=0;o<s;o++)m[o]=-m[o];b.set(m,s),i.attributes.normal.values=b}if(n){m=i.attributes.normal.values,a.normal||(i.attributes.normal=void 0);let R=new Float32Array(h);for(o=0;o<s;o++)m[o]=-m[o];R.set(m,s),i.attributes.extrudeDirection=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:3,values:R})}let Z,L=K(r);if(L){let R=s/3*2,it=new Uint8Array(R);r===ft.TOP?it=it.fill(1,0,R/2):(Z=r===ft.NONE?0:1,it=it.fill(Z)),i.attributes.applyOffset=new Y({componentDatatype:U.UNSIGNED_BYTE,componentsPerAttribute:1,values:it})}if(a.tangent){let R=i.attributes.tangent.values;for(V.set(R),o=0;o<s;o++)R[o]=-R[o];V.set(R,s),i.attributes.tangent.values=V}if(a.bitangent){let R=i.attributes.bitangent.values;z.set(R),z.set(R,s),i.attributes.bitangent.values=z}a.st&&(N=i.attributes.st.values,X.set(N),X.set(N,s/3*2),i.attributes.st.values=X);let C=i.indices,P=C.length,H=s/3,x=At.createTypedArray(h/3,P*2);for(x.set(C),o=0;o<P;o+=3)x[o+P]=C[o+2]+H,x[o+1+P]=C[o+1]+H,x[o+2+P]=C[o]+H;i.indices=x;let O=e.northCap,k=e.southCap,j=p,st=2,pt=0,Rt=4,xt=4;O&&(st-=1,j-=1,pt+=1,Rt-=2,xt-=1),k&&(st-=1,j-=1,pt+=1,Rt-=2,xt-=1),pt+=st*d+2*j-Rt;let dt=(pt+xt)*2,T=new Float64Array(dt*3),S=n?new Float32Array(dt*3):void 0,Q=L?new Uint8Array(dt):void 0,M=a.st?new Float32Array(dt*2):void 0,tt=r===ft.TOP;L&&!tt&&(Z=r===ft.ALL?1:0,Q=Q.fill(Z));let F=0,v=0,y=0,B=0,et=d*j,_;for(o=0;o<et;o+=d)_=o*3,T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,o*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1);if(k){let R=O?et+1:et;for(_=R*3,o=0;o<2;o++)T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,R*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1)}else for(o=et-d;o<et;o++)_=o*3,T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,o*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1);for(o=et-1;o>0;o-=d)_=o*3,T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,o*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1);if(O){let R=et;for(_=R*3,o=0;o<2;o++)T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,R*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1)}else for(o=d-1;o>=0;o--)_=o*3,T=ut(T,F,_,f,A),F+=6,a.st&&(M=ht(M,v,o*2,N),v+=4),n&&(y+=3,S[y++]=m[_],S[y++]=m[_+1],S[y++]=m[_+2]),tt&&(Q[B++]=1,B+=1);let nt=te(T,a,u);a.st&&(nt.attributes.st=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:2,values:M})),n&&(nt.attributes.extrudeDirection=new Y({componentDatatype:U.FLOAT,componentsPerAttribute:3,values:S})),L&&(nt.attributes.applyOffset=new Y({componentDatatype:U.UNSIGNED_BYTE,componentsPerAttribute:1,values:Q}));let ot=At.createTypedArray(dt,pt*6),gt,_t,kt,wt;s=T.length/3;let rt=0;for(o=0;o<s-1;o+=2){gt=o,wt=(gt+2)%s;let R=w.fromArray(T,gt*3,Ct),it=w.fromArray(T,wt*3,jt);w.equalsEpsilon(R,it,I.EPSILON10)||(_t=(gt+1)%s,kt=(_t+2)%s,ot[rt++]=gt,ot[rt++]=_t,ot[rt++]=wt,ot[rt++]=wt,ot[rt++]=_t,ot[rt++]=kt)}return nt.indices=ot,nt=zt.combineInstances([new Nt({geometry:i}),new Nt({geometry:nt})]),nt[0]}var ne=[new w,new w,new w,new w],Wt=new mt,oe=new mt;function Ht(t,e,n,r,a){if(n===0)return E.clone(t,a);let c=W.computeOptions(t,e,n,0,qt,Wt),l=c.height,u=c.width,p=ne;return W.computePosition(c,r,!1,0,0,p[0]),W.computePosition(c,r,!1,0,u-1,p[1]),W.computePosition(c,r,!1,l-1,0,p[2]),W.computePosition(c,r,!1,l-1,u-1,p[3]),E.fromCartesianArray(p,r,a)}function J(t){t=t??St.EMPTY_OBJECT;let e=t.rectangle;if(ct.typeOf.object("rectangle",e),E._validate(e),e.north<e.south)throw new Et("options.rectangle.north must be greater than or equal to options.rectangle.south");let n=t.height??0,r=t.extrudedHeight??n;this._rectangle=E.clone(e),this._granularity=t.granularity??I.RADIANS_PER_DEGREE,this._ellipsoid=D.clone(t.ellipsoid??D.default),this._surfaceHeight=Math.max(n,r),this._rotation=t.rotation??0,this._stRotation=t.stRotation??0,this._vertexFormat=q.clone(t.vertexFormat??q.DEFAULT),this._extrudedHeight=Math.min(n,r),this._shadowVolume=t.shadowVolume??!1,this._workerName="createRectangleGeometry",this._offsetAttribute=t.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}J.packedLength=E.packedLength+D.packedLength+q.packedLength+7;J.pack=function(t,e,n){return ct.typeOf.object("value",t),ct.defined("array",e),n=n??0,E.pack(t._rectangle,e,n),n+=E.packedLength,D.pack(t._ellipsoid,e,n),n+=D.packedLength,q.pack(t._vertexFormat,e,n),n+=q.packedLength,e[n++]=t._granularity,e[n++]=t._surfaceHeight,e[n++]=t._rotation,e[n++]=t._stRotation,e[n++]=t._extrudedHeight,e[n++]=t._shadowVolume?1:0,e[n]=t._offsetAttribute??-1,e};var Jt=new E,Qt=D.clone(D.UNIT_SPHERE),G={rectangle:Jt,ellipsoid:Qt,vertexFormat:Dt,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};J.unpack=function(t,e,n){ct.defined("array",t),e=e??0;let r=E.unpack(t,e,Jt);e+=E.packedLength;let a=D.unpack(t,e,Qt);e+=D.packedLength;let c=q.unpack(t,e,Dt);e+=q.packedLength;let l=t[e++],u=t[e++],p=t[e++],d=t[e++],o=t[e++],i=t[e++]===1,f=t[e];return K(n)?(n._rectangle=E.clone(r,n._rectangle),n._ellipsoid=D.clone(a,n._ellipsoid),n._vertexFormat=q.clone(c,n._vertexFormat),n._granularity=l,n._surfaceHeight=u,n._rotation=p,n._stRotation=d,n._extrudedHeight=o,n._shadowVolume=i,n._offsetAttribute=f===-1?void 0:f,n):(G.granularity=l,G.height=u,G.rotation=p,G.stRotation=d,G.extrudedHeight=o,G.shadowVolume=i,G.offsetAttribute=f===-1?void 0:f,new J(G))};J.computeRectangle=function(t,e){t=t??St.EMPTY_OBJECT;let n=t.rectangle;if(ct.typeOf.object("rectangle",n),E._validate(n),n.north<n.south)throw new Et("options.rectangle.north must be greater than or equal to options.rectangle.south");let r=t.granularity??I.RADIANS_PER_DEGREE,a=t.ellipsoid??D.default,c=t.rotation??0;return Ht(n,r,c,a,e)};var ie=new lt,Ft=new Lt,ae=new mt;J.createGeometry=function(t){if(I.equalsEpsilon(t._rectangle.north,t._rectangle.south,I.EPSILON10)||I.equalsEpsilon(t._rectangle.east,t._rectangle.west,I.EPSILON10))return;let e=t._rectangle,n=t._ellipsoid,r=t._rotation,a=t._stRotation,c=t._vertexFormat,l=W.computeOptions(e,t._granularity,r,a,qt,Wt,oe),u=ie;if(a!==0||r!==0){let s=E.center(e,ae),h=n.geodeticSurfaceNormalCartographic(s,Ct);Lt.fromAxisAngle(h,-a,Ft),lt.fromQuaternion(Ft,u)}else lt.clone(lt.IDENTITY,u);let p=t._surfaceHeight,d=t._extrudedHeight,o=!I.equalsEpsilon(p,d,0,I.EPSILON2);l.lonScalar=1/t._rectangle.width,l.latScalar=1/t._rectangle.height,l.tangentRotationMatrix=u;let i,f;if(e=t._rectangle,o){i=ee(t,l);let s=at.fromRectangle3D(e,n,p,$t),h=at.fromRectangle3D(e,n,d,Kt);f=at.union(s,h)}else{if(i=It(t,l),i.attributes.position.values=yt.scaleToGeodeticHeight(i.attributes.position.values,p,n,!1),K(t._offsetAttribute)){let s=i.attributes.position.values.length,h=t._offsetAttribute===ft.NONE?0:1,g=new Uint8Array(s/3).fill(h);i.attributes.applyOffset=new Y({componentDatatype:U.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}f=at.fromRectangle3D(e,n,p)}return c.position||delete i.attributes.position,new Pt({attributes:i.attributes,indices:i.indices,primitiveType:i.primitiveType,boundingSphere:f,offsetAttribute:t._offsetAttribute})};J.createShadowVolume=function(t,e,n){let r=t._granularity,a=t._ellipsoid,c=e(r,a),l=n(r,a);return new J({rectangle:t._rectangle,rotation:t._rotation,ellipsoid:a,stRotation:t._stRotation,granularity:r,extrudedHeight:l,height:c,vertexFormat:q.POSITION_ONLY,shadowVolume:!0})};var vt=new E,se=[new $,new $,new $],re=new bt,ce=new mt;function le(t){if(t._stRotation===0)return[0,0,0,1,1,0];let e=E.clone(t._rectangle,vt),n=t._granularity,r=t._ellipsoid,a=t._rotation-t._stRotation,c=Ht(e,n,a,r,vt),l=se;l[0].x=c.west,l[0].y=c.south,l[1].x=c.west,l[1].y=c.north,l[2].x=c.east,l[2].y=c.south;let u=t.rectangle,p=bt.fromRotation(t._stRotation,re),d=E.center(u,ce);for(let h=0;h<3;++h){let g=l[h];g.x-=d.longitude,g.y-=d.latitude,bt.multiplyByVector(p,g,g),g.x+=d.longitude,g.y+=d.latitude,g.x=(g.x-u.west)/u.width,g.y=(g.y-u.south)/u.height}let o=l[0],i=l[1],f=l[2],s=new Array(6);return $.pack(o,s),$.pack(i,s,2),$.pack(f,s,4),s}Object.defineProperties(J.prototype,{rectangle:{get:function(){return K(this._rotatedRectangle)||(this._rotatedRectangle=Ht(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return K(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=le(this)),this._textureCoordinateRotationPoints}}});var Ot=J;function fe(t,e){return K(e)&&(t=Ot.unpack(t,e)),t._ellipsoid=D.clone(t._ellipsoid),t._rectangle=E.clone(t._rectangle),Ot.createGeometry(t)}var Ye=fe;export{Ye as default};