@pggis/pg-sdk 3.3.9 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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/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-F3YA3Y2Z.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-EHWHNOEX.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-4H7PY4U5.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-BBWDMCVU.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-WZDE3RYP.js +28 -0
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -44
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -34
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -211
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -173
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -123
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -482
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -201
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1239
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -544
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -36
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -207
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -47
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -40
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -35
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -37
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -34
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -211
  78. package/dist/resources/Workers/createGeometry.js +2 -147
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1584
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -200
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -100
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1387
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -519
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -472
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -355
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -253
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1250
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -455
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -376
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -94
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -94
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -468
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -363
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -361
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -238
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -545
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2254
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -722
  101. package/dist/resources/Workers/createWallGeometry.js +2 -466
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -314
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2626
  105. package/dist/resources/Workers/decodeI3S.js +2 -1320
  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 -3398
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -795
  111. package/package.json +9 -8
  112. package/dist/pggis.min.js +0 -14796
  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,724 +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
- EllipsoidalOccluder_default,
28
- TerrainEncoding_default
29
- } from "./chunk-HU6N6EXB.js";
30
- import {
31
- createTaskProcessorWorker_default
32
- } from "./chunk-3VAZEH7M.js";
33
- import {
34
- WebMercatorProjection_default
35
- } from "./chunk-2UPKWTMJ.js";
36
- import "./chunk-Z3TIFFGF.js";
37
- import {
38
- AxisAlignedBoundingBox_default
39
- } from "./chunk-G43QFN4Q.js";
40
- import {
41
- IndexDatatype_default
42
- } from "./chunk-LPR3YNP2.js";
43
- import {
44
- Transforms_default
45
- } from "./chunk-FJKNFAKQ.js";
46
- import "./chunk-TTUZP4BO.js";
47
- import "./chunk-BG4UCVXN.js";
48
- import {
49
- Matrix4_default,
50
- Rectangle_default
51
- } from "./chunk-YJEBABKH.js";
52
- import "./chunk-PPH7OFP3.js";
53
- import {
54
- Cartesian2_default,
55
- Cartesian3_default,
56
- Cartographic_default,
57
- Ellipsoid_default
58
- } from "./chunk-OGXZVPPM.js";
59
- import {
60
- Math_default
61
- } from "./chunk-5QULIR53.js";
62
- import "./chunk-SOWMRMWA.js";
63
- import "./chunk-STW2DGFI.js";
64
- import "./chunk-BBWDMCVU.js";
65
- import {
66
- DeveloperError_default
67
- } from "./chunk-XGI5BXZY.js";
68
- import {
69
- defined_default
70
- } from "./chunk-YWTJ2B4B.js";
71
-
72
- // packages/engine/Source/Core/TerrainProvider.js
73
- function TerrainProvider() {
74
- DeveloperError_default.throwInstantiationError();
75
- }
76
- Object.defineProperties(TerrainProvider.prototype, {
77
- /**
78
- * Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
79
- * to the event, you will be notified of the error and can potentially recover from it. Event listeners
80
- * are passed an instance of {@link TileProviderError}.
81
- * @memberof TerrainProvider.prototype
82
- * @type {Event<TerrainProvider.ErrorEvent>}
83
- * @readonly
84
- */
85
- errorEvent: {
86
- get: DeveloperError_default.throwInstantiationError
87
- },
88
- /**
89
- * Gets the credit to display when this terrain provider is active. Typically this is used to credit
90
- * the source of the terrain.
91
- * @memberof TerrainProvider.prototype
92
- * @type {Credit}
93
- * @readonly
94
- */
95
- credit: {
96
- get: DeveloperError_default.throwInstantiationError
97
- },
98
- /**
99
- * Gets the tiling scheme used by the provider.
100
- * @memberof TerrainProvider.prototype
101
- * @type {TilingScheme}
102
- * @readonly
103
- */
104
- tilingScheme: {
105
- get: DeveloperError_default.throwInstantiationError
106
- },
107
- /**
108
- * Gets a value indicating whether or not the provider includes a water mask. The water mask
109
- * indicates which areas of the globe are water rather than land, so they can be rendered
110
- * as a reflective surface with animated waves.
111
- * @memberof TerrainProvider.prototype
112
- * @type {boolean}
113
- * @readonly
114
- */
115
- hasWaterMask: {
116
- get: DeveloperError_default.throwInstantiationError
117
- },
118
- /**
119
- * Gets a value indicating whether or not the requested tiles include vertex normals.
120
- * @memberof TerrainProvider.prototype
121
- * @type {boolean}
122
- * @readonly
123
- */
124
- hasVertexNormals: {
125
- get: DeveloperError_default.throwInstantiationError
126
- },
127
- /**
128
- * Gets an object that can be used to determine availability of terrain from this provider, such as
129
- * at points and in rectangles. This property may be undefined if availability
130
- * information is not available.
131
- * @memberof TerrainProvider.prototype
132
- * @type {TileAvailability}
133
- * @readonly
134
- */
135
- availability: {
136
- get: DeveloperError_default.throwInstantiationError
137
- }
138
- });
139
- var regularGridIndicesCache = [];
140
- TerrainProvider.getRegularGridIndices = function(width, height) {
141
- if (width * height >= Math_default.FOUR_GIGABYTES) {
142
- throw new DeveloperError_default(
143
- "The total number of vertices (width * height) must be less than 4,294,967,296."
144
- );
145
- }
146
- let byWidth = regularGridIndicesCache[width];
147
- if (!defined_default(byWidth)) {
148
- regularGridIndicesCache[width] = byWidth = [];
149
- }
150
- let indices = byWidth[height];
151
- if (!defined_default(indices)) {
152
- if (width * height < Math_default.SIXTY_FOUR_KILOBYTES) {
153
- indices = byWidth[height] = new Uint16Array(
154
- (width - 1) * (height - 1) * 6
155
- );
156
- } else {
157
- indices = byWidth[height] = new Uint32Array(
158
- (width - 1) * (height - 1) * 6
159
- );
160
- }
161
- addRegularGridIndices(width, height, indices, 0);
162
- }
163
- return indices;
164
- };
165
- var regularGridAndEdgeIndicesCache = [];
166
- TerrainProvider.getRegularGridIndicesAndEdgeIndices = function(width, height) {
167
- if (width * height >= Math_default.FOUR_GIGABYTES) {
168
- throw new DeveloperError_default(
169
- "The total number of vertices (width * height) must be less than 4,294,967,296."
170
- );
171
- }
172
- let byWidth = regularGridAndEdgeIndicesCache[width];
173
- if (!defined_default(byWidth)) {
174
- regularGridAndEdgeIndicesCache[width] = byWidth = [];
175
- }
176
- let indicesAndEdges = byWidth[height];
177
- if (!defined_default(indicesAndEdges)) {
178
- const indices = TerrainProvider.getRegularGridIndices(width, height);
179
- const edgeIndices = getEdgeIndices(width, height);
180
- const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
181
- const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
182
- const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
183
- const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
184
- indicesAndEdges = byWidth[height] = {
185
- indices,
186
- westIndicesSouthToNorth,
187
- southIndicesEastToWest,
188
- eastIndicesNorthToSouth,
189
- northIndicesWestToEast
190
- };
191
- }
192
- return indicesAndEdges;
193
- };
194
- var regularGridAndSkirtAndEdgeIndicesCache = [];
195
- TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function(width, height) {
196
- if (width * height >= Math_default.FOUR_GIGABYTES) {
197
- throw new DeveloperError_default(
198
- "The total number of vertices (width * height) must be less than 4,294,967,296."
199
- );
200
- }
201
- let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
202
- if (!defined_default(byWidth)) {
203
- regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
204
- }
205
- let indicesAndEdges = byWidth[height];
206
- if (!defined_default(indicesAndEdges)) {
207
- const gridVertexCount = width * height;
208
- const gridIndexCount = (width - 1) * (height - 1) * 6;
209
- const edgeVertexCount = width * 2 + height * 2;
210
- const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
211
- const vertexCount = gridVertexCount + edgeVertexCount;
212
- const indexCount = gridIndexCount + edgeIndexCount;
213
- const edgeIndices = getEdgeIndices(width, height);
214
- const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
215
- const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
216
- const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
217
- const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
218
- const indices = IndexDatatype_default.createTypedArray(vertexCount, indexCount);
219
- addRegularGridIndices(width, height, indices, 0);
220
- TerrainProvider.addSkirtIndices(
221
- westIndicesSouthToNorth,
222
- southIndicesEastToWest,
223
- eastIndicesNorthToSouth,
224
- northIndicesWestToEast,
225
- gridVertexCount,
226
- indices,
227
- gridIndexCount
228
- );
229
- indicesAndEdges = byWidth[height] = {
230
- indices,
231
- westIndicesSouthToNorth,
232
- southIndicesEastToWest,
233
- eastIndicesNorthToSouth,
234
- northIndicesWestToEast,
235
- indexCountWithoutSkirts: gridIndexCount
236
- };
237
- }
238
- return indicesAndEdges;
239
- };
240
- TerrainProvider.addSkirtIndices = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
241
- let vertexIndex = vertexCount;
242
- offset = addSkirtIndices(
243
- westIndicesSouthToNorth,
244
- vertexIndex,
245
- indices,
246
- offset
247
- );
248
- vertexIndex += westIndicesSouthToNorth.length;
249
- offset = addSkirtIndices(
250
- southIndicesEastToWest,
251
- vertexIndex,
252
- indices,
253
- offset
254
- );
255
- vertexIndex += southIndicesEastToWest.length;
256
- offset = addSkirtIndices(
257
- eastIndicesNorthToSouth,
258
- vertexIndex,
259
- indices,
260
- offset
261
- );
262
- vertexIndex += eastIndicesNorthToSouth.length;
263
- addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
264
- };
265
- function getEdgeIndices(width, height) {
266
- const westIndicesSouthToNorth = new Array(height);
267
- const southIndicesEastToWest = new Array(width);
268
- const eastIndicesNorthToSouth = new Array(height);
269
- const northIndicesWestToEast = new Array(width);
270
- let i;
271
- for (i = 0; i < width; ++i) {
272
- northIndicesWestToEast[i] = i;
273
- southIndicesEastToWest[i] = width * height - 1 - i;
274
- }
275
- for (i = 0; i < height; ++i) {
276
- eastIndicesNorthToSouth[i] = (i + 1) * width - 1;
277
- westIndicesSouthToNorth[i] = (height - i - 1) * width;
278
- }
279
- return {
280
- westIndicesSouthToNorth,
281
- southIndicesEastToWest,
282
- eastIndicesNorthToSouth,
283
- northIndicesWestToEast
284
- };
285
- }
286
- function addRegularGridIndices(width, height, indices, offset) {
287
- let index = 0;
288
- for (let j = 0; j < height - 1; ++j) {
289
- for (let i = 0; i < width - 1; ++i) {
290
- const upperLeft = index;
291
- const lowerLeft = upperLeft + width;
292
- const lowerRight = lowerLeft + 1;
293
- const upperRight = upperLeft + 1;
294
- indices[offset++] = upperLeft;
295
- indices[offset++] = lowerLeft;
296
- indices[offset++] = upperRight;
297
- indices[offset++] = upperRight;
298
- indices[offset++] = lowerLeft;
299
- indices[offset++] = lowerRight;
300
- ++index;
301
- }
302
- ++index;
303
- }
304
- }
305
- function addSkirtIndices(edgeIndices, vertexIndex, indices, offset) {
306
- let previousIndex = edgeIndices[0];
307
- const length = edgeIndices.length;
308
- for (let i = 1; i < length; ++i) {
309
- const index = edgeIndices[i];
310
- indices[offset++] = previousIndex;
311
- indices[offset++] = index;
312
- indices[offset++] = vertexIndex;
313
- indices[offset++] = vertexIndex;
314
- indices[offset++] = index;
315
- indices[offset++] = vertexIndex + 1;
316
- previousIndex = index;
317
- ++vertexIndex;
318
- }
319
- return offset;
320
- }
321
- TerrainProvider.heightmapTerrainQuality = 0.25;
322
- TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(ellipsoid, tileImageWidth, numberOfTilesAtLevelZero) {
323
- return ellipsoid.maximumRadius * 2 * Math.PI * TerrainProvider.heightmapTerrainQuality / (tileImageWidth * numberOfTilesAtLevelZero);
324
- };
325
- TerrainProvider.prototype.requestTileGeometry = DeveloperError_default.throwInstantiationError;
326
- TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
327
- TerrainProvider.prototype.getTileDataAvailable = DeveloperError_default.throwInstantiationError;
328
- TerrainProvider.prototype.loadTileDataAvailability = DeveloperError_default.throwInstantiationError;
329
- var TerrainProvider_default = TerrainProvider;
330
-
331
- // packages/engine/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
332
- var maxShort = 32767;
333
- var cartesian3Scratch = new Cartesian3_default();
334
- var scratchMinimum = new Cartesian3_default();
335
- var scratchMaximum = new Cartesian3_default();
336
- var cartographicScratch = new Cartographic_default();
337
- var toPack = new Cartesian2_default();
338
- function createVerticesFromQuantizedTerrainMesh(parameters, transferableObjects) {
339
- const quantizedVertices = parameters.quantizedVertices;
340
- const quantizedVertexCount = quantizedVertices.length / 3;
341
- const octEncodedNormals = parameters.octEncodedNormals;
342
- const edgeVertexCount = parameters.westIndices.length + parameters.eastIndices.length + parameters.southIndices.length + parameters.northIndices.length;
343
- const includeWebMercatorT = parameters.includeWebMercatorT;
344
- const exaggeration = parameters.exaggeration;
345
- const exaggerationRelativeHeight = parameters.exaggerationRelativeHeight;
346
- const hasExaggeration = exaggeration !== 1;
347
- const includeGeodeticSurfaceNormals = hasExaggeration;
348
- const rectangle = Rectangle_default.clone(parameters.rectangle);
349
- const west = rectangle.west;
350
- const south = rectangle.south;
351
- const east = rectangle.east;
352
- const north = rectangle.north;
353
- const ellipsoid = Ellipsoid_default.clone(parameters.ellipsoid);
354
- const minimumHeight = parameters.minimumHeight;
355
- const maximumHeight = parameters.maximumHeight;
356
- const center = parameters.relativeToCenter;
357
- const fromENU = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid);
358
- const toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
359
- let southMercatorY;
360
- let oneOverMercatorHeight;
361
- if (includeWebMercatorT) {
362
- southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
363
- south
364
- );
365
- oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(north) - southMercatorY);
366
- }
367
- const uBuffer = quantizedVertices.subarray(0, quantizedVertexCount);
368
- const vBuffer = quantizedVertices.subarray(
369
- quantizedVertexCount,
370
- 2 * quantizedVertexCount
371
- );
372
- const heightBuffer = quantizedVertices.subarray(
373
- quantizedVertexCount * 2,
374
- 3 * quantizedVertexCount
375
- );
376
- const hasVertexNormals = defined_default(octEncodedNormals);
377
- const uvs = new Array(quantizedVertexCount);
378
- const heights = new Array(quantizedVertexCount);
379
- const positions = new Array(quantizedVertexCount);
380
- const webMercatorTs = includeWebMercatorT ? new Array(quantizedVertexCount) : [];
381
- const geodeticSurfaceNormals = includeGeodeticSurfaceNormals ? new Array(quantizedVertexCount) : [];
382
- const minimum = scratchMinimum;
383
- minimum.x = Number.POSITIVE_INFINITY;
384
- minimum.y = Number.POSITIVE_INFINITY;
385
- minimum.z = Number.POSITIVE_INFINITY;
386
- const maximum = scratchMaximum;
387
- maximum.x = Number.NEGATIVE_INFINITY;
388
- maximum.y = Number.NEGATIVE_INFINITY;
389
- maximum.z = Number.NEGATIVE_INFINITY;
390
- let minLongitude = Number.POSITIVE_INFINITY;
391
- let maxLongitude = Number.NEGATIVE_INFINITY;
392
- let minLatitude = Number.POSITIVE_INFINITY;
393
- let maxLatitude = Number.NEGATIVE_INFINITY;
394
- for (let i = 0; i < quantizedVertexCount; ++i) {
395
- const rawU = uBuffer[i];
396
- const rawV = vBuffer[i];
397
- const u = rawU / maxShort;
398
- const v = rawV / maxShort;
399
- const height = Math_default.lerp(
400
- minimumHeight,
401
- maximumHeight,
402
- heightBuffer[i] / maxShort
403
- );
404
- cartographicScratch.longitude = Math_default.lerp(west, east, u);
405
- cartographicScratch.latitude = Math_default.lerp(south, north, v);
406
- cartographicScratch.height = height;
407
- minLongitude = Math.min(cartographicScratch.longitude, minLongitude);
408
- maxLongitude = Math.max(cartographicScratch.longitude, maxLongitude);
409
- minLatitude = Math.min(cartographicScratch.latitude, minLatitude);
410
- maxLatitude = Math.max(cartographicScratch.latitude, maxLatitude);
411
- const position = ellipsoid.cartographicToCartesian(cartographicScratch);
412
- uvs[i] = new Cartesian2_default(u, v);
413
- heights[i] = height;
414
- positions[i] = position;
415
- if (includeWebMercatorT) {
416
- webMercatorTs[i] = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
417
- cartographicScratch.latitude
418
- ) - southMercatorY) * oneOverMercatorHeight;
419
- }
420
- if (includeGeodeticSurfaceNormals) {
421
- geodeticSurfaceNormals[i] = ellipsoid.geodeticSurfaceNormal(position);
422
- }
423
- Matrix4_default.multiplyByPoint(toENU, position, cartesian3Scratch);
424
- Cartesian3_default.minimumByComponent(cartesian3Scratch, minimum, minimum);
425
- Cartesian3_default.maximumByComponent(cartesian3Scratch, maximum, maximum);
426
- }
427
- const westIndicesSouthToNorth = copyAndSort(parameters.westIndices, function(a, b) {
428
- return uvs[a].y - uvs[b].y;
429
- });
430
- const eastIndicesNorthToSouth = copyAndSort(parameters.eastIndices, function(a, b) {
431
- return uvs[b].y - uvs[a].y;
432
- });
433
- const southIndicesEastToWest = copyAndSort(parameters.southIndices, function(a, b) {
434
- return uvs[b].x - uvs[a].x;
435
- });
436
- const northIndicesWestToEast = copyAndSort(parameters.northIndices, function(a, b) {
437
- return uvs[a].x - uvs[b].x;
438
- });
439
- let occludeePointInScaledSpace;
440
- if (minimumHeight < 0) {
441
- const occluder = new EllipsoidalOccluder_default(ellipsoid);
442
- occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
443
- center,
444
- positions,
445
- minimumHeight
446
- );
447
- }
448
- let hMin = minimumHeight;
449
- hMin = Math.min(
450
- hMin,
451
- findMinMaxSkirts(
452
- parameters.westIndices,
453
- parameters.westSkirtHeight,
454
- heights,
455
- uvs,
456
- rectangle,
457
- ellipsoid,
458
- toENU,
459
- minimum,
460
- maximum
461
- )
462
- );
463
- hMin = Math.min(
464
- hMin,
465
- findMinMaxSkirts(
466
- parameters.southIndices,
467
- parameters.southSkirtHeight,
468
- heights,
469
- uvs,
470
- rectangle,
471
- ellipsoid,
472
- toENU,
473
- minimum,
474
- maximum
475
- )
476
- );
477
- hMin = Math.min(
478
- hMin,
479
- findMinMaxSkirts(
480
- parameters.eastIndices,
481
- parameters.eastSkirtHeight,
482
- heights,
483
- uvs,
484
- rectangle,
485
- ellipsoid,
486
- toENU,
487
- minimum,
488
- maximum
489
- )
490
- );
491
- hMin = Math.min(
492
- hMin,
493
- findMinMaxSkirts(
494
- parameters.northIndices,
495
- parameters.northSkirtHeight,
496
- heights,
497
- uvs,
498
- rectangle,
499
- ellipsoid,
500
- toENU,
501
- minimum,
502
- maximum
503
- )
504
- );
505
- const aaBox = new AxisAlignedBoundingBox_default(minimum, maximum, center);
506
- const encoding = new TerrainEncoding_default(
507
- center,
508
- aaBox,
509
- hMin,
510
- maximumHeight,
511
- fromENU,
512
- hasVertexNormals,
513
- includeWebMercatorT,
514
- includeGeodeticSurfaceNormals,
515
- exaggeration,
516
- exaggerationRelativeHeight
517
- );
518
- const vertexStride = encoding.stride;
519
- const size = quantizedVertexCount * vertexStride + edgeVertexCount * vertexStride;
520
- const vertexBuffer = new Float32Array(size);
521
- let bufferIndex = 0;
522
- for (let j = 0; j < quantizedVertexCount; ++j) {
523
- if (hasVertexNormals) {
524
- const n = j * 2;
525
- toPack.x = octEncodedNormals[n];
526
- toPack.y = octEncodedNormals[n + 1];
527
- }
528
- bufferIndex = encoding.encode(
529
- vertexBuffer,
530
- bufferIndex,
531
- positions[j],
532
- uvs[j],
533
- heights[j],
534
- toPack,
535
- webMercatorTs[j],
536
- geodeticSurfaceNormals[j]
537
- );
538
- }
539
- const edgeTriangleCount = Math.max(0, (edgeVertexCount - 4) * 2);
540
- const indexBufferLength = parameters.indices.length + edgeTriangleCount * 3;
541
- const indexBuffer = IndexDatatype_default.createTypedArray(
542
- quantizedVertexCount + edgeVertexCount,
543
- indexBufferLength
544
- );
545
- indexBuffer.set(parameters.indices, 0);
546
- const percentage = 1e-4;
547
- const lonOffset = (maxLongitude - minLongitude) * percentage;
548
- const latOffset = (maxLatitude - minLatitude) * percentage;
549
- const westLongitudeOffset = -lonOffset;
550
- const westLatitudeOffset = 0;
551
- const eastLongitudeOffset = lonOffset;
552
- const eastLatitudeOffset = 0;
553
- const northLongitudeOffset = 0;
554
- const northLatitudeOffset = latOffset;
555
- const southLongitudeOffset = 0;
556
- const southLatitudeOffset = -latOffset;
557
- let vertexBufferIndex = quantizedVertexCount * vertexStride;
558
- addSkirt(
559
- vertexBuffer,
560
- vertexBufferIndex,
561
- westIndicesSouthToNorth,
562
- encoding,
563
- heights,
564
- uvs,
565
- octEncodedNormals,
566
- ellipsoid,
567
- rectangle,
568
- parameters.westSkirtHeight,
569
- southMercatorY,
570
- oneOverMercatorHeight,
571
- westLongitudeOffset,
572
- westLatitudeOffset
573
- );
574
- vertexBufferIndex += parameters.westIndices.length * vertexStride;
575
- addSkirt(
576
- vertexBuffer,
577
- vertexBufferIndex,
578
- southIndicesEastToWest,
579
- encoding,
580
- heights,
581
- uvs,
582
- octEncodedNormals,
583
- ellipsoid,
584
- rectangle,
585
- parameters.southSkirtHeight,
586
- southMercatorY,
587
- oneOverMercatorHeight,
588
- southLongitudeOffset,
589
- southLatitudeOffset
590
- );
591
- vertexBufferIndex += parameters.southIndices.length * vertexStride;
592
- addSkirt(
593
- vertexBuffer,
594
- vertexBufferIndex,
595
- eastIndicesNorthToSouth,
596
- encoding,
597
- heights,
598
- uvs,
599
- octEncodedNormals,
600
- ellipsoid,
601
- rectangle,
602
- parameters.eastSkirtHeight,
603
- southMercatorY,
604
- oneOverMercatorHeight,
605
- eastLongitudeOffset,
606
- eastLatitudeOffset
607
- );
608
- vertexBufferIndex += parameters.eastIndices.length * vertexStride;
609
- addSkirt(
610
- vertexBuffer,
611
- vertexBufferIndex,
612
- northIndicesWestToEast,
613
- encoding,
614
- heights,
615
- uvs,
616
- octEncodedNormals,
617
- ellipsoid,
618
- rectangle,
619
- parameters.northSkirtHeight,
620
- southMercatorY,
621
- oneOverMercatorHeight,
622
- northLongitudeOffset,
623
- northLatitudeOffset
624
- );
625
- TerrainProvider_default.addSkirtIndices(
626
- westIndicesSouthToNorth,
627
- southIndicesEastToWest,
628
- eastIndicesNorthToSouth,
629
- northIndicesWestToEast,
630
- quantizedVertexCount,
631
- indexBuffer,
632
- parameters.indices.length
633
- );
634
- transferableObjects.push(vertexBuffer.buffer, indexBuffer.buffer);
635
- return {
636
- vertices: vertexBuffer.buffer,
637
- indices: indexBuffer.buffer,
638
- westIndicesSouthToNorth,
639
- southIndicesEastToWest,
640
- eastIndicesNorthToSouth,
641
- northIndicesWestToEast,
642
- vertexStride,
643
- center,
644
- minimumHeight,
645
- maximumHeight,
646
- occludeePointInScaledSpace,
647
- encoding,
648
- indexCountWithoutSkirts: parameters.indices.length
649
- };
650
- }
651
- function findMinMaxSkirts(edgeIndices, edgeHeight, heights, uvs, rectangle, ellipsoid, toENU, minimum, maximum) {
652
- let hMin = Number.POSITIVE_INFINITY;
653
- const north = rectangle.north;
654
- const south = rectangle.south;
655
- let east = rectangle.east;
656
- const west = rectangle.west;
657
- if (east < west) {
658
- east += Math_default.TWO_PI;
659
- }
660
- const length = edgeIndices.length;
661
- for (let i = 0; i < length; ++i) {
662
- const index = edgeIndices[i];
663
- const h = heights[index];
664
- const uv = uvs[index];
665
- cartographicScratch.longitude = Math_default.lerp(west, east, uv.x);
666
- cartographicScratch.latitude = Math_default.lerp(south, north, uv.y);
667
- cartographicScratch.height = h - edgeHeight;
668
- const position = ellipsoid.cartographicToCartesian(
669
- cartographicScratch,
670
- cartesian3Scratch
671
- );
672
- Matrix4_default.multiplyByPoint(toENU, position, position);
673
- Cartesian3_default.minimumByComponent(position, minimum, minimum);
674
- Cartesian3_default.maximumByComponent(position, maximum, maximum);
675
- hMin = Math.min(hMin, cartographicScratch.height);
676
- }
677
- return hMin;
678
- }
679
- function addSkirt(vertexBuffer, vertexBufferIndex, edgeVertices, encoding, heights, uvs, octEncodedNormals, ellipsoid, rectangle, skirtLength, southMercatorY, oneOverMercatorHeight, longitudeOffset, latitudeOffset) {
680
- const hasVertexNormals = defined_default(octEncodedNormals);
681
- const north = rectangle.north;
682
- const south = rectangle.south;
683
- let east = rectangle.east;
684
- const west = rectangle.west;
685
- if (east < west) {
686
- east += Math_default.TWO_PI;
687
- }
688
- const length = edgeVertices.length;
689
- for (let i = 0; i < length; ++i) {
690
- const index = edgeVertices[i];
691
- const h = heights[index];
692
- const uv = uvs[index];
693
- cartographicScratch.longitude = Math_default.lerp(west, east, uv.x) + longitudeOffset;
694
- cartographicScratch.latitude = Math_default.lerp(south, north, uv.y) + latitudeOffset;
695
- cartographicScratch.height = h - skirtLength;
696
- const position = ellipsoid.cartographicToCartesian(
697
- cartographicScratch,
698
- cartesian3Scratch
699
- );
700
- if (hasVertexNormals) {
701
- const n = index * 2;
702
- toPack.x = octEncodedNormals[n];
703
- toPack.y = octEncodedNormals[n + 1];
704
- }
705
- let webMercatorT;
706
- if (encoding.hasWebMercatorT) {
707
- webMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
708
- cartographicScratch.latitude
709
- ) - southMercatorY) * oneOverMercatorHeight;
710
- }
711
- let geodeticSurfaceNormal;
712
- if (encoding.hasGeodeticSurfaceNormals) {
713
- geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(position);
714
- }
715
- vertexBufferIndex = encoding.encode(
716
- vertexBuffer,
717
- vertexBufferIndex,
718
- position,
719
- uv,
720
- cartographicScratch.height,
721
- toPack,
722
- webMercatorT,
723
- geodeticSurfaceNormal
724
- );
725
- }
726
- }
727
- function copyAndSort(typedArray, comparator) {
728
- let copy;
729
- if (typeof typedArray.slice === "function") {
730
- copy = typedArray.slice();
731
- if (typeof copy.sort !== "function") {
732
- copy = void 0;
733
- }
734
- }
735
- if (!defined_default(copy)) {
736
- copy = Array.prototype.slice.call(typedArray);
737
- }
738
- copy.sort(comparator);
739
- return copy;
740
- }
741
- var createVerticesFromQuantizedTerrainMesh_default = createTaskProcessorWorker_default(
742
- createVerticesFromQuantizedTerrainMesh
743
- );
744
- export {
745
- createVerticesFromQuantizedTerrainMesh_default as default
746
- };
26
+ import{a as Ct,b as vt}from"./chunk-7HTKERZY.js";import{a as Mt}from"./chunk-WZDE3RYP.js";import{a as z}from"./chunk-DQQ63PYM.js";import"./chunk-DEPHB2WM.js";import{a as Wt}from"./chunk-N4VJKXZS.js";import{a as X}from"./chunk-OFUUQVMR.js";import"./chunk-4IW2T6GF.js";import{b as U,g as bt,h as At}from"./chunk-PSPPBZWI.js";import"./chunk-AU7IKHOH.js";import{a as P,b as wt,c as lt,d as pt}from"./chunk-64RSHJUE.js";import{a as f}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{a as m}from"./chunk-LEYMRMBK.js";import{e as w}from"./chunk-VTAIKJXX.js";function T(){m.throwInstantiationError()}Object.defineProperties(T.prototype,{errorEvent:{get:m.throwInstantiationError},credit:{get:m.throwInstantiationError},tilingScheme:{get:m.throwInstantiationError},hasWaterMask:{get:m.throwInstantiationError},hasVertexNormals:{get:m.throwInstantiationError},availability:{get:m.throwInstantiationError}});var Ot=[];T.getRegularGridIndices=function(t,n){if(t*n>=f.FOUR_GIGABYTES)throw new m("The total number of vertices (width * height) must be less than 4,294,967,296.");let o=Ot[t];w(o)||(Ot[t]=o=[]);let e=o[n];return w(e)||(t*n<f.SIXTY_FOUR_KILOBYTES?e=o[n]=new Uint16Array((t-1)*(n-1)*6):e=o[n]=new Uint32Array((t-1)*(n-1)*6),Pt(t,n,e,0)),e};var Gt=[];T.getRegularGridIndicesAndEdgeIndices=function(t,n){if(t*n>=f.FOUR_GIGABYTES)throw new m("The total number of vertices (width * height) must be less than 4,294,967,296.");let o=Gt[t];w(o)||(Gt[t]=o=[]);let e=o[n];if(!w(e)){let r=T.getRegularGridIndices(t,n),s=Lt(t,n),i=s.westIndicesSouthToNorth,c=s.southIndicesEastToWest,h=s.eastIndicesNorthToSouth,E=s.northIndicesWestToEast;e=o[n]={indices:r,westIndicesSouthToNorth:i,southIndicesEastToWest:c,eastIndicesNorthToSouth:h,northIndicesWestToEast:E}}return e};var kt=[];T.getRegularGridAndSkirtIndicesAndEdgeIndices=function(t,n){if(t*n>=f.FOUR_GIGABYTES)throw new m("The total number of vertices (width * height) must be less than 4,294,967,296.");let o=kt[t];w(o)||(kt[t]=o=[]);let e=o[n];if(!w(e)){let r=t*n,s=(t-1)*(n-1)*6,i=t*2+n*2,c=Math.max(0,i-4)*6,h=r+i,E=s+c,g=Lt(t,n),d=g.westIndicesSouthToNorth,p=g.southIndicesEastToWest,b=g.eastIndicesNorthToSouth,L=g.northIndicesWestToEast,N=X.createTypedArray(h,E);Pt(t,n,N,0),T.addSkirtIndices(d,p,b,L,r,N,s),e=o[n]={indices:N,westIndicesSouthToNorth:d,southIndicesEastToWest:p,eastIndicesNorthToSouth:b,northIndicesWestToEast:L,indexCountWithoutSkirts:s}}return e};T.addSkirtIndices=function(t,n,o,e,r,s,i){let c=r;i=Z(t,c,s,i),c+=t.length,i=Z(n,c,s,i),c+=n.length,i=Z(o,c,s,i),c+=o.length,Z(e,c,s,i)};function Lt(t,n){let o=new Array(n),e=new Array(t),r=new Array(n),s=new Array(t),i;for(i=0;i<t;++i)s[i]=i,e[i]=t*n-1-i;for(i=0;i<n;++i)r[i]=(i+1)*t-1,o[i]=(n-i-1)*t;return{westIndicesSouthToNorth:o,southIndicesEastToWest:e,eastIndicesNorthToSouth:r,northIndicesWestToEast:s}}function Pt(t,n,o,e){let r=0;for(let s=0;s<n-1;++s){for(let i=0;i<t-1;++i){let c=r,h=c+t,E=h+1,g=c+1;o[e++]=c,o[e++]=h,o[e++]=g,o[e++]=g,o[e++]=h,o[e++]=E,++r}++r}}function Z(t,n,o,e){let r=t[0],s=t.length;for(let i=1;i<s;++i){let c=t[i];o[e++]=r,o[e++]=c,o[e++]=n,o[e++]=n,o[e++]=c,o[e++]=n+1,r=c,++n}return e}T.heightmapTerrainQuality=.25;T.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(t,n,o){return t.maximumRadius*2*Math.PI*T.heightmapTerrainQuality/(n*o)};T.prototype.requestTileGeometry=m.throwInstantiationError;T.prototype.getLevelMaximumGeometricError=m.throwInstantiationError;T.prototype.getTileDataAvailable=m.throwInstantiationError;T.prototype.loadTileDataAvailability=m.throwInstantiationError;var Vt=T;var ht=32767,D=new P,Xt=new P,Zt=new P,u=new wt,Y=new lt;function Jt(t,n){let o=t.quantizedVertices,e=o.length/3,r=t.octEncodedNormals,s=t.westIndices.length+t.eastIndices.length+t.southIndices.length+t.northIndices.length,i=t.includeWebMercatorT,c=t.exaggeration,h=t.exaggerationRelativeHeight,g=c!==1,d=At.clone(t.rectangle),p=d.west,b=d.south,L=d.east,N=d.north,I=pt.clone(t.ellipsoid),y=t.minimumHeight,v=t.maximumHeight,S=t.relativeToCenter,_=bt.eastNorthUpToFixedFrame(S,I),O=U.inverseTransformation(_,new U),G,A;i&&(G=z.geodeticLatitudeToMercatorAngle(b),A=1/(z.geodeticLatitudeToMercatorAngle(N)-G));let j=o.subarray(0,e),q=o.subarray(e,2*e),Q=o.subarray(e*2,3*e),R=w(r),l=new Array(e),M=new Array(e),et=new Array(e),It=i?new Array(e):[],gt=g?new Array(e):[],W=Xt;W.x=Number.POSITIVE_INFINITY,W.y=Number.POSITIVE_INFINITY,W.z=Number.POSITIVE_INFINITY;let C=Zt;C.x=Number.NEGATIVE_INFINITY,C.y=Number.NEGATIVE_INFINITY,C.z=Number.NEGATIVE_INFINITY;let ot=Number.POSITIVE_INFINITY,nt=Number.NEGATIVE_INFINITY,it=Number.POSITIVE_INFINITY,rt=Number.NEGATIVE_INFINITY;for(let a=0;a<e;++a){let x=j[a],Kt=q[a],St=x/ht,xt=Kt/ht,yt=f.lerp(y,v,Q[a]/ht);u.longitude=f.lerp(p,L,St),u.latitude=f.lerp(b,N,xt),u.height=yt,ot=Math.min(u.longitude,ot),nt=Math.max(u.longitude,nt),it=Math.min(u.latitude,it),rt=Math.max(u.latitude,rt);let dt=I.cartographicToCartesian(u);l[a]=new lt(St,xt),M[a]=yt,et[a]=dt,i&&(It[a]=(z.geodeticLatitudeToMercatorAngle(u.latitude)-G)*A),g&&(gt[a]=I.geodeticSurfaceNormal(dt)),U.multiplyByPoint(O,dt,D),P.minimumByComponent(D,W,W),P.maximumByComponent(D,C,C)}let st=tt(t.westIndices,function(a,x){return l[a].y-l[x].y}),ct=tt(t.eastIndices,function(a,x){return l[x].y-l[a].y}),at=tt(t.southIndices,function(a,x){return l[x].x-l[a].x}),ut=tt(t.northIndices,function(a,x){return l[a].x-l[x].x}),mt;y<0&&(mt=new Ct(I).computeHorizonCullingPointPossiblyUnderEllipsoid(S,et,y));let k=y;k=Math.min(k,J(t.westIndices,t.westSkirtHeight,M,l,d,I,O,W,C)),k=Math.min(k,J(t.southIndices,t.southSkirtHeight,M,l,d,I,O,W,C)),k=Math.min(k,J(t.eastIndices,t.eastSkirtHeight,M,l,d,I,O,W,C)),k=Math.min(k,J(t.northIndices,t.northSkirtHeight,M,l,d,I,O,W,C));let Ft=new Wt(W,C,S),V=new vt(S,Ft,k,v,_,R,i,g,c,h),F=V.stride,Bt=e*F+s*F,B=new Float32Array(Bt),ft=0;for(let a=0;a<e;++a){if(R){let x=a*2;Y.x=r[x],Y.y=r[x+1]}ft=V.encode(B,ft,et[a],l[a],M[a],Y,It[a],gt[a])}let Ht=Math.max(0,(s-4)*2),_t=t.indices.length+Ht*3,K=X.createTypedArray(e+s,_t);K.set(t.indices,0);let Tt=1e-4,Et=(nt-ot)*Tt,Nt=(rt-it)*Tt,Yt=-Et,Rt=0,Ut=Et,zt=0,Dt=0,jt=Nt,qt=0,Qt=-Nt,H=e*F;return $(B,H,st,V,M,l,r,I,d,t.westSkirtHeight,G,A,Yt,Rt),H+=t.westIndices.length*F,$(B,H,at,V,M,l,r,I,d,t.southSkirtHeight,G,A,qt,Qt),H+=t.southIndices.length*F,$(B,H,ct,V,M,l,r,I,d,t.eastSkirtHeight,G,A,Ut,zt),H+=t.eastIndices.length*F,$(B,H,ut,V,M,l,r,I,d,t.northSkirtHeight,G,A,Dt,jt),Vt.addSkirtIndices(st,at,ct,ut,e,K,t.indices.length),n.push(B.buffer,K.buffer),{vertices:B.buffer,indices:K.buffer,westIndicesSouthToNorth:st,southIndicesEastToWest:at,eastIndicesNorthToSouth:ct,northIndicesWestToEast:ut,vertexStride:F,center:S,minimumHeight:y,maximumHeight:v,occludeePointInScaledSpace:mt,encoding:V,indexCountWithoutSkirts:t.indices.length}}function J(t,n,o,e,r,s,i,c,h){let E=Number.POSITIVE_INFINITY,g=r.north,d=r.south,p=r.east,b=r.west;p<b&&(p+=f.TWO_PI);let L=t.length;for(let N=0;N<L;++N){let I=t[N],y=o[I],v=e[I];u.longitude=f.lerp(b,p,v.x),u.latitude=f.lerp(d,g,v.y),u.height=y-n;let S=s.cartographicToCartesian(u,D);U.multiplyByPoint(i,S,S),P.minimumByComponent(S,c,c),P.maximumByComponent(S,h,h),E=Math.min(E,u.height)}return E}function $(t,n,o,e,r,s,i,c,h,E,g,d,p,b){let L=w(i),N=h.north,I=h.south,y=h.east,v=h.west;y<v&&(y+=f.TWO_PI);let S=o.length;for(let _=0;_<S;++_){let O=o[_],G=r[O],A=s[O];u.longitude=f.lerp(v,y,A.x)+p,u.latitude=f.lerp(I,N,A.y)+b,u.height=G-E;let j=c.cartographicToCartesian(u,D);if(L){let R=O*2;Y.x=i[R],Y.y=i[R+1]}let q;e.hasWebMercatorT&&(q=(z.geodeticLatitudeToMercatorAngle(u.latitude)-g)*d);let Q;e.hasGeodeticSurfaceNormals&&(Q=c.geodeticSurfaceNormal(j)),n=e.encode(t,n,j,A,u.height,Y,q,Q)}}function tt(t,n){let o;return typeof t.slice=="function"&&(o=t.slice(),typeof o.sort!="function"&&(o=void 0)),w(o)||(o=Array.prototype.slice.call(t)),o.sort(n),o}var Se=Mt(Jt);export{Se as default};