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