deeptwins-cesium-engine 0.0.37 → 0.0.39

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 (138) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +3 -3
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +3 -3
  3. package/Build/ThirdParty/Workers/zip-web-worker.js +2 -2
  4. package/Build/Workers/chunk-23I6J5G7.js +398 -0
  5. package/Build/Workers/chunk-2AHRUAHP.js +963 -0
  6. package/Build/Workers/chunk-2EXJYRVL.js +1800 -0
  7. package/Build/Workers/chunk-2KZSEMHE.js +368 -0
  8. package/Build/Workers/chunk-3DT7SFPW.js +959 -0
  9. package/Build/Workers/chunk-3HAZZIZN.js +435 -0
  10. package/Build/Workers/chunk-3JNKFBNK.js +287 -0
  11. package/Build/Workers/chunk-4GPYRP3M.js +157 -0
  12. package/Build/Workers/chunk-4HWJCCN5.js +1481 -0
  13. package/Build/Workers/chunk-4UN6DCKS.js +44 -0
  14. package/Build/Workers/chunk-5AS35AVH.js +101 -0
  15. package/Build/Workers/chunk-5QBKODYV.js +239 -0
  16. package/Build/Workers/chunk-7H2S5BNE.js +196 -0
  17. package/Build/Workers/chunk-7NK5LQGE.js +1055 -0
  18. package/Build/Workers/chunk-7USIJNJO.js +456 -0
  19. package/Build/Workers/chunk-A3LZJ465.js +634 -0
  20. package/Build/Workers/chunk-ACV745U5.js +629 -0
  21. package/Build/Workers/chunk-AF7CI434.js +476 -0
  22. package/Build/Workers/chunk-ARYZWDAD.js +157 -0
  23. package/Build/Workers/chunk-BDVR2XOF.js +305 -0
  24. package/Build/Workers/chunk-CBSLDU73.js +1481 -0
  25. package/Build/Workers/chunk-DD3ISUFZ.js +2717 -0
  26. package/Build/Workers/chunk-DIVAQ6AJ.js +196 -0
  27. package/Build/Workers/chunk-E2LXRH4B.js +390 -0
  28. package/Build/Workers/chunk-ESM3ZWV7.js +781 -0
  29. package/Build/Workers/chunk-EZS63EHQ.js +171 -0
  30. package/Build/Workers/chunk-F3HA5JVH.js +435 -0
  31. package/Build/Workers/chunk-FGQQ4BAX.js +684 -0
  32. package/Build/Workers/chunk-FL4PAMOR.js +100 -0
  33. package/Build/Workers/chunk-FXZPZ42H.js +122 -0
  34. package/Build/Workers/chunk-GBACHWVF.js +171 -0
  35. package/Build/Workers/chunk-GKTDHQWC.js +122 -0
  36. package/Build/Workers/chunk-HBSMOYMV.js +37 -0
  37. package/Build/Workers/chunk-HKLYRUUZ.js +691 -0
  38. package/Build/Workers/chunk-HRSYMVJK.js +511 -0
  39. package/Build/Workers/chunk-IE4WZF5B.js +220 -0
  40. package/Build/Workers/chunk-IXVT26OF.js +163 -0
  41. package/Build/Workers/chunk-IYRRJ6HP.js +262 -0
  42. package/Build/Workers/chunk-JGB65JJZ.js +58 -0
  43. package/Build/Workers/chunk-K4MHMSSB.js +1800 -0
  44. package/Build/Workers/chunk-KZZS6JY6.js +300 -0
  45. package/Build/Workers/chunk-LBBJTH3K.js +2717 -0
  46. package/Build/Workers/chunk-LFYSBTBW.js +963 -0
  47. package/Build/Workers/chunk-LHUR7S4A.js +421 -0
  48. package/Build/Workers/chunk-LNRTQ27Z.js +59 -0
  49. package/Build/Workers/chunk-LOR2HRSE.js +1073 -0
  50. package/Build/Workers/chunk-MCMBUNB4.js +10357 -0
  51. package/Build/Workers/chunk-NCVCDYTD.js +1258 -0
  52. package/Build/Workers/chunk-NS3GCKZS.js +102 -0
  53. package/Build/Workers/chunk-OGSJ5ZP6.js +500 -0
  54. package/Build/Workers/chunk-OH3VVE2G.js +758 -0
  55. package/Build/Workers/chunk-OVXKRRSP.js +305 -0
  56. package/Build/Workers/chunk-OYCWKCSH.js +139 -0
  57. package/Build/Workers/chunk-P53ISV4G.js +1258 -0
  58. package/Build/Workers/chunk-P76UBIMX.js +75 -0
  59. package/Build/Workers/chunk-PPJPELR6.js +834 -0
  60. package/Build/Workers/chunk-PXMNRFPM.js +691 -0
  61. package/Build/Workers/chunk-QW5GG3FR.js +59 -0
  62. package/Build/Workers/chunk-RBFNWURH.js +959 -0
  63. package/Build/Workers/chunk-RCW2L6C3.js +1055 -0
  64. package/Build/Workers/chunk-RO6KFQNC.js +287 -0
  65. package/Build/Workers/chunk-RZIOHE7Z.js +239 -0
  66. package/Build/Workers/chunk-S7VB62PT.js +511 -0
  67. package/Build/Workers/chunk-SS4SBY5P.js +421 -0
  68. package/Build/Workers/chunk-TDUWFVEH.js +300 -0
  69. package/Build/Workers/chunk-UBCK7AIW.js +39 -0
  70. package/Build/Workers/chunk-UDSU5OZZ.js +73 -0
  71. package/Build/Workers/chunk-UWBEXOKK.js +115 -0
  72. package/Build/Workers/chunk-VMHJ465B.js +781 -0
  73. package/Build/Workers/chunk-W3SVGQNY.js +353 -0
  74. package/Build/Workers/chunk-WANNP3AY.js +1073 -0
  75. package/Build/Workers/chunk-WJT5PV2Q.js +220 -0
  76. package/Build/Workers/chunk-X2PKPXPZ.js +10357 -0
  77. package/Build/Workers/chunk-XA76JK4A.js +758 -0
  78. package/Build/Workers/chunk-XAI7HXKB.js +476 -0
  79. package/Build/Workers/chunk-XCTF4LFK.js +138 -0
  80. package/Build/Workers/chunk-XQWSES33.js +55 -0
  81. package/Build/Workers/chunk-XUDMEXSI.js +834 -0
  82. package/Build/Workers/chunk-YNTVI3S3.js +390 -0
  83. package/Build/Workers/chunk-YW6GWBRU.js +368 -0
  84. package/Build/Workers/chunk-YZUNRTF3.js +398 -0
  85. package/Build/Workers/chunk-Z26UX5A7.js +684 -0
  86. package/Build/Workers/chunk-ZPEGWBIN.js +2857 -0
  87. package/Build/Workers/combineGeometry.js +22 -22
  88. package/Build/Workers/createBoxGeometry.js +16 -16
  89. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  90. package/Build/Workers/createCircleGeometry.js +24 -24
  91. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  92. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  93. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  94. package/Build/Workers/createCorridorGeometry.js +27 -27
  95. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  96. package/Build/Workers/createCylinderGeometry.js +18 -18
  97. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  98. package/Build/Workers/createEllipseGeometry.js +24 -24
  99. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  100. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  101. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  102. package/Build/Workers/createFrustumGeometry.js +16 -16
  103. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  104. package/Build/Workers/createGeometry.js +22 -22
  105. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  106. package/Build/Workers/createPlaneGeometry.js +14 -14
  107. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  108. package/Build/Workers/createPolygonGeometry.js +30 -30
  109. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  110. package/Build/Workers/createPolylineGeometry.js +23 -23
  111. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  112. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  113. package/Build/Workers/createRectangleGeometry.js +25 -25
  114. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  115. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  116. package/Build/Workers/createSphereGeometry.js +17 -17
  117. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  118. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  119. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  120. package/Build/Workers/createVectorTileGeometries.js +22 -22
  121. package/Build/Workers/createVectorTilePoints.js +12 -12
  122. package/Build/Workers/createVectorTilePolygons.js +20 -20
  123. package/Build/Workers/createVectorTilePolylines.js +13 -13
  124. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  125. package/Build/Workers/createVerticesFromHeightmap.js +26 -26
  126. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  127. package/Build/Workers/createWallGeometry.js +22 -22
  128. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  129. package/Build/Workers/decodeDraco.js +11 -11
  130. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  131. package/Build/Workers/decodeI3S.js +10 -10
  132. package/Build/Workers/transcodeKTX2.js +62 -54
  133. package/Build/Workers/transferTypedArrayTest.js +1 -1
  134. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  135. package/Source/Renderer/TextureAtlas.js +30 -21
  136. package/Source/Scene/BillboardTexture.js +99 -12
  137. package/index.js +46 -46
  138. package/package.json +1 -1
