@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,483 +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
- BoundingRectangle_default
28
- } from "./chunk-FDOV2LBJ.js";
29
- import {
30
- CoplanarPolygonGeometryLibrary_default
31
- } from "./chunk-76BYBWHP.js";
32
- import "./chunk-M3GMB5OP.js";
33
- import {
34
- PolygonGeometryLibrary_default
35
- } from "./chunk-PGRPDNHG.js";
36
- import "./chunk-PRGYLLJT.js";
37
- import {
38
- GeometryInstance_default
39
- } from "./chunk-7KTQP4VB.js";
40
- import {
41
- GeometryPipeline_default
42
- } from "./chunk-GGZJN2TI.js";
43
- import "./chunk-NGPPMXRM.js";
44
- import "./chunk-C6YYBQXW.js";
45
- import {
46
- VertexFormat_default
47
- } from "./chunk-EJZTDTUH.js";
48
- import "./chunk-CKY7HOHV.js";
49
- import "./chunk-S6MRMMQU.js";
50
- import {
51
- PolygonPipeline_default
52
- } from "./chunk-SMDOP47J.js";
53
- import {
54
- arrayRemoveDuplicates_default
55
- } from "./chunk-472HQ3EH.js";
56
- import "./chunk-E6V6SQZW.js";
57
- import "./chunk-3Q2L65QU.js";
58
- import "./chunk-2ZGOQXYU.js";
59
- import {
60
- IndexDatatype_default
61
- } from "./chunk-26GA3JAM.js";
62
- import {
63
- GeometryAttributes_default
64
- } from "./chunk-DI5NGJUP.js";
65
- import {
66
- GeometryAttribute_default,
67
- Geometry_default,
68
- PrimitiveType_default
69
- } from "./chunk-GWCFU2SA.js";
70
- import {
71
- BoundingSphere_default
72
- } from "./chunk-VJZB3WAV.js";
73
- import {
74
- Quaternion_default
75
- } from "./chunk-5PTXS2GO.js";
76
- import {
77
- ComponentDatatype_default
78
- } from "./chunk-K4GQUNB5.js";
79
- import {
80
- Cartesian2_default,
81
- Cartesian3_default,
82
- Ellipsoid_default,
83
- Matrix3_default
84
- } from "./chunk-YFXQECWV.js";
85
- import {
86
- Math_default
87
- } from "./chunk-XY4BATBS.js";
88
- import "./chunk-MXIZJAPH.js";
89
- import "./chunk-6CHGCNMW.js";
90
- import {
91
- defaultValue_default
92
- } from "./chunk-7JO7GPJN.js";
93
- import {
94
- Check_default
95
- } from "./chunk-AD63PIY6.js";
96
- import {
97
- defined_default
98
- } from "./chunk-E63IIM5T.js";
99
-
100
- // packages/engine/Source/Core/CoplanarPolygonGeometry.js
101
- var scratchPosition = new Cartesian3_default();
102
- var scratchBR = new BoundingRectangle_default();
103
- var stScratch = new Cartesian2_default();
104
- var textureCoordinatesOrigin = new Cartesian2_default();
105
- var scratchNormal = new Cartesian3_default();
106
- var scratchTangent = new Cartesian3_default();
107
- var scratchBitangent = new Cartesian3_default();
108
- var centerScratch = new Cartesian3_default();
109
- var axis1Scratch = new Cartesian3_default();
110
- var axis2Scratch = new Cartesian3_default();
111
- var quaternionScratch = new Quaternion_default();
112
- var textureMatrixScratch = new Matrix3_default();
113
- var tangentRotationScratch = new Matrix3_default();
114
- var surfaceNormalScratch = new Cartesian3_default();
115
- function createGeometryFromPolygon(polygon, vertexFormat, boundingRectangle, stRotation, hardcodedTextureCoordinates, projectPointTo2D, normal, tangent, bitangent) {
116
- const positions = polygon.positions;
117
- let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
118
- if (indices.length < 3) {
119
- indices = [0, 1, 2];
120
- }
121
- const newIndices = IndexDatatype_default.createTypedArray(
122
- positions.length,
123
- indices.length
124
- );
125
- newIndices.set(indices);
126
- let textureMatrix = textureMatrixScratch;
127
- if (stRotation !== 0) {
128
- let rotation = Quaternion_default.fromAxisAngle(
129
- normal,
130
- stRotation,
131
- quaternionScratch
132
- );
133
- textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
134
- if (vertexFormat.tangent || vertexFormat.bitangent) {
135
- rotation = Quaternion_default.fromAxisAngle(
136
- normal,
137
- -stRotation,
138
- quaternionScratch
139
- );
140
- const tangentRotation = Matrix3_default.fromQuaternion(
141
- rotation,
142
- tangentRotationScratch
143
- );
144
- tangent = Cartesian3_default.normalize(
145
- Matrix3_default.multiplyByVector(tangentRotation, tangent, tangent),
146
- tangent
147
- );
148
- if (vertexFormat.bitangent) {
149
- bitangent = Cartesian3_default.normalize(
150
- Cartesian3_default.cross(normal, tangent, bitangent),
151
- bitangent
152
- );
153
- }
154
- }
155
- } else {
156
- textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
157
- }
158
- const stOrigin = textureCoordinatesOrigin;
159
- if (vertexFormat.st) {
160
- stOrigin.x = boundingRectangle.x;
161
- stOrigin.y = boundingRectangle.y;
162
- }
163
- const length = positions.length;
164
- const size = length * 3;
165
- const flatPositions = new Float64Array(size);
166
- const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
167
- const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
168
- const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
169
- const textureCoordinates = vertexFormat.st ? new Float32Array(length * 2) : void 0;
170
- let positionIndex = 0;
171
- let normalIndex = 0;
172
- let bitangentIndex = 0;
173
- let tangentIndex = 0;
174
- let stIndex = 0;
175
- for (let i = 0; i < length; i++) {
176
- const position = positions[i];
177
- flatPositions[positionIndex++] = position.x;
178
- flatPositions[positionIndex++] = position.y;
179
- flatPositions[positionIndex++] = position.z;
180
- if (vertexFormat.st) {
181
- if (defined_default(hardcodedTextureCoordinates) && hardcodedTextureCoordinates.positions.length === length) {
182
- textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].x;
183
- textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].y;
184
- } else {
185
- const p = Matrix3_default.multiplyByVector(
186
- textureMatrix,
187
- position,
188
- scratchPosition
189
- );
190
- const st = projectPointTo2D(p, stScratch);
191
- Cartesian2_default.subtract(st, stOrigin, st);
192
- const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
193
- const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
194
- textureCoordinates[stIndex++] = stx;
195
- textureCoordinates[stIndex++] = sty;
196
- }
197
- }
198
- if (vertexFormat.normal) {
199
- normals[normalIndex++] = normal.x;
200
- normals[normalIndex++] = normal.y;
201
- normals[normalIndex++] = normal.z;
202
- }
203
- if (vertexFormat.tangent) {
204
- tangents[tangentIndex++] = tangent.x;
205
- tangents[tangentIndex++] = tangent.y;
206
- tangents[tangentIndex++] = tangent.z;
207
- }
208
- if (vertexFormat.bitangent) {
209
- bitangents[bitangentIndex++] = bitangent.x;
210
- bitangents[bitangentIndex++] = bitangent.y;
211
- bitangents[bitangentIndex++] = bitangent.z;
212
- }
213
- }
214
- const attributes = new GeometryAttributes_default();
215
- if (vertexFormat.position) {
216
- attributes.position = new GeometryAttribute_default({
217
- componentDatatype: ComponentDatatype_default.DOUBLE,
218
- componentsPerAttribute: 3,
219
- values: flatPositions
220
- });
221
- }
222
- if (vertexFormat.normal) {
223
- attributes.normal = new GeometryAttribute_default({
224
- componentDatatype: ComponentDatatype_default.FLOAT,
225
- componentsPerAttribute: 3,
226
- values: normals
227
- });
228
- }
229
- if (vertexFormat.tangent) {
230
- attributes.tangent = new GeometryAttribute_default({
231
- componentDatatype: ComponentDatatype_default.FLOAT,
232
- componentsPerAttribute: 3,
233
- values: tangents
234
- });
235
- }
236
- if (vertexFormat.bitangent) {
237
- attributes.bitangent = new GeometryAttribute_default({
238
- componentDatatype: ComponentDatatype_default.FLOAT,
239
- componentsPerAttribute: 3,
240
- values: bitangents
241
- });
242
- }
243
- if (vertexFormat.st) {
244
- attributes.st = new GeometryAttribute_default({
245
- componentDatatype: ComponentDatatype_default.FLOAT,
246
- componentsPerAttribute: 2,
247
- values: textureCoordinates
248
- });
249
- }
250
- return new Geometry_default({
251
- attributes,
252
- indices: newIndices,
253
- primitiveType: PrimitiveType_default.TRIANGLES
254
- });
255
- }
256
- function CoplanarPolygonGeometry(options) {
257
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
258
- const polygonHierarchy = options.polygonHierarchy;
259
- const textureCoordinates = options.textureCoordinates;
260
- Check_default.defined("options.polygonHierarchy", polygonHierarchy);
261
- const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
262
- this._vertexFormat = VertexFormat_default.clone(vertexFormat);
263
- this._polygonHierarchy = polygonHierarchy;
264
- this._stRotation = defaultValue_default(options.stRotation, 0);
265
- this._ellipsoid = Ellipsoid_default.clone(
266
- defaultValue_default(options.ellipsoid, Ellipsoid_default.default)
267
- );
268
- this._workerName = "createCoplanarPolygonGeometry";
269
- this._textureCoordinates = textureCoordinates;
270
- this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
271
- polygonHierarchy,
272
- Cartesian3_default
273
- ) + VertexFormat_default.packedLength + Ellipsoid_default.packedLength + (defined_default(textureCoordinates) ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
274
- textureCoordinates,
275
- Cartesian2_default
276
- ) : 1) + 2;
277
- }
278
- CoplanarPolygonGeometry.fromPositions = function(options) {
279
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
280
- Check_default.defined("options.positions", options.positions);
281
- const newOptions = {
282
- polygonHierarchy: {
283
- positions: options.positions
284
- },
285
- vertexFormat: options.vertexFormat,
286
- stRotation: options.stRotation,
287
- ellipsoid: options.ellipsoid,
288
- textureCoordinates: options.textureCoordinates
289
- };
290
- return new CoplanarPolygonGeometry(newOptions);
291
- };
292
- CoplanarPolygonGeometry.pack = function(value, array, startingIndex) {
293
- Check_default.typeOf.object("value", value);
294
- Check_default.defined("array", array);
295
- startingIndex = defaultValue_default(startingIndex, 0);
296
- startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
297
- value._polygonHierarchy,
298
- array,
299
- startingIndex,
300
- Cartesian3_default
301
- );
302
- Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
303
- startingIndex += Ellipsoid_default.packedLength;
304
- VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
305
- startingIndex += VertexFormat_default.packedLength;
306
- array[startingIndex++] = value._stRotation;
307
- if (defined_default(value._textureCoordinates)) {
308
- startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
309
- value._textureCoordinates,
310
- array,
311
- startingIndex,
312
- Cartesian2_default
313
- );
314
- } else {
315
- array[startingIndex++] = -1;
316
- }
317
- array[startingIndex++] = value.packedLength;
318
- return array;
319
- };
320
- var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
321
- var scratchVertexFormat = new VertexFormat_default();
322
- var scratchOptions = {
323
- polygonHierarchy: {}
324
- };
325
- CoplanarPolygonGeometry.unpack = function(array, startingIndex, result) {
326
- Check_default.defined("array", array);
327
- startingIndex = defaultValue_default(startingIndex, 0);
328
- const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
329
- array,
330
- startingIndex,
331
- Cartesian3_default
332
- );
333
- startingIndex = polygonHierarchy.startingIndex;
334
- delete polygonHierarchy.startingIndex;
335
- const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
336
- startingIndex += Ellipsoid_default.packedLength;
337
- const vertexFormat = VertexFormat_default.unpack(
338
- array,
339
- startingIndex,
340
- scratchVertexFormat
341
- );
342
- startingIndex += VertexFormat_default.packedLength;
343
- const stRotation = array[startingIndex++];
344
- const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
345
- array,
346
- startingIndex,
347
- Cartesian2_default
348
- );
349
- if (defined_default(textureCoordinates)) {
350
- startingIndex = textureCoordinates.startingIndex;
351
- delete textureCoordinates.startingIndex;
352
- } else {
353
- startingIndex++;
354
- }
355
- const packedLength = array[startingIndex++];
356
- if (!defined_default(result)) {
357
- result = new CoplanarPolygonGeometry(scratchOptions);
358
- }
359
- result._polygonHierarchy = polygonHierarchy;
360
- result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
361
- result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
362
- result._stRotation = stRotation;
363
- result._textureCoordinates = textureCoordinates;
364
- result.packedLength = packedLength;
365
- return result;
366
- };
367
- CoplanarPolygonGeometry.createGeometry = function(polygonGeometry) {
368
- const vertexFormat = polygonGeometry._vertexFormat;
369
- const polygonHierarchy = polygonGeometry._polygonHierarchy;
370
- const stRotation = polygonGeometry._stRotation;
371
- const textureCoordinates = polygonGeometry._textureCoordinates;
372
- const hasTextureCoordinates = defined_default(textureCoordinates);
373
- let outerPositions = polygonHierarchy.positions;
374
- outerPositions = arrayRemoveDuplicates_default(
375
- outerPositions,
376
- Cartesian3_default.equalsEpsilon,
377
- true
378
- );
379
- if (outerPositions.length < 3) {
380
- return;
381
- }
382
- let normal = scratchNormal;
383
- let tangent = scratchTangent;
384
- let bitangent = scratchBitangent;
385
- let axis1 = axis1Scratch;
386
- const axis2 = axis2Scratch;
387
- const validGeometry = CoplanarPolygonGeometryLibrary_default.computeProjectTo2DArguments(
388
- outerPositions,
389
- centerScratch,
390
- axis1,
391
- axis2
392
- );
393
- if (!validGeometry) {
394
- return void 0;
395
- }
396
- normal = Cartesian3_default.cross(axis1, axis2, normal);
397
- normal = Cartesian3_default.normalize(normal, normal);
398
- if (!Cartesian3_default.equalsEpsilon(
399
- centerScratch,
400
- Cartesian3_default.ZERO,
401
- Math_default.EPSILON6
402
- )) {
403
- const surfaceNormal = polygonGeometry._ellipsoid.geodeticSurfaceNormal(
404
- centerScratch,
405
- surfaceNormalScratch
406
- );
407
- if (Cartesian3_default.dot(normal, surfaceNormal) < 0) {
408
- normal = Cartesian3_default.negate(normal, normal);
409
- axis1 = Cartesian3_default.negate(axis1, axis1);
410
- }
411
- }
412
- const projectPoints = CoplanarPolygonGeometryLibrary_default.createProjectPointsTo2DFunction(
413
- centerScratch,
414
- axis1,
415
- axis2
416
- );
417
- const projectPoint = CoplanarPolygonGeometryLibrary_default.createProjectPointTo2DFunction(
418
- centerScratch,
419
- axis1,
420
- axis2
421
- );
422
- if (vertexFormat.tangent) {
423
- tangent = Cartesian3_default.clone(axis1, tangent);
424
- }
425
- if (vertexFormat.bitangent) {
426
- bitangent = Cartesian3_default.clone(axis2, bitangent);
427
- }
428
- const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
429
- polygonHierarchy,
430
- hasTextureCoordinates,
431
- projectPoints,
432
- false
433
- );
434
- const hierarchy = results.hierarchy;
435
- const polygons = results.polygons;
436
- const dummyFunction = function(identity) {
437
- return identity;
438
- };
439
- const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
440
- textureCoordinates,
441
- true,
442
- dummyFunction,
443
- false
444
- ).polygons : void 0;
445
- if (hierarchy.length === 0) {
446
- return;
447
- }
448
- outerPositions = hierarchy[0].outerRing;
449
- const boundingSphere = BoundingSphere_default.fromPoints(outerPositions);
450
- const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
451
- normal,
452
- projectPoint,
453
- outerPositions,
454
- stRotation,
455
- scratchBR
456
- );
457
- const geometries = [];
458
- for (let i = 0; i < polygons.length; i++) {
459
- const geometryInstance = new GeometryInstance_default({
460
- geometry: createGeometryFromPolygon(
461
- polygons[i],
462
- vertexFormat,
463
- boundingRectangle,
464
- stRotation,
465
- hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
466
- projectPoint,
467
- normal,
468
- tangent,
469
- bitangent
470
- )
471
- });
472
- geometries.push(geometryInstance);
473
- }
474
- const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
475
- geometry.attributes.position.values = new Float64Array(
476
- geometry.attributes.position.values
477
- );
478
- geometry.indices = IndexDatatype_default.createTypedArray(
479
- geometry.attributes.position.values.length / 3,
480
- geometry.indices
481
- );
482
- const attributes = geometry.attributes;
483
- if (!vertexFormat.position) {
484
- delete attributes.position;
485
- }
486
- return new Geometry_default({
487
- attributes,
488
- indices: geometry.indices,
489
- primitiveType: geometry.primitiveType,
490
- boundingSphere
491
- });
492
- };
493
- var CoplanarPolygonGeometry_default = CoplanarPolygonGeometry;
494
-
495
- // packages/engine/Source/Workers/createCoplanarPolygonGeometry.js
496
- function createCoplanarPolygonGeometry(polygonGeometry, offset) {
497
- if (defined_default(offset)) {
498
- polygonGeometry = CoplanarPolygonGeometry_default.unpack(polygonGeometry, offset);
499
- }
500
- return CoplanarPolygonGeometry_default.createGeometry(polygonGeometry);
501
- }
502
- var createCoplanarPolygonGeometry_default = createCoplanarPolygonGeometry;
503
- export {
504
- createCoplanarPolygonGeometry_default as default
505
- };
26
+ import{a as et}from"./chunk-WGGIH7QW.js";import{a as Q}from"./chunk-EZUYS2JF.js";import"./chunk-CNCV5UL7.js";import{a as u}from"./chunk-AJYK4IVJ.js";import"./chunk-J6UP6FLE.js";import{a as I}from"./chunk-D6AA5QVT.js";import{a as $}from"./chunk-VW6VD53G.js";import"./chunk-DEPHB2WM.js";import"./chunk-QOUAJ6TL.js";import{a as f}from"./chunk-CYCB63OH.js";import"./chunk-TCGIRNHN.js";import"./chunk-N4VJKXZS.js";import{b as ot}from"./chunk-77IHZJJ3.js";import{a as tt}from"./chunk-3W4GT7KQ.js";import"./chunk-G5AGHVVC.js";import"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as J}from"./chunk-OFUUQVMR.js";import{a as X}from"./chunk-A56XVLQR.js";import{b as W,c as Y,d as z}from"./chunk-RCV6KWXS.js";import{d as K}from"./chunk-4IW2T6GF.js";import{f as q}from"./chunk-PSPPBZWI.js";import{a as B}from"./chunk-AU7IKHOH.js";import{a as i,c as H,d as m,e as g,f as U}from"./chunk-64RSHJUE.js";import{a as V}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{b as G}from"./chunk-LEYMRMBK.js";import{e as d}from"./chunk-VTAIKJXX.js";var st=new i,at=new et,pt=new H,lt=new H,mt=new i,ft=new i,ut=new i,M=new i,yt=new i,ht=new i,nt=new q,dt=new g,gt=new g,Pt=new i;function wt(e,t,o,a,y,_,r,n,p){let A=e.positions,c=ot.triangulate(e.positions2D,e.holes);c.length<3&&(c=[0,1,2]);let P=J.createTypedArray(A.length,c.length);P.set(c);let E=dt;if(a!==0){let h=q.fromAxisAngle(r,a,nt);if(E=g.fromQuaternion(h,E),t.tangent||t.bitangent){h=q.fromAxisAngle(r,-a,nt);let O=g.fromQuaternion(h,gt);n=i.normalize(g.multiplyByVector(O,n,n),n),t.bitangent&&(p=i.normalize(i.cross(r,n,p),p))}}else E=g.clone(g.IDENTITY,E);let N=lt;t.st&&(N.x=o.x,N.y=o.y);let b=A.length,k=b*3,C=new Float64Array(k),L=t.normal?new Float32Array(k):void 0,D=t.tangent?new Float32Array(k):void 0,F=t.bitangent?new Float32Array(k):void 0,T=t.st?new Float32Array(b*2):void 0,j=0,R=0,l=0,S=0,s=0;for(let h=0;h<b;h++){let O=A[h];if(C[j++]=O.x,C[j++]=O.y,C[j++]=O.z,t.st)if(d(y)&&y.positions.length===b)T[s++]=y.positions[h].x,T[s++]=y.positions[h].y;else{let it=g.multiplyByVector(E,O,st),v=_(it,pt);H.subtract(v,N,v);let rt=V.clamp(v.x/o.width,0,1),ct=V.clamp(v.y/o.height,0,1);T[s++]=rt,T[s++]=ct}t.normal&&(L[R++]=r.x,L[R++]=r.y,L[R++]=r.z),t.tangent&&(D[S++]=n.x,D[S++]=n.y,D[S++]=n.z),t.bitangent&&(F[l++]=p.x,F[l++]=p.y,F[l++]=p.z)}let w=new X;return t.position&&(w.position=new z({componentDatatype:B.DOUBLE,componentsPerAttribute:3,values:C})),t.normal&&(w.normal=new z({componentDatatype:B.FLOAT,componentsPerAttribute:3,values:L})),t.tangent&&(w.tangent=new z({componentDatatype:B.FLOAT,componentsPerAttribute:3,values:D})),t.bitangent&&(w.bitangent=new z({componentDatatype:B.FLOAT,componentsPerAttribute:3,values:F})),t.st&&(w.st=new z({componentDatatype:B.FLOAT,componentsPerAttribute:2,values:T})),new Y({attributes:w,indices:P,primitiveType:W.TRIANGLES})}function x(e){e=e??U.EMPTY_OBJECT;let t=e.polygonHierarchy,o=e.textureCoordinates;G.defined("options.polygonHierarchy",t);let a=e.vertexFormat??f.DEFAULT;this._vertexFormat=f.clone(a),this._polygonHierarchy=t,this._stRotation=e.stRotation??0,this._ellipsoid=m.clone(e.ellipsoid??m.default),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=o,this.packedLength=u.computeHierarchyPackedLength(t,i)+f.packedLength+m.packedLength+(d(o)?u.computeHierarchyPackedLength(o,H):1)+2}x.fromPositions=function(e){e=e??U.EMPTY_OBJECT,G.defined("options.positions",e.positions);let t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new x(t)};x.pack=function(e,t,o){return G.typeOf.object("value",e),G.defined("array",t),o=o??0,o=u.packPolygonHierarchy(e._polygonHierarchy,t,o,i),m.pack(e._ellipsoid,t,o),o+=m.packedLength,f.pack(e._vertexFormat,t,o),o+=f.packedLength,t[o++]=e._stRotation,d(e._textureCoordinates)?o=u.packPolygonHierarchy(e._textureCoordinates,t,o,H):t[o++]=-1,t[o++]=e.packedLength,t};var _t=m.clone(m.UNIT_SPHERE),At=new f,bt={polygonHierarchy:{}};x.unpack=function(e,t,o){G.defined("array",e),t=t??0;let a=u.unpackPolygonHierarchy(e,t,i);t=a.startingIndex,delete a.startingIndex;let y=m.unpack(e,t,_t);t+=m.packedLength;let _=f.unpack(e,t,At);t+=f.packedLength;let r=e[t++],n=e[t]===-1?void 0:u.unpackPolygonHierarchy(e,t,H);d(n)?(t=n.startingIndex,delete n.startingIndex):t++;let p=e[t++];return d(o)||(o=new x(bt)),o._polygonHierarchy=a,o._ellipsoid=m.clone(y,o._ellipsoid),o._vertexFormat=f.clone(_,o._vertexFormat),o._stRotation=r,o._textureCoordinates=n,o.packedLength=p,o};x.createGeometry=function(e){let t=e._vertexFormat,o=e._polygonHierarchy,a=e._stRotation,y=e._textureCoordinates,_=d(y),r=o.positions;if(r=tt(r,i.equalsEpsilon,!0),r.length<3)return;let n=mt,p=ft,A=ut,c=yt,P=ht;if(!Q.computeProjectTo2DArguments(r,M,c,P))return;if(n=i.cross(c,P,n),n=i.normalize(n,n),!i.equalsEpsilon(M,i.ZERO,V.EPSILON6)){let s=e._ellipsoid.geodeticSurfaceNormal(M,Pt);i.dot(n,s)<0&&(n=i.negate(n,n),c=i.negate(c,c))}let N=Q.createProjectPointsTo2DFunction(M,c,P),b=Q.createProjectPointTo2DFunction(M,c,P);t.tangent&&(p=i.clone(c,p)),t.bitangent&&(A=i.clone(P,A));let k=u.polygonsFromHierarchy(o,_,N,!1),C=k.hierarchy,L=k.polygons,D=function(s){return s},F=_?u.polygonsFromHierarchy(y,!0,D,!1).polygons:void 0;if(C.length===0)return;r=C[0].outerRing;let T=K.fromPoints(r),j=u.computeBoundingRectangle(n,b,r,a,at),R=[];for(let s=0;s<L.length;s++){let w=new I({geometry:wt(L[s],t,j,a,_?F[s]:void 0,b,n,p,A)});R.push(w)}let l=$.combineInstances(R)[0];l.attributes.position.values=new Float64Array(l.attributes.position.values),l.indices=J.createTypedArray(l.attributes.position.values.length/3,l.indices);let S=l.attributes;return t.position||delete S.position,new Y({attributes:S,indices:l.indices,primitiveType:l.primitiveType,boundingSphere:T})};var Z=x;function kt(e,t){return d(t)&&(e=Z.unpack(e,t)),Z.createGeometry(e)}var Xt=kt;export{Xt as default};