@rtzh/engine 0.0.1 → 0.0.3

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 (115) hide show
  1. package/Source/Scene/GltfLoader.js +2 -2
  2. package/Source/Scene/Model/CustomShader.js +2 -2
  3. package/index.js +504 -504
  4. package/package.json +1 -1
  5. package/Build/ThirdParty/Workers/zip-web-worker.js +0 -640
  6. package/Build/Workers/chunk-245NZYCR.js +0 -124
  7. package/Build/Workers/chunk-25BA4527.js +0 -837
  8. package/Build/Workers/chunk-4HXPSZRC.js +0 -1483
  9. package/Build/Workers/chunk-4Z26IS65.js +0 -3514
  10. package/Build/Workers/chunk-55IROWAX.js +0 -139
  11. package/Build/Workers/chunk-56XTN5NJ.js +0 -1800
  12. package/Build/Workers/chunk-5VZISKJF.js +0 -629
  13. package/Build/Workers/chunk-5WAG5YKS.js +0 -368
  14. package/Build/Workers/chunk-66YGZWBI.js +0 -1317
  15. package/Build/Workers/chunk-6H33B6OL.js +0 -37
  16. package/Build/Workers/chunk-6LZBBEA7.js +0 -439
  17. package/Build/Workers/chunk-6XJO625E.js +0 -497
  18. package/Build/Workers/chunk-75UGCVME.js +0 -102
  19. package/Build/Workers/chunk-7B23DD46.js +0 -1054
  20. package/Build/Workers/chunk-7NCJH26L.js +0 -352
  21. package/Build/Workers/chunk-AIW5F22O.js +0 -352
  22. package/Build/Workers/chunk-AL22JVIA.js +0 -256
  23. package/Build/Workers/chunk-AVSQILVI.js +0 -75
  24. package/Build/Workers/chunk-B2VFNYD7.js +0 -280
  25. package/Build/Workers/chunk-BOV6T7FO.js +0 -44
  26. package/Build/Workers/chunk-DP76S3IQ.js +0 -1067
  27. package/Build/Workers/chunk-EDIUN7V3.js +0 -219
  28. package/Build/Workers/chunk-EKMWNF4U.js +0 -55
  29. package/Build/Workers/chunk-ELXGXAYS.js +0 -682
  30. package/Build/Workers/chunk-FVYRV2T6.js +0 -455
  31. package/Build/Workers/chunk-GDIBU55R.js +0 -778
  32. package/Build/Workers/chunk-HAY6YE7M.js +0 -97
  33. package/Build/Workers/chunk-I76SRIKN.js +0 -138
  34. package/Build/Workers/chunk-IELTSYPZ.js +0 -241
  35. package/Build/Workers/chunk-J4MIJCN5.js +0 -171
  36. package/Build/Workers/chunk-JFO3ELF3.js +0 -642
  37. package/Build/Workers/chunk-K4IMD7KH.js +0 -162
  38. package/Build/Workers/chunk-KFMCOG26.js +0 -692
  39. package/Build/Workers/chunk-KH2OWUUA.js +0 -163
  40. package/Build/Workers/chunk-KQIZ7AFF.js +0 -8366
  41. package/Build/Workers/chunk-KVE5EAPO.js +0 -398
  42. package/Build/Workers/chunk-OAOREOSO.js +0 -940
  43. package/Build/Workers/chunk-OFJRMGNX.js +0 -788
  44. package/Build/Workers/chunk-PLLZB3R4.js +0 -198
  45. package/Build/Workers/chunk-POY6ZE32.js +0 -2058
  46. package/Build/Workers/chunk-PV5B2YNB.js +0 -2719
  47. package/Build/Workers/chunk-Q2DXNFYW.js +0 -414
  48. package/Build/Workers/chunk-QWV2DM66.js +0 -1443
  49. package/Build/Workers/chunk-R73BHGGI.js +0 -305
  50. package/Build/Workers/chunk-S3AE3MZZ.js +0 -511
  51. package/Build/Workers/chunk-SBFTVHRW.js +0 -57
  52. package/Build/Workers/chunk-SOR7PD4V.js +0 -114
  53. package/Build/Workers/chunk-TO7TWUET.js +0 -476
  54. package/Build/Workers/chunk-TSAJNE4K.js +0 -101
  55. package/Build/Workers/chunk-TWF4XRZ6.js +0 -73
  56. package/Build/Workers/chunk-UTWLMOPM.js +0 -387
  57. package/Build/Workers/chunk-UYT2PBMV.js +0 -58
  58. package/Build/Workers/chunk-WAS3IHIQ.js +0 -288
  59. package/Build/Workers/chunk-WO5ZNC7S.js +0 -1045
  60. package/Build/Workers/chunk-X65Y2JSA.js +0 -55
  61. package/Build/Workers/chunk-XOVHLPKW.js +0 -299
  62. package/Build/Workers/chunk-YPGJSFOO.js +0 -1460
  63. package/Build/Workers/combineGeometry.js +0 -66
  64. package/Build/Workers/createBoxGeometry.js +0 -58
  65. package/Build/Workers/createBoxOutlineGeometry.js +0 -231
  66. package/Build/Workers/createCircleGeometry.js +0 -201
  67. package/Build/Workers/createCircleOutlineGeometry.js +0 -147
  68. package/Build/Workers/createCoplanarPolygonGeometry.js +0 -505
  69. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +0 -225
  70. package/Build/Workers/createCorridorGeometry.js +0 -1258
  71. package/Build/Workers/createCorridorOutlineGeometry.js +0 -563
  72. package/Build/Workers/createCylinderGeometry.js +0 -60
  73. package/Build/Workers/createCylinderOutlineGeometry.js +0 -231
  74. package/Build/Workers/createEllipseGeometry.js +0 -72
  75. package/Build/Workers/createEllipseOutlineGeometry.js +0 -65
  76. package/Build/Workers/createEllipsoidGeometry.js +0 -59
  77. package/Build/Workers/createEllipsoidOutlineGeometry.js +0 -61
  78. package/Build/Workers/createFrustumGeometry.js +0 -58
  79. package/Build/Workers/createFrustumOutlineGeometry.js +0 -234
  80. package/Build/Workers/createGeometry.js +0 -173
  81. package/Build/Workers/createGroundPolylineGeometry.js +0 -1602
  82. package/Build/Workers/createPlaneGeometry.js +0 -223
  83. package/Build/Workers/createPlaneOutlineGeometry.js +0 -124
  84. package/Build/Workers/createPolygonGeometry.js +0 -1404
  85. package/Build/Workers/createPolygonOutlineGeometry.js +0 -532
  86. package/Build/Workers/createPolylineGeometry.js +0 -491
  87. package/Build/Workers/createPolylineVolumeGeometry.js +0 -374
  88. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +0 -272
  89. package/Build/Workers/createRectangleGeometry.js +0 -1264
  90. package/Build/Workers/createRectangleOutlineGeometry.js +0 -476
  91. package/Build/Workers/createSimplePolylineGeometry.js +0 -397
  92. package/Build/Workers/createSphereGeometry.js +0 -116
  93. package/Build/Workers/createSphereOutlineGeometry.js +0 -116
  94. package/Build/Workers/createTaskProcessorWorker.js +0 -32
  95. package/Build/Workers/createVectorTileClampedPolylines.js +0 -492
  96. package/Build/Workers/createVectorTileGeometries.js +0 -387
  97. package/Build/Workers/createVectorTilePoints.js +0 -114
  98. package/Build/Workers/createVectorTilePolygons.js +0 -386
  99. package/Build/Workers/createVectorTilePolylines.js +0 -262
  100. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +0 -91
  101. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -565
  102. package/Build/Workers/createVerticesFromHeightmap.js +0 -2254
  103. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -499
  104. package/Build/Workers/createWallGeometry.js +0 -487
  105. package/Build/Workers/createWallOutlineGeometry.js +0 -335
  106. package/Build/Workers/decodeDraco.js +0 -369
  107. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +0 -2680
  108. package/Build/Workers/decodeI3S.js +0 -1339
  109. package/Build/Workers/gaussianSplatSorter.js +0 -62
  110. package/Build/Workers/gaussianSplatTextureGenerator.js +0 -68
  111. package/Build/Workers/incrementallyBuildTerrainPicker.js +0 -121
  112. package/Build/Workers/transcodeKTX2.js +0 -3463
  113. package/Build/Workers/transferTypedArrayTest.js +0 -41
  114. package/Build/Workers/upsampleQuantizedTerrainMesh.js +0 -820
  115. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +0 -95