@@ -0,0 +1,305 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.37
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
+ Quaternion_default
28
+ } from "./chunk-X2PKPXPZ.js";
29
+ import {
30
+ Cartesian3_default,
31
+ Matrix3_default
32
+ } from "./chunk-O3PMNFMM.js";
33
+ import {
34
+ Math_default
35
+ } from "./chunk-DVR6JMCT.js";
36
+
37
+ // packages/engine/Source/Core/EllipseGeometryLibrary.js
38
+ var EllipseGeometryLibrary = {};
39
+ var rotAxis = new Cartesian3_default();
40
+ var tempVec = new Cartesian3_default();
41
+ var unitQuat = new Quaternion_default();
42
+ var rotMtx = new Matrix3_default();
43
+ function pointOnEllipsoid(theta, rotation, northVec, eastVec, aSqr, ab, bSqr, mag, unitPos, result) {
44
+ const azimuth = theta + rotation;
45
+ Cartesian3_default.multiplyByScalar(eastVec, Math.cos(azimuth), rotAxis);
46
+ Cartesian3_default.multiplyByScalar(northVec, Math.sin(azimuth), tempVec);
47
+ Cartesian3_default.add(rotAxis, tempVec, rotAxis);
48
+ let cosThetaSquared = Math.cos(theta);
49
+ cosThetaSquared = cosThetaSquared * cosThetaSquared;
50
+ let sinThetaSquared = Math.sin(theta);
51
+ sinThetaSquared = sinThetaSquared * sinThetaSquared;
52
+ const radius = ab / Math.sqrt(bSqr * cosThetaSquared + aSqr * sinThetaSquared);
53
+ const angle = radius / mag;
54
+ Quaternion_default.fromAxisAngle(rotAxis, angle, unitQuat);
55
+ Matrix3_default.fromQuaternion(unitQuat, rotMtx);
56
+ Matrix3_default.multiplyByVector(rotMtx, unitPos, result);
57
+ Cartesian3_default.normalize(result, result);
58
+ Cartesian3_default.multiplyByScalar(result, mag, result);
59
+ return result;
60
+ }
61
+ var scratchCartesian1 = new Cartesian3_default();
62
+ var scratchCartesian2 = new Cartesian3_default();
63
+ var scratchCartesian3 = new Cartesian3_default();
64
+ var scratchNormal = new Cartesian3_default();
65
+ EllipseGeometryLibrary.raisePositionsToHeight = function(positions, options, extrude) {
66
+ const ellipsoid = options.ellipsoid;
67
+ const height = options.height;
68
+ const extrudedHeight = options.extrudedHeight;
69
+ const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
70
+ const finalPositions = new Float64Array(size * 3);
71
+ const length = positions.length;
72
+ const bottomOffset = extrude ? length : 0;
73
+ for (let i = 0; i < length; i += 3) {
74
+ const i1 = i + 1;
75
+ const i2 = i + 2;
76
+ const position = Cartesian3_default.fromArray(positions, i, scratchCartesian1);
77
+ ellipsoid.scaleToGeodeticSurface(position, position);
78
+ const extrudedPosition = Cartesian3_default.clone(position, scratchCartesian2);
79
+ const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
80
+ const scaledNormal = Cartesian3_default.multiplyByScalar(
81
+ normal,
82
+ height,
83
+ scratchCartesian3
84
+ );
85
+ Cartesian3_default.add(position, scaledNormal, position);
86
+ if (extrude) {
87
+ Cartesian3_default.multiplyByScalar(normal, extrudedHeight, scaledNormal);
88
+ Cartesian3_default.add(extrudedPosition, scaledNormal, extrudedPosition);
89
+ finalPositions[i + bottomOffset] = extrudedPosition.x;
90
+ finalPositions[i1 + bottomOffset] = extrudedPosition.y;
91
+ finalPositions[i2 + bottomOffset] = extrudedPosition.z;
92
+ }
93
+ finalPositions[i] = position.x;
94
+ finalPositions[i1] = position.y;
95
+ finalPositions[i2] = position.z;
96
+ }
97
+ return finalPositions;
98
+ };
99
+ var unitPosScratch = new Cartesian3_default();
100
+ var eastVecScratch = new Cartesian3_default();
101
+ var northVecScratch = new Cartesian3_default();
102
+ EllipseGeometryLibrary.computeEllipsePositions = function(options, addFillPositions, addEdgePositions) {
103
+ const semiMinorAxis = options.semiMinorAxis;
104
+ const semiMajorAxis = options.semiMajorAxis;
105
+ const rotation = options.rotation;
106
+ const center = options.center;
107
+ const granularity = options.granularity * 8;
108
+ const aSqr = semiMinorAxis * semiMinorAxis;
109
+ const bSqr = semiMajorAxis * semiMajorAxis;
110
+ const ab = semiMajorAxis * semiMinorAxis;
111
+ const mag = Cartesian3_default.magnitude(center);
112
+ const unitPos = Cartesian3_default.normalize(center, unitPosScratch);
113
+ let eastVec = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, center, eastVecScratch);
114
+ eastVec = Cartesian3_default.normalize(eastVec, eastVec);
115
+ const northVec = Cartesian3_default.cross(unitPos, eastVec, northVecScratch);
116
+ let numPts = 1 + Math.ceil(Math_default.PI_OVER_TWO / granularity);
117
+ const deltaTheta = Math_default.PI_OVER_TWO / (numPts - 1);
118
+ let theta = Math_default.PI_OVER_TWO - numPts * deltaTheta;
119
+ if (theta < 0) {
120
+ numPts -= Math.ceil(Math.abs(theta) / deltaTheta);
121
+ }
122
+ const size = 2 * (numPts * (numPts + 2));
123
+ const positions = addFillPositions ? new Array(size * 3) : void 0;
124
+ let positionIndex = 0;
125
+ let position = scratchCartesian1;
126
+ let reflectedPosition = scratchCartesian2;
127
+ const outerPositionsLength = numPts * 4 * 3;
128
+ let outerRightIndex = outerPositionsLength - 1;
129
+ let outerLeftIndex = 0;
130
+ const outerPositions = addEdgePositions ? new Array(outerPositionsLength) : void 0;
131
+ let i;
132
+ let j;
133
+ let numInterior;
134
+ let t;
135
+ let interiorPosition;
136
+ theta = Math_default.PI_OVER_TWO;
137
+ position = pointOnEllipsoid(
138
+ theta,
139
+ rotation,
140
+ northVec,
141
+ eastVec,
142
+ aSqr,
143
+ ab,
144
+ bSqr,
145
+ mag,
146
+ unitPos,
147
+ position
148
+ );
149
+ if (addFillPositions) {
150
+ positions[positionIndex++] = position.x;
151
+ positions[positionIndex++] = position.y;
152
+ positions[positionIndex++] = position.z;
153
+ }
154
+ if (addEdgePositions) {
155
+ outerPositions[outerRightIndex--] = position.z;
156
+ outerPositions[outerRightIndex--] = position.y;
157
+ outerPositions[outerRightIndex--] = position.x;
158
+ }
159
+ theta = Math_default.PI_OVER_TWO - deltaTheta;
160
+ for (i = 1; i < numPts + 1; ++i) {
161
+ position = pointOnEllipsoid(
162
+ theta,
163
+ rotation,
164
+ northVec,
165
+ eastVec,
166
+ aSqr,
167
+ ab,
168
+ bSqr,
169
+ mag,
170
+ unitPos,
171
+ position
172
+ );
173
+ reflectedPosition = pointOnEllipsoid(
174
+ Math.PI - theta,
175
+ rotation,
176
+ northVec,
177
+ eastVec,
178
+ aSqr,
179
+ ab,
180
+ bSqr,
181
+ mag,
182
+ unitPos,
183
+ reflectedPosition
184
+ );
185
+ if (addFillPositions) {
186
+ positions[positionIndex++] = position.x;
187
+ positions[positionIndex++] = position.y;
188
+ positions[positionIndex++] = position.z;
189
+ numInterior = 2 * i + 2;
190
+ for (j = 1; j < numInterior - 1; ++j) {
191
+ t = j / (numInterior - 1);
192
+ interiorPosition = Cartesian3_default.lerp(
193
+ position,
194
+ reflectedPosition,
195
+ t,
196
+ scratchCartesian3
197
+ );
198
+ positions[positionIndex++] = interiorPosition.x;
199
+ positions[positionIndex++] = interiorPosition.y;
200
+ positions[positionIndex++] = interiorPosition.z;
201
+ }
202
+ positions[positionIndex++] = reflectedPosition.x;
203
+ positions[positionIndex++] = reflectedPosition.y;
204
+ positions[positionIndex++] = reflectedPosition.z;
205
+ }
206
+ if (addEdgePositions) {
207
+ outerPositions[outerRightIndex--] = position.z;
208
+ outerPositions[outerRightIndex--] = position.y;
209
+ outerPositions[outerRightIndex--] = position.x;
210
+ outerPositions[outerLeftIndex++] = reflectedPosition.x;
211
+ outerPositions[outerLeftIndex++] = reflectedPosition.y;
212
+ outerPositions[outerLeftIndex++] = reflectedPosition.z;
213
+ }
214
+ theta = Math_default.PI_OVER_TWO - (i + 1) * deltaTheta;
215
+ }
216
+ for (i = numPts; i > 1; --i) {
217
+ theta = Math_default.PI_OVER_TWO - (i - 1) * deltaTheta;
218
+ position = pointOnEllipsoid(
219
+ -theta,
220
+ rotation,
221
+ northVec,
222
+ eastVec,
223
+ aSqr,
224
+ ab,
225
+ bSqr,
226
+ mag,
227
+ unitPos,
228
+ position
229
+ );
230
+ reflectedPosition = pointOnEllipsoid(
231
+ theta + Math.PI,
232
+ rotation,
233
+ northVec,
234
+ eastVec,
235
+ aSqr,
236
+ ab,
237
+ bSqr,
238
+ mag,
239
+ unitPos,
240
+ reflectedPosition
241
+ );
242
+ if (addFillPositions) {
243
+ positions[positionIndex++] = position.x;
244
+ positions[positionIndex++] = position.y;
245
+ positions[positionIndex++] = position.z;
246
+ numInterior = 2 * (i - 1) + 2;
247
+ for (j = 1; j < numInterior - 1; ++j) {
248
+ t = j / (numInterior - 1);
249
+ interiorPosition = Cartesian3_default.lerp(
250
+ position,
251
+ reflectedPosition,
252
+ t,
253
+ scratchCartesian3
254
+ );
255
+ positions[positionIndex++] = interiorPosition.x;
256
+ positions[positionIndex++] = interiorPosition.y;
257
+ positions[positionIndex++] = interiorPosition.z;
258
+ }
259
+ positions[positionIndex++] = reflectedPosition.x;
260
+ positions[positionIndex++] = reflectedPosition.y;
261
+ positions[positionIndex++] = reflectedPosition.z;
262
+ }
263
+ if (addEdgePositions) {
264
+ outerPositions[outerRightIndex--] = position.z;
265
+ outerPositions[outerRightIndex--] = position.y;
266
+ outerPositions[outerRightIndex--] = position.x;
267
+ outerPositions[outerLeftIndex++] = reflectedPosition.x;
268
+ outerPositions[outerLeftIndex++] = reflectedPosition.y;
269
+ outerPositions[outerLeftIndex++] = reflectedPosition.z;
270
+ }
271
+ }
272
+ theta = Math_default.PI_OVER_TWO;
273
+ position = pointOnEllipsoid(
274
+ -theta,
275
+ rotation,
276
+ northVec,
277
+ eastVec,
278
+ aSqr,
279
+ ab,
280
+ bSqr,
281
+ mag,
282
+ unitPos,
283
+ position
284
+ );
285
+ const r = {};
286
+ if (addFillPositions) {
287
+ positions[positionIndex++] = position.x;
288
+ positions[positionIndex++] = position.y;
289
+ positions[positionIndex++] = position.z;
290
+ r.positions = positions;
291
+ r.numPts = numPts;
292
+ }
293
+ if (addEdgePositions) {
294
+ outerPositions[outerRightIndex--] = position.z;
295
+ outerPositions[outerRightIndex--] = position.y;
296
+ outerPositions[outerRightIndex--] = position.x;
297
+ r.outerPositions = outerPositions;
298
+ }
299
+ return r;
300
+ };
301
+ var EllipseGeometryLibrary_default = EllipseGeometryLibrary;
302
+
303
+ export {
304
+ EllipseGeometryLibrary_default
305
+ };
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.38
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
+ Math_default
28
+ } from "./chunk-OGSJ5ZP6.js";
29
+ import {
30
+ WebGLConstants_default
31
+ } from "./chunk-ACV745U5.js";
32
+ import {
33
+ DeveloperError_default
34
+ } from "./chunk-IXVT26OF.js";
35
+ import {
36
+ defined_default
37
+ } from "./chunk-P76UBIMX.js";
38
+
39
+ // packages/engine/Source/Core/IndexDatatype.js
40
+ var IndexDatatype = {
41
+ /**
42
+ * 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
43
+ * of an element in <code>Uint8Array</code>.
44
+ *
45
+ * @type {number}
46
+ * @constant
47
+ */
48
+ UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
49
+ /**
50
+ * 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
51
+ * of an element in <code>Uint16Array</code>.
52
+ *
53
+ * @type {number}
54
+ * @constant
55
+ */
56
+ UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
57
+ /**
58
+ * 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
59
+ * of an element in <code>Uint32Array</code>.
60
+ *
61
+ * @type {number}
62
+ * @constant
63
+ */
64
+ UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT
65
+ };
66
+ IndexDatatype.getSizeInBytes = function(indexDatatype) {
67
+ switch (indexDatatype) {
68
+ case IndexDatatype.UNSIGNED_BYTE:
69
+ return Uint8Array.BYTES_PER_ELEMENT;
70
+ case IndexDatatype.UNSIGNED_SHORT:
71
+ return Uint16Array.BYTES_PER_ELEMENT;
72
+ case IndexDatatype.UNSIGNED_INT:
73
+ return Uint32Array.BYTES_PER_ELEMENT;
74
+ }
75
+ throw new DeveloperError_default(
76
+ "indexDatatype is required and must be a valid IndexDatatype constant."
77
+ );
78
+ };
79
+ IndexDatatype.fromSizeInBytes = function(sizeInBytes) {
80
+ switch (sizeInBytes) {
81
+ case 2:
82
+ return IndexDatatype.UNSIGNED_SHORT;
83
+ case 4:
84
+ return IndexDatatype.UNSIGNED_INT;
85
+ case 1:
86
+ return IndexDatatype.UNSIGNED_BYTE;
87
+ //>>includeStart('debug', pragmas.debug);
88
+ default:
89
+ throw new DeveloperError_default(
90
+ "Size in bytes cannot be mapped to an IndexDatatype"
91
+ );
92
+ }
93
+ };
94
+ IndexDatatype.validate = function(indexDatatype) {
95
+ return defined_default(indexDatatype) && (indexDatatype === IndexDatatype.UNSIGNED_BYTE || indexDatatype === IndexDatatype.UNSIGNED_SHORT || indexDatatype === IndexDatatype.UNSIGNED_INT);
96
+ };
97
+ IndexDatatype.createTypedArray = function(numberOfVertices, indicesLengthOrArray) {
98
+ if (!defined_default(numberOfVertices)) {
99
+ throw new DeveloperError_default("numberOfVertices is required.");
100
+ }
101
+ if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
102
+ return new Uint32Array(indicesLengthOrArray);
103
+ }
104
+ return new Uint16Array(indicesLengthOrArray);
105
+ };
106
+ IndexDatatype.createTypedArrayFromArrayBuffer = function(numberOfVertices, sourceArray, byteOffset, length) {
107
+ if (!defined_default(numberOfVertices)) {
108
+ throw new DeveloperError_default("numberOfVertices is required.");
109
+ }
110
+ if (!defined_default(sourceArray)) {
111
+ throw new DeveloperError_default("sourceArray is required.");
112
+ }
113
+ if (!defined_default(byteOffset)) {
114
+ throw new DeveloperError_default("byteOffset is required.");
115
+ }
116
+ if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
117
+ return new Uint32Array(sourceArray, byteOffset, length);
118
+ }
119
+ return new Uint16Array(sourceArray, byteOffset, length);
120
+ };
121
+ IndexDatatype.fromTypedArray = function(array) {
122
+ if (array instanceof Uint8Array) {
123
+ return IndexDatatype.UNSIGNED_BYTE;
124
+ }
125
+ if (array instanceof Uint16Array) {
126
+ return IndexDatatype.UNSIGNED_SHORT;
127
+ }
128
+ if (array instanceof Uint32Array) {
129
+ return IndexDatatype.UNSIGNED_INT;
130
+ }
131
+ throw new DeveloperError_default(
132
+ "array must be a Uint8Array, Uint16Array, or Uint32Array."
133
+ );
134
+ };
135
+ var IndexDatatype_default = Object.freeze(IndexDatatype);
136
+
137
+ export {
138
+ IndexDatatype_default
139
+ };