@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,511 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
5
- *
6
- * Copyright 2011-2022 Cesium Contributors
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- *
20
- * Columbus View (Pat. Pend.)
21
- *
22
- * Portions licensed separately.
23
- * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
- */
25
-
26
- import {
27
- GeometryOffsetAttribute_default
28
- } from "./chunk-I2ITFFPX.js";
29
- import {
30
- VertexFormat_default
31
- } from "./chunk-EJZTDTUH.js";
32
- import {
33
- IndexDatatype_default
34
- } from "./chunk-26GA3JAM.js";
35
- import {
36
- GeometryAttributes_default
37
- } from "./chunk-DI5NGJUP.js";
38
- import {
39
- GeometryAttribute_default,
40
- Geometry_default,
41
- PrimitiveType_default
42
- } from "./chunk-GWCFU2SA.js";
43
- import {
44
- BoundingSphere_default
45
- } from "./chunk-VJZB3WAV.js";
46
- import {
47
- ComponentDatatype_default
48
- } from "./chunk-K4GQUNB5.js";
49
- import {
50
- Cartesian2_default,
51
- Cartesian3_default,
52
- Ellipsoid_default
53
- } from "./chunk-YFXQECWV.js";
54
- import {
55
- Math_default
56
- } from "./chunk-XY4BATBS.js";
57
- import {
58
- defaultValue_default
59
- } from "./chunk-7JO7GPJN.js";
60
- import {
61
- DeveloperError_default
62
- } from "./chunk-AD63PIY6.js";
63
- import {
64
- defined_default
65
- } from "./chunk-E63IIM5T.js";
66
-
67
- // packages/engine/Source/Core/EllipsoidGeometry.js
68
- var scratchPosition = new Cartesian3_default();
69
- var scratchNormal = new Cartesian3_default();
70
- var scratchTangent = new Cartesian3_default();
71
- var scratchBitangent = new Cartesian3_default();
72
- var scratchNormalST = new Cartesian3_default();
73
- var defaultRadii = new Cartesian3_default(1, 1, 1);
74
- var cos = Math.cos;
75
- var sin = Math.sin;
76
- function EllipsoidGeometry(options) {
77
- options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
78
- const radii = defaultValue_default(options.radii, defaultRadii);
79
- const innerRadii = defaultValue_default(options.innerRadii, radii);
80
- const minimumClock = defaultValue_default(options.minimumClock, 0);
81
- const maximumClock = defaultValue_default(options.maximumClock, Math_default.TWO_PI);
82
- const minimumCone = defaultValue_default(options.minimumCone, 0);
83
- const maximumCone = defaultValue_default(options.maximumCone, Math_default.PI);
84
- const stackPartitions = Math.round(defaultValue_default(options.stackPartitions, 64));
85
- const slicePartitions = Math.round(defaultValue_default(options.slicePartitions, 64));
86
- const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
87
- if (slicePartitions < 3) {
88
- throw new DeveloperError_default(
89
- "options.slicePartitions cannot be less than three."
90
- );
91
- }
92
- if (stackPartitions < 3) {
93
- throw new DeveloperError_default(
94
- "options.stackPartitions cannot be less than three."
95
- );
96
- }
97
- this._radii = Cartesian3_default.clone(radii);
98
- this._innerRadii = Cartesian3_default.clone(innerRadii);
99
- this._minimumClock = minimumClock;
100
- this._maximumClock = maximumClock;
101
- this._minimumCone = minimumCone;
102
- this._maximumCone = maximumCone;
103
- this._stackPartitions = stackPartitions;
104
- this._slicePartitions = slicePartitions;
105
- this._vertexFormat = VertexFormat_default.clone(vertexFormat);
106
- this._offsetAttribute = options.offsetAttribute;
107
- this._workerName = "createEllipsoidGeometry";
108
- }
109
- EllipsoidGeometry.packedLength = 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength + 7;
110
- EllipsoidGeometry.pack = function(value, array, startingIndex) {
111
- if (!defined_default(value)) {
112
- throw new DeveloperError_default("value is required");
113
- }
114
- if (!defined_default(array)) {
115
- throw new DeveloperError_default("array is required");
116
- }
117
- startingIndex = defaultValue_default(startingIndex, 0);
118
- Cartesian3_default.pack(value._radii, array, startingIndex);
119
- startingIndex += Cartesian3_default.packedLength;
120
- Cartesian3_default.pack(value._innerRadii, array, startingIndex);
121
- startingIndex += Cartesian3_default.packedLength;
122
- VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
123
- startingIndex += VertexFormat_default.packedLength;
124
- array[startingIndex++] = value._minimumClock;
125
- array[startingIndex++] = value._maximumClock;
126
- array[startingIndex++] = value._minimumCone;
127
- array[startingIndex++] = value._maximumCone;
128
- array[startingIndex++] = value._stackPartitions;
129
- array[startingIndex++] = value._slicePartitions;
130
- array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
131
- return array;
132
- };
133
- var scratchRadii = new Cartesian3_default();
134
- var scratchInnerRadii = new Cartesian3_default();
135
- var scratchVertexFormat = new VertexFormat_default();
136
- var scratchOptions = {
137
- radii: scratchRadii,
138
- innerRadii: scratchInnerRadii,
139
- vertexFormat: scratchVertexFormat,
140
- minimumClock: void 0,
141
- maximumClock: void 0,
142
- minimumCone: void 0,
143
- maximumCone: void 0,
144
- stackPartitions: void 0,
145
- slicePartitions: void 0,
146
- offsetAttribute: void 0
147
- };
148
- EllipsoidGeometry.unpack = function(array, startingIndex, result) {
149
- if (!defined_default(array)) {
150
- throw new DeveloperError_default("array is required");
151
- }
152
- startingIndex = defaultValue_default(startingIndex, 0);
153
- const radii = Cartesian3_default.unpack(array, startingIndex, scratchRadii);
154
- startingIndex += Cartesian3_default.packedLength;
155
- const innerRadii = Cartesian3_default.unpack(array, startingIndex, scratchInnerRadii);
156
- startingIndex += Cartesian3_default.packedLength;
157
- const vertexFormat = VertexFormat_default.unpack(
158
- array,
159
- startingIndex,
160
- scratchVertexFormat
161
- );
162
- startingIndex += VertexFormat_default.packedLength;
163
- const minimumClock = array[startingIndex++];
164
- const maximumClock = array[startingIndex++];
165
- const minimumCone = array[startingIndex++];
166
- const maximumCone = array[startingIndex++];
167
- const stackPartitions = array[startingIndex++];
168
- const slicePartitions = array[startingIndex++];
169
- const offsetAttribute = array[startingIndex];
170
- if (!defined_default(result)) {
171
- scratchOptions.minimumClock = minimumClock;
172
- scratchOptions.maximumClock = maximumClock;
173
- scratchOptions.minimumCone = minimumCone;
174
- scratchOptions.maximumCone = maximumCone;
175
- scratchOptions.stackPartitions = stackPartitions;
176
- scratchOptions.slicePartitions = slicePartitions;
177
- scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
178
- return new EllipsoidGeometry(scratchOptions);
179
- }
180
- result._radii = Cartesian3_default.clone(radii, result._radii);
181
- result._innerRadii = Cartesian3_default.clone(innerRadii, result._innerRadii);
182
- result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
183
- result._minimumClock = minimumClock;
184
- result._maximumClock = maximumClock;
185
- result._minimumCone = minimumCone;
186
- result._maximumCone = maximumCone;
187
- result._stackPartitions = stackPartitions;
188
- result._slicePartitions = slicePartitions;
189
- result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
190
- return result;
191
- };
192
- EllipsoidGeometry.createGeometry = function(ellipsoidGeometry) {
193
- const radii = ellipsoidGeometry._radii;
194
- if (radii.x <= 0 || radii.y <= 0 || radii.z <= 0) {
195
- return;
196
- }
197
- const innerRadii = ellipsoidGeometry._innerRadii;
198
- if (innerRadii.x <= 0 || innerRadii.y <= 0 || innerRadii.z <= 0) {
199
- return;
200
- }
201
- const minimumClock = ellipsoidGeometry._minimumClock;
202
- const maximumClock = ellipsoidGeometry._maximumClock;
203
- const minimumCone = ellipsoidGeometry._minimumCone;
204
- const maximumCone = ellipsoidGeometry._maximumCone;
205
- const vertexFormat = ellipsoidGeometry._vertexFormat;
206
- let slicePartitions = ellipsoidGeometry._slicePartitions + 1;
207
- let stackPartitions = ellipsoidGeometry._stackPartitions + 1;
208
- slicePartitions = Math.round(
209
- slicePartitions * Math.abs(maximumClock - minimumClock) / Math_default.TWO_PI
210
- );
211
- stackPartitions = Math.round(
212
- stackPartitions * Math.abs(maximumCone - minimumCone) / Math_default.PI
213
- );
214
- if (slicePartitions < 2) {
215
- slicePartitions = 2;
216
- }
217
- if (stackPartitions < 2) {
218
- stackPartitions = 2;
219
- }
220
- let i;
221
- let j;
222
- let index = 0;
223
- const phis = [minimumCone];
224
- const thetas = [minimumClock];
225
- for (i = 0; i < stackPartitions; i++) {
226
- phis.push(
227
- minimumCone + i * (maximumCone - minimumCone) / (stackPartitions - 1)
228
- );
229
- }
230
- phis.push(maximumCone);
231
- for (j = 0; j < slicePartitions; j++) {
232
- thetas.push(
233
- minimumClock + j * (maximumClock - minimumClock) / (slicePartitions - 1)
234
- );
235
- }
236
- thetas.push(maximumClock);
237
- const numPhis = phis.length;
238
- const numThetas = thetas.length;
239
- let extraIndices = 0;
240
- let vertexMultiplier = 1;
241
- const hasInnerSurface = innerRadii.x !== radii.x || innerRadii.y !== radii.y || innerRadii.z !== radii.z;
242
- let isTopOpen = false;
243
- let isBotOpen = false;
244
- let isClockOpen = false;
245
- if (hasInnerSurface) {
246
- vertexMultiplier = 2;
247
- if (minimumCone > 0) {
248
- isTopOpen = true;
249
- extraIndices += slicePartitions - 1;
250
- }
251
- if (maximumCone < Math.PI) {
252
- isBotOpen = true;
253
- extraIndices += slicePartitions - 1;
254
- }
255
- if ((maximumClock - minimumClock) % Math_default.TWO_PI) {
256
- isClockOpen = true;
257
- extraIndices += (stackPartitions - 1) * 2 + 1;
258
- } else {
259
- extraIndices += 1;
260
- }
261
- }
262
- const vertexCount = numThetas * numPhis * vertexMultiplier;
263
- const positions = new Float64Array(vertexCount * 3);
264
- const isInner = new Array(vertexCount).fill(false);
265
- const negateNormal = new Array(vertexCount).fill(false);
266
- const indexCount = slicePartitions * stackPartitions * vertexMultiplier;
267
- const numIndices = 6 * (indexCount + extraIndices + 1 - (slicePartitions + stackPartitions) * vertexMultiplier);
268
- const indices = IndexDatatype_default.createTypedArray(indexCount, numIndices);
269
- const normals = vertexFormat.normal ? new Float32Array(vertexCount * 3) : void 0;
270
- const tangents = vertexFormat.tangent ? new Float32Array(vertexCount * 3) : void 0;
271
- const bitangents = vertexFormat.bitangent ? new Float32Array(vertexCount * 3) : void 0;
272
- const st = vertexFormat.st ? new Float32Array(vertexCount * 2) : void 0;
273
- const sinPhi = new Array(numPhis);
274
- const cosPhi = new Array(numPhis);
275
- for (i = 0; i < numPhis; i++) {
276
- sinPhi[i] = sin(phis[i]);
277
- cosPhi[i] = cos(phis[i]);
278
- }
279
- const sinTheta = new Array(numThetas);
280
- const cosTheta = new Array(numThetas);
281
- for (j = 0; j < numThetas; j++) {
282
- cosTheta[j] = cos(thetas[j]);
283
- sinTheta[j] = sin(thetas[j]);
284
- }
285
- for (i = 0; i < numPhis; i++) {
286
- for (j = 0; j < numThetas; j++) {
287
- positions[index++] = radii.x * sinPhi[i] * cosTheta[j];
288
- positions[index++] = radii.y * sinPhi[i] * sinTheta[j];
289
- positions[index++] = radii.z * cosPhi[i];
290
- }
291
- }
292
- let vertexIndex = vertexCount / 2;
293
- if (hasInnerSurface) {
294
- for (i = 0; i < numPhis; i++) {
295
- for (j = 0; j < numThetas; j++) {
296
- positions[index++] = innerRadii.x * sinPhi[i] * cosTheta[j];
297
- positions[index++] = innerRadii.y * sinPhi[i] * sinTheta[j];
298
- positions[index++] = innerRadii.z * cosPhi[i];
299
- isInner[vertexIndex] = true;
300
- if (i > 0 && i !== numPhis - 1 && j !== 0 && j !== numThetas - 1) {
301
- negateNormal[vertexIndex] = true;
302
- }
303
- vertexIndex++;
304
- }
305
- }
306
- }
307
- index = 0;
308
- let topOffset;
309
- let bottomOffset;
310
- for (i = 1; i < numPhis - 2; i++) {
311
- topOffset = i * numThetas;
312
- bottomOffset = (i + 1) * numThetas;
313
- for (j = 1; j < numThetas - 2; j++) {
314
- indices[index++] = bottomOffset + j;
315
- indices[index++] = bottomOffset + j + 1;
316
- indices[index++] = topOffset + j + 1;
317
- indices[index++] = bottomOffset + j;
318
- indices[index++] = topOffset + j + 1;
319
- indices[index++] = topOffset + j;
320
- }
321
- }
322
- if (hasInnerSurface) {
323
- const offset = numPhis * numThetas;
324
- for (i = 1; i < numPhis - 2; i++) {
325
- topOffset = offset + i * numThetas;
326
- bottomOffset = offset + (i + 1) * numThetas;
327
- for (j = 1; j < numThetas - 2; j++) {
328
- indices[index++] = bottomOffset + j;
329
- indices[index++] = topOffset + j;
330
- indices[index++] = topOffset + j + 1;
331
- indices[index++] = bottomOffset + j;
332
- indices[index++] = topOffset + j + 1;
333
- indices[index++] = bottomOffset + j + 1;
334
- }
335
- }
336
- }
337
- let outerOffset;
338
- let innerOffset;
339
- if (hasInnerSurface) {
340
- if (isTopOpen) {
341
- innerOffset = numPhis * numThetas;
342
- for (i = 1; i < numThetas - 2; i++) {
343
- indices[index++] = i;
344
- indices[index++] = i + 1;
345
- indices[index++] = innerOffset + i + 1;
346
- indices[index++] = i;
347
- indices[index++] = innerOffset + i + 1;
348
- indices[index++] = innerOffset + i;
349
- }
350
- }
351
- if (isBotOpen) {
352
- outerOffset = numPhis * numThetas - numThetas;
353
- innerOffset = numPhis * numThetas * vertexMultiplier - numThetas;
354
- for (i = 1; i < numThetas - 2; i++) {
355
- indices[index++] = outerOffset + i + 1;
356
- indices[index++] = outerOffset + i;
357
- indices[index++] = innerOffset + i;
358
- indices[index++] = outerOffset + i + 1;
359
- indices[index++] = innerOffset + i;
360
- indices[index++] = innerOffset + i + 1;
361
- }
362
- }
363
- }
364
- if (isClockOpen) {
365
- for (i = 1; i < numPhis - 2; i++) {
366
- innerOffset = numThetas * numPhis + numThetas * i;
367
- outerOffset = numThetas * i;
368
- indices[index++] = innerOffset;
369
- indices[index++] = outerOffset + numThetas;
370
- indices[index++] = outerOffset;
371
- indices[index++] = innerOffset;
372
- indices[index++] = innerOffset + numThetas;
373
- indices[index++] = outerOffset + numThetas;
374
- }
375
- for (i = 1; i < numPhis - 2; i++) {
376
- innerOffset = numThetas * numPhis + numThetas * (i + 1) - 1;
377
- outerOffset = numThetas * (i + 1) - 1;
378
- indices[index++] = outerOffset + numThetas;
379
- indices[index++] = innerOffset;
380
- indices[index++] = outerOffset;
381
- indices[index++] = outerOffset + numThetas;
382
- indices[index++] = innerOffset + numThetas;
383
- indices[index++] = innerOffset;
384
- }
385
- }
386
- const attributes = new GeometryAttributes_default();
387
- if (vertexFormat.position) {
388
- attributes.position = new GeometryAttribute_default({
389
- componentDatatype: ComponentDatatype_default.DOUBLE,
390
- componentsPerAttribute: 3,
391
- values: positions
392
- });
393
- }
394
- let stIndex = 0;
395
- let normalIndex = 0;
396
- let tangentIndex = 0;
397
- let bitangentIndex = 0;
398
- const vertexCountHalf = vertexCount / 2;
399
- let ellipsoid;
400
- const ellipsoidOuter = Ellipsoid_default.fromCartesian3(radii);
401
- const ellipsoidInner = Ellipsoid_default.fromCartesian3(innerRadii);
402
- if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
403
- for (i = 0; i < vertexCount; i++) {
404
- ellipsoid = isInner[i] ? ellipsoidInner : ellipsoidOuter;
405
- const position = Cartesian3_default.fromArray(positions, i * 3, scratchPosition);
406
- const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
407
- if (negateNormal[i]) {
408
- Cartesian3_default.negate(normal, normal);
409
- }
410
- if (vertexFormat.st) {
411
- const normalST = Cartesian2_default.negate(normal, scratchNormalST);
412
- st[stIndex++] = Math.atan2(normalST.y, normalST.x) / Math_default.TWO_PI + 0.5;
413
- st[stIndex++] = Math.asin(normal.z) / Math.PI + 0.5;
414
- }
415
- if (vertexFormat.normal) {
416
- normals[normalIndex++] = normal.x;
417
- normals[normalIndex++] = normal.y;
418
- normals[normalIndex++] = normal.z;
419
- }
420
- if (vertexFormat.tangent || vertexFormat.bitangent) {
421
- const tangent = scratchTangent;
422
- let tangetOffset = 0;
423
- let unit;
424
- if (isInner[i]) {
425
- tangetOffset = vertexCountHalf;
426
- }
427
- if (!isTopOpen && i >= tangetOffset && i < tangetOffset + numThetas * 2) {
428
- unit = Cartesian3_default.UNIT_X;
429
- } else {
430
- unit = Cartesian3_default.UNIT_Z;
431
- }
432
- Cartesian3_default.cross(unit, normal, tangent);
433
- Cartesian3_default.normalize(tangent, tangent);
434
- if (vertexFormat.tangent) {
435
- tangents[tangentIndex++] = tangent.x;
436
- tangents[tangentIndex++] = tangent.y;
437
- tangents[tangentIndex++] = tangent.z;
438
- }
439
- if (vertexFormat.bitangent) {
440
- const bitangent = Cartesian3_default.cross(normal, tangent, scratchBitangent);
441
- Cartesian3_default.normalize(bitangent, bitangent);
442
- bitangents[bitangentIndex++] = bitangent.x;
443
- bitangents[bitangentIndex++] = bitangent.y;
444
- bitangents[bitangentIndex++] = bitangent.z;
445
- }
446
- }
447
- }
448
- if (vertexFormat.st) {
449
- attributes.st = new GeometryAttribute_default({
450
- componentDatatype: ComponentDatatype_default.FLOAT,
451
- componentsPerAttribute: 2,
452
- values: st
453
- });
454
- }
455
- if (vertexFormat.normal) {
456
- attributes.normal = new GeometryAttribute_default({
457
- componentDatatype: ComponentDatatype_default.FLOAT,
458
- componentsPerAttribute: 3,
459
- values: normals
460
- });
461
- }
462
- if (vertexFormat.tangent) {
463
- attributes.tangent = new GeometryAttribute_default({
464
- componentDatatype: ComponentDatatype_default.FLOAT,
465
- componentsPerAttribute: 3,
466
- values: tangents
467
- });
468
- }
469
- if (vertexFormat.bitangent) {
470
- attributes.bitangent = new GeometryAttribute_default({
471
- componentDatatype: ComponentDatatype_default.FLOAT,
472
- componentsPerAttribute: 3,
473
- values: bitangents
474
- });
475
- }
476
- }
477
- if (defined_default(ellipsoidGeometry._offsetAttribute)) {
478
- const length = positions.length;
479
- const offsetValue = ellipsoidGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
480
- const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
481
- attributes.applyOffset = new GeometryAttribute_default({
482
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
483
- componentsPerAttribute: 1,
484
- values: applyOffset
485
- });
486
- }
487
- return new Geometry_default({
488
- attributes,
489
- indices,
490
- primitiveType: PrimitiveType_default.TRIANGLES,
491
- boundingSphere: BoundingSphere_default.fromEllipsoid(ellipsoidOuter),
492
- offsetAttribute: ellipsoidGeometry._offsetAttribute
493
- });
494
- };
495
- var unitEllipsoidGeometry;
496
- EllipsoidGeometry.getUnitEllipsoid = function() {
497
- if (!defined_default(unitEllipsoidGeometry)) {
498
- unitEllipsoidGeometry = EllipsoidGeometry.createGeometry(
499
- new EllipsoidGeometry({
500
- radii: new Cartesian3_default(1, 1, 1),
501
- vertexFormat: VertexFormat_default.POSITION_ONLY
502
- })
503
- );
504
- }
505
- return unitEllipsoidGeometry;
506
- };
507
- var EllipsoidGeometry_default = EllipsoidGeometry;
508
-
509
- export {
510
- EllipsoidGeometry_default
511
- };