@rtzh/engine 0.0.2 → 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 (113) hide show
  1. package/Source/Scene/GltfLoader.js +2 -2
  2. package/package.json +1 -1
  3. package/Build/ThirdParty/Workers/zip-web-worker.js +0 -640
  4. package/Build/Workers/chunk-245NZYCR.js +0 -124
  5. package/Build/Workers/chunk-25BA4527.js +0 -837
  6. package/Build/Workers/chunk-4HXPSZRC.js +0 -1483
  7. package/Build/Workers/chunk-4Z26IS65.js +0 -3514
  8. package/Build/Workers/chunk-55IROWAX.js +0 -139
  9. package/Build/Workers/chunk-56XTN5NJ.js +0 -1800
  10. package/Build/Workers/chunk-5VZISKJF.js +0 -629
  11. package/Build/Workers/chunk-5WAG5YKS.js +0 -368
  12. package/Build/Workers/chunk-66YGZWBI.js +0 -1317
  13. package/Build/Workers/chunk-6H33B6OL.js +0 -37
  14. package/Build/Workers/chunk-6LZBBEA7.js +0 -439
  15. package/Build/Workers/chunk-6XJO625E.js +0 -497
  16. package/Build/Workers/chunk-75UGCVME.js +0 -102
  17. package/Build/Workers/chunk-7B23DD46.js +0 -1054
  18. package/Build/Workers/chunk-7NCJH26L.js +0 -352
  19. package/Build/Workers/chunk-AIW5F22O.js +0 -352
  20. package/Build/Workers/chunk-AL22JVIA.js +0 -256
  21. package/Build/Workers/chunk-AVSQILVI.js +0 -75
  22. package/Build/Workers/chunk-B2VFNYD7.js +0 -280
  23. package/Build/Workers/chunk-BOV6T7FO.js +0 -44
  24. package/Build/Workers/chunk-DP76S3IQ.js +0 -1067
  25. package/Build/Workers/chunk-EDIUN7V3.js +0 -219
  26. package/Build/Workers/chunk-EKMWNF4U.js +0 -55
  27. package/Build/Workers/chunk-ELXGXAYS.js +0 -682
  28. package/Build/Workers/chunk-FVYRV2T6.js +0 -455
  29. package/Build/Workers/chunk-GDIBU55R.js +0 -778
  30. package/Build/Workers/chunk-HAY6YE7M.js +0 -97
  31. package/Build/Workers/chunk-I76SRIKN.js +0 -138
  32. package/Build/Workers/chunk-IELTSYPZ.js +0 -241
  33. package/Build/Workers/chunk-J4MIJCN5.js +0 -171
  34. package/Build/Workers/chunk-JFO3ELF3.js +0 -642
  35. package/Build/Workers/chunk-K4IMD7KH.js +0 -162
  36. package/Build/Workers/chunk-KFMCOG26.js +0 -692
  37. package/Build/Workers/chunk-KH2OWUUA.js +0 -163
  38. package/Build/Workers/chunk-KQIZ7AFF.js +0 -8366
  39. package/Build/Workers/chunk-KVE5EAPO.js +0 -398
  40. package/Build/Workers/chunk-OAOREOSO.js +0 -940
  41. package/Build/Workers/chunk-OFJRMGNX.js +0 -788
  42. package/Build/Workers/chunk-PLLZB3R4.js +0 -198
  43. package/Build/Workers/chunk-POY6ZE32.js +0 -2058
  44. package/Build/Workers/chunk-PV5B2YNB.js +0 -2719
  45. package/Build/Workers/chunk-Q2DXNFYW.js +0 -414
  46. package/Build/Workers/chunk-QWV2DM66.js +0 -1443
  47. package/Build/Workers/chunk-R73BHGGI.js +0 -305
  48. package/Build/Workers/chunk-S3AE3MZZ.js +0 -511
  49. package/Build/Workers/chunk-SBFTVHRW.js +0 -57
  50. package/Build/Workers/chunk-SOR7PD4V.js +0 -114
  51. package/Build/Workers/chunk-TO7TWUET.js +0 -476
  52. package/Build/Workers/chunk-TSAJNE4K.js +0 -101
  53. package/Build/Workers/chunk-TWF4XRZ6.js +0 -73
  54. package/Build/Workers/chunk-UTWLMOPM.js +0 -387
  55. package/Build/Workers/chunk-UYT2PBMV.js +0 -58
  56. package/Build/Workers/chunk-WAS3IHIQ.js +0 -288
  57. package/Build/Workers/chunk-WO5ZNC7S.js +0 -1045
  58. package/Build/Workers/chunk-X65Y2JSA.js +0 -55
  59. package/Build/Workers/chunk-XOVHLPKW.js +0 -299
  60. package/Build/Workers/chunk-YPGJSFOO.js +0 -1460
  61. package/Build/Workers/combineGeometry.js +0 -66
  62. package/Build/Workers/createBoxGeometry.js +0 -58
  63. package/Build/Workers/createBoxOutlineGeometry.js +0 -231
  64. package/Build/Workers/createCircleGeometry.js +0 -201
  65. package/Build/Workers/createCircleOutlineGeometry.js +0 -147
  66. package/Build/Workers/createCoplanarPolygonGeometry.js +0 -505
  67. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +0 -225
  68. package/Build/Workers/createCorridorGeometry.js +0 -1258
  69. package/Build/Workers/createCorridorOutlineGeometry.js +0 -563
  70. package/Build/Workers/createCylinderGeometry.js +0 -60
  71. package/Build/Workers/createCylinderOutlineGeometry.js +0 -231
  72. package/Build/Workers/createEllipseGeometry.js +0 -72
  73. package/Build/Workers/createEllipseOutlineGeometry.js +0 -65
  74. package/Build/Workers/createEllipsoidGeometry.js +0 -59
  75. package/Build/Workers/createEllipsoidOutlineGeometry.js +0 -61
  76. package/Build/Workers/createFrustumGeometry.js +0 -58
  77. package/Build/Workers/createFrustumOutlineGeometry.js +0 -234
  78. package/Build/Workers/createGeometry.js +0 -173
  79. package/Build/Workers/createGroundPolylineGeometry.js +0 -1602
  80. package/Build/Workers/createPlaneGeometry.js +0 -223
  81. package/Build/Workers/createPlaneOutlineGeometry.js +0 -124
  82. package/Build/Workers/createPolygonGeometry.js +0 -1404
  83. package/Build/Workers/createPolygonOutlineGeometry.js +0 -532
  84. package/Build/Workers/createPolylineGeometry.js +0 -491
  85. package/Build/Workers/createPolylineVolumeGeometry.js +0 -374
  86. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +0 -272
  87. package/Build/Workers/createRectangleGeometry.js +0 -1264
  88. package/Build/Workers/createRectangleOutlineGeometry.js +0 -476
  89. package/Build/Workers/createSimplePolylineGeometry.js +0 -397
  90. package/Build/Workers/createSphereGeometry.js +0 -116
  91. package/Build/Workers/createSphereOutlineGeometry.js +0 -116
  92. package/Build/Workers/createTaskProcessorWorker.js +0 -32
  93. package/Build/Workers/createVectorTileClampedPolylines.js +0 -492
  94. package/Build/Workers/createVectorTileGeometries.js +0 -387
  95. package/Build/Workers/createVectorTilePoints.js +0 -114
  96. package/Build/Workers/createVectorTilePolygons.js +0 -386
  97. package/Build/Workers/createVectorTilePolylines.js +0 -262
  98. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +0 -91
  99. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -565
  100. package/Build/Workers/createVerticesFromHeightmap.js +0 -2254
  101. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -499
  102. package/Build/Workers/createWallGeometry.js +0 -487
  103. package/Build/Workers/createWallOutlineGeometry.js +0 -335
  104. package/Build/Workers/decodeDraco.js +0 -369
  105. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +0 -2680
  106. package/Build/Workers/decodeI3S.js +0 -1339
  107. package/Build/Workers/gaussianSplatSorter.js +0 -62
  108. package/Build/Workers/gaussianSplatTextureGenerator.js +0 -68
  109. package/Build/Workers/incrementallyBuildTerrainPicker.js +0 -121
  110. package/Build/Workers/transcodeKTX2.js +0 -3463
  111. package/Build/Workers/transferTypedArrayTest.js +0 -41
  112. package/Build/Workers/upsampleQuantizedTerrainMesh.js +0 -820
  113. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +0 -95