@@ -1,386 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 0.0.1
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
- Color_default
28
- } from "./chunk-JFO3ELF3.js";
29
- import {
30
- createTaskProcessorWorker_default
31
- } from "./chunk-TSAJNE4K.js";
32
- import {
33
- OrientedBoundingBox_default
34
- } from "./chunk-25BA4527.js";
35
- import {
36
- AttributeCompression_default
37
- } from "./chunk-6LZBBEA7.js";
38
- import "./chunk-WAS3IHIQ.js";
39
- import "./chunk-K4IMD7KH.js";
40
- import "./chunk-66YGZWBI.js";
41
- import "./chunk-J4MIJCN5.js";
42
- import {
43
- IndexDatatype_default
44
- } from "./chunk-55IROWAX.js";
45
- import "./chunk-OAOREOSO.js";
46
- import "./chunk-EKMWNF4U.js";
47
- import {
48
- Rectangle_default
49
- } from "./chunk-KQIZ7AFF.js";
50
- import "./chunk-POY6ZE32.js";
51
- import "./chunk-AL22JVIA.js";
52
- import "./chunk-5VZISKJF.js";
53
- import "./chunk-UYT2PBMV.js";
54
- import {
55
- Cartographic_default,
56
- Ellipsoid_default
57
- } from "./chunk-YPGJSFOO.js";
58
- import {
59
- Cartesian3_default
60
- } from "./chunk-QWV2DM66.js";
61
- import {
62
- Math_default
63
- } from "./chunk-6XJO625E.js";
64
- import "./chunk-KH2OWUUA.js";
65
- import {
66
- defined_default
67
- } from "./chunk-AVSQILVI.js";
68
-
69
- // packages/engine/Source/Workers/createVectorTilePolygons.js
70
- var scratchCenter = new Cartesian3_default();
71
- var scratchEllipsoid = new Ellipsoid_default();
72
- var scratchRectangle = new Rectangle_default();
73
- var scratchScalars = {
74
- min: void 0,
75
- max: void 0,
76
- indexBytesPerElement: void 0
77
- };
78
- function unpackBuffer(buffer) {
79
- const packedBuffer = new Float64Array(buffer);
80
- let offset = 0;
81
- scratchScalars.indexBytesPerElement = packedBuffer[offset++];
82
- scratchScalars.min = packedBuffer[offset++];
83
- scratchScalars.max = packedBuffer[offset++];
84
- Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
85
- offset += Cartesian3_default.packedLength;
86
- Ellipsoid_default.unpack(packedBuffer, offset, scratchEllipsoid);
87
- offset += Ellipsoid_default.packedLength;
88
- Rectangle_default.unpack(packedBuffer, offset, scratchRectangle);
89
- }
90
- function packedBatchedIndicesLength(batchedIndices) {
91
- const length = batchedIndices.length;
92
- let count = 0;
93
- for (let i = 0; i < length; ++i) {
94
- count += Color_default.packedLength + 3 + batchedIndices[i].batchIds.length;
95
- }
96
- return count;
97
- }
98
- function packBuffer(indexDatatype, boundingVolumes, batchedIndices) {
99
- const numBVs = boundingVolumes.length;
100
- const length = 1 + 1 + numBVs * OrientedBoundingBox_default.packedLength + 1 + packedBatchedIndicesLength(batchedIndices);
101
- const packedBuffer = new Float64Array(length);
102
- let offset = 0;
103
- packedBuffer[offset++] = indexDatatype;
104
- packedBuffer[offset++] = numBVs;
105
- for (let i = 0; i < numBVs; ++i) {
106
- OrientedBoundingBox_default.pack(boundingVolumes[i], packedBuffer, offset);
107
- offset += OrientedBoundingBox_default.packedLength;
108
- }
109
- const indicesLength = batchedIndices.length;
110
- packedBuffer[offset++] = indicesLength;
111
- for (let j = 0; j < indicesLength; ++j) {
112
- const batchedIndex = batchedIndices[j];
113
- Color_default.pack(batchedIndex.color, packedBuffer, offset);
114
- offset += Color_default.packedLength;
115
- packedBuffer[offset++] = batchedIndex.offset;
116
- packedBuffer[offset++] = batchedIndex.count;
117
- const batchIds = batchedIndex.batchIds;
118
- const batchIdsLength = batchIds.length;
119
- packedBuffer[offset++] = batchIdsLength;
120
- for (let k = 0; k < batchIdsLength; ++k) {
121
- packedBuffer[offset++] = batchIds[k];
122
- }
123
- }
124
- return packedBuffer;
125
- }
126
- var maxShort = 32767;
127
- var scratchEncodedPosition = new Cartesian3_default();
128
- var scratchNormal = new Cartesian3_default();
129
- var scratchScaledNormal = new Cartesian3_default();
130
- var scratchMinHeightPosition = new Cartesian3_default();
131
- var scratchMaxHeightPosition = new Cartesian3_default();
132
- var scratchBVCartographic = new Cartographic_default();
133
- var scratchBVRectangle = new Rectangle_default();
134
- function createVectorTilePolygons(parameters, transferableObjects) {
135
- unpackBuffer(parameters.packedBuffer);
136
- let indices;
137
- const indexBytesPerElement = scratchScalars.indexBytesPerElement;
138
- if (indexBytesPerElement === 2) {
139
- indices = new Uint16Array(parameters.indices);
140
- } else {
141
- indices = new Uint32Array(parameters.indices);
142
- }
143
- const positions = new Uint16Array(parameters.positions);
144
- const counts = new Uint32Array(parameters.counts);
145
- const indexCounts = new Uint32Array(parameters.indexCounts);
146
- const batchIds = new Uint32Array(parameters.batchIds);
147
- const batchTableColors = new Uint32Array(parameters.batchTableColors);
148
- const boundingVolumes = new Array(counts.length);
149
- const center = scratchCenter;
150
- const ellipsoid = scratchEllipsoid;
151
- let rectangle = scratchRectangle;
152
- const minHeight = scratchScalars.min;
153
- const maxHeight = scratchScalars.max;
154
- let minimumHeights = parameters.minimumHeights;
155
- let maximumHeights = parameters.maximumHeights;
156
- if (defined_default(minimumHeights) && defined_default(maximumHeights)) {
157
- minimumHeights = new Float32Array(minimumHeights);
158
- maximumHeights = new Float32Array(maximumHeights);
159
- }
160
- let i;
161
- let j;
162
- let rgba;
163
- const positionsLength = positions.length / 2;
164
- const uBuffer = positions.subarray(0, positionsLength);
165
- const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
166
- AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer);
167
- const decodedPositions = new Float64Array(positionsLength * 3);
168
- for (i = 0; i < positionsLength; ++i) {
169
- const u = uBuffer[i];
170
- const v = vBuffer[i];
171
- const x = Math_default.lerp(rectangle.west, rectangle.east, u / maxShort);
172
- const y = Math_default.lerp(rectangle.south, rectangle.north, v / maxShort);
173
- const cart = Cartographic_default.fromRadians(x, y, 0, scratchBVCartographic);
174
- const decodedPosition = ellipsoid.cartographicToCartesian(
175
- cart,
176
- scratchEncodedPosition
177
- );
178
- Cartesian3_default.pack(decodedPosition, decodedPositions, i * 3);
179
- }
180
- const countsLength = counts.length;
181
- const offsets = new Array(countsLength);
182
- const indexOffsets = new Array(countsLength);
183
- let currentOffset = 0;
184
- let currentIndexOffset = 0;
185
- for (i = 0; i < countsLength; ++i) {
186
- offsets[i] = currentOffset;
187
- indexOffsets[i] = currentIndexOffset;
188
- currentOffset += counts[i];
189
- currentIndexOffset += indexCounts[i];
190
- }
191
- const batchedPositions = new Float32Array(positionsLength * 3 * 2);
192
- const batchedIds = new Uint16Array(positionsLength * 2);
193
- const batchedIndexOffsets = new Uint32Array(indexOffsets.length);
194
- const batchedIndexCounts = new Uint32Array(indexCounts.length);
195
- let batchedIndices = [];
196
- const colorToBuffers = {};
197
- for (i = 0; i < countsLength; ++i) {
198
- rgba = batchTableColors[i];
199
- if (!defined_default(colorToBuffers[rgba])) {
200
- colorToBuffers[rgba] = {
201
- positionLength: counts[i],
202
- indexLength: indexCounts[i],
203
- offset: 0,
204
- indexOffset: 0,
205
- batchIds: [i]
206
- };
207
- } else {
208
- colorToBuffers[rgba].positionLength += counts[i];
209
- colorToBuffers[rgba].indexLength += indexCounts[i];
210
- colorToBuffers[rgba].batchIds.push(i);
211
- }
212
- }
213
- let buffer;
214
- let byColorPositionOffset = 0;
215
- let byColorIndexOffset = 0;
216
- for (rgba in colorToBuffers) {
217
- if (colorToBuffers.hasOwnProperty(rgba)) {
218
- buffer = colorToBuffers[rgba];
219
- buffer.offset = byColorPositionOffset;
220
- buffer.indexOffset = byColorIndexOffset;
221
- const positionLength = buffer.positionLength * 2;
222
- const indexLength = buffer.indexLength * 2 + buffer.positionLength * 6;
223
- byColorPositionOffset += positionLength;
224
- byColorIndexOffset += indexLength;
225
- buffer.indexLength = indexLength;
226
- }
227
- }
228
- const batchedDrawCalls = [];
229
- for (rgba in colorToBuffers) {
230
- if (colorToBuffers.hasOwnProperty(rgba)) {
231
- buffer = colorToBuffers[rgba];
232
- batchedDrawCalls.push({
233
- color: Color_default.fromRgba(parseInt(rgba)),
234
- offset: buffer.indexOffset,
235
- count: buffer.indexLength,
236
- batchIds: buffer.batchIds
237
- });
238
- }
239
- }
240
- for (i = 0; i < countsLength; ++i) {
241
- rgba = batchTableColors[i];
242
- buffer = colorToBuffers[rgba];
243
- const positionOffset = buffer.offset;
244
- let positionIndex = positionOffset * 3;
245
- let batchIdIndex = positionOffset;
246
- const polygonOffset = offsets[i];
247
- const polygonCount = counts[i];
248
- const batchId = batchIds[i];
249
- let polygonMinimumHeight = minHeight;
250
- let polygonMaximumHeight = maxHeight;
251
- if (defined_default(minimumHeights) && defined_default(maximumHeights)) {
252
- polygonMinimumHeight = minimumHeights[i];
253
- polygonMaximumHeight = maximumHeights[i];
254
- }
255
- let minLat = Number.POSITIVE_INFINITY;
256
- let maxLat = Number.NEGATIVE_INFINITY;
257
- let minLon = Number.POSITIVE_INFINITY;
258
- let maxLon = Number.NEGATIVE_INFINITY;
259
- for (j = 0; j < polygonCount; ++j) {
260
- const position = Cartesian3_default.unpack(
261
- decodedPositions,
262
- polygonOffset * 3 + j * 3,
263
- scratchEncodedPosition
264
- );
265
- ellipsoid.scaleToGeodeticSurface(position, position);
266
- const carto = ellipsoid.cartesianToCartographic(
267
- position,
268
- scratchBVCartographic
269
- );
270
- const lat = carto.latitude;
271
- const lon = carto.longitude;
272
- minLat = Math.min(lat, minLat);
273
- maxLat = Math.max(lat, maxLat);
274
- minLon = Math.min(lon, minLon);
275
- maxLon = Math.max(lon, maxLon);
276
- const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
277
- let scaledNormal = Cartesian3_default.multiplyByScalar(
278
- normal,
279
- polygonMinimumHeight,
280
- scratchScaledNormal
281
- );
282
- const minHeightPosition = Cartesian3_default.add(
283
- position,
284
- scaledNormal,
285
- scratchMinHeightPosition
286
- );
287
- scaledNormal = Cartesian3_default.multiplyByScalar(
288
- normal,
289
- polygonMaximumHeight,
290
- scaledNormal
291
- );
292
- const maxHeightPosition = Cartesian3_default.add(
293
- position,
294
- scaledNormal,
295
- scratchMaxHeightPosition
296
- );
297
- Cartesian3_default.subtract(maxHeightPosition, center, maxHeightPosition);
298
- Cartesian3_default.subtract(minHeightPosition, center, minHeightPosition);
299
- Cartesian3_default.pack(maxHeightPosition, batchedPositions, positionIndex);
300
- Cartesian3_default.pack(minHeightPosition, batchedPositions, positionIndex + 3);
301
- batchedIds[batchIdIndex] = batchId;
302
- batchedIds[batchIdIndex + 1] = batchId;
303
- positionIndex += 6;
304
- batchIdIndex += 2;
305
- }
306
- rectangle = scratchBVRectangle;
307
- rectangle.west = minLon;
308
- rectangle.east = maxLon;
309
- rectangle.south = minLat;
310
- rectangle.north = maxLat;
311
- boundingVolumes[i] = OrientedBoundingBox_default.fromRectangle(
312
- rectangle,
313
- minHeight,
314
- maxHeight,
315
- ellipsoid
316
- );
317
- let indicesIndex = buffer.indexOffset;
318
- const indexOffset = indexOffsets[i];
319
- const indexCount = indexCounts[i];
320
- batchedIndexOffsets[i] = indicesIndex;
321
- for (j = 0; j < indexCount; j += 3) {
322
- const i0 = indices[indexOffset + j] - polygonOffset;
323
- const i1 = indices[indexOffset + j + 1] - polygonOffset;
324
- const i2 = indices[indexOffset + j + 2] - polygonOffset;
325
- batchedIndices[indicesIndex++] = i0 * 2 + positionOffset;
326
- batchedIndices[indicesIndex++] = i1 * 2 + positionOffset;
327
- batchedIndices[indicesIndex++] = i2 * 2 + positionOffset;
328
- batchedIndices[indicesIndex++] = i2 * 2 + 1 + positionOffset;
329
- batchedIndices[indicesIndex++] = i1 * 2 + 1 + positionOffset;
330
- batchedIndices[indicesIndex++] = i0 * 2 + 1 + positionOffset;
331
- }
332
- for (j = 0; j < polygonCount; ++j) {
333
- const v0 = j;
334
- const v1 = (j + 1) % polygonCount;
335
- batchedIndices[indicesIndex++] = v0 * 2 + 1 + positionOffset;
336
- batchedIndices[indicesIndex++] = v1 * 2 + positionOffset;
337
- batchedIndices[indicesIndex++] = v0 * 2 + positionOffset;
338
- batchedIndices[indicesIndex++] = v0 * 2 + 1 + positionOffset;
339
- batchedIndices[indicesIndex++] = v1 * 2 + 1 + positionOffset;
340
- batchedIndices[indicesIndex++] = v1 * 2 + positionOffset;
341
- }
342
- buffer.offset += polygonCount * 2;
343
- buffer.indexOffset = indicesIndex;
344
- batchedIndexCounts[i] = indicesIndex - batchedIndexOffsets[i];
345
- }
346
- batchedIndices = IndexDatatype_default.createTypedArray(
347
- batchedPositions.length / 3,
348
- batchedIndices
349
- );
350
- const batchedIndicesLength = batchedDrawCalls.length;
351
- for (let m = 0; m < batchedIndicesLength; ++m) {
352
- const tempIds = batchedDrawCalls[m].batchIds;
353
- let count = 0;
354
- const tempIdsLength = tempIds.length;
355
- for (let n = 0; n < tempIdsLength; ++n) {
356
- count += batchedIndexCounts[tempIds[n]];
357
- }
358
- batchedDrawCalls[m].count = count;
359
- }
360
- const indexDatatype = batchedIndices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT;
361
- const packedBuffer = packBuffer(
362
- indexDatatype,
363
- boundingVolumes,
364
- batchedDrawCalls
365
- );
366
- transferableObjects.push(
367
- batchedPositions.buffer,
368
- batchedIndices.buffer,
369
- batchedIndexOffsets.buffer,
370
- batchedIndexCounts.buffer,
371
- batchedIds.buffer,
372
- packedBuffer.buffer
373
- );
374
- return {
375
- positions: batchedPositions.buffer,
376
- indices: batchedIndices.buffer,
377
- indexOffsets: batchedIndexOffsets.buffer,
378
- indexCounts: batchedIndexCounts.buffer,
379
- batchIds: batchedIds.buffer,
380
- packedBuffer: packedBuffer.buffer
381
- };
382
- }
383
- var createVectorTilePolygons_default = createTaskProcessorWorker_default(createVectorTilePolygons);
384
- export {
385
- createVectorTilePolygons_default as default
386
- };
@@ -1,262 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 0.0.1
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
- createTaskProcessorWorker_default
28
- } from "./chunk-TSAJNE4K.js";
29
- import {
30
- AttributeCompression_default
31
- } from "./chunk-6LZBBEA7.js";
32
- import {
33
- IndexDatatype_default
34
- } from "./chunk-55IROWAX.js";
35
- import {
36
- Rectangle_default,
37
- combine_default
38
- } from "./chunk-KQIZ7AFF.js";
39
- import "./chunk-POY6ZE32.js";
40
- import "./chunk-AL22JVIA.js";
41
- import "./chunk-5VZISKJF.js";
42
- import "./chunk-UYT2PBMV.js";
43
- import {
44
- Cartographic_default,
45
- Ellipsoid_default
46
- } from "./chunk-YPGJSFOO.js";
47
- import {
48
- Cartesian3_default
49
- } from "./chunk-QWV2DM66.js";
50
- import {
51
- Math_default
52
- } from "./chunk-6XJO625E.js";
53
- import "./chunk-KH2OWUUA.js";
54
- import "./chunk-AVSQILVI.js";
55
-
56
- // packages/engine/Source/Core/decodeVectorPolylinePositions.js
57
- var maxShort = 32767;
58
- var scratchBVCartographic = new Cartographic_default();
59
- var scratchEncodedPosition = new Cartesian3_default();
60
- function decodeVectorPolylinePositions(positions, rectangle, minimumHeight, maximumHeight, ellipsoid) {
61
- const positionsLength = positions.length / 3;
62
- const uBuffer = positions.subarray(0, positionsLength);
63
- const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
64
- const heightBuffer = positions.subarray(
65
- 2 * positionsLength,
66
- 3 * positionsLength
67
- );
68
- AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
69
- const decoded = new Float64Array(positions.length);
70
- for (let i = 0; i < positionsLength; ++i) {
71
- const u = uBuffer[i];
72
- const v = vBuffer[i];
73
- const h = heightBuffer[i];
74
- const lon = Math_default.lerp(rectangle.west, rectangle.east, u / maxShort);
75
- const lat = Math_default.lerp(rectangle.south, rectangle.north, v / maxShort);
76
- const alt = Math_default.lerp(minimumHeight, maximumHeight, h / maxShort);
77
- const cartographic = Cartographic_default.fromRadians(
78
- lon,
79
- lat,
80
- alt,
81
- scratchBVCartographic
82
- );
83
- const decodedPosition = ellipsoid.cartographicToCartesian(
84
- cartographic,
85
- scratchEncodedPosition
86
- );
87
- Cartesian3_default.pack(decodedPosition, decoded, i * 3);
88
- }
89
- return decoded;
90
- }
91
- var decodeVectorPolylinePositions_default = decodeVectorPolylinePositions;
92
-
93
- // packages/engine/Source/Workers/createVectorTilePolylines.js
94
- var scratchRectangle = new Rectangle_default();
95
- var scratchEllipsoid = new Ellipsoid_default();
96
- var scratchCenter = new Cartesian3_default();
97
- var scratchMinMaxHeights = {
98
- min: void 0,
99
- max: void 0
100
- };
101
- function unpackBuffer(packedBuffer) {
102
- packedBuffer = new Float64Array(packedBuffer);
103
- let offset = 0;
104
- scratchMinMaxHeights.min = packedBuffer[offset++];
105
- scratchMinMaxHeights.max = packedBuffer[offset++];
106
- Rectangle_default.unpack(packedBuffer, offset, scratchRectangle);
107
- offset += Rectangle_default.packedLength;
108
- Ellipsoid_default.unpack(packedBuffer, offset, scratchEllipsoid);
109
- offset += Ellipsoid_default.packedLength;
110
- Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
111
- }
112
- function getPositionOffsets(counts) {
113
- const countsLength = counts.length;
114
- const positionOffsets = new Uint32Array(countsLength + 1);
115
- let offset = 0;
116
- for (let i = 0; i < countsLength; ++i) {
117
- positionOffsets[i] = offset;
118
- offset += counts[i];
119
- }
120
- positionOffsets[countsLength] = offset;
121
- return positionOffsets;
122
- }
123
- var scratchP0 = new Cartesian3_default();
124
- var scratchP1 = new Cartesian3_default();
125
- var scratchPrev = new Cartesian3_default();
126
- var scratchCur = new Cartesian3_default();
127
- var scratchNext = new Cartesian3_default();
128
- function createVectorTilePolylines(parameters, transferableObjects) {
129
- const encodedPositions = new Uint16Array(parameters.positions);
130
- const widths = new Uint16Array(parameters.widths);
131
- const counts = new Uint32Array(parameters.counts);
132
- const batchIds = new Uint16Array(parameters.batchIds);
133
- unpackBuffer(parameters.packedBuffer);
134
- const rectangle = scratchRectangle;
135
- const ellipsoid = scratchEllipsoid;
136
- const center = scratchCenter;
137
- const minimumHeight = scratchMinMaxHeights.min;
138
- const maximumHeight = scratchMinMaxHeights.max;
139
- const positions = decodeVectorPolylinePositions_default(
140
- encodedPositions,
141
- rectangle,
142
- minimumHeight,
143
- maximumHeight,
144
- ellipsoid
145
- );
146
- const positionsLength = positions.length / 3;
147
- const size = positionsLength * 4 - 4;
148
- const curPositions = new Float32Array(size * 3);
149
- const prevPositions = new Float32Array(size * 3);
150
- const nextPositions = new Float32Array(size * 3);
151
- const expandAndWidth = new Float32Array(size * 2);
152
- const vertexBatchIds = new Uint16Array(size);
153
- let positionIndex = 0;
154
- let expandAndWidthIndex = 0;
155
- let batchIdIndex = 0;
156
- let i;
157
- let offset = 0;
158
- let length = counts.length;
159
- for (i = 0; i < length; ++i) {
160
- const count = counts[i];
161
- const width = widths[i];
162
- const batchId = batchIds[i];
163
- for (let j = 0; j < count; ++j) {
164
- let previous;
165
- if (j === 0) {
166
- const p0 = Cartesian3_default.unpack(positions, offset * 3, scratchP0);
167
- const p1 = Cartesian3_default.unpack(positions, (offset + 1) * 3, scratchP1);
168
- previous = Cartesian3_default.subtract(p0, p1, scratchPrev);
169
- Cartesian3_default.add(p0, previous, previous);
170
- } else {
171
- previous = Cartesian3_default.unpack(
172
- positions,
173
- (offset + j - 1) * 3,
174
- scratchPrev
175
- );
176
- }
177
- const current = Cartesian3_default.unpack(
178
- positions,
179
- (offset + j) * 3,
180
- scratchCur
181
- );
182
- let next;
183
- if (j === count - 1) {
184
- const p2 = Cartesian3_default.unpack(
185
- positions,
186
- (offset + count - 1) * 3,
187
- scratchP0
188
- );
189
- const p3 = Cartesian3_default.unpack(
190
- positions,
191
- (offset + count - 2) * 3,
192
- scratchP1
193
- );
194
- next = Cartesian3_default.subtract(p2, p3, scratchNext);
195
- Cartesian3_default.add(p2, next, next);
196
- } else {
197
- next = Cartesian3_default.unpack(positions, (offset + j + 1) * 3, scratchNext);
198
- }
199
- Cartesian3_default.subtract(previous, center, previous);
200
- Cartesian3_default.subtract(current, center, current);
201
- Cartesian3_default.subtract(next, center, next);
202
- const startK = j === 0 ? 2 : 0;
203
- const endK = j === count - 1 ? 2 : 4;
204
- for (let k = startK; k < endK; ++k) {
205
- Cartesian3_default.pack(current, curPositions, positionIndex);
206
- Cartesian3_default.pack(previous, prevPositions, positionIndex);
207
- Cartesian3_default.pack(next, nextPositions, positionIndex);
208
- positionIndex += 3;
209
- const direction = k - 2 < 0 ? -1 : 1;
210
- expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1;
211
- expandAndWidth[expandAndWidthIndex++] = direction * width;
212
- vertexBatchIds[batchIdIndex++] = batchId;
213
- }
214
- }
215
- offset += count;
216
- }
217
- const indices = IndexDatatype_default.createTypedArray(size, positionsLength * 6 - 6);
218
- let index = 0;
219
- let indicesIndex = 0;
220
- length = positionsLength - 1;
221
- for (i = 0; i < length; ++i) {
222
- indices[indicesIndex++] = index;
223
- indices[indicesIndex++] = index + 2;
224
- indices[indicesIndex++] = index + 1;
225
- indices[indicesIndex++] = index + 1;
226
- indices[indicesIndex++] = index + 2;
227
- indices[indicesIndex++] = index + 3;
228
- index += 4;
229
- }
230
- transferableObjects.push(
231
- curPositions.buffer,
232
- prevPositions.buffer,
233
- nextPositions.buffer
234
- );
235
- transferableObjects.push(
236
- expandAndWidth.buffer,
237
- vertexBatchIds.buffer,
238
- indices.buffer
239
- );
240
- let results = {
241
- indexDatatype: indices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT,
242
- currentPositions: curPositions.buffer,
243
- previousPositions: prevPositions.buffer,
244
- nextPositions: nextPositions.buffer,
245
- expandAndWidth: expandAndWidth.buffer,
246
- batchIds: vertexBatchIds.buffer,
247
- indices: indices.buffer
248
- };
249
- if (parameters.keepDecodedPositions) {
250
- const positionOffsets = getPositionOffsets(counts);
251
- transferableObjects.push(positions.buffer, positionOffsets.buffer);
252
- results = combine_default(results, {
253
- decodedPositions: positions.buffer,
254
- decodedPositionOffsets: positionOffsets.buffer
255
- });
256
- }
257
- return results;
258
- }
259
- var createVectorTilePolylines_default = createTaskProcessorWorker_default(createVectorTilePolylines);
260
- export {
261
- createVectorTilePolylines_default as default
262
- };