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