@@ -1,491 +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
- ArcType_default
31
- } from "./chunk-X65Y2JSA.js";
32
- import {
33
- PolylinePipeline_default
34
- } from "./chunk-Q2DXNFYW.js";
35
- import "./chunk-AIW5F22O.js";
36
- import {
37
- VertexFormat_default
38
- } from "./chunk-I76SRIKN.js";
39
- import {
40
- arrayRemoveDuplicates_default
41
- } from "./chunk-HAY6YE7M.js";
42
- import "./chunk-FVYRV2T6.js";
43
- import "./chunk-66YGZWBI.js";
44
- import "./chunk-J4MIJCN5.js";
45
- import {
46
- IndexDatatype_default
47
- } from "./chunk-55IROWAX.js";
48
- import {
49
- GeometryAttributes_default
50
- } from "./chunk-BOV6T7FO.js";
51
- import {
52
- GeometryAttribute_default,
53
- GeometryType_default,
54
- Geometry_default,
55
- PrimitiveType_default
56
- } from "./chunk-XOVHLPKW.js";
57
- import {
58
- BoundingSphere_default
59
- } from "./chunk-OAOREOSO.js";
60
- import "./chunk-EKMWNF4U.js";
61
- import "./chunk-KQIZ7AFF.js";
62
- import "./chunk-POY6ZE32.js";
63
- import {
64
- ComponentDatatype_default
65
- } from "./chunk-AL22JVIA.js";
66
- import "./chunk-5VZISKJF.js";
67
- import "./chunk-UYT2PBMV.js";
68
- import {
69
- Ellipsoid_default
70
- } from "./chunk-YPGJSFOO.js";
71
- import {
72
- Cartesian3_default,
73
- Frozen_default
74
- } from "./chunk-QWV2DM66.js";
75
- import {
76
- Math_default
77
- } from "./chunk-6XJO625E.js";
78
- import {
79
- DeveloperError_default
80
- } from "./chunk-KH2OWUUA.js";
81
- import {
82
- defined_default
83
- } from "./chunk-AVSQILVI.js";
84
-
85
- // packages/engine/Source/Core/PolylineGeometry.js
86
- var scratchInterpolateColorsArray = [];
87
- function interpolateColors(p0, p1, color0, color1, numPoints) {
88
- const colors = scratchInterpolateColorsArray;
89
- colors.length = numPoints;
90
- let i;
91
- const r0 = color0.red;
92
- const g0 = color0.green;
93
- const b0 = color0.blue;
94
- const a0 = color0.alpha;
95
- const r1 = color1.red;
96
- const g1 = color1.green;
97
- const b1 = color1.blue;
98
- const a1 = color1.alpha;
99
- if (Color_default.equals(color0, color1)) {
100
- for (i = 0; i < numPoints; i++) {
101
- colors[i] = Color_default.clone(color0);
102
- }
103
- return colors;
104
- }
105
- const redPerVertex = (r1 - r0) / numPoints;
106
- const greenPerVertex = (g1 - g0) / numPoints;
107
- const bluePerVertex = (b1 - b0) / numPoints;
108
- const alphaPerVertex = (a1 - a0) / numPoints;
109
- for (i = 0; i < numPoints; i++) {
110
- colors[i] = new Color_default(
111
- r0 + i * redPerVertex,
112
- g0 + i * greenPerVertex,
113
- b0 + i * bluePerVertex,
114
- a0 + i * alphaPerVertex
115
- );
116
- }
117
- return colors;
118
- }
119
- function PolylineGeometry(options) {
120
- options = options ?? Frozen_default.EMPTY_OBJECT;
121
- const positions = options.positions;
122
- const colors = options.colors;
123
- const width = options.width ?? 1;
124
- const colorsPerVertex = options.colorsPerVertex ?? false;
125
- if (!defined_default(positions) || positions.length < 2) {
126
- throw new DeveloperError_default("At least two positions are required.");
127
- }
128
- if (typeof width !== "number") {
129
- throw new DeveloperError_default("width must be a number");
130
- }
131
- if (defined_default(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 1)) {
132
- throw new DeveloperError_default("colors has an invalid length.");
133
- }
134
- this._positions = positions;
135
- this._colors = colors;
136
- this._width = width;
137
- this._colorsPerVertex = colorsPerVertex;
138
- this._vertexFormat = VertexFormat_default.clone(
139
- options.vertexFormat ?? VertexFormat_default.DEFAULT
140
- );
141
- this._arcType = options.arcType ?? ArcType_default.GEODESIC;
142
- this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
143
- this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
144
- this._workerName = "createPolylineGeometry";
145
- let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
146
- numComponents += defined_default(colors) ? 1 + colors.length * Color_default.packedLength : 1;
147
- this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 4;
148
- }
149
- PolylineGeometry.pack = function(value, array, startingIndex) {
150
- if (!defined_default(value)) {
151
- throw new DeveloperError_default("value is required");
152
- }
153
- if (!defined_default(array)) {
154
- throw new DeveloperError_default("array is required");
155
- }
156
- startingIndex = startingIndex ?? 0;
157
- let i;
158
- const positions = value._positions;
159
- let length = positions.length;
160
- array[startingIndex++] = length;
161
- for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
162
- Cartesian3_default.pack(positions[i], array, startingIndex);
163
- }
164
- const colors = value._colors;
165
- length = defined_default(colors) ? colors.length : 0;
166
- array[startingIndex++] = length;
167
- for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
168
- Color_default.pack(colors[i], array, startingIndex);
169
- }
170
- Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
171
- startingIndex += Ellipsoid_default.packedLength;
172
- VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
173
- startingIndex += VertexFormat_default.packedLength;
174
- array[startingIndex++] = value._width;
175
- array[startingIndex++] = value._colorsPerVertex ? 1 : 0;
176
- array[startingIndex++] = value._arcType;
177
- array[startingIndex] = value._granularity;
178
- return array;
179
- };
180
- var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
181
- var scratchVertexFormat = new VertexFormat_default();
182
- var scratchOptions = {
183
- positions: void 0,
184
- colors: void 0,
185
- ellipsoid: scratchEllipsoid,
186
- vertexFormat: scratchVertexFormat,
187
- width: void 0,
188
- colorsPerVertex: void 0,
189
- arcType: void 0,
190
- granularity: void 0
191
- };
192
- PolylineGeometry.unpack = function(array, startingIndex, result) {
193
- if (!defined_default(array)) {
194
- throw new DeveloperError_default("array is required");
195
- }
196
- startingIndex = startingIndex ?? 0;
197
- let i;
198
- let length = array[startingIndex++];
199
- const positions = new Array(length);
200
- for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
201
- positions[i] = Cartesian3_default.unpack(array, startingIndex);
202
- }
203
- length = array[startingIndex++];
204
- const colors = length > 0 ? new Array(length) : void 0;
205
- for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
206
- colors[i] = Color_default.unpack(array, startingIndex);
207
- }
208
- const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
209
- startingIndex += Ellipsoid_default.packedLength;
210
- const vertexFormat = VertexFormat_default.unpack(
211
- array,
212
- startingIndex,
213
- scratchVertexFormat
214
- );
215
- startingIndex += VertexFormat_default.packedLength;
216
- const width = array[startingIndex++];
217
- const colorsPerVertex = array[startingIndex++] === 1;
218
- const arcType = array[startingIndex++];
219
- const granularity = array[startingIndex];
220
- if (!defined_default(result)) {
221
- scratchOptions.positions = positions;
222
- scratchOptions.colors = colors;
223
- scratchOptions.width = width;
224
- scratchOptions.colorsPerVertex = colorsPerVertex;
225
- scratchOptions.arcType = arcType;
226
- scratchOptions.granularity = granularity;
227
- return new PolylineGeometry(scratchOptions);
228
- }
229
- result._positions = positions;
230
- result._colors = colors;
231
- result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
232
- result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
233
- result._width = width;
234
- result._colorsPerVertex = colorsPerVertex;
235
- result._arcType = arcType;
236
- result._granularity = granularity;
237
- return result;
238
- };
239
- var scratchCartesian3 = new Cartesian3_default();
240
- var scratchPosition = new Cartesian3_default();
241
- var scratchPrevPosition = new Cartesian3_default();
242
- var scratchNextPosition = new Cartesian3_default();
243
- PolylineGeometry.createGeometry = function(polylineGeometry) {
244
- const width = polylineGeometry._width;
245
- const vertexFormat = polylineGeometry._vertexFormat;
246
- let colors = polylineGeometry._colors;
247
- const colorsPerVertex = polylineGeometry._colorsPerVertex;
248
- const arcType = polylineGeometry._arcType;
249
- const granularity = polylineGeometry._granularity;
250
- const ellipsoid = polylineGeometry._ellipsoid;
251
- let i;
252
- let j;
253
- let k;
254
- const removedIndices = [];
255
- let positions = arrayRemoveDuplicates_default(
256
- polylineGeometry._positions,
257
- Cartesian3_default.equalsEpsilon,
258
- false,
259
- removedIndices
260
- );
261
- if (defined_default(colors) && removedIndices.length > 0) {
262
- let removedArrayIndex = 0;
263
- let nextRemovedIndex = removedIndices[0];
264
- colors = colors.filter(function(color, index2) {
265
- let remove = false;
266
- if (colorsPerVertex) {
267
- remove = index2 === nextRemovedIndex || index2 === 0 && nextRemovedIndex === 1;
268
- } else {
269
- remove = index2 + 1 === nextRemovedIndex;
270
- }
271
- if (remove) {
272
- removedArrayIndex++;
273
- nextRemovedIndex = removedIndices[removedArrayIndex];
274
- return false;
275
- }
276
- return true;
277
- });
278
- }
279
- let positionsLength = positions.length;
280
- if (positionsLength < 2 || width <= 0) {
281
- return void 0;
282
- }
283
- if (arcType === ArcType_default.GEODESIC || arcType === ArcType_default.RHUMB) {
284
- let subdivisionSize;
285
- let numberOfPointsFunction;
286
- if (arcType === ArcType_default.GEODESIC) {
287
- subdivisionSize = Math_default.chordLength(
288
- granularity,
289
- ellipsoid.maximumRadius
290
- );
291
- numberOfPointsFunction = PolylinePipeline_default.numberOfPoints;
292
- } else {
293
- subdivisionSize = granularity;
294
- numberOfPointsFunction = PolylinePipeline_default.numberOfPointsRhumbLine;
295
- }
296
- const heights = PolylinePipeline_default.extractHeights(positions, ellipsoid);
297
- if (defined_default(colors)) {
298
- let colorLength = 1;
299
- for (i = 0; i < positionsLength - 1; ++i) {
300
- colorLength += numberOfPointsFunction(
301
- positions[i],
302
- positions[i + 1],
303
- subdivisionSize
304
- );
305
- }
306
- const newColors = new Array(colorLength);
307
- let newColorIndex = 0;
308
- for (i = 0; i < positionsLength - 1; ++i) {
309
- const p0 = positions[i];
310
- const p1 = positions[i + 1];
311
- const c0 = colors[i];
312
- const numColors = numberOfPointsFunction(p0, p1, subdivisionSize);
313
- if (colorsPerVertex && i < colorLength) {
314
- const c1 = colors[i + 1];
315
- const interpolatedColors = interpolateColors(
316
- p0,
317
- p1,
318
- c0,
319
- c1,
320
- numColors
321
- );
322
- const interpolatedColorsLength = interpolatedColors.length;
323
- for (j = 0; j < interpolatedColorsLength; ++j) {
324
- newColors[newColorIndex++] = interpolatedColors[j];
325
- }
326
- } else {
327
- for (j = 0; j < numColors; ++j) {
328
- newColors[newColorIndex++] = Color_default.clone(c0);
329
- }
330
- }
331
- }
332
- newColors[newColorIndex] = Color_default.clone(colors[colors.length - 1]);
333
- colors = newColors;
334
- scratchInterpolateColorsArray.length = 0;
335
- }
336
- if (arcType === ArcType_default.GEODESIC) {
337
- positions = PolylinePipeline_default.generateCartesianArc({
338
- positions,
339
- minDistance: subdivisionSize,
340
- ellipsoid,
341
- height: heights
342
- });
343
- } else {
344
- positions = PolylinePipeline_default.generateCartesianRhumbArc({
345
- positions,
346
- granularity: subdivisionSize,
347
- ellipsoid,
348
- height: heights
349
- });
350
- }
351
- }
352
- positionsLength = positions.length;
353
- const size = positionsLength * 4 - 4;
354
- const finalPositions = new Float64Array(size * 3);
355
- const prevPositions = new Float64Array(size * 3);
356
- const nextPositions = new Float64Array(size * 3);
357
- const expandAndWidth = new Float32Array(size * 2);
358
- const st = vertexFormat.st ? new Float32Array(size * 2) : void 0;
359
- const finalColors = defined_default(colors) ? new Uint8Array(size * 4) : void 0;
360
- let positionIndex = 0;
361
- let expandAndWidthIndex = 0;
362
- let stIndex = 0;
363
- let colorIndex = 0;
364
- let position;
365
- for (j = 0; j < positionsLength; ++j) {
366
- if (j === 0) {
367
- position = scratchCartesian3;
368
- Cartesian3_default.subtract(positions[0], positions[1], position);
369
- Cartesian3_default.add(positions[0], position, position);
370
- } else {
371
- position = positions[j - 1];
372
- }
373
- Cartesian3_default.clone(position, scratchPrevPosition);
374
- Cartesian3_default.clone(positions[j], scratchPosition);
375
- if (j === positionsLength - 1) {
376
- position = scratchCartesian3;
377
- Cartesian3_default.subtract(
378
- positions[positionsLength - 1],
379
- positions[positionsLength - 2],
380
- position
381
- );
382
- Cartesian3_default.add(positions[positionsLength - 1], position, position);
383
- } else {
384
- position = positions[j + 1];
385
- }
386
- Cartesian3_default.clone(position, scratchNextPosition);
387
- let color0, color1;
388
- if (defined_default(finalColors)) {
389
- if (j !== 0 && !colorsPerVertex) {
390
- color0 = colors[j - 1];
391
- } else {
392
- color0 = colors[j];
393
- }
394
- if (j !== positionsLength - 1) {
395
- color1 = colors[j];
396
- }
397
- }
398
- const startK = j === 0 ? 2 : 0;
399
- const endK = j === positionsLength - 1 ? 2 : 4;
400
- for (k = startK; k < endK; ++k) {
401
- Cartesian3_default.pack(scratchPosition, finalPositions, positionIndex);
402
- Cartesian3_default.pack(scratchPrevPosition, prevPositions, positionIndex);
403
- Cartesian3_default.pack(scratchNextPosition, nextPositions, positionIndex);
404
- positionIndex += 3;
405
- const direction = k - 2 < 0 ? -1 : 1;
406
- expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1;
407
- expandAndWidth[expandAndWidthIndex++] = direction * width;
408
- if (vertexFormat.st) {
409
- st[stIndex++] = j / (positionsLength - 1);
410
- st[stIndex++] = Math.max(expandAndWidth[expandAndWidthIndex - 2], 0);
411
- }
412
- if (defined_default(finalColors)) {
413
- const color = k < 2 ? color0 : color1;
414
- finalColors[colorIndex++] = Color_default.floatToByte(color.red);
415
- finalColors[colorIndex++] = Color_default.floatToByte(color.green);
416
- finalColors[colorIndex++] = Color_default.floatToByte(color.blue);
417
- finalColors[colorIndex++] = Color_default.floatToByte(color.alpha);
418
- }
419
- }
420
- }
421
- const attributes = new GeometryAttributes_default();
422
- attributes.position = new GeometryAttribute_default({
423
- componentDatatype: ComponentDatatype_default.DOUBLE,
424
- componentsPerAttribute: 3,
425
- values: finalPositions
426
- });
427
- attributes.prevPosition = new GeometryAttribute_default({
428
- componentDatatype: ComponentDatatype_default.DOUBLE,
429
- componentsPerAttribute: 3,
430
- values: prevPositions
431
- });
432
- attributes.nextPosition = new GeometryAttribute_default({
433
- componentDatatype: ComponentDatatype_default.DOUBLE,
434
- componentsPerAttribute: 3,
435
- values: nextPositions
436
- });
437
- attributes.expandAndWidth = new GeometryAttribute_default({
438
- componentDatatype: ComponentDatatype_default.FLOAT,
439
- componentsPerAttribute: 2,
440
- values: expandAndWidth
441
- });
442
- if (vertexFormat.st) {
443
- attributes.st = new GeometryAttribute_default({
444
- componentDatatype: ComponentDatatype_default.FLOAT,
445
- componentsPerAttribute: 2,
446
- values: st
447
- });
448
- }
449
- if (defined_default(finalColors)) {
450
- attributes.color = new GeometryAttribute_default({
451
- componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
452
- componentsPerAttribute: 4,
453
- values: finalColors,
454
- normalize: true
455
- });
456
- }
457
- const indices = IndexDatatype_default.createTypedArray(size, positionsLength * 6 - 6);
458
- let index = 0;
459
- let indicesIndex = 0;
460
- const length = positionsLength - 1;
461
- for (j = 0; j < length; ++j) {
462
- indices[indicesIndex++] = index;
463
- indices[indicesIndex++] = index + 2;
464
- indices[indicesIndex++] = index + 1;
465
- indices[indicesIndex++] = index + 1;
466
- indices[indicesIndex++] = index + 2;
467
- indices[indicesIndex++] = index + 3;
468
- index += 4;
469
- }
470
- return new Geometry_default({
471
- attributes,
472
- indices,
473
- primitiveType: PrimitiveType_default.TRIANGLES,
474
- boundingSphere: BoundingSphere_default.fromPoints(positions),
475
- geometryType: GeometryType_default.POLYLINES
476
- });
477
- };
478
- var PolylineGeometry_default = PolylineGeometry;
479
-
480
- // packages/engine/Source/Workers/createPolylineGeometry.js
481
- function createPolylineGeometry(polylineGeometry, offset) {
482
- if (defined_default(offset)) {
483
- polylineGeometry = PolylineGeometry_default.unpack(polylineGeometry, offset);
484
- }
485
- polylineGeometry._ellipsoid = Ellipsoid_default.clone(polylineGeometry._ellipsoid);
486
- return PolylineGeometry_default.createGeometry(polylineGeometry);
487
- }
488
- var createPolylineGeometry_default = createPolylineGeometry;
489
- export {
490
- createPolylineGeometry_default as default
491
- };