@rtzh/engine 0.0.3 → 0.0.4
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.
- package/Build/ThirdParty/Workers/zip-web-worker.js +640 -0
- package/Build/Workers/chunk-245NZYCR.js +124 -0
- package/Build/Workers/chunk-25BA4527.js +837 -0
- package/Build/Workers/chunk-2APW7KRS.js +101 -0
- package/Build/Workers/chunk-2BLQ3B4Q.js +299 -0
- package/Build/Workers/chunk-2CAIFJD5.js +387 -0
- package/Build/Workers/chunk-3K2PK2OU.js +1045 -0
- package/Build/Workers/chunk-3M5CRHSG.js +288 -0
- package/Build/Workers/chunk-4HXPSZRC.js +1483 -0
- package/Build/Workers/chunk-4Z26IS65.js +3514 -0
- package/Build/Workers/chunk-55IROWAX.js +139 -0
- package/Build/Workers/chunk-56XTN5NJ.js +1800 -0
- package/Build/Workers/chunk-5BIQOSBV.js +55 -0
- package/Build/Workers/chunk-5CSRWY7L.js +280 -0
- package/Build/Workers/chunk-5QTPACZQ.js +455 -0
- package/Build/Workers/chunk-5VZISKJF.js +629 -0
- package/Build/Workers/chunk-5WAG5YKS.js +368 -0
- package/Build/Workers/chunk-64W2RXA4.js +219 -0
- package/Build/Workers/chunk-66YGZWBI.js +1317 -0
- package/Build/Workers/chunk-6H33B6OL.js +37 -0
- package/Build/Workers/chunk-6LZBBEA7.js +439 -0
- package/Build/Workers/chunk-6QVMKRJ4.js +3514 -0
- package/Build/Workers/chunk-6XJO625E.js +497 -0
- package/Build/Workers/chunk-75UGCVME.js +102 -0
- package/Build/Workers/chunk-7B23DD46.js +1054 -0
- package/Build/Workers/chunk-7NCJH26L.js +352 -0
- package/Build/Workers/chunk-ACH67MPW.js +1483 -0
- package/Build/Workers/chunk-AIW5F22O.js +352 -0
- package/Build/Workers/chunk-AL22JVIA.js +256 -0
- package/Build/Workers/chunk-AVSQILVI.js +75 -0
- package/Build/Workers/chunk-B2VFNYD7.js +280 -0
- package/Build/Workers/chunk-BJ6WXQOW.js +305 -0
- package/Build/Workers/chunk-BN4WA7LX.js +75 -0
- package/Build/Workers/chunk-BOV6T7FO.js +44 -0
- package/Build/Workers/chunk-BXBGWQ3Z.js +171 -0
- package/Build/Workers/chunk-D7TGILR3.js +1054 -0
- package/Build/Workers/chunk-DBKYAGM6.js +1800 -0
- package/Build/Workers/chunk-DEIMB3B5.js +629 -0
- package/Build/Workers/chunk-DP76S3IQ.js +1067 -0
- package/Build/Workers/chunk-DSBEWMOQ.js +1067 -0
- package/Build/Workers/chunk-E2CARZA7.js +73 -0
- package/Build/Workers/chunk-EDIUN7V3.js +219 -0
- package/Build/Workers/chunk-EISI2CR2.js +2058 -0
- package/Build/Workers/chunk-EKMWNF4U.js +55 -0
- package/Build/Workers/chunk-ELXGXAYS.js +682 -0
- package/Build/Workers/chunk-F5LAPCFC.js +1460 -0
- package/Build/Workers/chunk-FJREGHFG.js +138 -0
- package/Build/Workers/chunk-FVYRV2T6.js +455 -0
- package/Build/Workers/chunk-GDIBU55R.js +778 -0
- package/Build/Workers/chunk-HAWJ7FMN.js +8366 -0
- package/Build/Workers/chunk-HAY6YE7M.js +97 -0
- package/Build/Workers/chunk-HGIGANIQ.js +163 -0
- package/Build/Workers/chunk-HI6X33GO.js +58 -0
- package/Build/Workers/chunk-HU5P7PMU.js +1317 -0
- package/Build/Workers/chunk-I76SRIKN.js +138 -0
- package/Build/Workers/chunk-IDVURFRN.js +241 -0
- package/Build/Workers/chunk-IELTSYPZ.js +241 -0
- package/Build/Workers/chunk-J3FBVUY4.js +37 -0
- package/Build/Workers/chunk-J4MIJCN5.js +171 -0
- package/Build/Workers/chunk-JFO3ELF3.js +642 -0
- package/Build/Workers/chunk-JH27ZGLN.js +352 -0
- package/Build/Workers/chunk-JURLMTV2.js +398 -0
- package/Build/Workers/chunk-K4IMD7KH.js +162 -0
- package/Build/Workers/chunk-KBAGFNQ4.js +139 -0
- package/Build/Workers/chunk-KFMCOG26.js +692 -0
- package/Build/Workers/chunk-KH2OWUUA.js +163 -0
- package/Build/Workers/chunk-KHKSE4WQ.js +778 -0
- package/Build/Workers/chunk-KKYQRQ57.js +368 -0
- package/Build/Workers/chunk-KQIZ7AFF.js +8366 -0
- package/Build/Workers/chunk-KUAWPGSB.js +511 -0
- package/Build/Workers/chunk-KVDSJXRK.js +114 -0
- package/Build/Workers/chunk-KVE5EAPO.js +398 -0
- package/Build/Workers/chunk-KXB3AARU.js +162 -0
- package/Build/Workers/chunk-LN4NMLYY.js +55 -0
- package/Build/Workers/chunk-LPM2FVDN.js +642 -0
- package/Build/Workers/chunk-MLFVICFZ.js +102 -0
- package/Build/Workers/chunk-MQ62ZE2U.js +124 -0
- package/Build/Workers/chunk-NOH3R3YY.js +198 -0
- package/Build/Workers/chunk-OAOREOSO.js +940 -0
- package/Build/Workers/chunk-OFJRMGNX.js +788 -0
- package/Build/Workers/chunk-OOB2KZC6.js +476 -0
- package/Build/Workers/chunk-OVPPHDU7.js +97 -0
- package/Build/Workers/chunk-P7M4VYFT.js +788 -0
- package/Build/Workers/chunk-PHB5MRHM.js +439 -0
- package/Build/Workers/chunk-PLLZB3R4.js +198 -0
- package/Build/Workers/chunk-POY6ZE32.js +2058 -0
- package/Build/Workers/chunk-PV5B2YNB.js +2719 -0
- package/Build/Workers/chunk-Q2DXNFYW.js +414 -0
- package/Build/Workers/chunk-QWV2DM66.js +1443 -0
- package/Build/Workers/chunk-R73BHGGI.js +305 -0
- package/Build/Workers/chunk-S3AE3MZZ.js +511 -0
- package/Build/Workers/chunk-SBFTVHRW.js +57 -0
- package/Build/Workers/chunk-SOR7PD4V.js +114 -0
- package/Build/Workers/chunk-TDI7UQBO.js +57 -0
- package/Build/Workers/chunk-TO7TWUET.js +476 -0
- package/Build/Workers/chunk-TSAJNE4K.js +101 -0
- package/Build/Workers/chunk-TWF4XRZ6.js +73 -0
- package/Build/Workers/chunk-U364CIW4.js +682 -0
- package/Build/Workers/chunk-UOD5YNH3.js +940 -0
- package/Build/Workers/chunk-UTWLMOPM.js +387 -0
- package/Build/Workers/chunk-UUJXSLQ2.js +2719 -0
- package/Build/Workers/chunk-UYT2PBMV.js +58 -0
- package/Build/Workers/chunk-VIYQ56Z7.js +837 -0
- package/Build/Workers/chunk-VR2L2Y4Z.js +1443 -0
- package/Build/Workers/chunk-WAS3IHIQ.js +288 -0
- package/Build/Workers/chunk-WLREXLZ7.js +414 -0
- package/Build/Workers/chunk-WMGESUDW.js +497 -0
- package/Build/Workers/chunk-WO5ZNC7S.js +1045 -0
- package/Build/Workers/chunk-X65Y2JSA.js +55 -0
- package/Build/Workers/chunk-XJKMLTSH.js +692 -0
- package/Build/Workers/chunk-XOVHLPKW.js +299 -0
- package/Build/Workers/chunk-YBVMSCW4.js +352 -0
- package/Build/Workers/chunk-YPGJSFOO.js +1460 -0
- package/Build/Workers/chunk-Z356SW7E.js +256 -0
- package/Build/Workers/chunk-ZV42SJKS.js +44 -0
- package/Build/Workers/combineGeometry.js +66 -0
- package/Build/Workers/createBoxGeometry.js +58 -0
- package/Build/Workers/createBoxOutlineGeometry.js +231 -0
- package/Build/Workers/createCircleGeometry.js +201 -0
- package/Build/Workers/createCircleOutlineGeometry.js +147 -0
- package/Build/Workers/createCoplanarPolygonGeometry.js +505 -0
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +225 -0
- package/Build/Workers/createCorridorGeometry.js +1258 -0
- package/Build/Workers/createCorridorOutlineGeometry.js +563 -0
- package/Build/Workers/createCylinderGeometry.js +60 -0
- package/Build/Workers/createCylinderOutlineGeometry.js +231 -0
- package/Build/Workers/createEllipseGeometry.js +72 -0
- package/Build/Workers/createEllipseOutlineGeometry.js +65 -0
- package/Build/Workers/createEllipsoidGeometry.js +59 -0
- package/Build/Workers/createEllipsoidOutlineGeometry.js +61 -0
- package/Build/Workers/createFrustumGeometry.js +58 -0
- package/Build/Workers/createFrustumOutlineGeometry.js +234 -0
- package/Build/Workers/createGeometry.js +173 -0
- package/Build/Workers/createGroundPolylineGeometry.js +1602 -0
- package/Build/Workers/createPlaneGeometry.js +223 -0
- package/Build/Workers/createPlaneOutlineGeometry.js +124 -0
- package/Build/Workers/createPolygonGeometry.js +1404 -0
- package/Build/Workers/createPolygonOutlineGeometry.js +532 -0
- package/Build/Workers/createPolylineGeometry.js +491 -0
- package/Build/Workers/createPolylineVolumeGeometry.js +374 -0
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -0
- package/Build/Workers/createRectangleGeometry.js +1264 -0
- package/Build/Workers/createRectangleOutlineGeometry.js +476 -0
- package/Build/Workers/createSimplePolylineGeometry.js +397 -0
- package/Build/Workers/createSphereGeometry.js +116 -0
- package/Build/Workers/createSphereOutlineGeometry.js +116 -0
- package/Build/Workers/createTaskProcessorWorker.js +32 -0
- package/Build/Workers/createVectorTileClampedPolylines.js +492 -0
- package/Build/Workers/createVectorTileGeometries.js +387 -0
- package/Build/Workers/createVectorTilePoints.js +114 -0
- package/Build/Workers/createVectorTilePolygons.js +386 -0
- package/Build/Workers/createVectorTilePolylines.js +262 -0
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +91 -0
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +565 -0
- package/Build/Workers/createVerticesFromHeightmap.js +2254 -0
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +499 -0
- package/Build/Workers/createWallGeometry.js +487 -0
- package/Build/Workers/createWallOutlineGeometry.js +335 -0
- package/Build/Workers/decodeDraco.js +369 -0
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2680 -0
- package/Build/Workers/decodeI3S.js +1339 -0
- package/Build/Workers/gaussianSplatSorter.js +62 -0
- package/Build/Workers/gaussianSplatTextureGenerator.js +68 -0
- package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
- package/Build/Workers/transcodeKTX2.js +3463 -0
- package/Build/Workers/transferTypedArrayTest.js +41 -0
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +820 -0
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +95 -0
- package/Source/Scene/GltfLoader.js +2 -2
- package/Source/Scene/Model/I3dmLoader.js +2 -2
- package/index.js +110 -110
- package/package.json +1 -1
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.4
|
|
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
|
+
PolygonGeometryLibrary_default
|
|
28
|
+
} from "./chunk-D7TGILR3.js";
|
|
29
|
+
import {
|
|
30
|
+
ArcType_default
|
|
31
|
+
} from "./chunk-LN4NMLYY.js";
|
|
32
|
+
import {
|
|
33
|
+
GeometryInstance_default
|
|
34
|
+
} from "./chunk-TDI7UQBO.js";
|
|
35
|
+
import {
|
|
36
|
+
GeometryPipeline_default
|
|
37
|
+
} from "./chunk-UUJXSLQ2.js";
|
|
38
|
+
import "./chunk-PHB5MRHM.js";
|
|
39
|
+
import "./chunk-MLFVICFZ.js";
|
|
40
|
+
import {
|
|
41
|
+
GeometryOffsetAttribute_default
|
|
42
|
+
} from "./chunk-J3FBVUY4.js";
|
|
43
|
+
import {
|
|
44
|
+
EllipsoidTangentPlane_default
|
|
45
|
+
} from "./chunk-3M5CRHSG.js";
|
|
46
|
+
import "./chunk-KXB3AARU.js";
|
|
47
|
+
import {
|
|
48
|
+
PolygonPipeline_default,
|
|
49
|
+
WindingOrder_default
|
|
50
|
+
} from "./chunk-3K2PK2OU.js";
|
|
51
|
+
import "./chunk-OVPPHDU7.js";
|
|
52
|
+
import "./chunk-5QTPACZQ.js";
|
|
53
|
+
import "./chunk-HU5P7PMU.js";
|
|
54
|
+
import "./chunk-BXBGWQ3Z.js";
|
|
55
|
+
import {
|
|
56
|
+
IndexDatatype_default
|
|
57
|
+
} from "./chunk-KBAGFNQ4.js";
|
|
58
|
+
import {
|
|
59
|
+
GeometryAttributes_default
|
|
60
|
+
} from "./chunk-ZV42SJKS.js";
|
|
61
|
+
import {
|
|
62
|
+
GeometryAttribute_default,
|
|
63
|
+
Geometry_default,
|
|
64
|
+
PrimitiveType_default
|
|
65
|
+
} from "./chunk-2BLQ3B4Q.js";
|
|
66
|
+
import {
|
|
67
|
+
BoundingSphere_default
|
|
68
|
+
} from "./chunk-UOD5YNH3.js";
|
|
69
|
+
import "./chunk-5BIQOSBV.js";
|
|
70
|
+
import "./chunk-HAWJ7FMN.js";
|
|
71
|
+
import "./chunk-EISI2CR2.js";
|
|
72
|
+
import {
|
|
73
|
+
ComponentDatatype_default
|
|
74
|
+
} from "./chunk-Z356SW7E.js";
|
|
75
|
+
import "./chunk-DEIMB3B5.js";
|
|
76
|
+
import "./chunk-HI6X33GO.js";
|
|
77
|
+
import {
|
|
78
|
+
Ellipsoid_default
|
|
79
|
+
} from "./chunk-F5LAPCFC.js";
|
|
80
|
+
import {
|
|
81
|
+
Cartesian3_default,
|
|
82
|
+
Frozen_default
|
|
83
|
+
} from "./chunk-VR2L2Y4Z.js";
|
|
84
|
+
import {
|
|
85
|
+
Math_default
|
|
86
|
+
} from "./chunk-WMGESUDW.js";
|
|
87
|
+
import {
|
|
88
|
+
Check_default,
|
|
89
|
+
DeveloperError_default
|
|
90
|
+
} from "./chunk-HGIGANIQ.js";
|
|
91
|
+
import {
|
|
92
|
+
defined_default
|
|
93
|
+
} from "./chunk-BN4WA7LX.js";
|
|
94
|
+
|
|
95
|
+
// packages/engine/Source/Core/PolygonOutlineGeometry.js
|
|
96
|
+
var createGeometryFromPositionsPositions = [];
|
|
97
|
+
var createGeometryFromPositionsSubdivided = [];
|
|
98
|
+
function createGeometryFromPositions(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
|
|
99
|
+
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
|
|
100
|
+
const positions2D = tangentPlane.projectPointsOntoPlane(
|
|
101
|
+
positions,
|
|
102
|
+
createGeometryFromPositionsPositions
|
|
103
|
+
);
|
|
104
|
+
const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
|
|
105
|
+
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
|
|
106
|
+
positions2D.reverse();
|
|
107
|
+
positions = positions.slice().reverse();
|
|
108
|
+
}
|
|
109
|
+
let subdividedPositions;
|
|
110
|
+
let i;
|
|
111
|
+
let length = positions.length;
|
|
112
|
+
let index = 0;
|
|
113
|
+
if (!perPositionHeight) {
|
|
114
|
+
let numVertices = 0;
|
|
115
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
116
|
+
for (i = 0; i < length; i++) {
|
|
117
|
+
numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
|
|
118
|
+
positions[i],
|
|
119
|
+
positions[(i + 1) % length],
|
|
120
|
+
minDistance
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
124
|
+
for (i = 0; i < length; i++) {
|
|
125
|
+
numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
|
|
126
|
+
ellipsoid,
|
|
127
|
+
positions[i],
|
|
128
|
+
positions[(i + 1) % length],
|
|
129
|
+
minDistance
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
subdividedPositions = new Float64Array(numVertices * 3);
|
|
134
|
+
for (i = 0; i < length; i++) {
|
|
135
|
+
let tempPositions;
|
|
136
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
137
|
+
tempPositions = PolygonGeometryLibrary_default.subdivideLine(
|
|
138
|
+
positions[i],
|
|
139
|
+
positions[(i + 1) % length],
|
|
140
|
+
minDistance,
|
|
141
|
+
createGeometryFromPositionsSubdivided
|
|
142
|
+
);
|
|
143
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
144
|
+
tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
|
|
145
|
+
ellipsoid,
|
|
146
|
+
positions[i],
|
|
147
|
+
positions[(i + 1) % length],
|
|
148
|
+
minDistance,
|
|
149
|
+
createGeometryFromPositionsSubdivided
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const tempPositionsLength = tempPositions.length;
|
|
153
|
+
for (let j = 0; j < tempPositionsLength; ++j) {
|
|
154
|
+
subdividedPositions[index++] = tempPositions[j];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
subdividedPositions = new Float64Array(length * 2 * 3);
|
|
159
|
+
for (i = 0; i < length; i++) {
|
|
160
|
+
const p0 = positions[i];
|
|
161
|
+
const p1 = positions[(i + 1) % length];
|
|
162
|
+
subdividedPositions[index++] = p0.x;
|
|
163
|
+
subdividedPositions[index++] = p0.y;
|
|
164
|
+
subdividedPositions[index++] = p0.z;
|
|
165
|
+
subdividedPositions[index++] = p1.x;
|
|
166
|
+
subdividedPositions[index++] = p1.y;
|
|
167
|
+
subdividedPositions[index++] = p1.z;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
length = subdividedPositions.length / 3;
|
|
171
|
+
const indicesSize = length * 2;
|
|
172
|
+
const indices = IndexDatatype_default.createTypedArray(length, indicesSize);
|
|
173
|
+
index = 0;
|
|
174
|
+
for (i = 0; i < length - 1; i++) {
|
|
175
|
+
indices[index++] = i;
|
|
176
|
+
indices[index++] = i + 1;
|
|
177
|
+
}
|
|
178
|
+
indices[index++] = length - 1;
|
|
179
|
+
indices[index++] = 0;
|
|
180
|
+
return new GeometryInstance_default({
|
|
181
|
+
geometry: new Geometry_default({
|
|
182
|
+
attributes: new GeometryAttributes_default({
|
|
183
|
+
position: new GeometryAttribute_default({
|
|
184
|
+
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
185
|
+
componentsPerAttribute: 3,
|
|
186
|
+
values: subdividedPositions
|
|
187
|
+
})
|
|
188
|
+
}),
|
|
189
|
+
indices,
|
|
190
|
+
primitiveType: PrimitiveType_default.LINES
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function createGeometryFromPositionsExtruded(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
|
|
195
|
+
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
|
|
196
|
+
const positions2D = tangentPlane.projectPointsOntoPlane(
|
|
197
|
+
positions,
|
|
198
|
+
createGeometryFromPositionsPositions
|
|
199
|
+
);
|
|
200
|
+
const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
|
|
201
|
+
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
|
|
202
|
+
positions2D.reverse();
|
|
203
|
+
positions = positions.slice().reverse();
|
|
204
|
+
}
|
|
205
|
+
let subdividedPositions;
|
|
206
|
+
let i;
|
|
207
|
+
let length = positions.length;
|
|
208
|
+
const corners = new Array(length);
|
|
209
|
+
let index = 0;
|
|
210
|
+
if (!perPositionHeight) {
|
|
211
|
+
let numVertices = 0;
|
|
212
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
213
|
+
for (i = 0; i < length; i++) {
|
|
214
|
+
numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
|
|
215
|
+
positions[i],
|
|
216
|
+
positions[(i + 1) % length],
|
|
217
|
+
minDistance
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
221
|
+
for (i = 0; i < length; i++) {
|
|
222
|
+
numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
|
|
223
|
+
ellipsoid,
|
|
224
|
+
positions[i],
|
|
225
|
+
positions[(i + 1) % length],
|
|
226
|
+
minDistance
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
subdividedPositions = new Float64Array(numVertices * 3 * 2);
|
|
231
|
+
for (i = 0; i < length; ++i) {
|
|
232
|
+
corners[i] = index / 3;
|
|
233
|
+
let tempPositions;
|
|
234
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
235
|
+
tempPositions = PolygonGeometryLibrary_default.subdivideLine(
|
|
236
|
+
positions[i],
|
|
237
|
+
positions[(i + 1) % length],
|
|
238
|
+
minDistance,
|
|
239
|
+
createGeometryFromPositionsSubdivided
|
|
240
|
+
);
|
|
241
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
242
|
+
tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
|
|
243
|
+
ellipsoid,
|
|
244
|
+
positions[i],
|
|
245
|
+
positions[(i + 1) % length],
|
|
246
|
+
minDistance,
|
|
247
|
+
createGeometryFromPositionsSubdivided
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
const tempPositionsLength = tempPositions.length;
|
|
251
|
+
for (let j = 0; j < tempPositionsLength; ++j) {
|
|
252
|
+
subdividedPositions[index++] = tempPositions[j];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
subdividedPositions = new Float64Array(length * 2 * 3 * 2);
|
|
257
|
+
for (i = 0; i < length; ++i) {
|
|
258
|
+
corners[i] = index / 3;
|
|
259
|
+
const p0 = positions[i];
|
|
260
|
+
const p1 = positions[(i + 1) % length];
|
|
261
|
+
subdividedPositions[index++] = p0.x;
|
|
262
|
+
subdividedPositions[index++] = p0.y;
|
|
263
|
+
subdividedPositions[index++] = p0.z;
|
|
264
|
+
subdividedPositions[index++] = p1.x;
|
|
265
|
+
subdividedPositions[index++] = p1.y;
|
|
266
|
+
subdividedPositions[index++] = p1.z;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
length = subdividedPositions.length / (3 * 2);
|
|
270
|
+
const cornersLength = corners.length;
|
|
271
|
+
const indicesSize = (length * 2 + cornersLength) * 2;
|
|
272
|
+
const indices = IndexDatatype_default.createTypedArray(
|
|
273
|
+
length + cornersLength,
|
|
274
|
+
indicesSize
|
|
275
|
+
);
|
|
276
|
+
index = 0;
|
|
277
|
+
for (i = 0; i < length; ++i) {
|
|
278
|
+
indices[index++] = i;
|
|
279
|
+
indices[index++] = (i + 1) % length;
|
|
280
|
+
indices[index++] = i + length;
|
|
281
|
+
indices[index++] = (i + 1) % length + length;
|
|
282
|
+
}
|
|
283
|
+
for (i = 0; i < cornersLength; i++) {
|
|
284
|
+
const corner = corners[i];
|
|
285
|
+
indices[index++] = corner;
|
|
286
|
+
indices[index++] = corner + length;
|
|
287
|
+
}
|
|
288
|
+
return new GeometryInstance_default({
|
|
289
|
+
geometry: new Geometry_default({
|
|
290
|
+
attributes: new GeometryAttributes_default({
|
|
291
|
+
position: new GeometryAttribute_default({
|
|
292
|
+
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
293
|
+
componentsPerAttribute: 3,
|
|
294
|
+
values: subdividedPositions
|
|
295
|
+
})
|
|
296
|
+
}),
|
|
297
|
+
indices,
|
|
298
|
+
primitiveType: PrimitiveType_default.LINES
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function PolygonOutlineGeometry(options) {
|
|
303
|
+
Check_default.typeOf.object("options", options);
|
|
304
|
+
Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
|
|
305
|
+
if (options.perPositionHeight && defined_default(options.height)) {
|
|
306
|
+
throw new DeveloperError_default(
|
|
307
|
+
"Cannot use both options.perPositionHeight and options.height"
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
|
|
311
|
+
throw new DeveloperError_default(
|
|
312
|
+
"Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
const polygonHierarchy = options.polygonHierarchy;
|
|
316
|
+
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
|
|
317
|
+
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
|
|
318
|
+
const perPositionHeight = options.perPositionHeight ?? false;
|
|
319
|
+
const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
|
|
320
|
+
const arcType = options.arcType ?? ArcType_default.GEODESIC;
|
|
321
|
+
let height = options.height ?? 0;
|
|
322
|
+
let extrudedHeight = options.extrudedHeight ?? height;
|
|
323
|
+
if (!perPositionHeightExtrude) {
|
|
324
|
+
const h = Math.max(height, extrudedHeight);
|
|
325
|
+
extrudedHeight = Math.min(height, extrudedHeight);
|
|
326
|
+
height = h;
|
|
327
|
+
}
|
|
328
|
+
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
|
|
329
|
+
this._granularity = granularity;
|
|
330
|
+
this._height = height;
|
|
331
|
+
this._extrudedHeight = extrudedHeight;
|
|
332
|
+
this._arcType = arcType;
|
|
333
|
+
this._polygonHierarchy = polygonHierarchy;
|
|
334
|
+
this._perPositionHeight = perPositionHeight;
|
|
335
|
+
this._perPositionHeightExtrude = perPositionHeightExtrude;
|
|
336
|
+
this._offsetAttribute = options.offsetAttribute;
|
|
337
|
+
this._workerName = "createPolygonOutlineGeometry";
|
|
338
|
+
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
|
|
339
|
+
polygonHierarchy,
|
|
340
|
+
Cartesian3_default
|
|
341
|
+
) + Ellipsoid_default.packedLength + 8;
|
|
342
|
+
}
|
|
343
|
+
PolygonOutlineGeometry.pack = function(value, array, startingIndex) {
|
|
344
|
+
Check_default.typeOf.object("value", value);
|
|
345
|
+
Check_default.defined("array", array);
|
|
346
|
+
startingIndex = startingIndex ?? 0;
|
|
347
|
+
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
|
|
348
|
+
value._polygonHierarchy,
|
|
349
|
+
array,
|
|
350
|
+
startingIndex,
|
|
351
|
+
Cartesian3_default
|
|
352
|
+
);
|
|
353
|
+
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
|
|
354
|
+
startingIndex += Ellipsoid_default.packedLength;
|
|
355
|
+
array[startingIndex++] = value._height;
|
|
356
|
+
array[startingIndex++] = value._extrudedHeight;
|
|
357
|
+
array[startingIndex++] = value._granularity;
|
|
358
|
+
array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
|
|
359
|
+
array[startingIndex++] = value._perPositionHeight ? 1 : 0;
|
|
360
|
+
array[startingIndex++] = value._arcType;
|
|
361
|
+
array[startingIndex++] = value._offsetAttribute ?? -1;
|
|
362
|
+
array[startingIndex] = value.packedLength;
|
|
363
|
+
return array;
|
|
364
|
+
};
|
|
365
|
+
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
|
|
366
|
+
var dummyOptions = {
|
|
367
|
+
polygonHierarchy: {}
|
|
368
|
+
};
|
|
369
|
+
PolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
|
|
370
|
+
Check_default.defined("array", array);
|
|
371
|
+
startingIndex = startingIndex ?? 0;
|
|
372
|
+
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
|
|
373
|
+
array,
|
|
374
|
+
startingIndex,
|
|
375
|
+
Cartesian3_default
|
|
376
|
+
);
|
|
377
|
+
startingIndex = polygonHierarchy.startingIndex;
|
|
378
|
+
delete polygonHierarchy.startingIndex;
|
|
379
|
+
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
|
|
380
|
+
startingIndex += Ellipsoid_default.packedLength;
|
|
381
|
+
const height = array[startingIndex++];
|
|
382
|
+
const extrudedHeight = array[startingIndex++];
|
|
383
|
+
const granularity = array[startingIndex++];
|
|
384
|
+
const perPositionHeightExtrude = array[startingIndex++] === 1;
|
|
385
|
+
const perPositionHeight = array[startingIndex++] === 1;
|
|
386
|
+
const arcType = array[startingIndex++];
|
|
387
|
+
const offsetAttribute = array[startingIndex++];
|
|
388
|
+
const packedLength = array[startingIndex];
|
|
389
|
+
if (!defined_default(result)) {
|
|
390
|
+
result = new PolygonOutlineGeometry(dummyOptions);
|
|
391
|
+
}
|
|
392
|
+
result._polygonHierarchy = polygonHierarchy;
|
|
393
|
+
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
|
|
394
|
+
result._height = height;
|
|
395
|
+
result._extrudedHeight = extrudedHeight;
|
|
396
|
+
result._granularity = granularity;
|
|
397
|
+
result._perPositionHeight = perPositionHeight;
|
|
398
|
+
result._perPositionHeightExtrude = perPositionHeightExtrude;
|
|
399
|
+
result._arcType = arcType;
|
|
400
|
+
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
401
|
+
result.packedLength = packedLength;
|
|
402
|
+
return result;
|
|
403
|
+
};
|
|
404
|
+
PolygonOutlineGeometry.fromPositions = function(options) {
|
|
405
|
+
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
406
|
+
Check_default.defined("options.positions", options.positions);
|
|
407
|
+
const newOptions = {
|
|
408
|
+
polygonHierarchy: {
|
|
409
|
+
positions: options.positions
|
|
410
|
+
},
|
|
411
|
+
height: options.height,
|
|
412
|
+
extrudedHeight: options.extrudedHeight,
|
|
413
|
+
ellipsoid: options.ellipsoid,
|
|
414
|
+
granularity: options.granularity,
|
|
415
|
+
perPositionHeight: options.perPositionHeight,
|
|
416
|
+
arcType: options.arcType,
|
|
417
|
+
offsetAttribute: options.offsetAttribute
|
|
418
|
+
};
|
|
419
|
+
return new PolygonOutlineGeometry(newOptions);
|
|
420
|
+
};
|
|
421
|
+
PolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
|
|
422
|
+
const ellipsoid = polygonGeometry._ellipsoid;
|
|
423
|
+
const granularity = polygonGeometry._granularity;
|
|
424
|
+
const polygonHierarchy = polygonGeometry._polygonHierarchy;
|
|
425
|
+
const perPositionHeight = polygonGeometry._perPositionHeight;
|
|
426
|
+
const arcType = polygonGeometry._arcType;
|
|
427
|
+
const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
|
|
428
|
+
polygonHierarchy,
|
|
429
|
+
!perPositionHeight,
|
|
430
|
+
ellipsoid
|
|
431
|
+
);
|
|
432
|
+
if (polygons.length === 0) {
|
|
433
|
+
return void 0;
|
|
434
|
+
}
|
|
435
|
+
let geometryInstance;
|
|
436
|
+
const geometries = [];
|
|
437
|
+
const minDistance = Math_default.chordLength(
|
|
438
|
+
granularity,
|
|
439
|
+
ellipsoid.maximumRadius
|
|
440
|
+
);
|
|
441
|
+
const height = polygonGeometry._height;
|
|
442
|
+
const extrudedHeight = polygonGeometry._extrudedHeight;
|
|
443
|
+
const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
|
|
444
|
+
let offsetValue;
|
|
445
|
+
let i;
|
|
446
|
+
if (extrude) {
|
|
447
|
+
for (i = 0; i < polygons.length; i++) {
|
|
448
|
+
geometryInstance = createGeometryFromPositionsExtruded(
|
|
449
|
+
ellipsoid,
|
|
450
|
+
polygons[i],
|
|
451
|
+
minDistance,
|
|
452
|
+
perPositionHeight,
|
|
453
|
+
arcType
|
|
454
|
+
);
|
|
455
|
+
geometryInstance.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
|
|
456
|
+
geometryInstance.geometry,
|
|
457
|
+
height,
|
|
458
|
+
extrudedHeight,
|
|
459
|
+
ellipsoid,
|
|
460
|
+
perPositionHeight
|
|
461
|
+
);
|
|
462
|
+
if (defined_default(polygonGeometry._offsetAttribute)) {
|
|
463
|
+
const size = geometryInstance.geometry.attributes.position.values.length / 3;
|
|
464
|
+
let offsetAttribute = new Uint8Array(size);
|
|
465
|
+
if (polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
|
|
466
|
+
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
|
|
467
|
+
} else {
|
|
468
|
+
offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
469
|
+
offsetAttribute = offsetAttribute.fill(offsetValue);
|
|
470
|
+
}
|
|
471
|
+
geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default({
|
|
472
|
+
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
473
|
+
componentsPerAttribute: 1,
|
|
474
|
+
values: offsetAttribute
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
geometries.push(geometryInstance);
|
|
478
|
+
}
|
|
479
|
+
} else {
|
|
480
|
+
for (i = 0; i < polygons.length; i++) {
|
|
481
|
+
geometryInstance = createGeometryFromPositions(
|
|
482
|
+
ellipsoid,
|
|
483
|
+
polygons[i],
|
|
484
|
+
minDistance,
|
|
485
|
+
perPositionHeight,
|
|
486
|
+
arcType
|
|
487
|
+
);
|
|
488
|
+
geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
489
|
+
geometryInstance.geometry.attributes.position.values,
|
|
490
|
+
height,
|
|
491
|
+
ellipsoid,
|
|
492
|
+
!perPositionHeight
|
|
493
|
+
);
|
|
494
|
+
if (defined_default(polygonGeometry._offsetAttribute)) {
|
|
495
|
+
const length = geometryInstance.geometry.attributes.position.values.length;
|
|
496
|
+
offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
497
|
+
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
|
|
498
|
+
geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default({
|
|
499
|
+
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
500
|
+
componentsPerAttribute: 1,
|
|
501
|
+
values: applyOffset
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
geometries.push(geometryInstance);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
|
|
508
|
+
const boundingSphere = BoundingSphere_default.fromVertices(
|
|
509
|
+
geometry.attributes.position.values
|
|
510
|
+
);
|
|
511
|
+
return new Geometry_default({
|
|
512
|
+
attributes: geometry.attributes,
|
|
513
|
+
indices: geometry.indices,
|
|
514
|
+
primitiveType: geometry.primitiveType,
|
|
515
|
+
boundingSphere,
|
|
516
|
+
offsetAttribute: polygonGeometry._offsetAttribute
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
var PolygonOutlineGeometry_default = PolygonOutlineGeometry;
|
|
520
|
+
|
|
521
|
+
// packages/engine/Source/Workers/createPolygonOutlineGeometry.js
|
|
522
|
+
function createPolygonOutlineGeometry(polygonGeometry, offset) {
|
|
523
|
+
if (defined_default(offset)) {
|
|
524
|
+
polygonGeometry = PolygonOutlineGeometry_default.unpack(polygonGeometry, offset);
|
|
525
|
+
}
|
|
526
|
+
polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
|
|
527
|
+
return PolygonOutlineGeometry_default.createGeometry(polygonGeometry);
|
|
528
|
+
}
|
|
529
|
+
var createPolygonOutlineGeometry_default = createPolygonOutlineGeometry;
|
|
530
|
+
export {
|
|
531
|
+
createPolygonOutlineGeometry_default as default
|
|
532
|
+
};
|