@pggis/pg-sdk 3.3.10 → 3.5.0
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/README.md +8 -8
- package/dist/index.js +1966 -4
- package/dist/pggis.min.css +1 -1
- package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
- package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
- package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
- package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
- package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
- package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
- package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
- package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
- package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
- package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
- package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
- package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
- package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
- package/dist/resources/Workers/{chunk-F3YA3Y2Z.js → chunk-A56XVLQR.js} +2 -13
- package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
- package/dist/resources/Workers/{chunk-EHWHNOEX.js → chunk-ARG42DC4.js} +2 -31
- package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
- package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
- package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
- package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
- package/dist/resources/Workers/{chunk-4H7PY4U5.js → chunk-D6AA5QVT.js} +2 -20
- package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
- package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
- package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
- package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
- package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
- package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
- package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
- package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
- package/dist/resources/Workers/{chunk-BBWDMCVU.js → chunk-GBYLG25F.js} +2 -15
- package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
- package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
- package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
- package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
- package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
- package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
- package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
- package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
- package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
- package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
- package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
- package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
- package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
- package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
- package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
- package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
- package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
- package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
- package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
- package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
- package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
- package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
- package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
- package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
- package/dist/resources/Workers/chunk-WZDE3RYP.js +28 -0
- package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
- package/dist/resources/Workers/combineGeometry.js +2 -44
- package/dist/resources/Workers/createBoxGeometry.js +2 -34
- package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -211
- package/dist/resources/Workers/createCircleGeometry.js +2 -173
- package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -123
- package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -482
- package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -201
- package/dist/resources/Workers/createCorridorGeometry.js +2 -1239
- package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -544
- package/dist/resources/Workers/createCylinderGeometry.js +2 -36
- package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -207
- package/dist/resources/Workers/createEllipseGeometry.js +2 -47
- package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -40
- package/dist/resources/Workers/createEllipsoidGeometry.js +2 -35
- package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -37
- package/dist/resources/Workers/createFrustumGeometry.js +2 -34
- package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -211
- package/dist/resources/Workers/createGeometry.js +2 -147
- package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1584
- package/dist/resources/Workers/createPlaneGeometry.js +2 -200
- package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -100
- package/dist/resources/Workers/createPolygonGeometry.js +2 -1387
- package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -519
- package/dist/resources/Workers/createPolylineGeometry.js +2 -472
- package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -355
- package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -253
- package/dist/resources/Workers/createRectangleGeometry.js +2 -1250
- package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -455
- package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -376
- package/dist/resources/Workers/createSphereGeometry.js +2 -94
- package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -94
- package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
- package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -468
- package/dist/resources/Workers/createVectorTileGeometries.js +2 -363
- package/dist/resources/Workers/createVectorTilePoints.js +2 -88
- package/dist/resources/Workers/createVectorTilePolygons.js +2 -361
- package/dist/resources/Workers/createVectorTilePolylines.js +2 -238
- package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -545
- package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2254
- package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -722
- package/dist/resources/Workers/createWallGeometry.js +2 -466
- package/dist/resources/Workers/createWallOutlineGeometry.js +2 -314
- package/dist/resources/Workers/decodeDraco.js +2 -345
- package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2626
- package/dist/resources/Workers/decodeI3S.js +2 -1320
- package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
- package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
- package/dist/resources/Workers/transcodeKTX2.js +29 -3398
- package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
- package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -795
- package/package.json +9 -8
- package/dist/pggis.min.js +0 -14796
- package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
- package/dist/resources/Workers/chunk-23UFSGND.js +0 -236
- package/dist/resources/Workers/chunk-2A75IWRS.js +0 -218
- package/dist/resources/Workers/chunk-2FRVPMCS.js +0 -1258
- package/dist/resources/Workers/chunk-2FWRMUTY.js +0 -138
- package/dist/resources/Workers/chunk-2UPKWTMJ.js +0 -117
- package/dist/resources/Workers/chunk-34FXV7D7.js +0 -73
- package/dist/resources/Workers/chunk-3VAZEH7M.js +0 -101
- package/dist/resources/Workers/chunk-4DO5W5XZ.js +0 -196
- package/dist/resources/Workers/chunk-5QULIR53.js +0 -501
- package/dist/resources/Workers/chunk-7TC63SJW.js +0 -302
- package/dist/resources/Workers/chunk-7ZFGPDJA.js +0 -122
- package/dist/resources/Workers/chunk-A5DWLWCY.js +0 -834
- package/dist/resources/Workers/chunk-BG4UCVXN.js +0 -73
- package/dist/resources/Workers/chunk-BIKA3NRA.js +0 -59
- package/dist/resources/Workers/chunk-BROJAZRZ.js +0 -390
- package/dist/resources/Workers/chunk-DDUQAJ4P.js +0 -476
- package/dist/resources/Workers/chunk-EERJKOAF.js +0 -305
- package/dist/resources/Workers/chunk-EG6PTBY2.js +0 -2716
- package/dist/resources/Workers/chunk-F4HFJMGM.js +0 -353
- package/dist/resources/Workers/chunk-FJKNFAKQ.js +0 -8219
- package/dist/resources/Workers/chunk-FNIRWHJB.js +0 -289
- package/dist/resources/Workers/chunk-FZRIVR7Y.js +0 -100
- package/dist/resources/Workers/chunk-G43QFN4Q.js +0 -157
- package/dist/resources/Workers/chunk-GATZHF3K.js +0 -1860
- package/dist/resources/Workers/chunk-GRC2ZTAF.js +0 -398
- package/dist/resources/Workers/chunk-HU6N6EXB.js +0 -767
- package/dist/resources/Workers/chunk-I46ZRR5W.js +0 -1052
- package/dist/resources/Workers/chunk-JURN7NPV.js +0 -1075
- package/dist/resources/Workers/chunk-KKCR2YOP.js +0 -421
- package/dist/resources/Workers/chunk-LPR3YNP2.js +0 -138
- package/dist/resources/Workers/chunk-M7ERACJJ.js +0 -511
- package/dist/resources/Workers/chunk-MDWEGWPA.js +0 -1007
- package/dist/resources/Workers/chunk-OGXZVPPM.js +0 -2365
- package/dist/resources/Workers/chunk-PGSJK77E.js +0 -634
- package/dist/resources/Workers/chunk-PPH7OFP3.js +0 -258
- package/dist/resources/Workers/chunk-SH5USDPI.js +0 -456
- package/dist/resources/Workers/chunk-SOWMRMWA.js +0 -629
- package/dist/resources/Workers/chunk-STW2DGFI.js +0 -58
- package/dist/resources/Workers/chunk-T3XIFPYR.js +0 -1477
- package/dist/resources/Workers/chunk-TTUZP4BO.js +0 -501
- package/dist/resources/Workers/chunk-UEXTBDBE.js +0 -693
- package/dist/resources/Workers/chunk-VOXYEYJT.js +0 -684
- package/dist/resources/Workers/chunk-X4356LRH.js +0 -368
- package/dist/resources/Workers/chunk-XGI5BXZY.js +0 -163
- package/dist/resources/Workers/chunk-Y2ME2IJV.js +0 -781
- package/dist/resources/Workers/chunk-Y5UQJLYE.js +0 -171
- package/dist/resources/Workers/chunk-YJEBABKH.js +0 -2977
- package/dist/resources/Workers/chunk-YWTJ2B4B.js +0 -77
- package/dist/resources/Workers/chunk-Z3TIFFGF.js +0 -430
- package/dist/resources/Workers/chunk-ZT7KWISZ.js +0 -102
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.132
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -23,1241 +23,4 @@
|
|
|
23
23
|
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import {
|
|
27
|
-
CorridorGeometryLibrary_default
|
|
28
|
-
} from "./chunk-DDUQAJ4P.js";
|
|
29
|
-
import {
|
|
30
|
-
CornerType_default
|
|
31
|
-
} from "./chunk-UEXTBDBE.js";
|
|
32
|
-
import "./chunk-KKCR2YOP.js";
|
|
33
|
-
import "./chunk-F4HFJMGM.js";
|
|
34
|
-
import {
|
|
35
|
-
GeometryOffsetAttribute_default
|
|
36
|
-
} from "./chunk-F3YA3Y2Z.js";
|
|
37
|
-
import {
|
|
38
|
-
VertexFormat_default
|
|
39
|
-
} from "./chunk-2FWRMUTY.js";
|
|
40
|
-
import "./chunk-FNIRWHJB.js";
|
|
41
|
-
import "./chunk-G43QFN4Q.js";
|
|
42
|
-
import {
|
|
43
|
-
PolygonPipeline_default
|
|
44
|
-
} from "./chunk-MDWEGWPA.js";
|
|
45
|
-
import {
|
|
46
|
-
arrayRemoveDuplicates_default
|
|
47
|
-
} from "./chunk-FZRIVR7Y.js";
|
|
48
|
-
import "./chunk-SH5USDPI.js";
|
|
49
|
-
import "./chunk-2FRVPMCS.js";
|
|
50
|
-
import "./chunk-Y5UQJLYE.js";
|
|
51
|
-
import {
|
|
52
|
-
IndexDatatype_default
|
|
53
|
-
} from "./chunk-LPR3YNP2.js";
|
|
54
|
-
import {
|
|
55
|
-
GeometryAttributes_default
|
|
56
|
-
} from "./chunk-4H7PY4U5.js";
|
|
57
|
-
import {
|
|
58
|
-
GeometryAttribute_default,
|
|
59
|
-
Geometry_default,
|
|
60
|
-
PrimitiveType_default
|
|
61
|
-
} from "./chunk-7TC63SJW.js";
|
|
62
|
-
import {
|
|
63
|
-
BoundingSphere_default
|
|
64
|
-
} from "./chunk-FJKNFAKQ.js";
|
|
65
|
-
import "./chunk-TTUZP4BO.js";
|
|
66
|
-
import "./chunk-BG4UCVXN.js";
|
|
67
|
-
import {
|
|
68
|
-
Rectangle_default
|
|
69
|
-
} from "./chunk-YJEBABKH.js";
|
|
70
|
-
import {
|
|
71
|
-
ComponentDatatype_default
|
|
72
|
-
} from "./chunk-PPH7OFP3.js";
|
|
73
|
-
import {
|
|
74
|
-
Cartesian3_default,
|
|
75
|
-
Cartographic_default,
|
|
76
|
-
Ellipsoid_default
|
|
77
|
-
} from "./chunk-OGXZVPPM.js";
|
|
78
|
-
import {
|
|
79
|
-
Math_default
|
|
80
|
-
} from "./chunk-5QULIR53.js";
|
|
81
|
-
import "./chunk-SOWMRMWA.js";
|
|
82
|
-
import "./chunk-STW2DGFI.js";
|
|
83
|
-
import {
|
|
84
|
-
defaultValue_default
|
|
85
|
-
} from "./chunk-BBWDMCVU.js";
|
|
86
|
-
import {
|
|
87
|
-
Check_default
|
|
88
|
-
} from "./chunk-XGI5BXZY.js";
|
|
89
|
-
import {
|
|
90
|
-
defined_default
|
|
91
|
-
} from "./chunk-YWTJ2B4B.js";
|
|
92
|
-
|
|
93
|
-
// packages/engine/Source/Core/CorridorGeometry.js
|
|
94
|
-
var cartesian1 = new Cartesian3_default();
|
|
95
|
-
var cartesian2 = new Cartesian3_default();
|
|
96
|
-
var cartesian3 = new Cartesian3_default();
|
|
97
|
-
var cartesian4 = new Cartesian3_default();
|
|
98
|
-
var cartesian5 = new Cartesian3_default();
|
|
99
|
-
var cartesian6 = new Cartesian3_default();
|
|
100
|
-
var scratch1 = new Cartesian3_default();
|
|
101
|
-
var scratch2 = new Cartesian3_default();
|
|
102
|
-
function scaleToSurface(positions, ellipsoid) {
|
|
103
|
-
for (let i = 0; i < positions.length; i++) {
|
|
104
|
-
positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
|
|
105
|
-
}
|
|
106
|
-
return positions;
|
|
107
|
-
}
|
|
108
|
-
function addNormals(attr, normal, left, front, back, vertexFormat) {
|
|
109
|
-
const normals = attr.normals;
|
|
110
|
-
const tangents = attr.tangents;
|
|
111
|
-
const bitangents = attr.bitangents;
|
|
112
|
-
const forward = Cartesian3_default.normalize(
|
|
113
|
-
Cartesian3_default.cross(left, normal, scratch1),
|
|
114
|
-
scratch1
|
|
115
|
-
);
|
|
116
|
-
if (vertexFormat.normal) {
|
|
117
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, front, back);
|
|
118
|
-
}
|
|
119
|
-
if (vertexFormat.tangent) {
|
|
120
|
-
CorridorGeometryLibrary_default.addAttribute(tangents, forward, front, back);
|
|
121
|
-
}
|
|
122
|
-
if (vertexFormat.bitangent) {
|
|
123
|
-
CorridorGeometryLibrary_default.addAttribute(bitangents, left, front, back);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function combine(computedPositions, vertexFormat, ellipsoid) {
|
|
127
|
-
const positions = computedPositions.positions;
|
|
128
|
-
const corners = computedPositions.corners;
|
|
129
|
-
const endPositions = computedPositions.endPositions;
|
|
130
|
-
const computedLefts = computedPositions.lefts;
|
|
131
|
-
const computedNormals = computedPositions.normals;
|
|
132
|
-
const attributes = new GeometryAttributes_default();
|
|
133
|
-
let corner;
|
|
134
|
-
let leftCount = 0;
|
|
135
|
-
let rightCount = 0;
|
|
136
|
-
let i;
|
|
137
|
-
let indicesLength = 0;
|
|
138
|
-
let length;
|
|
139
|
-
for (i = 0; i < positions.length; i += 2) {
|
|
140
|
-
length = positions[i].length - 3;
|
|
141
|
-
leftCount += length;
|
|
142
|
-
indicesLength += length * 2;
|
|
143
|
-
rightCount += positions[i + 1].length - 3;
|
|
144
|
-
}
|
|
145
|
-
leftCount += 3;
|
|
146
|
-
rightCount += 3;
|
|
147
|
-
for (i = 0; i < corners.length; i++) {
|
|
148
|
-
corner = corners[i];
|
|
149
|
-
const leftSide = corners[i].leftPositions;
|
|
150
|
-
if (defined_default(leftSide)) {
|
|
151
|
-
length = leftSide.length;
|
|
152
|
-
leftCount += length;
|
|
153
|
-
indicesLength += length;
|
|
154
|
-
} else {
|
|
155
|
-
length = corners[i].rightPositions.length;
|
|
156
|
-
rightCount += length;
|
|
157
|
-
indicesLength += length;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const addEndPositions = defined_default(endPositions);
|
|
161
|
-
let endPositionLength;
|
|
162
|
-
if (addEndPositions) {
|
|
163
|
-
endPositionLength = endPositions[0].length - 3;
|
|
164
|
-
leftCount += endPositionLength;
|
|
165
|
-
rightCount += endPositionLength;
|
|
166
|
-
endPositionLength /= 3;
|
|
167
|
-
indicesLength += endPositionLength * 6;
|
|
168
|
-
}
|
|
169
|
-
const size = leftCount + rightCount;
|
|
170
|
-
const finalPositions = new Float64Array(size);
|
|
171
|
-
const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
|
|
172
|
-
const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
|
|
173
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
|
|
174
|
-
const attr = {
|
|
175
|
-
normals,
|
|
176
|
-
tangents,
|
|
177
|
-
bitangents
|
|
178
|
-
};
|
|
179
|
-
let front = 0;
|
|
180
|
-
let back = size - 1;
|
|
181
|
-
let UL, LL, UR, LR;
|
|
182
|
-
let normal = cartesian1;
|
|
183
|
-
let left = cartesian2;
|
|
184
|
-
let rightPos, leftPos;
|
|
185
|
-
const halfLength = endPositionLength / 2;
|
|
186
|
-
const indices = IndexDatatype_default.createTypedArray(size / 3, indicesLength);
|
|
187
|
-
let index = 0;
|
|
188
|
-
if (addEndPositions) {
|
|
189
|
-
leftPos = cartesian3;
|
|
190
|
-
rightPos = cartesian4;
|
|
191
|
-
const firstEndPositions = endPositions[0];
|
|
192
|
-
normal = Cartesian3_default.fromArray(computedNormals, 0, normal);
|
|
193
|
-
left = Cartesian3_default.fromArray(computedLefts, 0, left);
|
|
194
|
-
for (i = 0; i < halfLength; i++) {
|
|
195
|
-
leftPos = Cartesian3_default.fromArray(
|
|
196
|
-
firstEndPositions,
|
|
197
|
-
(halfLength - 1 - i) * 3,
|
|
198
|
-
leftPos
|
|
199
|
-
);
|
|
200
|
-
rightPos = Cartesian3_default.fromArray(
|
|
201
|
-
firstEndPositions,
|
|
202
|
-
(halfLength + i) * 3,
|
|
203
|
-
rightPos
|
|
204
|
-
);
|
|
205
|
-
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
|
|
206
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
207
|
-
finalPositions,
|
|
208
|
-
leftPos,
|
|
209
|
-
void 0,
|
|
210
|
-
back
|
|
211
|
-
);
|
|
212
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
213
|
-
LL = front / 3;
|
|
214
|
-
LR = LL + 1;
|
|
215
|
-
UL = (back - 2) / 3;
|
|
216
|
-
UR = UL - 1;
|
|
217
|
-
indices[index++] = UL;
|
|
218
|
-
indices[index++] = LL;
|
|
219
|
-
indices[index++] = UR;
|
|
220
|
-
indices[index++] = UR;
|
|
221
|
-
indices[index++] = LL;
|
|
222
|
-
indices[index++] = LR;
|
|
223
|
-
front += 3;
|
|
224
|
-
back -= 3;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
let posIndex = 0;
|
|
228
|
-
let compIndex = 0;
|
|
229
|
-
let rightEdge = positions[posIndex++];
|
|
230
|
-
let leftEdge = positions[posIndex++];
|
|
231
|
-
finalPositions.set(rightEdge, front);
|
|
232
|
-
finalPositions.set(leftEdge, back - leftEdge.length + 1);
|
|
233
|
-
left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
|
|
234
|
-
let rightNormal;
|
|
235
|
-
let leftNormal;
|
|
236
|
-
length = leftEdge.length - 3;
|
|
237
|
-
for (i = 0; i < length; i += 3) {
|
|
238
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
239
|
-
Cartesian3_default.fromArray(rightEdge, i, scratch1),
|
|
240
|
-
scratch1
|
|
241
|
-
);
|
|
242
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
243
|
-
Cartesian3_default.fromArray(leftEdge, length - i, scratch2),
|
|
244
|
-
scratch2
|
|
245
|
-
);
|
|
246
|
-
normal = Cartesian3_default.normalize(
|
|
247
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
248
|
-
normal
|
|
249
|
-
);
|
|
250
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
251
|
-
LL = front / 3;
|
|
252
|
-
LR = LL + 1;
|
|
253
|
-
UL = (back - 2) / 3;
|
|
254
|
-
UR = UL - 1;
|
|
255
|
-
indices[index++] = UL;
|
|
256
|
-
indices[index++] = LL;
|
|
257
|
-
indices[index++] = UR;
|
|
258
|
-
indices[index++] = UR;
|
|
259
|
-
indices[index++] = LL;
|
|
260
|
-
indices[index++] = LR;
|
|
261
|
-
front += 3;
|
|
262
|
-
back -= 3;
|
|
263
|
-
}
|
|
264
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
265
|
-
Cartesian3_default.fromArray(rightEdge, length, scratch1),
|
|
266
|
-
scratch1
|
|
267
|
-
);
|
|
268
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
269
|
-
Cartesian3_default.fromArray(leftEdge, length, scratch2),
|
|
270
|
-
scratch2
|
|
271
|
-
);
|
|
272
|
-
normal = Cartesian3_default.normalize(
|
|
273
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
274
|
-
normal
|
|
275
|
-
);
|
|
276
|
-
compIndex += 3;
|
|
277
|
-
for (i = 0; i < corners.length; i++) {
|
|
278
|
-
let j;
|
|
279
|
-
corner = corners[i];
|
|
280
|
-
const l = corner.leftPositions;
|
|
281
|
-
const r = corner.rightPositions;
|
|
282
|
-
let pivot;
|
|
283
|
-
let start;
|
|
284
|
-
let outsidePoint = cartesian6;
|
|
285
|
-
let previousPoint = cartesian3;
|
|
286
|
-
let nextPoint = cartesian4;
|
|
287
|
-
normal = Cartesian3_default.fromArray(computedNormals, compIndex, normal);
|
|
288
|
-
if (defined_default(l)) {
|
|
289
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
290
|
-
back -= 3;
|
|
291
|
-
pivot = LR;
|
|
292
|
-
start = UR;
|
|
293
|
-
for (j = 0; j < l.length / 3; j++) {
|
|
294
|
-
outsidePoint = Cartesian3_default.fromArray(l, j * 3, outsidePoint);
|
|
295
|
-
indices[index++] = pivot;
|
|
296
|
-
indices[index++] = start - j - 1;
|
|
297
|
-
indices[index++] = start - j;
|
|
298
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
299
|
-
finalPositions,
|
|
300
|
-
outsidePoint,
|
|
301
|
-
void 0,
|
|
302
|
-
back
|
|
303
|
-
);
|
|
304
|
-
previousPoint = Cartesian3_default.fromArray(
|
|
305
|
-
finalPositions,
|
|
306
|
-
(start - j - 1) * 3,
|
|
307
|
-
previousPoint
|
|
308
|
-
);
|
|
309
|
-
nextPoint = Cartesian3_default.fromArray(finalPositions, pivot * 3, nextPoint);
|
|
310
|
-
left = Cartesian3_default.normalize(
|
|
311
|
-
Cartesian3_default.subtract(previousPoint, nextPoint, left),
|
|
312
|
-
left
|
|
313
|
-
);
|
|
314
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
315
|
-
back -= 3;
|
|
316
|
-
}
|
|
317
|
-
outsidePoint = Cartesian3_default.fromArray(
|
|
318
|
-
finalPositions,
|
|
319
|
-
pivot * 3,
|
|
320
|
-
outsidePoint
|
|
321
|
-
);
|
|
322
|
-
previousPoint = Cartesian3_default.subtract(
|
|
323
|
-
Cartesian3_default.fromArray(finalPositions, start * 3, previousPoint),
|
|
324
|
-
outsidePoint,
|
|
325
|
-
previousPoint
|
|
326
|
-
);
|
|
327
|
-
nextPoint = Cartesian3_default.subtract(
|
|
328
|
-
Cartesian3_default.fromArray(finalPositions, (start - j) * 3, nextPoint),
|
|
329
|
-
outsidePoint,
|
|
330
|
-
nextPoint
|
|
331
|
-
);
|
|
332
|
-
left = Cartesian3_default.normalize(
|
|
333
|
-
Cartesian3_default.add(previousPoint, nextPoint, left),
|
|
334
|
-
left
|
|
335
|
-
);
|
|
336
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
337
|
-
front += 3;
|
|
338
|
-
} else {
|
|
339
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
340
|
-
front += 3;
|
|
341
|
-
pivot = UR;
|
|
342
|
-
start = LR;
|
|
343
|
-
for (j = 0; j < r.length / 3; j++) {
|
|
344
|
-
outsidePoint = Cartesian3_default.fromArray(r, j * 3, outsidePoint);
|
|
345
|
-
indices[index++] = pivot;
|
|
346
|
-
indices[index++] = start + j;
|
|
347
|
-
indices[index++] = start + j + 1;
|
|
348
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
349
|
-
finalPositions,
|
|
350
|
-
outsidePoint,
|
|
351
|
-
front
|
|
352
|
-
);
|
|
353
|
-
previousPoint = Cartesian3_default.fromArray(
|
|
354
|
-
finalPositions,
|
|
355
|
-
pivot * 3,
|
|
356
|
-
previousPoint
|
|
357
|
-
);
|
|
358
|
-
nextPoint = Cartesian3_default.fromArray(
|
|
359
|
-
finalPositions,
|
|
360
|
-
(start + j) * 3,
|
|
361
|
-
nextPoint
|
|
362
|
-
);
|
|
363
|
-
left = Cartesian3_default.normalize(
|
|
364
|
-
Cartesian3_default.subtract(previousPoint, nextPoint, left),
|
|
365
|
-
left
|
|
366
|
-
);
|
|
367
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
368
|
-
front += 3;
|
|
369
|
-
}
|
|
370
|
-
outsidePoint = Cartesian3_default.fromArray(
|
|
371
|
-
finalPositions,
|
|
372
|
-
pivot * 3,
|
|
373
|
-
outsidePoint
|
|
374
|
-
);
|
|
375
|
-
previousPoint = Cartesian3_default.subtract(
|
|
376
|
-
Cartesian3_default.fromArray(finalPositions, (start + j) * 3, previousPoint),
|
|
377
|
-
outsidePoint,
|
|
378
|
-
previousPoint
|
|
379
|
-
);
|
|
380
|
-
nextPoint = Cartesian3_default.subtract(
|
|
381
|
-
Cartesian3_default.fromArray(finalPositions, start * 3, nextPoint),
|
|
382
|
-
outsidePoint,
|
|
383
|
-
nextPoint
|
|
384
|
-
);
|
|
385
|
-
left = Cartesian3_default.normalize(
|
|
386
|
-
Cartesian3_default.negate(Cartesian3_default.add(nextPoint, previousPoint, left), left),
|
|
387
|
-
left
|
|
388
|
-
);
|
|
389
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
390
|
-
back -= 3;
|
|
391
|
-
}
|
|
392
|
-
rightEdge = positions[posIndex++];
|
|
393
|
-
leftEdge = positions[posIndex++];
|
|
394
|
-
rightEdge.splice(0, 3);
|
|
395
|
-
leftEdge.splice(leftEdge.length - 3, 3);
|
|
396
|
-
finalPositions.set(rightEdge, front);
|
|
397
|
-
finalPositions.set(leftEdge, back - leftEdge.length + 1);
|
|
398
|
-
length = leftEdge.length - 3;
|
|
399
|
-
compIndex += 3;
|
|
400
|
-
left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
|
|
401
|
-
for (j = 0; j < leftEdge.length; j += 3) {
|
|
402
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
403
|
-
Cartesian3_default.fromArray(rightEdge, j, scratch1),
|
|
404
|
-
scratch1
|
|
405
|
-
);
|
|
406
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
407
|
-
Cartesian3_default.fromArray(leftEdge, length - j, scratch2),
|
|
408
|
-
scratch2
|
|
409
|
-
);
|
|
410
|
-
normal = Cartesian3_default.normalize(
|
|
411
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
412
|
-
normal
|
|
413
|
-
);
|
|
414
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
415
|
-
LR = front / 3;
|
|
416
|
-
LL = LR - 1;
|
|
417
|
-
UR = (back - 2) / 3;
|
|
418
|
-
UL = UR + 1;
|
|
419
|
-
indices[index++] = UL;
|
|
420
|
-
indices[index++] = LL;
|
|
421
|
-
indices[index++] = UR;
|
|
422
|
-
indices[index++] = UR;
|
|
423
|
-
indices[index++] = LL;
|
|
424
|
-
indices[index++] = LR;
|
|
425
|
-
front += 3;
|
|
426
|
-
back -= 3;
|
|
427
|
-
}
|
|
428
|
-
front -= 3;
|
|
429
|
-
back += 3;
|
|
430
|
-
}
|
|
431
|
-
normal = Cartesian3_default.fromArray(
|
|
432
|
-
computedNormals,
|
|
433
|
-
computedNormals.length - 3,
|
|
434
|
-
normal
|
|
435
|
-
);
|
|
436
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
437
|
-
if (addEndPositions) {
|
|
438
|
-
front += 3;
|
|
439
|
-
back -= 3;
|
|
440
|
-
leftPos = cartesian3;
|
|
441
|
-
rightPos = cartesian4;
|
|
442
|
-
const lastEndPositions = endPositions[1];
|
|
443
|
-
for (i = 0; i < halfLength; i++) {
|
|
444
|
-
leftPos = Cartesian3_default.fromArray(
|
|
445
|
-
lastEndPositions,
|
|
446
|
-
(endPositionLength - i - 1) * 3,
|
|
447
|
-
leftPos
|
|
448
|
-
);
|
|
449
|
-
rightPos = Cartesian3_default.fromArray(lastEndPositions, i * 3, rightPos);
|
|
450
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
451
|
-
finalPositions,
|
|
452
|
-
leftPos,
|
|
453
|
-
void 0,
|
|
454
|
-
back
|
|
455
|
-
);
|
|
456
|
-
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
|
|
457
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
458
|
-
LR = front / 3;
|
|
459
|
-
LL = LR - 1;
|
|
460
|
-
UR = (back - 2) / 3;
|
|
461
|
-
UL = UR + 1;
|
|
462
|
-
indices[index++] = UL;
|
|
463
|
-
indices[index++] = LL;
|
|
464
|
-
indices[index++] = UR;
|
|
465
|
-
indices[index++] = UR;
|
|
466
|
-
indices[index++] = LL;
|
|
467
|
-
indices[index++] = LR;
|
|
468
|
-
front += 3;
|
|
469
|
-
back -= 3;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
attributes.position = new GeometryAttribute_default({
|
|
473
|
-
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
474
|
-
componentsPerAttribute: 3,
|
|
475
|
-
values: finalPositions
|
|
476
|
-
});
|
|
477
|
-
if (vertexFormat.st) {
|
|
478
|
-
const st = new Float32Array(size / 3 * 2);
|
|
479
|
-
let rightSt;
|
|
480
|
-
let leftSt;
|
|
481
|
-
let stIndex = 0;
|
|
482
|
-
if (addEndPositions) {
|
|
483
|
-
leftCount /= 3;
|
|
484
|
-
rightCount /= 3;
|
|
485
|
-
const theta = Math.PI / (endPositionLength + 1);
|
|
486
|
-
leftSt = 1 / (leftCount - endPositionLength + 1);
|
|
487
|
-
rightSt = 1 / (rightCount - endPositionLength + 1);
|
|
488
|
-
let a;
|
|
489
|
-
const halfEndPos = endPositionLength / 2;
|
|
490
|
-
for (i = halfEndPos + 1; i < endPositionLength + 1; i++) {
|
|
491
|
-
a = Math_default.PI_OVER_TWO + theta * i;
|
|
492
|
-
st[stIndex++] = rightSt * (1 + Math.cos(a));
|
|
493
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
494
|
-
}
|
|
495
|
-
for (i = 1; i < rightCount - endPositionLength + 1; i++) {
|
|
496
|
-
st[stIndex++] = i * rightSt;
|
|
497
|
-
st[stIndex++] = 0;
|
|
498
|
-
}
|
|
499
|
-
for (i = endPositionLength; i > halfEndPos; i--) {
|
|
500
|
-
a = Math_default.PI_OVER_TWO - i * theta;
|
|
501
|
-
st[stIndex++] = 1 - rightSt * (1 + Math.cos(a));
|
|
502
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
503
|
-
}
|
|
504
|
-
for (i = halfEndPos; i > 0; i--) {
|
|
505
|
-
a = Math_default.PI_OVER_TWO - theta * i;
|
|
506
|
-
st[stIndex++] = 1 - leftSt * (1 + Math.cos(a));
|
|
507
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
508
|
-
}
|
|
509
|
-
for (i = leftCount - endPositionLength; i > 0; i--) {
|
|
510
|
-
st[stIndex++] = i * leftSt;
|
|
511
|
-
st[stIndex++] = 1;
|
|
512
|
-
}
|
|
513
|
-
for (i = 1; i < halfEndPos + 1; i++) {
|
|
514
|
-
a = Math_default.PI_OVER_TWO + theta * i;
|
|
515
|
-
st[stIndex++] = leftSt * (1 + Math.cos(a));
|
|
516
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
517
|
-
}
|
|
518
|
-
} else {
|
|
519
|
-
leftCount /= 3;
|
|
520
|
-
rightCount /= 3;
|
|
521
|
-
leftSt = 1 / (leftCount - 1);
|
|
522
|
-
rightSt = 1 / (rightCount - 1);
|
|
523
|
-
for (i = 0; i < rightCount; i++) {
|
|
524
|
-
st[stIndex++] = i * rightSt;
|
|
525
|
-
st[stIndex++] = 0;
|
|
526
|
-
}
|
|
527
|
-
for (i = leftCount; i > 0; i--) {
|
|
528
|
-
st[stIndex++] = (i - 1) * leftSt;
|
|
529
|
-
st[stIndex++] = 1;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
attributes.st = new GeometryAttribute_default({
|
|
533
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
534
|
-
componentsPerAttribute: 2,
|
|
535
|
-
values: st
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (vertexFormat.normal) {
|
|
539
|
-
attributes.normal = new GeometryAttribute_default({
|
|
540
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
541
|
-
componentsPerAttribute: 3,
|
|
542
|
-
values: attr.normals
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
if (vertexFormat.tangent) {
|
|
546
|
-
attributes.tangent = new GeometryAttribute_default({
|
|
547
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
548
|
-
componentsPerAttribute: 3,
|
|
549
|
-
values: attr.tangents
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
if (vertexFormat.bitangent) {
|
|
553
|
-
attributes.bitangent = new GeometryAttribute_default({
|
|
554
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
555
|
-
componentsPerAttribute: 3,
|
|
556
|
-
values: attr.bitangents
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
return {
|
|
560
|
-
attributes,
|
|
561
|
-
indices
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function extrudedAttributes(attributes, vertexFormat) {
|
|
565
|
-
if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
|
|
566
|
-
return attributes;
|
|
567
|
-
}
|
|
568
|
-
const positions = attributes.position.values;
|
|
569
|
-
let topNormals;
|
|
570
|
-
let topBitangents;
|
|
571
|
-
if (vertexFormat.normal || vertexFormat.bitangent) {
|
|
572
|
-
topNormals = attributes.normal.values;
|
|
573
|
-
topBitangents = attributes.bitangent.values;
|
|
574
|
-
}
|
|
575
|
-
const size = attributes.position.values.length / 18;
|
|
576
|
-
const threeSize = size * 3;
|
|
577
|
-
const twoSize = size * 2;
|
|
578
|
-
const sixSize = threeSize * 2;
|
|
579
|
-
let i;
|
|
580
|
-
if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
|
|
581
|
-
const normals = vertexFormat.normal ? new Float32Array(threeSize * 6) : void 0;
|
|
582
|
-
const tangents = vertexFormat.tangent ? new Float32Array(threeSize * 6) : void 0;
|
|
583
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(threeSize * 6) : void 0;
|
|
584
|
-
let topPosition = cartesian1;
|
|
585
|
-
let bottomPosition = cartesian2;
|
|
586
|
-
let previousPosition = cartesian3;
|
|
587
|
-
let normal = cartesian4;
|
|
588
|
-
let tangent = cartesian5;
|
|
589
|
-
let bitangent = cartesian6;
|
|
590
|
-
let attrIndex = sixSize;
|
|
591
|
-
for (i = 0; i < threeSize; i += 3) {
|
|
592
|
-
const attrIndexOffset = attrIndex + sixSize;
|
|
593
|
-
topPosition = Cartesian3_default.fromArray(positions, i, topPosition);
|
|
594
|
-
bottomPosition = Cartesian3_default.fromArray(
|
|
595
|
-
positions,
|
|
596
|
-
i + threeSize,
|
|
597
|
-
bottomPosition
|
|
598
|
-
);
|
|
599
|
-
previousPosition = Cartesian3_default.fromArray(
|
|
600
|
-
positions,
|
|
601
|
-
(i + 3) % threeSize,
|
|
602
|
-
previousPosition
|
|
603
|
-
);
|
|
604
|
-
bottomPosition = Cartesian3_default.subtract(
|
|
605
|
-
bottomPosition,
|
|
606
|
-
topPosition,
|
|
607
|
-
bottomPosition
|
|
608
|
-
);
|
|
609
|
-
previousPosition = Cartesian3_default.subtract(
|
|
610
|
-
previousPosition,
|
|
611
|
-
topPosition,
|
|
612
|
-
previousPosition
|
|
613
|
-
);
|
|
614
|
-
normal = Cartesian3_default.normalize(
|
|
615
|
-
Cartesian3_default.cross(bottomPosition, previousPosition, normal),
|
|
616
|
-
normal
|
|
617
|
-
);
|
|
618
|
-
if (vertexFormat.normal) {
|
|
619
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndexOffset);
|
|
620
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
621
|
-
normals,
|
|
622
|
-
normal,
|
|
623
|
-
attrIndexOffset + 3
|
|
624
|
-
);
|
|
625
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex);
|
|
626
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex + 3);
|
|
627
|
-
}
|
|
628
|
-
if (vertexFormat.tangent || vertexFormat.bitangent) {
|
|
629
|
-
bitangent = Cartesian3_default.fromArray(topNormals, i, bitangent);
|
|
630
|
-
if (vertexFormat.bitangent) {
|
|
631
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
632
|
-
bitangents,
|
|
633
|
-
bitangent,
|
|
634
|
-
attrIndexOffset
|
|
635
|
-
);
|
|
636
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
637
|
-
bitangents,
|
|
638
|
-
bitangent,
|
|
639
|
-
attrIndexOffset + 3
|
|
640
|
-
);
|
|
641
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
642
|
-
bitangents,
|
|
643
|
-
bitangent,
|
|
644
|
-
attrIndex
|
|
645
|
-
);
|
|
646
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
647
|
-
bitangents,
|
|
648
|
-
bitangent,
|
|
649
|
-
attrIndex + 3
|
|
650
|
-
);
|
|
651
|
-
}
|
|
652
|
-
if (vertexFormat.tangent) {
|
|
653
|
-
tangent = Cartesian3_default.normalize(
|
|
654
|
-
Cartesian3_default.cross(bitangent, normal, tangent),
|
|
655
|
-
tangent
|
|
656
|
-
);
|
|
657
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
658
|
-
tangents,
|
|
659
|
-
tangent,
|
|
660
|
-
attrIndexOffset
|
|
661
|
-
);
|
|
662
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
663
|
-
tangents,
|
|
664
|
-
tangent,
|
|
665
|
-
attrIndexOffset + 3
|
|
666
|
-
);
|
|
667
|
-
CorridorGeometryLibrary_default.addAttribute(tangents, tangent, attrIndex);
|
|
668
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
669
|
-
tangents,
|
|
670
|
-
tangent,
|
|
671
|
-
attrIndex + 3
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
attrIndex += 6;
|
|
676
|
-
}
|
|
677
|
-
if (vertexFormat.normal) {
|
|
678
|
-
normals.set(topNormals);
|
|
679
|
-
for (i = 0; i < threeSize; i += 3) {
|
|
680
|
-
normals[i + threeSize] = -topNormals[i];
|
|
681
|
-
normals[i + threeSize + 1] = -topNormals[i + 1];
|
|
682
|
-
normals[i + threeSize + 2] = -topNormals[i + 2];
|
|
683
|
-
}
|
|
684
|
-
attributes.normal.values = normals;
|
|
685
|
-
} else {
|
|
686
|
-
attributes.normal = void 0;
|
|
687
|
-
}
|
|
688
|
-
if (vertexFormat.bitangent) {
|
|
689
|
-
bitangents.set(topBitangents);
|
|
690
|
-
bitangents.set(topBitangents, threeSize);
|
|
691
|
-
attributes.bitangent.values = bitangents;
|
|
692
|
-
} else {
|
|
693
|
-
attributes.bitangent = void 0;
|
|
694
|
-
}
|
|
695
|
-
if (vertexFormat.tangent) {
|
|
696
|
-
const topTangents = attributes.tangent.values;
|
|
697
|
-
tangents.set(topTangents);
|
|
698
|
-
tangents.set(topTangents, threeSize);
|
|
699
|
-
attributes.tangent.values = tangents;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (vertexFormat.st) {
|
|
703
|
-
const topSt = attributes.st.values;
|
|
704
|
-
const st = new Float32Array(twoSize * 6);
|
|
705
|
-
st.set(topSt);
|
|
706
|
-
st.set(topSt, twoSize);
|
|
707
|
-
let index = twoSize * 2;
|
|
708
|
-
for (let j = 0; j < 2; j++) {
|
|
709
|
-
st[index++] = topSt[0];
|
|
710
|
-
st[index++] = topSt[1];
|
|
711
|
-
for (i = 2; i < twoSize; i += 2) {
|
|
712
|
-
const s = topSt[i];
|
|
713
|
-
const t = topSt[i + 1];
|
|
714
|
-
st[index++] = s;
|
|
715
|
-
st[index++] = t;
|
|
716
|
-
st[index++] = s;
|
|
717
|
-
st[index++] = t;
|
|
718
|
-
}
|
|
719
|
-
st[index++] = topSt[0];
|
|
720
|
-
st[index++] = topSt[1];
|
|
721
|
-
}
|
|
722
|
-
attributes.st.values = st;
|
|
723
|
-
}
|
|
724
|
-
return attributes;
|
|
725
|
-
}
|
|
726
|
-
function addWallPositions(positions, index, wallPositions) {
|
|
727
|
-
wallPositions[index++] = positions[0];
|
|
728
|
-
wallPositions[index++] = positions[1];
|
|
729
|
-
wallPositions[index++] = positions[2];
|
|
730
|
-
for (let i = 3; i < positions.length; i += 3) {
|
|
731
|
-
const x = positions[i];
|
|
732
|
-
const y = positions[i + 1];
|
|
733
|
-
const z = positions[i + 2];
|
|
734
|
-
wallPositions[index++] = x;
|
|
735
|
-
wallPositions[index++] = y;
|
|
736
|
-
wallPositions[index++] = z;
|
|
737
|
-
wallPositions[index++] = x;
|
|
738
|
-
wallPositions[index++] = y;
|
|
739
|
-
wallPositions[index++] = z;
|
|
740
|
-
}
|
|
741
|
-
wallPositions[index++] = positions[0];
|
|
742
|
-
wallPositions[index++] = positions[1];
|
|
743
|
-
wallPositions[index++] = positions[2];
|
|
744
|
-
return wallPositions;
|
|
745
|
-
}
|
|
746
|
-
function computePositionsExtruded(params, vertexFormat) {
|
|
747
|
-
const topVertexFormat = new VertexFormat_default({
|
|
748
|
-
position: vertexFormat.position,
|
|
749
|
-
normal: vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
|
|
750
|
-
tangent: vertexFormat.tangent,
|
|
751
|
-
bitangent: vertexFormat.normal || vertexFormat.bitangent,
|
|
752
|
-
st: vertexFormat.st
|
|
753
|
-
});
|
|
754
|
-
const ellipsoid = params.ellipsoid;
|
|
755
|
-
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
|
|
756
|
-
const attr = combine(computedPositions, topVertexFormat, ellipsoid);
|
|
757
|
-
const height = params.height;
|
|
758
|
-
const extrudedHeight = params.extrudedHeight;
|
|
759
|
-
let attributes = attr.attributes;
|
|
760
|
-
const indices = attr.indices;
|
|
761
|
-
let positions = attributes.position.values;
|
|
762
|
-
let length = positions.length;
|
|
763
|
-
const newPositions = new Float64Array(length * 6);
|
|
764
|
-
let extrudedPositions = new Float64Array(length);
|
|
765
|
-
extrudedPositions.set(positions);
|
|
766
|
-
let wallPositions = new Float64Array(length * 4);
|
|
767
|
-
positions = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
768
|
-
positions,
|
|
769
|
-
height,
|
|
770
|
-
ellipsoid
|
|
771
|
-
);
|
|
772
|
-
wallPositions = addWallPositions(positions, 0, wallPositions);
|
|
773
|
-
extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
774
|
-
extrudedPositions,
|
|
775
|
-
extrudedHeight,
|
|
776
|
-
ellipsoid
|
|
777
|
-
);
|
|
778
|
-
wallPositions = addWallPositions(
|
|
779
|
-
extrudedPositions,
|
|
780
|
-
length * 2,
|
|
781
|
-
wallPositions
|
|
782
|
-
);
|
|
783
|
-
newPositions.set(positions);
|
|
784
|
-
newPositions.set(extrudedPositions, length);
|
|
785
|
-
newPositions.set(wallPositions, length * 2);
|
|
786
|
-
attributes.position.values = newPositions;
|
|
787
|
-
attributes = extrudedAttributes(attributes, vertexFormat);
|
|
788
|
-
let i;
|
|
789
|
-
const size = length / 3;
|
|
790
|
-
if (params.shadowVolume) {
|
|
791
|
-
const topNormals = attributes.normal.values;
|
|
792
|
-
length = topNormals.length;
|
|
793
|
-
let extrudeNormals = new Float32Array(length * 6);
|
|
794
|
-
for (i = 0; i < length; i++) {
|
|
795
|
-
topNormals[i] = -topNormals[i];
|
|
796
|
-
}
|
|
797
|
-
extrudeNormals.set(topNormals, length);
|
|
798
|
-
extrudeNormals = addWallPositions(topNormals, length * 4, extrudeNormals);
|
|
799
|
-
attributes.extrudeDirection = new GeometryAttribute_default({
|
|
800
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
801
|
-
componentsPerAttribute: 3,
|
|
802
|
-
values: extrudeNormals
|
|
803
|
-
});
|
|
804
|
-
if (!vertexFormat.normal) {
|
|
805
|
-
attributes.normal = void 0;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
if (defined_default(params.offsetAttribute)) {
|
|
809
|
-
let applyOffset = new Uint8Array(size * 6);
|
|
810
|
-
if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
|
|
811
|
-
applyOffset = applyOffset.fill(1, 0, size).fill(1, size * 2, size * 4);
|
|
812
|
-
} else {
|
|
813
|
-
const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
814
|
-
applyOffset = applyOffset.fill(applyOffsetValue);
|
|
815
|
-
}
|
|
816
|
-
attributes.applyOffset = new GeometryAttribute_default({
|
|
817
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
818
|
-
componentsPerAttribute: 1,
|
|
819
|
-
values: applyOffset
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
const iLength = indices.length;
|
|
823
|
-
const twoSize = size + size;
|
|
824
|
-
const newIndices = IndexDatatype_default.createTypedArray(
|
|
825
|
-
newPositions.length / 3,
|
|
826
|
-
iLength * 2 + twoSize * 3
|
|
827
|
-
);
|
|
828
|
-
newIndices.set(indices);
|
|
829
|
-
let index = iLength;
|
|
830
|
-
for (i = 0; i < iLength; i += 3) {
|
|
831
|
-
const v0 = indices[i];
|
|
832
|
-
const v1 = indices[i + 1];
|
|
833
|
-
const v2 = indices[i + 2];
|
|
834
|
-
newIndices[index++] = v2 + size;
|
|
835
|
-
newIndices[index++] = v1 + size;
|
|
836
|
-
newIndices[index++] = v0 + size;
|
|
837
|
-
}
|
|
838
|
-
let UL, LL, UR, LR;
|
|
839
|
-
for (i = 0; i < twoSize; i += 2) {
|
|
840
|
-
UL = i + twoSize;
|
|
841
|
-
LL = UL + twoSize;
|
|
842
|
-
UR = UL + 1;
|
|
843
|
-
LR = LL + 1;
|
|
844
|
-
newIndices[index++] = UL;
|
|
845
|
-
newIndices[index++] = LL;
|
|
846
|
-
newIndices[index++] = UR;
|
|
847
|
-
newIndices[index++] = UR;
|
|
848
|
-
newIndices[index++] = LL;
|
|
849
|
-
newIndices[index++] = LR;
|
|
850
|
-
}
|
|
851
|
-
return {
|
|
852
|
-
attributes,
|
|
853
|
-
indices: newIndices
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
var scratchCartesian1 = new Cartesian3_default();
|
|
857
|
-
var scratchCartesian2 = new Cartesian3_default();
|
|
858
|
-
var scratchCartographic = new Cartographic_default();
|
|
859
|
-
function computeOffsetPoints(position1, position2, ellipsoid, halfWidth, min, max) {
|
|
860
|
-
const direction = Cartesian3_default.subtract(
|
|
861
|
-
position2,
|
|
862
|
-
position1,
|
|
863
|
-
scratchCartesian1
|
|
864
|
-
);
|
|
865
|
-
Cartesian3_default.normalize(direction, direction);
|
|
866
|
-
const normal = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian2);
|
|
867
|
-
const offsetDirection = Cartesian3_default.cross(
|
|
868
|
-
direction,
|
|
869
|
-
normal,
|
|
870
|
-
scratchCartesian1
|
|
871
|
-
);
|
|
872
|
-
Cartesian3_default.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
|
|
873
|
-
let minLat = min.latitude;
|
|
874
|
-
let minLon = min.longitude;
|
|
875
|
-
let maxLat = max.latitude;
|
|
876
|
-
let maxLon = max.longitude;
|
|
877
|
-
Cartesian3_default.add(position1, offsetDirection, scratchCartesian2);
|
|
878
|
-
ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
|
|
879
|
-
let lat = scratchCartographic.latitude;
|
|
880
|
-
let lon = scratchCartographic.longitude;
|
|
881
|
-
minLat = Math.min(minLat, lat);
|
|
882
|
-
minLon = Math.min(minLon, lon);
|
|
883
|
-
maxLat = Math.max(maxLat, lat);
|
|
884
|
-
maxLon = Math.max(maxLon, lon);
|
|
885
|
-
Cartesian3_default.subtract(position1, offsetDirection, scratchCartesian2);
|
|
886
|
-
ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
|
|
887
|
-
lat = scratchCartographic.latitude;
|
|
888
|
-
lon = scratchCartographic.longitude;
|
|
889
|
-
minLat = Math.min(minLat, lat);
|
|
890
|
-
minLon = Math.min(minLon, lon);
|
|
891
|
-
maxLat = Math.max(maxLat, lat);
|
|
892
|
-
maxLon = Math.max(maxLon, lon);
|
|
893
|
-
min.latitude = minLat;
|
|
894
|
-
min.longitude = minLon;
|
|
895
|
-
max.latitude = maxLat;
|
|
896
|
-
max.longitude = maxLon;
|
|
897
|
-
}
|
|
898
|
-
var scratchCartesianOffset = new Cartesian3_default();
|
|
899
|
-
var scratchCartesianEnds = new Cartesian3_default();
|
|
900
|
-
var scratchCartographicMin = new Cartographic_default();
|
|
901
|
-
var scratchCartographicMax = new Cartographic_default();
|
|
902
|
-
function computeRectangle(positions, ellipsoid, width, cornerType, result) {
|
|
903
|
-
positions = scaleToSurface(positions, ellipsoid);
|
|
904
|
-
const cleanPositions = arrayRemoveDuplicates_default(
|
|
905
|
-
positions,
|
|
906
|
-
Cartesian3_default.equalsEpsilon
|
|
907
|
-
);
|
|
908
|
-
const length = cleanPositions.length;
|
|
909
|
-
if (length < 2 || width <= 0) {
|
|
910
|
-
return new Rectangle_default();
|
|
911
|
-
}
|
|
912
|
-
const halfWidth = width * 0.5;
|
|
913
|
-
scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
|
|
914
|
-
scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
|
|
915
|
-
scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
|
|
916
|
-
scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
|
|
917
|
-
let lat, lon;
|
|
918
|
-
if (cornerType === CornerType_default.ROUNDED) {
|
|
919
|
-
const first = cleanPositions[0];
|
|
920
|
-
Cartesian3_default.subtract(first, cleanPositions[1], scratchCartesianOffset);
|
|
921
|
-
Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
|
|
922
|
-
Cartesian3_default.multiplyByScalar(
|
|
923
|
-
scratchCartesianOffset,
|
|
924
|
-
halfWidth,
|
|
925
|
-
scratchCartesianOffset
|
|
926
|
-
);
|
|
927
|
-
Cartesian3_default.add(first, scratchCartesianOffset, scratchCartesianEnds);
|
|
928
|
-
ellipsoid.cartesianToCartographic(
|
|
929
|
-
scratchCartesianEnds,
|
|
930
|
-
scratchCartographic
|
|
931
|
-
);
|
|
932
|
-
lat = scratchCartographic.latitude;
|
|
933
|
-
lon = scratchCartographic.longitude;
|
|
934
|
-
scratchCartographicMin.latitude = Math.min(
|
|
935
|
-
scratchCartographicMin.latitude,
|
|
936
|
-
lat
|
|
937
|
-
);
|
|
938
|
-
scratchCartographicMin.longitude = Math.min(
|
|
939
|
-
scratchCartographicMin.longitude,
|
|
940
|
-
lon
|
|
941
|
-
);
|
|
942
|
-
scratchCartographicMax.latitude = Math.max(
|
|
943
|
-
scratchCartographicMax.latitude,
|
|
944
|
-
lat
|
|
945
|
-
);
|
|
946
|
-
scratchCartographicMax.longitude = Math.max(
|
|
947
|
-
scratchCartographicMax.longitude,
|
|
948
|
-
lon
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
for (let i = 0; i < length - 1; ++i) {
|
|
952
|
-
computeOffsetPoints(
|
|
953
|
-
cleanPositions[i],
|
|
954
|
-
cleanPositions[i + 1],
|
|
955
|
-
ellipsoid,
|
|
956
|
-
halfWidth,
|
|
957
|
-
scratchCartographicMin,
|
|
958
|
-
scratchCartographicMax
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
|
-
const last = cleanPositions[length - 1];
|
|
962
|
-
Cartesian3_default.subtract(last, cleanPositions[length - 2], scratchCartesianOffset);
|
|
963
|
-
Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
|
|
964
|
-
Cartesian3_default.multiplyByScalar(
|
|
965
|
-
scratchCartesianOffset,
|
|
966
|
-
halfWidth,
|
|
967
|
-
scratchCartesianOffset
|
|
968
|
-
);
|
|
969
|
-
Cartesian3_default.add(last, scratchCartesianOffset, scratchCartesianEnds);
|
|
970
|
-
computeOffsetPoints(
|
|
971
|
-
last,
|
|
972
|
-
scratchCartesianEnds,
|
|
973
|
-
ellipsoid,
|
|
974
|
-
halfWidth,
|
|
975
|
-
scratchCartographicMin,
|
|
976
|
-
scratchCartographicMax
|
|
977
|
-
);
|
|
978
|
-
if (cornerType === CornerType_default.ROUNDED) {
|
|
979
|
-
ellipsoid.cartesianToCartographic(
|
|
980
|
-
scratchCartesianEnds,
|
|
981
|
-
scratchCartographic
|
|
982
|
-
);
|
|
983
|
-
lat = scratchCartographic.latitude;
|
|
984
|
-
lon = scratchCartographic.longitude;
|
|
985
|
-
scratchCartographicMin.latitude = Math.min(
|
|
986
|
-
scratchCartographicMin.latitude,
|
|
987
|
-
lat
|
|
988
|
-
);
|
|
989
|
-
scratchCartographicMin.longitude = Math.min(
|
|
990
|
-
scratchCartographicMin.longitude,
|
|
991
|
-
lon
|
|
992
|
-
);
|
|
993
|
-
scratchCartographicMax.latitude = Math.max(
|
|
994
|
-
scratchCartographicMax.latitude,
|
|
995
|
-
lat
|
|
996
|
-
);
|
|
997
|
-
scratchCartographicMax.longitude = Math.max(
|
|
998
|
-
scratchCartographicMax.longitude,
|
|
999
|
-
lon
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
const rectangle = defined_default(result) ? result : new Rectangle_default();
|
|
1003
|
-
rectangle.north = scratchCartographicMax.latitude;
|
|
1004
|
-
rectangle.south = scratchCartographicMin.latitude;
|
|
1005
|
-
rectangle.east = scratchCartographicMax.longitude;
|
|
1006
|
-
rectangle.west = scratchCartographicMin.longitude;
|
|
1007
|
-
return rectangle;
|
|
1008
|
-
}
|
|
1009
|
-
function CorridorGeometry(options) {
|
|
1010
|
-
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
|
|
1011
|
-
const positions = options.positions;
|
|
1012
|
-
const width = options.width;
|
|
1013
|
-
Check_default.defined("options.positions", positions);
|
|
1014
|
-
Check_default.defined("options.width", width);
|
|
1015
|
-
const height = defaultValue_default(options.height, 0);
|
|
1016
|
-
const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
|
|
1017
|
-
this._positions = positions;
|
|
1018
|
-
this._ellipsoid = Ellipsoid_default.clone(
|
|
1019
|
-
defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
|
|
1020
|
-
);
|
|
1021
|
-
this._vertexFormat = VertexFormat_default.clone(
|
|
1022
|
-
defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
|
|
1023
|
-
);
|
|
1024
|
-
this._width = width;
|
|
1025
|
-
this._height = Math.max(height, extrudedHeight);
|
|
1026
|
-
this._extrudedHeight = Math.min(height, extrudedHeight);
|
|
1027
|
-
this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
|
|
1028
|
-
this._granularity = defaultValue_default(
|
|
1029
|
-
options.granularity,
|
|
1030
|
-
Math_default.RADIANS_PER_DEGREE
|
|
1031
|
-
);
|
|
1032
|
-
this._shadowVolume = defaultValue_default(options.shadowVolume, false);
|
|
1033
|
-
this._workerName = "createCorridorGeometry";
|
|
1034
|
-
this._offsetAttribute = options.offsetAttribute;
|
|
1035
|
-
this._rectangle = void 0;
|
|
1036
|
-
this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
|
|
1037
|
-
}
|
|
1038
|
-
CorridorGeometry.pack = function(value, array, startingIndex) {
|
|
1039
|
-
Check_default.defined("value", value);
|
|
1040
|
-
Check_default.defined("array", array);
|
|
1041
|
-
startingIndex = defaultValue_default(startingIndex, 0);
|
|
1042
|
-
const positions = value._positions;
|
|
1043
|
-
const length = positions.length;
|
|
1044
|
-
array[startingIndex++] = length;
|
|
1045
|
-
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
|
|
1046
|
-
Cartesian3_default.pack(positions[i], array, startingIndex);
|
|
1047
|
-
}
|
|
1048
|
-
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
|
|
1049
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
1050
|
-
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
|
|
1051
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
1052
|
-
array[startingIndex++] = value._width;
|
|
1053
|
-
array[startingIndex++] = value._height;
|
|
1054
|
-
array[startingIndex++] = value._extrudedHeight;
|
|
1055
|
-
array[startingIndex++] = value._cornerType;
|
|
1056
|
-
array[startingIndex++] = value._granularity;
|
|
1057
|
-
array[startingIndex++] = value._shadowVolume ? 1 : 0;
|
|
1058
|
-
array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
|
|
1059
|
-
return array;
|
|
1060
|
-
};
|
|
1061
|
-
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
|
|
1062
|
-
var scratchVertexFormat = new VertexFormat_default();
|
|
1063
|
-
var scratchOptions = {
|
|
1064
|
-
positions: void 0,
|
|
1065
|
-
ellipsoid: scratchEllipsoid,
|
|
1066
|
-
vertexFormat: scratchVertexFormat,
|
|
1067
|
-
width: void 0,
|
|
1068
|
-
height: void 0,
|
|
1069
|
-
extrudedHeight: void 0,
|
|
1070
|
-
cornerType: void 0,
|
|
1071
|
-
granularity: void 0,
|
|
1072
|
-
shadowVolume: void 0,
|
|
1073
|
-
offsetAttribute: void 0
|
|
1074
|
-
};
|
|
1075
|
-
CorridorGeometry.unpack = function(array, startingIndex, result) {
|
|
1076
|
-
Check_default.defined("array", array);
|
|
1077
|
-
startingIndex = defaultValue_default(startingIndex, 0);
|
|
1078
|
-
const length = array[startingIndex++];
|
|
1079
|
-
const positions = new Array(length);
|
|
1080
|
-
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
|
|
1081
|
-
positions[i] = Cartesian3_default.unpack(array, startingIndex);
|
|
1082
|
-
}
|
|
1083
|
-
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
|
|
1084
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
1085
|
-
const vertexFormat = VertexFormat_default.unpack(
|
|
1086
|
-
array,
|
|
1087
|
-
startingIndex,
|
|
1088
|
-
scratchVertexFormat
|
|
1089
|
-
);
|
|
1090
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
1091
|
-
const width = array[startingIndex++];
|
|
1092
|
-
const height = array[startingIndex++];
|
|
1093
|
-
const extrudedHeight = array[startingIndex++];
|
|
1094
|
-
const cornerType = array[startingIndex++];
|
|
1095
|
-
const granularity = array[startingIndex++];
|
|
1096
|
-
const shadowVolume = array[startingIndex++] === 1;
|
|
1097
|
-
const offsetAttribute = array[startingIndex];
|
|
1098
|
-
if (!defined_default(result)) {
|
|
1099
|
-
scratchOptions.positions = positions;
|
|
1100
|
-
scratchOptions.width = width;
|
|
1101
|
-
scratchOptions.height = height;
|
|
1102
|
-
scratchOptions.extrudedHeight = extrudedHeight;
|
|
1103
|
-
scratchOptions.cornerType = cornerType;
|
|
1104
|
-
scratchOptions.granularity = granularity;
|
|
1105
|
-
scratchOptions.shadowVolume = shadowVolume;
|
|
1106
|
-
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
1107
|
-
return new CorridorGeometry(scratchOptions);
|
|
1108
|
-
}
|
|
1109
|
-
result._positions = positions;
|
|
1110
|
-
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
|
|
1111
|
-
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
|
|
1112
|
-
result._width = width;
|
|
1113
|
-
result._height = height;
|
|
1114
|
-
result._extrudedHeight = extrudedHeight;
|
|
1115
|
-
result._cornerType = cornerType;
|
|
1116
|
-
result._granularity = granularity;
|
|
1117
|
-
result._shadowVolume = shadowVolume;
|
|
1118
|
-
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
1119
|
-
return result;
|
|
1120
|
-
};
|
|
1121
|
-
CorridorGeometry.computeRectangle = function(options, result) {
|
|
1122
|
-
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
|
|
1123
|
-
const positions = options.positions;
|
|
1124
|
-
const width = options.width;
|
|
1125
|
-
Check_default.defined("options.positions", positions);
|
|
1126
|
-
Check_default.defined("options.width", width);
|
|
1127
|
-
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
|
|
1128
|
-
const cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
|
|
1129
|
-
return computeRectangle(positions, ellipsoid, width, cornerType, result);
|
|
1130
|
-
};
|
|
1131
|
-
CorridorGeometry.createGeometry = function(corridorGeometry) {
|
|
1132
|
-
let positions = corridorGeometry._positions;
|
|
1133
|
-
const width = corridorGeometry._width;
|
|
1134
|
-
const ellipsoid = corridorGeometry._ellipsoid;
|
|
1135
|
-
positions = scaleToSurface(positions, ellipsoid);
|
|
1136
|
-
const cleanPositions = arrayRemoveDuplicates_default(
|
|
1137
|
-
positions,
|
|
1138
|
-
Cartesian3_default.equalsEpsilon
|
|
1139
|
-
);
|
|
1140
|
-
if (cleanPositions.length < 2 || width <= 0) {
|
|
1141
|
-
return;
|
|
1142
|
-
}
|
|
1143
|
-
const height = corridorGeometry._height;
|
|
1144
|
-
const extrudedHeight = corridorGeometry._extrudedHeight;
|
|
1145
|
-
const extrude = !Math_default.equalsEpsilon(
|
|
1146
|
-
height,
|
|
1147
|
-
extrudedHeight,
|
|
1148
|
-
0,
|
|
1149
|
-
Math_default.EPSILON2
|
|
1150
|
-
);
|
|
1151
|
-
const vertexFormat = corridorGeometry._vertexFormat;
|
|
1152
|
-
const params = {
|
|
1153
|
-
ellipsoid,
|
|
1154
|
-
positions: cleanPositions,
|
|
1155
|
-
width,
|
|
1156
|
-
cornerType: corridorGeometry._cornerType,
|
|
1157
|
-
granularity: corridorGeometry._granularity,
|
|
1158
|
-
saveAttributes: true
|
|
1159
|
-
};
|
|
1160
|
-
let attr;
|
|
1161
|
-
if (extrude) {
|
|
1162
|
-
params.height = height;
|
|
1163
|
-
params.extrudedHeight = extrudedHeight;
|
|
1164
|
-
params.shadowVolume = corridorGeometry._shadowVolume;
|
|
1165
|
-
params.offsetAttribute = corridorGeometry._offsetAttribute;
|
|
1166
|
-
attr = computePositionsExtruded(params, vertexFormat);
|
|
1167
|
-
} else {
|
|
1168
|
-
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
|
|
1169
|
-
attr = combine(computedPositions, vertexFormat, ellipsoid);
|
|
1170
|
-
attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
1171
|
-
attr.attributes.position.values,
|
|
1172
|
-
height,
|
|
1173
|
-
ellipsoid
|
|
1174
|
-
);
|
|
1175
|
-
if (defined_default(corridorGeometry._offsetAttribute)) {
|
|
1176
|
-
const applyOffsetValue = corridorGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
1177
|
-
const length = attr.attributes.position.values.length;
|
|
1178
|
-
const applyOffset = new Uint8Array(length / 3).fill(applyOffsetValue);
|
|
1179
|
-
attr.attributes.applyOffset = new GeometryAttribute_default({
|
|
1180
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
1181
|
-
componentsPerAttribute: 1,
|
|
1182
|
-
values: applyOffset
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
const attributes = attr.attributes;
|
|
1187
|
-
const boundingSphere = BoundingSphere_default.fromVertices(
|
|
1188
|
-
attributes.position.values,
|
|
1189
|
-
void 0,
|
|
1190
|
-
3
|
|
1191
|
-
);
|
|
1192
|
-
if (!vertexFormat.position) {
|
|
1193
|
-
attr.attributes.position.values = void 0;
|
|
1194
|
-
}
|
|
1195
|
-
return new Geometry_default({
|
|
1196
|
-
attributes,
|
|
1197
|
-
indices: attr.indices,
|
|
1198
|
-
primitiveType: PrimitiveType_default.TRIANGLES,
|
|
1199
|
-
boundingSphere,
|
|
1200
|
-
offsetAttribute: corridorGeometry._offsetAttribute
|
|
1201
|
-
});
|
|
1202
|
-
};
|
|
1203
|
-
CorridorGeometry.createShadowVolume = function(corridorGeometry, minHeightFunc, maxHeightFunc) {
|
|
1204
|
-
const granularity = corridorGeometry._granularity;
|
|
1205
|
-
const ellipsoid = corridorGeometry._ellipsoid;
|
|
1206
|
-
const minHeight = minHeightFunc(granularity, ellipsoid);
|
|
1207
|
-
const maxHeight = maxHeightFunc(granularity, ellipsoid);
|
|
1208
|
-
return new CorridorGeometry({
|
|
1209
|
-
positions: corridorGeometry._positions,
|
|
1210
|
-
width: corridorGeometry._width,
|
|
1211
|
-
cornerType: corridorGeometry._cornerType,
|
|
1212
|
-
ellipsoid,
|
|
1213
|
-
granularity,
|
|
1214
|
-
extrudedHeight: minHeight,
|
|
1215
|
-
height: maxHeight,
|
|
1216
|
-
vertexFormat: VertexFormat_default.POSITION_ONLY,
|
|
1217
|
-
shadowVolume: true
|
|
1218
|
-
});
|
|
1219
|
-
};
|
|
1220
|
-
Object.defineProperties(CorridorGeometry.prototype, {
|
|
1221
|
-
/**
|
|
1222
|
-
* @private
|
|
1223
|
-
*/
|
|
1224
|
-
rectangle: {
|
|
1225
|
-
get: function() {
|
|
1226
|
-
if (!defined_default(this._rectangle)) {
|
|
1227
|
-
this._rectangle = computeRectangle(
|
|
1228
|
-
this._positions,
|
|
1229
|
-
this._ellipsoid,
|
|
1230
|
-
this._width,
|
|
1231
|
-
this._cornerType
|
|
1232
|
-
);
|
|
1233
|
-
}
|
|
1234
|
-
return this._rectangle;
|
|
1235
|
-
}
|
|
1236
|
-
},
|
|
1237
|
-
/**
|
|
1238
|
-
* For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
|
|
1239
|
-
*
|
|
1240
|
-
* Corridors don't support stRotation,
|
|
1241
|
-
* so just return the corners of the original system.
|
|
1242
|
-
* @private
|
|
1243
|
-
*/
|
|
1244
|
-
textureCoordinateRotationPoints: {
|
|
1245
|
-
get: function() {
|
|
1246
|
-
return [0, 0, 0, 1, 1, 0];
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
});
|
|
1250
|
-
var CorridorGeometry_default = CorridorGeometry;
|
|
1251
|
-
|
|
1252
|
-
// packages/engine/Source/Workers/createCorridorGeometry.js
|
|
1253
|
-
function createCorridorGeometry(corridorGeometry, offset) {
|
|
1254
|
-
if (defined_default(offset)) {
|
|
1255
|
-
corridorGeometry = CorridorGeometry_default.unpack(corridorGeometry, offset);
|
|
1256
|
-
}
|
|
1257
|
-
corridorGeometry._ellipsoid = Ellipsoid_default.clone(corridorGeometry._ellipsoid);
|
|
1258
|
-
return CorridorGeometry_default.createGeometry(corridorGeometry);
|
|
1259
|
-
}
|
|
1260
|
-
var createCorridorGeometry_default = createCorridorGeometry;
|
|
1261
|
-
export {
|
|
1262
|
-
createCorridorGeometry_default as default
|
|
1263
|
-
};
|
|
26
|
+
import{a as M}from"./chunk-WWA5PL4H.js";import{a as ut}from"./chunk-B4AA3ARO.js";import"./chunk-XRL4AVS5.js";import"./chunk-U4IEOH5K.js";import{a as bt}from"./chunk-GBYLG25F.js";import{a as J}from"./chunk-CYCB63OH.js";import"./chunk-TCGIRNHN.js";import"./chunk-N4VJKXZS.js";import{b as _t}from"./chunk-77IHZJJ3.js";import{a as Pt}from"./chunk-3W4GT7KQ.js";import"./chunk-G5AGHVVC.js";import"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as Nt}from"./chunk-OFUUQVMR.js";import{a as Dt}from"./chunk-A56XVLQR.js";import{b as Mt,c as Ct,d as F}from"./chunk-RCV6KWXS.js";import{d as St}from"./chunk-4IW2T6GF.js";import{h as Et}from"./chunk-PSPPBZWI.js";import{a as v}from"./chunk-AU7IKHOH.js";import{a as o,b as At,d as Y,f as Tt}from"./chunk-64RSHJUE.js";import{a as it}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{b as ot}from"./chunk-LEYMRMBK.js";import{e as Q}from"./chunk-VTAIKJXX.js";var Rt=new o,kt=new o,yt=new o,wt=new o,jt=new o,Ht=new o,st=new o,dt=new o;function Ut(t,e){for(let i=0;i<t.length;i++)t[i]=e.scaleToGeodeticSurface(t[i],t[i]);return t}function X(t,e,i,l,d,f){let h=t.normals,O=t.tangents,g=t.bitangents,r=o.normalize(o.cross(i,e,st),st);f.normal&&M.addAttribute(h,e,l,d),f.tangent&&M.addAttribute(O,r,l,d),f.bitangent&&M.addAttribute(g,i,l,d)}function Bt(t,e,i){let l=t.positions,d=t.corners,f=t.endPositions,h=t.lefts,O=t.normals,g=new Dt,r,a=0,s=0,n,A=0,u;for(n=0;n<l.length;n+=2)u=l[n].length-3,a+=u,A+=u*2,s+=l[n+1].length-3;for(a+=3,s+=3,n=0;n<d.length;n++){r=d[n];let c=d[n].leftPositions;Q(c)?(u=c.length,a+=u,A+=u):(u=d[n].rightPositions.length,s+=u,A+=u)}let b=Q(f),p;b&&(p=f[0].length-3,a+=p,s+=p,p/=3,A+=p*6);let z=a+s,m=new Float64Array(z),D=e.normal?new Float32Array(z):void 0,V=e.tangent?new Float32Array(z):void 0,rt=e.bitangent?new Float32Array(z):void 0,R={normals:D,tangents:V,bitangents:rt},y=0,E=z-1,S,C,H,q,P=Rt,w=kt,et,nt,pt=p/2,_=Nt.createTypedArray(z/3,A),T=0;if(b){nt=yt,et=wt;let c=f[0];for(P=o.fromArray(O,0,P),w=o.fromArray(h,0,w),n=0;n<pt;n++)nt=o.fromArray(c,(pt-1-n)*3,nt),et=o.fromArray(c,(pt+n)*3,et),M.addAttribute(m,et,y),M.addAttribute(m,nt,void 0,E),X(R,P,w,y,E,e),C=y/3,q=C+1,S=(E-2)/3,H=S-1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3}let mt=0,ft=0,at=l[mt++],j=l[mt++];m.set(at,y),m.set(j,E-j.length+1),w=o.fromArray(h,ft,w);let lt,ct;for(u=j.length-3,n=0;n<u;n+=3)lt=i.geodeticSurfaceNormal(o.fromArray(at,n,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u-n,dt),dt),P=o.normalize(o.add(lt,ct,P),P),X(R,P,w,y,E,e),C=y/3,q=C+1,S=(E-2)/3,H=S-1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3;for(lt=i.geodeticSurfaceNormal(o.fromArray(at,u,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u,dt),dt),P=o.normalize(o.add(lt,ct,P),P),ft+=3,n=0;n<d.length;n++){let c;r=d[n];let Z=r.leftPositions,$=r.rightPositions,L,U,N=Ht,k=yt,B=wt;if(P=o.fromArray(O,ft,P),Q(Z)){for(X(R,P,w,void 0,E,e),E-=3,L=q,U=H,c=0;c<Z.length/3;c++)N=o.fromArray(Z,c*3,N),_[T++]=L,_[T++]=U-c-1,_[T++]=U-c,M.addAttribute(m,N,void 0,E),k=o.fromArray(m,(U-c-1)*3,k),B=o.fromArray(m,L*3,B),w=o.normalize(o.subtract(k,B,w),w),X(R,P,w,void 0,E,e),E-=3;N=o.fromArray(m,L*3,N),k=o.subtract(o.fromArray(m,U*3,k),N,k),B=o.subtract(o.fromArray(m,(U-c)*3,B),N,B),w=o.normalize(o.add(k,B,w),w),X(R,P,w,y,void 0,e),y+=3}else{for(X(R,P,w,y,void 0,e),y+=3,L=H,U=q,c=0;c<$.length/3;c++)N=o.fromArray($,c*3,N),_[T++]=L,_[T++]=U+c,_[T++]=U+c+1,M.addAttribute(m,N,y),k=o.fromArray(m,L*3,k),B=o.fromArray(m,(U+c)*3,B),w=o.normalize(o.subtract(k,B,w),w),X(R,P,w,y,void 0,e),y+=3;N=o.fromArray(m,L*3,N),k=o.subtract(o.fromArray(m,(U+c)*3,k),N,k),B=o.subtract(o.fromArray(m,U*3,B),N,B),w=o.normalize(o.negate(o.add(B,k,w),w),w),X(R,P,w,void 0,E,e),E-=3}for(at=l[mt++],j=l[mt++],at.splice(0,3),j.splice(j.length-3,3),m.set(at,y),m.set(j,E-j.length+1),u=j.length-3,ft+=3,w=o.fromArray(h,ft,w),c=0;c<j.length;c+=3)lt=i.geodeticSurfaceNormal(o.fromArray(at,c,st),st),ct=i.geodeticSurfaceNormal(o.fromArray(j,u-c,dt),dt),P=o.normalize(o.add(lt,ct,P),P),X(R,P,w,y,E,e),q=y/3,C=q-1,H=(E-2)/3,S=H+1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3;y-=3,E+=3}if(P=o.fromArray(O,O.length-3,P),X(R,P,w,y,E,e),b){y+=3,E-=3,nt=yt,et=wt;let c=f[1];for(n=0;n<pt;n++)nt=o.fromArray(c,(p-n-1)*3,nt),et=o.fromArray(c,n*3,et),M.addAttribute(m,nt,void 0,E),M.addAttribute(m,et,y),X(R,P,w,y,E,e),q=y/3,C=q-1,H=(E-2)/3,S=H+1,_[T++]=S,_[T++]=C,_[T++]=H,_[T++]=H,_[T++]=C,_[T++]=q,y+=3,E-=3}if(g.position=new F({componentDatatype:v.DOUBLE,componentsPerAttribute:3,values:m}),e.st){let c=new Float32Array(z/3*2),Z,$,L=0;if(b){a/=3,s/=3;let U=Math.PI/(p+1);$=1/(a-p+1),Z=1/(s-p+1);let N,k=p/2;for(n=k+1;n<p+1;n++)N=it.PI_OVER_TWO+U*n,c[L++]=Z*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=1;n<s-p+1;n++)c[L++]=n*Z,c[L++]=0;for(n=p;n>k;n--)N=it.PI_OVER_TWO-n*U,c[L++]=1-Z*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=k;n>0;n--)N=it.PI_OVER_TWO-U*n,c[L++]=1-$*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N));for(n=a-p;n>0;n--)c[L++]=n*$,c[L++]=1;for(n=1;n<k+1;n++)N=it.PI_OVER_TWO+U*n,c[L++]=$*(1+Math.cos(N)),c[L++]=.5*(1+Math.sin(N))}else{for(a/=3,s/=3,$=1/(a-1),Z=1/(s-1),n=0;n<s;n++)c[L++]=n*Z,c[L++]=0;for(n=a;n>0;n--)c[L++]=(n-1)*$,c[L++]=1}g.st=new F({componentDatatype:v.FLOAT,componentsPerAttribute:2,values:c})}return e.normal&&(g.normal=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.normals})),e.tangent&&(g.tangent=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.tangents})),e.bitangent&&(g.bitangent=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:R.bitangents})),{attributes:g,indices:_}}function qt(t,e){if(!e.normal&&!e.tangent&&!e.bitangent&&!e.st)return t;let i=t.position.values,l,d;(e.normal||e.bitangent)&&(l=t.normal.values,d=t.bitangent.values);let f=t.position.values.length/18,h=f*3,O=f*2,g=h*2,r;if(e.normal||e.bitangent||e.tangent){let a=e.normal?new Float32Array(h*6):void 0,s=e.tangent?new Float32Array(h*6):void 0,n=e.bitangent?new Float32Array(h*6):void 0,A=Rt,u=kt,b=yt,p=wt,z=jt,m=Ht,D=g;for(r=0;r<h;r+=3){let V=D+g;A=o.fromArray(i,r,A),u=o.fromArray(i,r+h,u),b=o.fromArray(i,(r+3)%h,b),u=o.subtract(u,A,u),b=o.subtract(b,A,b),p=o.normalize(o.cross(u,b,p),p),e.normal&&(M.addAttribute(a,p,V),M.addAttribute(a,p,V+3),M.addAttribute(a,p,D),M.addAttribute(a,p,D+3)),(e.tangent||e.bitangent)&&(m=o.fromArray(l,r,m),e.bitangent&&(M.addAttribute(n,m,V),M.addAttribute(n,m,V+3),M.addAttribute(n,m,D),M.addAttribute(n,m,D+3)),e.tangent&&(z=o.normalize(o.cross(m,p,z),z),M.addAttribute(s,z,V),M.addAttribute(s,z,V+3),M.addAttribute(s,z,D),M.addAttribute(s,z,D+3))),D+=6}if(e.normal){for(a.set(l),r=0;r<h;r+=3)a[r+h]=-l[r],a[r+h+1]=-l[r+1],a[r+h+2]=-l[r+2];t.normal.values=a}else t.normal=void 0;if(e.bitangent?(n.set(d),n.set(d,h),t.bitangent.values=n):t.bitangent=void 0,e.tangent){let V=t.tangent.values;s.set(V),s.set(V,h),t.tangent.values=s}}if(e.st){let a=t.st.values,s=new Float32Array(O*6);s.set(a),s.set(a,O);let n=O*2;for(let A=0;A<2;A++){for(s[n++]=a[0],s[n++]=a[1],r=2;r<O;r+=2){let u=a[r],b=a[r+1];s[n++]=u,s[n++]=b,s[n++]=u,s[n++]=b}s[n++]=a[0],s[n++]=a[1]}t.st.values=s}return t}function Ot(t,e,i){i[e++]=t[0],i[e++]=t[1],i[e++]=t[2];for(let l=3;l<t.length;l+=3){let d=t[l],f=t[l+1],h=t[l+2];i[e++]=d,i[e++]=f,i[e++]=h,i[e++]=d,i[e++]=f,i[e++]=h}return i[e++]=t[0],i[e++]=t[1],i[e++]=t[2],i}function Jt(t,e){let i=new J({position:e.position,normal:e.normal||e.bitangent||t.shadowVolume,tangent:e.tangent,bitangent:e.normal||e.bitangent,st:e.st}),l=t.ellipsoid,d=M.computePositions(t),f=Bt(d,i,l),h=t.height,O=t.extrudedHeight,g=f.attributes,r=f.indices,a=g.position.values,s=a.length,n=new Float64Array(s*6),A=new Float64Array(s);A.set(a);let u=new Float64Array(s*4);a=_t.scaleToGeodeticHeight(a,h,l),u=Ot(a,0,u),A=_t.scaleToGeodeticHeight(A,O,l),u=Ot(A,s*2,u),n.set(a),n.set(A,s),n.set(u,s*2),g.position.values=n,g=qt(g,e);let b,p=s/3;if(t.shadowVolume){let S=g.normal.values;s=S.length;let C=new Float32Array(s*6);for(b=0;b<s;b++)S[b]=-S[b];C.set(S,s),C=Ot(S,s*4,C),g.extrudeDirection=new F({componentDatatype:v.FLOAT,componentsPerAttribute:3,values:C}),e.normal||(g.normal=void 0)}if(Q(t.offsetAttribute)){let S=new Uint8Array(p*6);if(t.offsetAttribute===bt.TOP)S=S.fill(1,0,p).fill(1,p*2,p*4);else{let C=t.offsetAttribute===bt.NONE?0:1;S=S.fill(C)}g.applyOffset=new F({componentDatatype:v.UNSIGNED_BYTE,componentsPerAttribute:1,values:S})}let z=r.length,m=p+p,D=Nt.createTypedArray(n.length/3,z*2+m*3);D.set(r);let V=z;for(b=0;b<z;b+=3){let S=r[b],C=r[b+1],H=r[b+2];D[V++]=H+p,D[V++]=C+p,D[V++]=S+p}let rt,R,y,E;for(b=0;b<m;b+=2)rt=b+m,R=rt+m,y=rt+1,E=R+1,D[V++]=rt,D[V++]=R,D[V++]=y,D[V++]=y,D[V++]=R,D[V++]=E;return{attributes:g,indices:D}}var Vt=new o,ht=new o,K=new At;function zt(t,e,i,l,d,f){let h=o.subtract(e,t,Vt);o.normalize(h,h);let O=i.geodeticSurfaceNormal(t,ht),g=o.cross(h,O,Vt);o.multiplyByScalar(g,l,g);let r=d.latitude,a=d.longitude,s=f.latitude,n=f.longitude;o.add(t,g,ht),i.cartesianToCartographic(ht,K);let A=K.latitude,u=K.longitude;r=Math.min(r,A),a=Math.min(a,u),s=Math.max(s,A),n=Math.max(n,u),o.subtract(t,g,ht),i.cartesianToCartographic(ht,K),A=K.latitude,u=K.longitude,r=Math.min(r,A),a=Math.min(a,u),s=Math.max(s,A),n=Math.max(n,u),d.latitude=r,d.longitude=a,f.latitude=s,f.longitude=n}var G=new o,gt=new o,I=new At,W=new At;function Yt(t,e,i,l,d){t=Ut(t,e);let f=Pt(t,o.equalsEpsilon),h=f.length;if(h<2||i<=0)return new Et;let O=i*.5;I.latitude=Number.POSITIVE_INFINITY,I.longitude=Number.POSITIVE_INFINITY,W.latitude=Number.NEGATIVE_INFINITY,W.longitude=Number.NEGATIVE_INFINITY;let g,r;if(l===ut.ROUNDED){let n=f[0];o.subtract(n,f[1],G),o.normalize(G,G),o.multiplyByScalar(G,O,G),o.add(n,G,gt),e.cartesianToCartographic(gt,K),g=K.latitude,r=K.longitude,I.latitude=Math.min(I.latitude,g),I.longitude=Math.min(I.longitude,r),W.latitude=Math.max(W.latitude,g),W.longitude=Math.max(W.longitude,r)}for(let n=0;n<h-1;++n)zt(f[n],f[n+1],e,O,I,W);let a=f[h-1];o.subtract(a,f[h-2],G),o.normalize(G,G),o.multiplyByScalar(G,O,G),o.add(a,G,gt),zt(a,gt,e,O,I,W),l===ut.ROUNDED&&(e.cartesianToCartographic(gt,K),g=K.latitude,r=K.longitude,I.latitude=Math.min(I.latitude,g),I.longitude=Math.min(I.longitude,r),W.latitude=Math.max(W.latitude,g),W.longitude=Math.max(W.longitude,r));let s=Q(d)?d:new Et;return s.north=W.latitude,s.south=I.latitude,s.east=W.longitude,s.west=I.longitude,s}function tt(t){t=t??Tt.EMPTY_OBJECT;let e=t.positions,i=t.width;ot.defined("options.positions",e),ot.defined("options.width",i);let l=t.height??0,d=t.extrudedHeight??l;this._positions=e,this._ellipsoid=Y.clone(t.ellipsoid??Y.default),this._vertexFormat=J.clone(t.vertexFormat??J.DEFAULT),this._width=i,this._height=Math.max(l,d),this._extrudedHeight=Math.min(l,d),this._cornerType=t.cornerType??ut.ROUNDED,this._granularity=t.granularity??it.RADIANS_PER_DEGREE,this._shadowVolume=t.shadowVolume??!1,this._workerName="createCorridorGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this.packedLength=1+e.length*o.packedLength+Y.packedLength+J.packedLength+7}tt.pack=function(t,e,i){ot.defined("value",t),ot.defined("array",e),i=i??0;let l=t._positions,d=l.length;e[i++]=d;for(let f=0;f<d;++f,i+=o.packedLength)o.pack(l[f],e,i);return Y.pack(t._ellipsoid,e,i),i+=Y.packedLength,J.pack(t._vertexFormat,e,i),i+=J.packedLength,e[i++]=t._width,e[i++]=t._height,e[i++]=t._extrudedHeight,e[i++]=t._cornerType,e[i++]=t._granularity,e[i++]=t._shadowVolume?1:0,e[i]=t._offsetAttribute??-1,e};var It=Y.clone(Y.UNIT_SPHERE),Wt=new J,x={positions:void 0,ellipsoid:It,vertexFormat:Wt,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};tt.unpack=function(t,e,i){ot.defined("array",t),e=e??0;let l=t[e++],d=new Array(l);for(let u=0;u<l;++u,e+=o.packedLength)d[u]=o.unpack(t,e);let f=Y.unpack(t,e,It);e+=Y.packedLength;let h=J.unpack(t,e,Wt);e+=J.packedLength;let O=t[e++],g=t[e++],r=t[e++],a=t[e++],s=t[e++],n=t[e++]===1,A=t[e];return Q(i)?(i._positions=d,i._ellipsoid=Y.clone(f,i._ellipsoid),i._vertexFormat=J.clone(h,i._vertexFormat),i._width=O,i._height=g,i._extrudedHeight=r,i._cornerType=a,i._granularity=s,i._shadowVolume=n,i._offsetAttribute=A===-1?void 0:A,i):(x.positions=d,x.width=O,x.height=g,x.extrudedHeight=r,x.cornerType=a,x.granularity=s,x.shadowVolume=n,x.offsetAttribute=A===-1?void 0:A,new tt(x))};tt.computeRectangle=function(t,e){t=t??Tt.EMPTY_OBJECT;let i=t.positions,l=t.width;ot.defined("options.positions",i),ot.defined("options.width",l);let d=t.ellipsoid??Y.default,f=t.cornerType??ut.ROUNDED;return Yt(i,d,l,f,e)};tt.createGeometry=function(t){let e=t._positions,i=t._width,l=t._ellipsoid;e=Ut(e,l);let d=Pt(e,o.equalsEpsilon);if(d.length<2||i<=0)return;let f=t._height,h=t._extrudedHeight,O=!it.equalsEpsilon(f,h,0,it.EPSILON2),g=t._vertexFormat,r={ellipsoid:l,positions:d,width:i,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!0},a;if(O)r.height=f,r.extrudedHeight=h,r.shadowVolume=t._shadowVolume,r.offsetAttribute=t._offsetAttribute,a=Jt(r,g);else{let A=M.computePositions(r);if(a=Bt(A,g,l),a.attributes.position.values=_t.scaleToGeodeticHeight(a.attributes.position.values,f,l),Q(t._offsetAttribute)){let u=t._offsetAttribute===bt.NONE?0:1,b=a.attributes.position.values.length,p=new Uint8Array(b/3).fill(u);a.attributes.applyOffset=new F({componentDatatype:v.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}}let s=a.attributes,n=St.fromVertices(s.position.values,void 0,3);return g.position||(a.attributes.position.values=void 0),new Ct({attributes:s,indices:a.indices,primitiveType:Mt.TRIANGLES,boundingSphere:n,offsetAttribute:t._offsetAttribute})};tt.createShadowVolume=function(t,e,i){let l=t._granularity,d=t._ellipsoid,f=e(l,d),h=i(l,d);return new tt({positions:t._positions,width:t._width,cornerType:t._cornerType,ellipsoid:d,granularity:l,extrudedHeight:f,height:h,vertexFormat:J.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(tt.prototype,{rectangle:{get:function(){return Q(this._rectangle)||(this._rectangle=Yt(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var Lt=tt;function Gt(t,e){return Q(e)&&(t=Lt.unpack(t,e)),t._ellipsoid=Y.clone(t._ellipsoid),Lt.createGeometry(t)}var Ae=Gt;export{Ae as default};
|