@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,797 +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
|
-
EllipsoidalOccluder_default,
|
|
28
|
-
TerrainEncoding_default
|
|
29
|
-
} from "./chunk-HU6N6EXB.js";
|
|
30
|
-
import {
|
|
31
|
-
createTaskProcessorWorker_default
|
|
32
|
-
} from "./chunk-3VAZEH7M.js";
|
|
33
|
-
import {
|
|
34
|
-
OrientedBoundingBox_default
|
|
35
|
-
} from "./chunk-A5DWLWCY.js";
|
|
36
|
-
import {
|
|
37
|
-
AttributeCompression_default
|
|
38
|
-
} from "./chunk-Z3TIFFGF.js";
|
|
39
|
-
import "./chunk-FNIRWHJB.js";
|
|
40
|
-
import "./chunk-G43QFN4Q.js";
|
|
41
|
-
import "./chunk-2FRVPMCS.js";
|
|
42
|
-
import "./chunk-Y5UQJLYE.js";
|
|
43
|
-
import {
|
|
44
|
-
IndexDatatype_default
|
|
45
|
-
} from "./chunk-LPR3YNP2.js";
|
|
46
|
-
import {
|
|
47
|
-
BoundingSphere_default
|
|
48
|
-
} from "./chunk-FJKNFAKQ.js";
|
|
49
|
-
import "./chunk-TTUZP4BO.js";
|
|
50
|
-
import "./chunk-BG4UCVXN.js";
|
|
51
|
-
import {
|
|
52
|
-
Rectangle_default
|
|
53
|
-
} from "./chunk-YJEBABKH.js";
|
|
54
|
-
import "./chunk-PPH7OFP3.js";
|
|
55
|
-
import {
|
|
56
|
-
Cartesian2_default,
|
|
57
|
-
Cartesian3_default,
|
|
58
|
-
Cartographic_default,
|
|
59
|
-
Ellipsoid_default
|
|
60
|
-
} from "./chunk-OGXZVPPM.js";
|
|
61
|
-
import {
|
|
62
|
-
Math_default
|
|
63
|
-
} from "./chunk-5QULIR53.js";
|
|
64
|
-
import "./chunk-SOWMRMWA.js";
|
|
65
|
-
import "./chunk-STW2DGFI.js";
|
|
66
|
-
import "./chunk-BBWDMCVU.js";
|
|
67
|
-
import {
|
|
68
|
-
Check_default,
|
|
69
|
-
DeveloperError_default
|
|
70
|
-
} from "./chunk-XGI5BXZY.js";
|
|
71
|
-
import {
|
|
72
|
-
defined_default
|
|
73
|
-
} from "./chunk-YWTJ2B4B.js";
|
|
74
|
-
|
|
75
|
-
// packages/engine/Source/Core/Intersections2D.js
|
|
76
|
-
var Intersections2D = {};
|
|
77
|
-
Intersections2D.clipTriangleAtAxisAlignedThreshold = function(threshold, keepAbove, u0, u1, u2, result) {
|
|
78
|
-
if (!defined_default(threshold)) {
|
|
79
|
-
throw new DeveloperError_default("threshold is required.");
|
|
80
|
-
}
|
|
81
|
-
if (!defined_default(keepAbove)) {
|
|
82
|
-
throw new DeveloperError_default("keepAbove is required.");
|
|
83
|
-
}
|
|
84
|
-
if (!defined_default(u0)) {
|
|
85
|
-
throw new DeveloperError_default("u0 is required.");
|
|
86
|
-
}
|
|
87
|
-
if (!defined_default(u1)) {
|
|
88
|
-
throw new DeveloperError_default("u1 is required.");
|
|
89
|
-
}
|
|
90
|
-
if (!defined_default(u2)) {
|
|
91
|
-
throw new DeveloperError_default("u2 is required.");
|
|
92
|
-
}
|
|
93
|
-
if (!defined_default(result)) {
|
|
94
|
-
result = [];
|
|
95
|
-
} else {
|
|
96
|
-
result.length = 0;
|
|
97
|
-
}
|
|
98
|
-
let u0Behind;
|
|
99
|
-
let u1Behind;
|
|
100
|
-
let u2Behind;
|
|
101
|
-
if (keepAbove) {
|
|
102
|
-
u0Behind = u0 < threshold;
|
|
103
|
-
u1Behind = u1 < threshold;
|
|
104
|
-
u2Behind = u2 < threshold;
|
|
105
|
-
} else {
|
|
106
|
-
u0Behind = u0 > threshold;
|
|
107
|
-
u1Behind = u1 > threshold;
|
|
108
|
-
u2Behind = u2 > threshold;
|
|
109
|
-
}
|
|
110
|
-
const numBehind = u0Behind + u1Behind + u2Behind;
|
|
111
|
-
let u01Ratio;
|
|
112
|
-
let u02Ratio;
|
|
113
|
-
let u12Ratio;
|
|
114
|
-
let u10Ratio;
|
|
115
|
-
let u20Ratio;
|
|
116
|
-
let u21Ratio;
|
|
117
|
-
if (numBehind === 1) {
|
|
118
|
-
if (u0Behind) {
|
|
119
|
-
u01Ratio = (threshold - u0) / (u1 - u0);
|
|
120
|
-
u02Ratio = (threshold - u0) / (u2 - u0);
|
|
121
|
-
result.push(1);
|
|
122
|
-
result.push(2);
|
|
123
|
-
if (u02Ratio !== 1) {
|
|
124
|
-
result.push(-1);
|
|
125
|
-
result.push(0);
|
|
126
|
-
result.push(2);
|
|
127
|
-
result.push(u02Ratio);
|
|
128
|
-
}
|
|
129
|
-
if (u01Ratio !== 1) {
|
|
130
|
-
result.push(-1);
|
|
131
|
-
result.push(0);
|
|
132
|
-
result.push(1);
|
|
133
|
-
result.push(u01Ratio);
|
|
134
|
-
}
|
|
135
|
-
} else if (u1Behind) {
|
|
136
|
-
u12Ratio = (threshold - u1) / (u2 - u1);
|
|
137
|
-
u10Ratio = (threshold - u1) / (u0 - u1);
|
|
138
|
-
result.push(2);
|
|
139
|
-
result.push(0);
|
|
140
|
-
if (u10Ratio !== 1) {
|
|
141
|
-
result.push(-1);
|
|
142
|
-
result.push(1);
|
|
143
|
-
result.push(0);
|
|
144
|
-
result.push(u10Ratio);
|
|
145
|
-
}
|
|
146
|
-
if (u12Ratio !== 1) {
|
|
147
|
-
result.push(-1);
|
|
148
|
-
result.push(1);
|
|
149
|
-
result.push(2);
|
|
150
|
-
result.push(u12Ratio);
|
|
151
|
-
}
|
|
152
|
-
} else if (u2Behind) {
|
|
153
|
-
u20Ratio = (threshold - u2) / (u0 - u2);
|
|
154
|
-
u21Ratio = (threshold - u2) / (u1 - u2);
|
|
155
|
-
result.push(0);
|
|
156
|
-
result.push(1);
|
|
157
|
-
if (u21Ratio !== 1) {
|
|
158
|
-
result.push(-1);
|
|
159
|
-
result.push(2);
|
|
160
|
-
result.push(1);
|
|
161
|
-
result.push(u21Ratio);
|
|
162
|
-
}
|
|
163
|
-
if (u20Ratio !== 1) {
|
|
164
|
-
result.push(-1);
|
|
165
|
-
result.push(2);
|
|
166
|
-
result.push(0);
|
|
167
|
-
result.push(u20Ratio);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
} else if (numBehind === 2) {
|
|
171
|
-
if (!u0Behind && u0 !== threshold) {
|
|
172
|
-
u10Ratio = (threshold - u1) / (u0 - u1);
|
|
173
|
-
u20Ratio = (threshold - u2) / (u0 - u2);
|
|
174
|
-
result.push(0);
|
|
175
|
-
result.push(-1);
|
|
176
|
-
result.push(1);
|
|
177
|
-
result.push(0);
|
|
178
|
-
result.push(u10Ratio);
|
|
179
|
-
result.push(-1);
|
|
180
|
-
result.push(2);
|
|
181
|
-
result.push(0);
|
|
182
|
-
result.push(u20Ratio);
|
|
183
|
-
} else if (!u1Behind && u1 !== threshold) {
|
|
184
|
-
u21Ratio = (threshold - u2) / (u1 - u2);
|
|
185
|
-
u01Ratio = (threshold - u0) / (u1 - u0);
|
|
186
|
-
result.push(1);
|
|
187
|
-
result.push(-1);
|
|
188
|
-
result.push(2);
|
|
189
|
-
result.push(1);
|
|
190
|
-
result.push(u21Ratio);
|
|
191
|
-
result.push(-1);
|
|
192
|
-
result.push(0);
|
|
193
|
-
result.push(1);
|
|
194
|
-
result.push(u01Ratio);
|
|
195
|
-
} else if (!u2Behind && u2 !== threshold) {
|
|
196
|
-
u02Ratio = (threshold - u0) / (u2 - u0);
|
|
197
|
-
u12Ratio = (threshold - u1) / (u2 - u1);
|
|
198
|
-
result.push(2);
|
|
199
|
-
result.push(-1);
|
|
200
|
-
result.push(0);
|
|
201
|
-
result.push(2);
|
|
202
|
-
result.push(u02Ratio);
|
|
203
|
-
result.push(-1);
|
|
204
|
-
result.push(1);
|
|
205
|
-
result.push(2);
|
|
206
|
-
result.push(u12Ratio);
|
|
207
|
-
}
|
|
208
|
-
} else if (numBehind !== 3) {
|
|
209
|
-
result.push(0);
|
|
210
|
-
result.push(1);
|
|
211
|
-
result.push(2);
|
|
212
|
-
}
|
|
213
|
-
return result;
|
|
214
|
-
};
|
|
215
|
-
Intersections2D.computeBarycentricCoordinates = function(x, y, x1, y1, x2, y2, x3, y3, result) {
|
|
216
|
-
if (!defined_default(x)) {
|
|
217
|
-
throw new DeveloperError_default("x is required.");
|
|
218
|
-
}
|
|
219
|
-
if (!defined_default(y)) {
|
|
220
|
-
throw new DeveloperError_default("y is required.");
|
|
221
|
-
}
|
|
222
|
-
if (!defined_default(x1)) {
|
|
223
|
-
throw new DeveloperError_default("x1 is required.");
|
|
224
|
-
}
|
|
225
|
-
if (!defined_default(y1)) {
|
|
226
|
-
throw new DeveloperError_default("y1 is required.");
|
|
227
|
-
}
|
|
228
|
-
if (!defined_default(x2)) {
|
|
229
|
-
throw new DeveloperError_default("x2 is required.");
|
|
230
|
-
}
|
|
231
|
-
if (!defined_default(y2)) {
|
|
232
|
-
throw new DeveloperError_default("y2 is required.");
|
|
233
|
-
}
|
|
234
|
-
if (!defined_default(x3)) {
|
|
235
|
-
throw new DeveloperError_default("x3 is required.");
|
|
236
|
-
}
|
|
237
|
-
if (!defined_default(y3)) {
|
|
238
|
-
throw new DeveloperError_default("y3 is required.");
|
|
239
|
-
}
|
|
240
|
-
const x1mx3 = x1 - x3;
|
|
241
|
-
const x3mx2 = x3 - x2;
|
|
242
|
-
const y2my3 = y2 - y3;
|
|
243
|
-
const y1my3 = y1 - y3;
|
|
244
|
-
const inverseDeterminant = 1 / (y2my3 * x1mx3 + x3mx2 * y1my3);
|
|
245
|
-
const ymy3 = y - y3;
|
|
246
|
-
const xmx3 = x - x3;
|
|
247
|
-
const l1 = (y2my3 * xmx3 + x3mx2 * ymy3) * inverseDeterminant;
|
|
248
|
-
const l2 = (-y1my3 * xmx3 + x1mx3 * ymy3) * inverseDeterminant;
|
|
249
|
-
const l3 = 1 - l1 - l2;
|
|
250
|
-
if (defined_default(result)) {
|
|
251
|
-
result.x = l1;
|
|
252
|
-
result.y = l2;
|
|
253
|
-
result.z = l3;
|
|
254
|
-
return result;
|
|
255
|
-
}
|
|
256
|
-
return new Cartesian3_default(l1, l2, l3);
|
|
257
|
-
};
|
|
258
|
-
Intersections2D.computeLineSegmentLineSegmentIntersection = function(x00, y00, x01, y01, x10, y10, x11, y11, result) {
|
|
259
|
-
Check_default.typeOf.number("x00", x00);
|
|
260
|
-
Check_default.typeOf.number("y00", y00);
|
|
261
|
-
Check_default.typeOf.number("x01", x01);
|
|
262
|
-
Check_default.typeOf.number("y01", y01);
|
|
263
|
-
Check_default.typeOf.number("x10", x10);
|
|
264
|
-
Check_default.typeOf.number("y10", y10);
|
|
265
|
-
Check_default.typeOf.number("x11", x11);
|
|
266
|
-
Check_default.typeOf.number("y11", y11);
|
|
267
|
-
const numerator1A = (x11 - x10) * (y00 - y10) - (y11 - y10) * (x00 - x10);
|
|
268
|
-
const numerator1B = (x01 - x00) * (y00 - y10) - (y01 - y00) * (x00 - x10);
|
|
269
|
-
const denominator1 = (y11 - y10) * (x01 - x00) - (x11 - x10) * (y01 - y00);
|
|
270
|
-
if (denominator1 === 0) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
const ua1 = numerator1A / denominator1;
|
|
274
|
-
const ub1 = numerator1B / denominator1;
|
|
275
|
-
if (ua1 >= 0 && ua1 <= 1 && ub1 >= 0 && ub1 <= 1) {
|
|
276
|
-
if (!defined_default(result)) {
|
|
277
|
-
result = new Cartesian2_default();
|
|
278
|
-
}
|
|
279
|
-
result.x = x00 + ua1 * (x01 - x00);
|
|
280
|
-
result.y = y00 + ua1 * (y01 - y00);
|
|
281
|
-
return result;
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
var Intersections2D_default = Intersections2D;
|
|
285
|
-
|
|
286
|
-
// packages/engine/Source/Workers/upsampleQuantizedTerrainMesh.js
|
|
287
|
-
var maxShort = 32767;
|
|
288
|
-
var halfMaxShort = maxShort / 2 | 0;
|
|
289
|
-
var clipScratch = [];
|
|
290
|
-
var clipScratch2 = [];
|
|
291
|
-
var verticesScratch = [];
|
|
292
|
-
var cartographicScratch = new Cartographic_default();
|
|
293
|
-
var cartesian3Scratch = new Cartesian3_default();
|
|
294
|
-
var uScratch = [];
|
|
295
|
-
var vScratch = [];
|
|
296
|
-
var heightScratch = [];
|
|
297
|
-
var indicesScratch = [];
|
|
298
|
-
var normalsScratch = [];
|
|
299
|
-
var horizonOcclusionPointScratch = new Cartesian3_default();
|
|
300
|
-
var boundingSphereScratch = new BoundingSphere_default();
|
|
301
|
-
var orientedBoundingBoxScratch = new OrientedBoundingBox_default();
|
|
302
|
-
var decodeTexCoordsScratch = new Cartesian2_default();
|
|
303
|
-
var octEncodedNormalScratch = new Cartesian3_default();
|
|
304
|
-
function upsampleQuantizedTerrainMesh(parameters, transferableObjects) {
|
|
305
|
-
const isEastChild = parameters.isEastChild;
|
|
306
|
-
const isNorthChild = parameters.isNorthChild;
|
|
307
|
-
const minU = isEastChild ? halfMaxShort : 0;
|
|
308
|
-
const maxU = isEastChild ? maxShort : halfMaxShort;
|
|
309
|
-
const minV = isNorthChild ? halfMaxShort : 0;
|
|
310
|
-
const maxV = isNorthChild ? maxShort : halfMaxShort;
|
|
311
|
-
const uBuffer = uScratch;
|
|
312
|
-
const vBuffer = vScratch;
|
|
313
|
-
const heightBuffer = heightScratch;
|
|
314
|
-
const normalBuffer = normalsScratch;
|
|
315
|
-
uBuffer.length = 0;
|
|
316
|
-
vBuffer.length = 0;
|
|
317
|
-
heightBuffer.length = 0;
|
|
318
|
-
normalBuffer.length = 0;
|
|
319
|
-
const indices = indicesScratch;
|
|
320
|
-
indices.length = 0;
|
|
321
|
-
const vertexMap = {};
|
|
322
|
-
const parentVertices = parameters.vertices;
|
|
323
|
-
let parentIndices = parameters.indices;
|
|
324
|
-
parentIndices = parentIndices.subarray(0, parameters.indexCountWithoutSkirts);
|
|
325
|
-
const encoding = TerrainEncoding_default.clone(parameters.encoding);
|
|
326
|
-
const hasVertexNormals = encoding.hasVertexNormals;
|
|
327
|
-
let vertexCount = 0;
|
|
328
|
-
const quantizedVertexCount = parameters.vertexCountWithoutSkirts;
|
|
329
|
-
const parentMinimumHeight = parameters.minimumHeight;
|
|
330
|
-
const parentMaximumHeight = parameters.maximumHeight;
|
|
331
|
-
const parentUBuffer = new Array(quantizedVertexCount);
|
|
332
|
-
const parentVBuffer = new Array(quantizedVertexCount);
|
|
333
|
-
const parentHeightBuffer = new Array(quantizedVertexCount);
|
|
334
|
-
const parentNormalBuffer = hasVertexNormals ? new Array(quantizedVertexCount * 2) : void 0;
|
|
335
|
-
const threshold = 20;
|
|
336
|
-
let height;
|
|
337
|
-
let i, n;
|
|
338
|
-
let u, v;
|
|
339
|
-
for (i = 0, n = 0; i < quantizedVertexCount; ++i, n += 2) {
|
|
340
|
-
const texCoords = encoding.decodeTextureCoordinates(
|
|
341
|
-
parentVertices,
|
|
342
|
-
i,
|
|
343
|
-
decodeTexCoordsScratch
|
|
344
|
-
);
|
|
345
|
-
height = encoding.decodeHeight(parentVertices, i);
|
|
346
|
-
u = Math_default.clamp(texCoords.x * maxShort | 0, 0, maxShort);
|
|
347
|
-
v = Math_default.clamp(texCoords.y * maxShort | 0, 0, maxShort);
|
|
348
|
-
parentHeightBuffer[i] = Math_default.clamp(
|
|
349
|
-
(height - parentMinimumHeight) / (parentMaximumHeight - parentMinimumHeight) * maxShort | 0,
|
|
350
|
-
0,
|
|
351
|
-
maxShort
|
|
352
|
-
);
|
|
353
|
-
if (u < threshold) {
|
|
354
|
-
u = 0;
|
|
355
|
-
}
|
|
356
|
-
if (v < threshold) {
|
|
357
|
-
v = 0;
|
|
358
|
-
}
|
|
359
|
-
if (maxShort - u < threshold) {
|
|
360
|
-
u = maxShort;
|
|
361
|
-
}
|
|
362
|
-
if (maxShort - v < threshold) {
|
|
363
|
-
v = maxShort;
|
|
364
|
-
}
|
|
365
|
-
parentUBuffer[i] = u;
|
|
366
|
-
parentVBuffer[i] = v;
|
|
367
|
-
if (hasVertexNormals) {
|
|
368
|
-
const encodedNormal = encoding.getOctEncodedNormal(
|
|
369
|
-
parentVertices,
|
|
370
|
-
i,
|
|
371
|
-
octEncodedNormalScratch
|
|
372
|
-
);
|
|
373
|
-
parentNormalBuffer[n] = encodedNormal.x;
|
|
374
|
-
parentNormalBuffer[n + 1] = encodedNormal.y;
|
|
375
|
-
}
|
|
376
|
-
if ((isEastChild && u >= halfMaxShort || !isEastChild && u <= halfMaxShort) && (isNorthChild && v >= halfMaxShort || !isNorthChild && v <= halfMaxShort)) {
|
|
377
|
-
vertexMap[i] = vertexCount;
|
|
378
|
-
uBuffer.push(u);
|
|
379
|
-
vBuffer.push(v);
|
|
380
|
-
heightBuffer.push(parentHeightBuffer[i]);
|
|
381
|
-
if (hasVertexNormals) {
|
|
382
|
-
normalBuffer.push(parentNormalBuffer[n]);
|
|
383
|
-
normalBuffer.push(parentNormalBuffer[n + 1]);
|
|
384
|
-
}
|
|
385
|
-
++vertexCount;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
const triangleVertices = [];
|
|
389
|
-
triangleVertices.push(new Vertex());
|
|
390
|
-
triangleVertices.push(new Vertex());
|
|
391
|
-
triangleVertices.push(new Vertex());
|
|
392
|
-
const clippedTriangleVertices = [];
|
|
393
|
-
clippedTriangleVertices.push(new Vertex());
|
|
394
|
-
clippedTriangleVertices.push(new Vertex());
|
|
395
|
-
clippedTriangleVertices.push(new Vertex());
|
|
396
|
-
let clippedIndex;
|
|
397
|
-
let clipped2;
|
|
398
|
-
for (i = 0; i < parentIndices.length; i += 3) {
|
|
399
|
-
const i0 = parentIndices[i];
|
|
400
|
-
const i1 = parentIndices[i + 1];
|
|
401
|
-
const i2 = parentIndices[i + 2];
|
|
402
|
-
const u0 = parentUBuffer[i0];
|
|
403
|
-
const u1 = parentUBuffer[i1];
|
|
404
|
-
const u2 = parentUBuffer[i2];
|
|
405
|
-
triangleVertices[0].initializeIndexed(
|
|
406
|
-
parentUBuffer,
|
|
407
|
-
parentVBuffer,
|
|
408
|
-
parentHeightBuffer,
|
|
409
|
-
parentNormalBuffer,
|
|
410
|
-
i0
|
|
411
|
-
);
|
|
412
|
-
triangleVertices[1].initializeIndexed(
|
|
413
|
-
parentUBuffer,
|
|
414
|
-
parentVBuffer,
|
|
415
|
-
parentHeightBuffer,
|
|
416
|
-
parentNormalBuffer,
|
|
417
|
-
i1
|
|
418
|
-
);
|
|
419
|
-
triangleVertices[2].initializeIndexed(
|
|
420
|
-
parentUBuffer,
|
|
421
|
-
parentVBuffer,
|
|
422
|
-
parentHeightBuffer,
|
|
423
|
-
parentNormalBuffer,
|
|
424
|
-
i2
|
|
425
|
-
);
|
|
426
|
-
const clipped = Intersections2D_default.clipTriangleAtAxisAlignedThreshold(
|
|
427
|
-
halfMaxShort,
|
|
428
|
-
isEastChild,
|
|
429
|
-
u0,
|
|
430
|
-
u1,
|
|
431
|
-
u2,
|
|
432
|
-
clipScratch
|
|
433
|
-
);
|
|
434
|
-
clippedIndex = 0;
|
|
435
|
-
if (clippedIndex >= clipped.length) {
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
clippedIndex = clippedTriangleVertices[0].initializeFromClipResult(
|
|
439
|
-
clipped,
|
|
440
|
-
clippedIndex,
|
|
441
|
-
triangleVertices
|
|
442
|
-
);
|
|
443
|
-
if (clippedIndex >= clipped.length) {
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
clippedIndex = clippedTriangleVertices[1].initializeFromClipResult(
|
|
447
|
-
clipped,
|
|
448
|
-
clippedIndex,
|
|
449
|
-
triangleVertices
|
|
450
|
-
);
|
|
451
|
-
if (clippedIndex >= clipped.length) {
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
clippedIndex = clippedTriangleVertices[2].initializeFromClipResult(
|
|
455
|
-
clipped,
|
|
456
|
-
clippedIndex,
|
|
457
|
-
triangleVertices
|
|
458
|
-
);
|
|
459
|
-
clipped2 = Intersections2D_default.clipTriangleAtAxisAlignedThreshold(
|
|
460
|
-
halfMaxShort,
|
|
461
|
-
isNorthChild,
|
|
462
|
-
clippedTriangleVertices[0].getV(),
|
|
463
|
-
clippedTriangleVertices[1].getV(),
|
|
464
|
-
clippedTriangleVertices[2].getV(),
|
|
465
|
-
clipScratch2
|
|
466
|
-
);
|
|
467
|
-
addClippedPolygon(
|
|
468
|
-
uBuffer,
|
|
469
|
-
vBuffer,
|
|
470
|
-
heightBuffer,
|
|
471
|
-
normalBuffer,
|
|
472
|
-
indices,
|
|
473
|
-
vertexMap,
|
|
474
|
-
clipped2,
|
|
475
|
-
clippedTriangleVertices,
|
|
476
|
-
hasVertexNormals
|
|
477
|
-
);
|
|
478
|
-
if (clippedIndex < clipped.length) {
|
|
479
|
-
clippedTriangleVertices[2].clone(clippedTriangleVertices[1]);
|
|
480
|
-
clippedTriangleVertices[2].initializeFromClipResult(
|
|
481
|
-
clipped,
|
|
482
|
-
clippedIndex,
|
|
483
|
-
triangleVertices
|
|
484
|
-
);
|
|
485
|
-
clipped2 = Intersections2D_default.clipTriangleAtAxisAlignedThreshold(
|
|
486
|
-
halfMaxShort,
|
|
487
|
-
isNorthChild,
|
|
488
|
-
clippedTriangleVertices[0].getV(),
|
|
489
|
-
clippedTriangleVertices[1].getV(),
|
|
490
|
-
clippedTriangleVertices[2].getV(),
|
|
491
|
-
clipScratch2
|
|
492
|
-
);
|
|
493
|
-
addClippedPolygon(
|
|
494
|
-
uBuffer,
|
|
495
|
-
vBuffer,
|
|
496
|
-
heightBuffer,
|
|
497
|
-
normalBuffer,
|
|
498
|
-
indices,
|
|
499
|
-
vertexMap,
|
|
500
|
-
clipped2,
|
|
501
|
-
clippedTriangleVertices,
|
|
502
|
-
hasVertexNormals
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
const uOffset = isEastChild ? -maxShort : 0;
|
|
507
|
-
const vOffset = isNorthChild ? -maxShort : 0;
|
|
508
|
-
const westIndices = [];
|
|
509
|
-
const southIndices = [];
|
|
510
|
-
const eastIndices = [];
|
|
511
|
-
const northIndices = [];
|
|
512
|
-
let minimumHeight = Number.MAX_VALUE;
|
|
513
|
-
let maximumHeight = -minimumHeight;
|
|
514
|
-
const cartesianVertices = verticesScratch;
|
|
515
|
-
cartesianVertices.length = 0;
|
|
516
|
-
const ellipsoid = Ellipsoid_default.clone(parameters.ellipsoid);
|
|
517
|
-
const rectangle = Rectangle_default.clone(parameters.childRectangle);
|
|
518
|
-
const north = rectangle.north;
|
|
519
|
-
const south = rectangle.south;
|
|
520
|
-
let east = rectangle.east;
|
|
521
|
-
const west = rectangle.west;
|
|
522
|
-
if (east < west) {
|
|
523
|
-
east += Math_default.TWO_PI;
|
|
524
|
-
}
|
|
525
|
-
for (i = 0; i < uBuffer.length; ++i) {
|
|
526
|
-
u = Math.round(uBuffer[i]);
|
|
527
|
-
if (u <= minU) {
|
|
528
|
-
westIndices.push(i);
|
|
529
|
-
u = 0;
|
|
530
|
-
} else if (u >= maxU) {
|
|
531
|
-
eastIndices.push(i);
|
|
532
|
-
u = maxShort;
|
|
533
|
-
} else {
|
|
534
|
-
u = u * 2 + uOffset;
|
|
535
|
-
}
|
|
536
|
-
uBuffer[i] = u;
|
|
537
|
-
v = Math.round(vBuffer[i]);
|
|
538
|
-
if (v <= minV) {
|
|
539
|
-
southIndices.push(i);
|
|
540
|
-
v = 0;
|
|
541
|
-
} else if (v >= maxV) {
|
|
542
|
-
northIndices.push(i);
|
|
543
|
-
v = maxShort;
|
|
544
|
-
} else {
|
|
545
|
-
v = v * 2 + vOffset;
|
|
546
|
-
}
|
|
547
|
-
vBuffer[i] = v;
|
|
548
|
-
height = Math_default.lerp(
|
|
549
|
-
parentMinimumHeight,
|
|
550
|
-
parentMaximumHeight,
|
|
551
|
-
heightBuffer[i] / maxShort
|
|
552
|
-
);
|
|
553
|
-
if (height < minimumHeight) {
|
|
554
|
-
minimumHeight = height;
|
|
555
|
-
}
|
|
556
|
-
if (height > maximumHeight) {
|
|
557
|
-
maximumHeight = height;
|
|
558
|
-
}
|
|
559
|
-
heightBuffer[i] = height;
|
|
560
|
-
cartographicScratch.longitude = Math_default.lerp(west, east, u / maxShort);
|
|
561
|
-
cartographicScratch.latitude = Math_default.lerp(south, north, v / maxShort);
|
|
562
|
-
cartographicScratch.height = height;
|
|
563
|
-
ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch);
|
|
564
|
-
cartesianVertices.push(cartesian3Scratch.x);
|
|
565
|
-
cartesianVertices.push(cartesian3Scratch.y);
|
|
566
|
-
cartesianVertices.push(cartesian3Scratch.z);
|
|
567
|
-
}
|
|
568
|
-
const boundingSphere = BoundingSphere_default.fromVertices(
|
|
569
|
-
cartesianVertices,
|
|
570
|
-
Cartesian3_default.ZERO,
|
|
571
|
-
3,
|
|
572
|
-
boundingSphereScratch
|
|
573
|
-
);
|
|
574
|
-
const orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
|
|
575
|
-
rectangle,
|
|
576
|
-
minimumHeight,
|
|
577
|
-
maximumHeight,
|
|
578
|
-
ellipsoid,
|
|
579
|
-
orientedBoundingBoxScratch
|
|
580
|
-
);
|
|
581
|
-
const occluder = new EllipsoidalOccluder_default(ellipsoid);
|
|
582
|
-
const horizonOcclusionPoint = occluder.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(
|
|
583
|
-
boundingSphere.center,
|
|
584
|
-
cartesianVertices,
|
|
585
|
-
3,
|
|
586
|
-
boundingSphere.center,
|
|
587
|
-
minimumHeight,
|
|
588
|
-
horizonOcclusionPointScratch
|
|
589
|
-
);
|
|
590
|
-
const heightRange = maximumHeight - minimumHeight;
|
|
591
|
-
const vertices = new Uint16Array(
|
|
592
|
-
uBuffer.length + vBuffer.length + heightBuffer.length
|
|
593
|
-
);
|
|
594
|
-
for (i = 0; i < uBuffer.length; ++i) {
|
|
595
|
-
vertices[i] = uBuffer[i];
|
|
596
|
-
}
|
|
597
|
-
let start = uBuffer.length;
|
|
598
|
-
for (i = 0; i < vBuffer.length; ++i) {
|
|
599
|
-
vertices[start + i] = vBuffer[i];
|
|
600
|
-
}
|
|
601
|
-
start += vBuffer.length;
|
|
602
|
-
for (i = 0; i < heightBuffer.length; ++i) {
|
|
603
|
-
vertices[start + i] = maxShort * (heightBuffer[i] - minimumHeight) / heightRange;
|
|
604
|
-
}
|
|
605
|
-
const indicesTypedArray = IndexDatatype_default.createTypedArray(
|
|
606
|
-
uBuffer.length,
|
|
607
|
-
indices
|
|
608
|
-
);
|
|
609
|
-
let encodedNormals;
|
|
610
|
-
if (hasVertexNormals) {
|
|
611
|
-
const normalArray = new Uint8Array(normalBuffer);
|
|
612
|
-
transferableObjects.push(
|
|
613
|
-
vertices.buffer,
|
|
614
|
-
indicesTypedArray.buffer,
|
|
615
|
-
normalArray.buffer
|
|
616
|
-
);
|
|
617
|
-
encodedNormals = normalArray.buffer;
|
|
618
|
-
} else {
|
|
619
|
-
transferableObjects.push(vertices.buffer, indicesTypedArray.buffer);
|
|
620
|
-
}
|
|
621
|
-
return {
|
|
622
|
-
vertices: vertices.buffer,
|
|
623
|
-
encodedNormals,
|
|
624
|
-
indices: indicesTypedArray.buffer,
|
|
625
|
-
minimumHeight,
|
|
626
|
-
maximumHeight,
|
|
627
|
-
westIndices,
|
|
628
|
-
southIndices,
|
|
629
|
-
eastIndices,
|
|
630
|
-
northIndices,
|
|
631
|
-
boundingSphere,
|
|
632
|
-
orientedBoundingBox,
|
|
633
|
-
horizonOcclusionPoint
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function Vertex() {
|
|
637
|
-
this.vertexBuffer = void 0;
|
|
638
|
-
this.index = void 0;
|
|
639
|
-
this.first = void 0;
|
|
640
|
-
this.second = void 0;
|
|
641
|
-
this.ratio = void 0;
|
|
642
|
-
}
|
|
643
|
-
Vertex.prototype.clone = function(result) {
|
|
644
|
-
if (!defined_default(result)) {
|
|
645
|
-
result = new Vertex();
|
|
646
|
-
}
|
|
647
|
-
result.uBuffer = this.uBuffer;
|
|
648
|
-
result.vBuffer = this.vBuffer;
|
|
649
|
-
result.heightBuffer = this.heightBuffer;
|
|
650
|
-
result.normalBuffer = this.normalBuffer;
|
|
651
|
-
result.index = this.index;
|
|
652
|
-
result.first = this.first;
|
|
653
|
-
result.second = this.second;
|
|
654
|
-
result.ratio = this.ratio;
|
|
655
|
-
return result;
|
|
656
|
-
};
|
|
657
|
-
Vertex.prototype.initializeIndexed = function(uBuffer, vBuffer, heightBuffer, normalBuffer, index) {
|
|
658
|
-
this.uBuffer = uBuffer;
|
|
659
|
-
this.vBuffer = vBuffer;
|
|
660
|
-
this.heightBuffer = heightBuffer;
|
|
661
|
-
this.normalBuffer = normalBuffer;
|
|
662
|
-
this.index = index;
|
|
663
|
-
this.first = void 0;
|
|
664
|
-
this.second = void 0;
|
|
665
|
-
this.ratio = void 0;
|
|
666
|
-
};
|
|
667
|
-
Vertex.prototype.initializeFromClipResult = function(clipResult, index, vertices) {
|
|
668
|
-
let nextIndex = index + 1;
|
|
669
|
-
if (clipResult[index] !== -1) {
|
|
670
|
-
vertices[clipResult[index]].clone(this);
|
|
671
|
-
} else {
|
|
672
|
-
this.vertexBuffer = void 0;
|
|
673
|
-
this.index = void 0;
|
|
674
|
-
this.first = vertices[clipResult[nextIndex]];
|
|
675
|
-
++nextIndex;
|
|
676
|
-
this.second = vertices[clipResult[nextIndex]];
|
|
677
|
-
++nextIndex;
|
|
678
|
-
this.ratio = clipResult[nextIndex];
|
|
679
|
-
++nextIndex;
|
|
680
|
-
}
|
|
681
|
-
return nextIndex;
|
|
682
|
-
};
|
|
683
|
-
Vertex.prototype.getKey = function() {
|
|
684
|
-
if (this.isIndexed()) {
|
|
685
|
-
return this.index;
|
|
686
|
-
}
|
|
687
|
-
return JSON.stringify({
|
|
688
|
-
first: this.first.getKey(),
|
|
689
|
-
second: this.second.getKey(),
|
|
690
|
-
ratio: this.ratio
|
|
691
|
-
});
|
|
692
|
-
};
|
|
693
|
-
Vertex.prototype.isIndexed = function() {
|
|
694
|
-
return defined_default(this.index);
|
|
695
|
-
};
|
|
696
|
-
Vertex.prototype.getH = function() {
|
|
697
|
-
if (defined_default(this.index)) {
|
|
698
|
-
return this.heightBuffer[this.index];
|
|
699
|
-
}
|
|
700
|
-
return Math_default.lerp(this.first.getH(), this.second.getH(), this.ratio);
|
|
701
|
-
};
|
|
702
|
-
Vertex.prototype.getU = function() {
|
|
703
|
-
if (defined_default(this.index)) {
|
|
704
|
-
return this.uBuffer[this.index];
|
|
705
|
-
}
|
|
706
|
-
return Math_default.lerp(this.first.getU(), this.second.getU(), this.ratio);
|
|
707
|
-
};
|
|
708
|
-
Vertex.prototype.getV = function() {
|
|
709
|
-
if (defined_default(this.index)) {
|
|
710
|
-
return this.vBuffer[this.index];
|
|
711
|
-
}
|
|
712
|
-
return Math_default.lerp(this.first.getV(), this.second.getV(), this.ratio);
|
|
713
|
-
};
|
|
714
|
-
var encodedScratch = new Cartesian2_default();
|
|
715
|
-
var depth = -1;
|
|
716
|
-
var cartesianScratch1 = [new Cartesian3_default(), new Cartesian3_default()];
|
|
717
|
-
var cartesianScratch2 = [new Cartesian3_default(), new Cartesian3_default()];
|
|
718
|
-
function lerpOctEncodedNormal(vertex, result) {
|
|
719
|
-
++depth;
|
|
720
|
-
let first = cartesianScratch1[depth];
|
|
721
|
-
let second = cartesianScratch2[depth];
|
|
722
|
-
first = AttributeCompression_default.octDecode(
|
|
723
|
-
vertex.first.getNormalX(),
|
|
724
|
-
vertex.first.getNormalY(),
|
|
725
|
-
first
|
|
726
|
-
);
|
|
727
|
-
second = AttributeCompression_default.octDecode(
|
|
728
|
-
vertex.second.getNormalX(),
|
|
729
|
-
vertex.second.getNormalY(),
|
|
730
|
-
second
|
|
731
|
-
);
|
|
732
|
-
cartesian3Scratch = Cartesian3_default.lerp(
|
|
733
|
-
first,
|
|
734
|
-
second,
|
|
735
|
-
vertex.ratio,
|
|
736
|
-
cartesian3Scratch
|
|
737
|
-
);
|
|
738
|
-
Cartesian3_default.normalize(cartesian3Scratch, cartesian3Scratch);
|
|
739
|
-
AttributeCompression_default.octEncode(cartesian3Scratch, result);
|
|
740
|
-
--depth;
|
|
741
|
-
return result;
|
|
742
|
-
}
|
|
743
|
-
Vertex.prototype.getNormalX = function() {
|
|
744
|
-
if (defined_default(this.index)) {
|
|
745
|
-
return this.normalBuffer[this.index * 2];
|
|
746
|
-
}
|
|
747
|
-
encodedScratch = lerpOctEncodedNormal(this, encodedScratch);
|
|
748
|
-
return encodedScratch.x;
|
|
749
|
-
};
|
|
750
|
-
Vertex.prototype.getNormalY = function() {
|
|
751
|
-
if (defined_default(this.index)) {
|
|
752
|
-
return this.normalBuffer[this.index * 2 + 1];
|
|
753
|
-
}
|
|
754
|
-
encodedScratch = lerpOctEncodedNormal(this, encodedScratch);
|
|
755
|
-
return encodedScratch.y;
|
|
756
|
-
};
|
|
757
|
-
var polygonVertices = [];
|
|
758
|
-
polygonVertices.push(new Vertex());
|
|
759
|
-
polygonVertices.push(new Vertex());
|
|
760
|
-
polygonVertices.push(new Vertex());
|
|
761
|
-
polygonVertices.push(new Vertex());
|
|
762
|
-
function addClippedPolygon(uBuffer, vBuffer, heightBuffer, normalBuffer, indices, vertexMap, clipped, triangleVertices, hasVertexNormals) {
|
|
763
|
-
if (clipped.length === 0) {
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
let numVertices = 0;
|
|
767
|
-
let clippedIndex = 0;
|
|
768
|
-
while (clippedIndex < clipped.length) {
|
|
769
|
-
clippedIndex = polygonVertices[numVertices++].initializeFromClipResult(
|
|
770
|
-
clipped,
|
|
771
|
-
clippedIndex,
|
|
772
|
-
triangleVertices
|
|
773
|
-
);
|
|
774
|
-
}
|
|
775
|
-
for (let i = 0; i < numVertices; ++i) {
|
|
776
|
-
const polygonVertex = polygonVertices[i];
|
|
777
|
-
if (!polygonVertex.isIndexed()) {
|
|
778
|
-
const key = polygonVertex.getKey();
|
|
779
|
-
if (defined_default(vertexMap[key])) {
|
|
780
|
-
polygonVertex.newIndex = vertexMap[key];
|
|
781
|
-
} else {
|
|
782
|
-
const newIndex = uBuffer.length;
|
|
783
|
-
uBuffer.push(polygonVertex.getU());
|
|
784
|
-
vBuffer.push(polygonVertex.getV());
|
|
785
|
-
heightBuffer.push(polygonVertex.getH());
|
|
786
|
-
if (hasVertexNormals) {
|
|
787
|
-
normalBuffer.push(polygonVertex.getNormalX());
|
|
788
|
-
normalBuffer.push(polygonVertex.getNormalY());
|
|
789
|
-
}
|
|
790
|
-
polygonVertex.newIndex = newIndex;
|
|
791
|
-
vertexMap[key] = newIndex;
|
|
792
|
-
}
|
|
793
|
-
} else {
|
|
794
|
-
polygonVertex.newIndex = vertexMap[polygonVertex.index];
|
|
795
|
-
polygonVertex.uBuffer = uBuffer;
|
|
796
|
-
polygonVertex.vBuffer = vBuffer;
|
|
797
|
-
polygonVertex.heightBuffer = heightBuffer;
|
|
798
|
-
if (hasVertexNormals) {
|
|
799
|
-
polygonVertex.normalBuffer = normalBuffer;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
if (numVertices === 3) {
|
|
804
|
-
indices.push(polygonVertices[0].newIndex);
|
|
805
|
-
indices.push(polygonVertices[1].newIndex);
|
|
806
|
-
indices.push(polygonVertices[2].newIndex);
|
|
807
|
-
} else if (numVertices === 4) {
|
|
808
|
-
indices.push(polygonVertices[0].newIndex);
|
|
809
|
-
indices.push(polygonVertices[1].newIndex);
|
|
810
|
-
indices.push(polygonVertices[2].newIndex);
|
|
811
|
-
indices.push(polygonVertices[0].newIndex);
|
|
812
|
-
indices.push(polygonVertices[2].newIndex);
|
|
813
|
-
indices.push(polygonVertices[3].newIndex);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
var upsampleQuantizedTerrainMesh_default = createTaskProcessorWorker_default(upsampleQuantizedTerrainMesh);
|
|
817
|
-
export {
|
|
818
|
-
upsampleQuantizedTerrainMesh_default as default
|
|
819
|
-
};
|
|
26
|
+
import{a as be,b as Ne}from"./chunk-7HTKERZY.js";import{a as Ae}from"./chunk-WZDE3RYP.js";import{a as ue}from"./chunk-CNCV5UL7.js";import{a as ee}from"./chunk-DEPHB2WM.js";import"./chunk-TCGIRNHN.js";import"./chunk-N4VJKXZS.js";import"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as Ve}from"./chunk-OFUUQVMR.js";import{d as de}from"./chunk-4IW2T6GF.js";import{h as Se}from"./chunk-PSPPBZWI.js";import"./chunk-AU7IKHOH.js";import{a as A,b as Ie,c as Z,d as Ce}from"./chunk-64RSHJUE.js";import{a as N}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{a as V,b as q}from"./chunk-LEYMRMBK.js";import{e as f}from"./chunk-VTAIKJXX.js";var ne={};ne.clipTriangleAtAxisAlignedThreshold=function(n,h,o,i,s,e){if(!f(n))throw new V("threshold is required.");if(!f(h))throw new V("keepAbove is required.");if(!f(o))throw new V("u0 is required.");if(!f(i))throw new V("u1 is required.");if(!f(s))throw new V("u2 is required.");f(e)?e.length=0:e=[];let g,w,c;h?(g=o<n,w=i<n,c=s<n):(g=o>n,w=i>n,c=s>n);let p=g+w+c,d,u,r,l,I,C;return p===1?g?(d=(n-o)/(i-o),u=(n-o)/(s-o),e.push(1),e.push(2),u!==1&&(e.push(-1),e.push(0),e.push(2),e.push(u)),d!==1&&(e.push(-1),e.push(0),e.push(1),e.push(d))):w?(r=(n-i)/(s-i),l=(n-i)/(o-i),e.push(2),e.push(0),l!==1&&(e.push(-1),e.push(1),e.push(0),e.push(l)),r!==1&&(e.push(-1),e.push(1),e.push(2),e.push(r))):c&&(I=(n-s)/(o-s),C=(n-s)/(i-s),e.push(0),e.push(1),C!==1&&(e.push(-1),e.push(2),e.push(1),e.push(C)),I!==1&&(e.push(-1),e.push(2),e.push(0),e.push(I))):p===2?!g&&o!==n?(l=(n-i)/(o-i),I=(n-s)/(o-s),e.push(0),e.push(-1),e.push(1),e.push(0),e.push(l),e.push(-1),e.push(2),e.push(0),e.push(I)):!w&&i!==n?(C=(n-s)/(i-s),d=(n-o)/(i-o),e.push(1),e.push(-1),e.push(2),e.push(1),e.push(C),e.push(-1),e.push(0),e.push(1),e.push(d)):!c&&s!==n&&(u=(n-o)/(s-o),r=(n-i)/(s-i),e.push(2),e.push(-1),e.push(0),e.push(2),e.push(u),e.push(-1),e.push(1),e.push(2),e.push(r)):p!==3&&(e.push(0),e.push(1),e.push(2)),e};ne.computeBarycentricCoordinates=function(n,h,o,i,s,e,g,w,c){if(!f(n))throw new V("x is required.");if(!f(h))throw new V("y is required.");if(!f(o))throw new V("x1 is required.");if(!f(i))throw new V("y1 is required.");if(!f(s))throw new V("x2 is required.");if(!f(e))throw new V("y2 is required.");if(!f(g))throw new V("x3 is required.");if(!f(w))throw new V("y3 is required.");let p=o-g,d=g-s,u=e-w,r=i-w,l=1/(u*p+d*r),I=h-w,C=n-g,R=(u*C+d*I)*l,O=(-r*C+p*I)*l,W=1-R-O;return f(c)?(c.x=R,c.y=O,c.z=W,c):new A(R,O,W)};ne.computeLineSegmentLineSegmentIntersection=function(n,h,o,i,s,e,g,w,c){q.typeOf.number("x00",n),q.typeOf.number("y00",h),q.typeOf.number("x01",o),q.typeOf.number("y01",i),q.typeOf.number("x10",s),q.typeOf.number("y10",e),q.typeOf.number("x11",g),q.typeOf.number("y11",w);let p=(g-s)*(h-e)-(w-e)*(n-s),d=(o-n)*(h-e)-(i-h)*(n-s),u=(w-e)*(o-n)-(g-s)*(i-h);if(u===0)return;let r=p/u,l=d/u;if(r>=0&&r<=1&&l>=0&&l<=1)return f(c)||(c=new Z),c.x=n+r*(o-n),c.y=h+r*(i-h),c};var ie=ne;var a=32767,z=a/2|0,Me=[],ze=[],Xe=[],te=new Ie,E=new A,Ke=[],We=[],Ye=[],Le=[],_e=[],Je=new A,Qe=new de,Ze=new ue,Ge=new Z,$e=new A;function je(n,h){let o=n.isEastChild,i=n.isNorthChild,s=o?z:0,e=o?a:z,g=i?z:0,w=i?a:z,c=Ke,p=We,d=Ye,u=_e;c.length=0,p.length=0,d.length=0,u.length=0;let r=Le;r.length=0;let l={},I=n.vertices,C=n.indices;C=C.subarray(0,n.indexCountWithoutSkirts);let R=Ne.clone(n.encoding),O=R.hasVertexNormals,W=0,Y=n.vertexCountWithoutSkirts,se=n.minimumHeight,ae=n.maximumHeight,D=new Array(Y),G=new Array(Y),L=new Array(Y),F=O?new Array(Y*2):void 0,$=20,H,t,k,x,y;for(t=0,k=0;t<Y;++t,k+=2){let v=R.decodeTextureCoordinates(I,t,Ge);if(H=R.decodeHeight(I,t),x=N.clamp(v.x*a|0,0,a),y=N.clamp(v.y*a|0,0,a),L[t]=N.clamp((H-se)/(ae-se)*a|0,0,a),x<$&&(x=0),y<$&&(y=0),a-x<$&&(x=a),a-y<$&&(y=a),D[t]=x,G[t]=y,O){let Q=R.getOctEncodedNormal(I,t,$e);F[k]=Q.x,F[k+1]=Q.y}(o&&x>=z||!o&&x<=z)&&(i&&y>=z||!i&&y<=z)&&(l[t]=W,c.push(x),p.push(y),d.push(L[t]),O&&(u.push(F[k]),u.push(F[k+1])),++W)}let T=[];T.push(new m),T.push(new m),T.push(new m);let B=[];B.push(new m),B.push(new m),B.push(new m);let b,j;for(t=0;t<C.length;t+=3){let v=C[t],Q=C[t+1],Be=C[t+2],De=D[v],Fe=D[Q],ke=D[Be];T[0].initializeIndexed(D,G,L,F,v),T[1].initializeIndexed(D,G,L,F,Q),T[2].initializeIndexed(D,G,L,F,Be);let P=ie.clipTriangleAtAxisAlignedThreshold(z,o,De,Fe,ke,Me);b=0,!(b>=P.length)&&(b=B[0].initializeFromClipResult(P,b,T),!(b>=P.length)&&(b=B[1].initializeFromClipResult(P,b,T),!(b>=P.length)&&(b=B[2].initializeFromClipResult(P,b,T),j=ie.clipTriangleAtAxisAlignedThreshold(z,i,B[0].getV(),B[1].getV(),B[2].getV(),ze),Oe(c,p,d,u,r,l,j,B,O),b<P.length&&(B[2].clone(B[1]),B[2].initializeFromClipResult(P,b,T),j=ie.clipTriangleAtAxisAlignedThreshold(z,i,B[0].getV(),B[1].getV(),B[2].getV(),ze),Oe(c,p,d,u,r,l,j,B,O)))))}let He=o?-a:0,qe=i?-a:0,me=[],ge=[],le=[],we=[],U=Number.MAX_VALUE,_=-U,M=Xe;M.length=0;let re=Ce.clone(n.ellipsoid),J=Se.clone(n.childRectangle),Ee=J.north,Re=J.south,ce=J.east,xe=J.west;for(ce<xe&&(ce+=N.TWO_PI),t=0;t<c.length;++t)x=Math.round(c[t]),x<=s?(me.push(t),x=0):x>=e?(le.push(t),x=a):x=x*2+He,c[t]=x,y=Math.round(p[t]),y<=g?(ge.push(t),y=0):y>=w?(we.push(t),y=a):y=y*2+qe,p[t]=y,H=N.lerp(se,ae,d[t]/a),H<U&&(U=H),H>_&&(_=H),d[t]=H,te.longitude=N.lerp(xe,ce,x/a),te.latitude=N.lerp(Re,Ee,y/a),te.height=H,re.cartographicToCartesian(te,E),M.push(E.x),M.push(E.y),M.push(E.z);let he=de.fromVertices(M,A.ZERO,3,Qe),Ue=ue.fromRectangle(J,U,_,re,Ze),ve=new be(re).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(he.center,M,3,he.center,U,Je),Pe=_-U,X=new Uint16Array(c.length+p.length+d.length);for(t=0;t<c.length;++t)X[t]=c[t];let fe=c.length;for(t=0;t<p.length;++t)X[fe+t]=p[t];for(fe+=p.length,t=0;t<d.length;++t)X[fe+t]=a*(d[t]-U)/Pe;let pe=Ve.createTypedArray(c.length,r),ye;if(O){let v=new Uint8Array(u);h.push(X.buffer,pe.buffer,v.buffer),ye=v.buffer}else h.push(X.buffer,pe.buffer);return{vertices:X.buffer,encodedNormals:ye,indices:pe.buffer,minimumHeight:U,maximumHeight:_,westIndices:me,southIndices:ge,eastIndices:le,northIndices:we,boundingSphere:he,orientedBoundingBox:Ue,horizonOcclusionPoint:ve}}function m(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}m.prototype.clone=function(n){return f(n)||(n=new m),n.uBuffer=this.uBuffer,n.vBuffer=this.vBuffer,n.heightBuffer=this.heightBuffer,n.normalBuffer=this.normalBuffer,n.index=this.index,n.first=this.first,n.second=this.second,n.ratio=this.ratio,n};m.prototype.initializeIndexed=function(n,h,o,i,s){this.uBuffer=n,this.vBuffer=h,this.heightBuffer=o,this.normalBuffer=i,this.index=s,this.first=void 0,this.second=void 0,this.ratio=void 0};m.prototype.initializeFromClipResult=function(n,h,o){let i=h+1;return n[h]!==-1?o[n[h]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=o[n[i]],++i,this.second=o[n[i]],++i,this.ratio=n[i],++i),i};m.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})};m.prototype.isIndexed=function(){return f(this.index)};m.prototype.getH=function(){return f(this.index)?this.heightBuffer[this.index]:N.lerp(this.first.getH(),this.second.getH(),this.ratio)};m.prototype.getU=function(){return f(this.index)?this.uBuffer[this.index]:N.lerp(this.first.getU(),this.second.getU(),this.ratio)};m.prototype.getV=function(){return f(this.index)?this.vBuffer[this.index]:N.lerp(this.first.getV(),this.second.getV(),this.ratio)};var K=new Z,oe=-1,en=[new A,new A],nn=[new A,new A];function Te(n,h){++oe;let o=en[oe],i=nn[oe];return o=ee.octDecode(n.first.getNormalX(),n.first.getNormalY(),o),i=ee.octDecode(n.second.getNormalX(),n.second.getNormalY(),i),E=A.lerp(o,i,n.ratio,E),A.normalize(E,E),ee.octEncode(E,h),--oe,h}m.prototype.getNormalX=function(){return f(this.index)?this.normalBuffer[this.index*2]:(K=Te(this,K),K.x)};m.prototype.getNormalY=function(){return f(this.index)?this.normalBuffer[this.index*2+1]:(K=Te(this,K),K.y)};var S=[];S.push(new m);S.push(new m);S.push(new m);S.push(new m);function Oe(n,h,o,i,s,e,g,w,c){if(g.length===0)return;let p=0,d=0;for(;d<g.length;)d=S[p++].initializeFromClipResult(g,d,w);for(let u=0;u<p;++u){let r=S[u];if(r.isIndexed())r.newIndex=e[r.index],r.uBuffer=n,r.vBuffer=h,r.heightBuffer=o,c&&(r.normalBuffer=i);else{let l=r.getKey();if(f(e[l]))r.newIndex=e[l];else{let I=n.length;n.push(r.getU()),h.push(r.getV()),o.push(r.getH()),c&&(i.push(r.getNormalX()),i.push(r.getNormalY())),r.newIndex=I,e[l]=I}}}p===3?(s.push(S[0].newIndex),s.push(S[1].newIndex),s.push(S[2].newIndex)):p===4&&(s.push(S[0].newIndex),s.push(S[1].newIndex),s.push(S[2].newIndex),s.push(S[0].newIndex),s.push(S[2].newIndex),s.push(S[3].newIndex))}var An=Ae(je);export{An as default};
|