@maptalks/3dtiles 0.12.3 → 0.12.7
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/dist/maptalks.3dtiles.js +627 -595
- package/package.json +3 -3
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.12.
|
|
2
|
+
* @maptalks/3dtiles v0.12.7
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
6
|
+
/*!
|
|
7
|
+
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2011-2017 Cesium Contributors
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*
|
|
23
|
+
* Columbus View (Pat. Pend.)
|
|
24
|
+
*
|
|
25
|
+
* Portions licensed separately.
|
|
26
|
+
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
|
27
|
+
*/
|
|
6
28
|
!function(t, e) {
|
|
7
29
|
"object" == typeof exports && "undefined" != typeof module ? e(require("maptalks"), require("@maptalks/gl")) : "function" == typeof define && define.amd ? define([ "maptalks", "@maptalks/gl" ], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).maptalks, t.maptalksgl);
|
|
8
30
|
}(this, (function(t, e) {
|
|
@@ -124,7 +146,7 @@
|
|
|
124
146
|
s(), o(1, 0, 0), o(0, 1, 0), g(), g(), A = new e(9), e != Float32Array && (A[1] = 0,
|
|
125
147
|
A[2] = 0, A[3] = 0, A[5] = 0, A[6] = 0, A[7] = 0), A[0] = 1, A[4] = 1, A[8] = 1;
|
|
126
148
|
/*!
|
|
127
|
-
* @maptalks/gltf-loader v0.25.
|
|
149
|
+
* @maptalks/gltf-loader v0.25.5
|
|
128
150
|
* LICENSE : UNLICENSED
|
|
129
151
|
* (c) 2016-2022 maptalks.org
|
|
130
152
|
*/
|
|
@@ -674,7 +696,7 @@
|
|
|
674
696
|
return n;
|
|
675
697
|
}(new Uint8Array(t, e, n));
|
|
676
698
|
}
|
|
677
|
-
const X = [ 1, 1, 1, 1, 2, 2, 3, 0 ], W = [ 0, 0, 0 ], Z = [ 0, 0, 0, 1 ],
|
|
699
|
+
const X = [ 1, 1, 1, 1, 2, 2, 3, 0 ], W = [ 0, 0, 0 ], Z = [ 0, 0, 0, 1 ], Q = [ 1, 1, 1 ], Y = {
|
|
678
700
|
TRANSLATION: [ 0, 0, 0 ],
|
|
679
701
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
680
702
|
SCALE: [ 1, 1, 1 ]
|
|
@@ -688,14 +710,14 @@
|
|
|
688
710
|
P(t, e, n, r, s, i, o, c) {
|
|
689
711
|
const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
|
|
690
712
|
for (let e = 0; e < h.length; e++) {
|
|
691
|
-
const f = h[e];
|
|
692
|
-
if (S(t) &&
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const e =
|
|
713
|
+
const f = h[e], l = f.name || e;
|
|
714
|
+
if (S(t) && l !== t) continue;
|
|
715
|
+
const d = f.channelsMap[n];
|
|
716
|
+
if (d) for (let t = 0; t < d.length; t++) {
|
|
717
|
+
const e = d[t];
|
|
696
718
|
"translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
|
|
697
719
|
u.rotation = O(Z, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
|
|
698
|
-
u.scale = a(
|
|
720
|
+
u.scale = a(Q, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
|
|
699
721
|
u.weights = c);
|
|
700
722
|
}
|
|
701
723
|
}
|
|
@@ -801,7 +823,7 @@
|
|
|
801
823
|
},
|
|
802
824
|
getAnimationClip(t, e, n, r) {
|
|
803
825
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
804
|
-
return c(W, ...
|
|
826
|
+
return c(W, ...Y.TRANSLATION), _(Z, ...Y.ROTATION), c(Q, ...Y.SCALE), this.P(r, t, e, n, W, Z, Q, s);
|
|
805
827
|
},
|
|
806
828
|
getTimeSpan(t) {
|
|
807
829
|
if (!t.animations) return null;
|
|
@@ -831,7 +853,7 @@
|
|
|
831
853
|
let t;
|
|
832
854
|
try {
|
|
833
855
|
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
834
|
-
} catch (
|
|
856
|
+
} catch (Qt) {}
|
|
835
857
|
t && "undefined" != typeof createImageBitmap && (nt = !0);
|
|
836
858
|
}
|
|
837
859
|
const rt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
@@ -1105,8 +1127,9 @@
|
|
|
1105
1127
|
let ot, at;
|
|
1106
1128
|
function ct(t, e) {
|
|
1107
1129
|
ot || (ot = new OffscreenCanvas(2, 2), at = ot.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
1108
|
-
|
|
1109
|
-
ot.width = n, ot.height = r, at.drawImage(t, 0, 0),
|
|
1130
|
+
let {width: n, height: r} = t;
|
|
1131
|
+
ht(n) || (n = ut(n)), ht(r) || (r = ut(r)), ot.width = n, ot.height = r, at.drawImage(t, 0, 0, n, r),
|
|
1132
|
+
t.close();
|
|
1110
1133
|
const s = at.getImageData(0, 0, n, r);
|
|
1111
1134
|
e(null, {
|
|
1112
1135
|
width: n,
|
|
@@ -1118,19 +1141,25 @@
|
|
|
1118
1141
|
});
|
|
1119
1142
|
}
|
|
1120
1143
|
function ht(t) {
|
|
1121
|
-
return t
|
|
1144
|
+
return 0 == (t & t - 1) && 0 !== t;
|
|
1122
1145
|
}
|
|
1123
1146
|
function ut(t) {
|
|
1124
|
-
return Math.
|
|
1147
|
+
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
1148
|
+
}
|
|
1149
|
+
function ft(t) {
|
|
1150
|
+
return t / Math.PI * 180;
|
|
1125
1151
|
}
|
|
1126
|
-
const ft = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
1127
1152
|
function lt(t) {
|
|
1153
|
+
return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : t > 0 ? 1 : -1;
|
|
1154
|
+
}
|
|
1155
|
+
const dt = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
1156
|
+
function mt(t) {
|
|
1128
1157
|
const e = t.length;
|
|
1129
1158
|
let n = "";
|
|
1130
1159
|
for (let r = 0; r < e; ) {
|
|
1131
1160
|
let s = t[r++];
|
|
1132
1161
|
if (128 & s) {
|
|
1133
|
-
let n =
|
|
1162
|
+
let n = dt[s >> 3 & 7];
|
|
1134
1163
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
1135
1164
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
1136
1165
|
const e = t[r++];
|
|
@@ -1143,14 +1172,14 @@
|
|
|
1143
1172
|
return n;
|
|
1144
1173
|
}
|
|
1145
1174
|
new Array(3), new Array(3);
|
|
1146
|
-
const
|
|
1147
|
-
function
|
|
1148
|
-
const n =
|
|
1149
|
-
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], l = i * i * c * c, d = o * o * h * h, m = a * a * u * u, y = l + d + m, b = Math.sqrt(1 / y), p = f(
|
|
1175
|
+
const yt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], bt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], pt = new Array(3), wt = new Array(3), _t = new Array(3);
|
|
1176
|
+
function gt(t, e) {
|
|
1177
|
+
const n = bt, r = function(t, e, n, r, s) {
|
|
1178
|
+
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], l = i * i * c * c, d = o * o * h * h, m = a * a * u * u, y = l + d + m, b = Math.sqrt(1 / y), p = f(Tt, e, b);
|
|
1150
1179
|
if (y < s) return isFinite(b) ? p : void 0;
|
|
1151
|
-
const w = r[0], _ = r[1], g = r[2], T =
|
|
1180
|
+
const w = r[0], _ = r[1], g = r[2], T = At;
|
|
1152
1181
|
T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
|
|
1153
|
-
let A, O, v, M, S, x, I, N, E, P, L, B = (1 - b) *
|
|
1182
|
+
let A, O, v, M, S, x, I, N, E, P, L, B = (1 - b) * Ot(e) / (.5 * Ot(T)), U = 0;
|
|
1154
1183
|
do {
|
|
1155
1184
|
B -= U, v = 1 / (1 + B * w), M = 1 / (1 + B * _), S = 1 / (1 + B * g), x = v * v,
|
|
1156
1185
|
I = M * M, N = S * S, E = x * v, P = I * M, L = N * S, A = l * x + d * I + m * N - 1,
|
|
@@ -1158,22 +1187,22 @@
|
|
|
1158
1187
|
U = A / (-2 * O);
|
|
1159
1188
|
} while (Math.abs(A) > 1e-12);
|
|
1160
1189
|
return t[0] = i * v, t[1] = o * M, t[2] = a * S, t;
|
|
1161
|
-
}(
|
|
1162
|
-
let s = p(
|
|
1190
|
+
}(pt, e, yt, n, .1);
|
|
1191
|
+
let s = p(wt, r, n);
|
|
1163
1192
|
s = function(t, e) {
|
|
1164
1193
|
const n = e[0], r = e[1], s = e[2];
|
|
1165
1194
|
let i = n * n + r * r + s * s;
|
|
1166
1195
|
i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i);
|
|
1167
1196
|
return t;
|
|
1168
1197
|
}(s, s);
|
|
1169
|
-
const i = b(
|
|
1170
|
-
return t[0] =
|
|
1198
|
+
const i = b(_t, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = lt(d(i, e)) * Ot(i);
|
|
1199
|
+
return t[0] = ft(o), t[1] = ft(a), t[2] = c, t;
|
|
1171
1200
|
}
|
|
1172
|
-
const
|
|
1173
|
-
function
|
|
1201
|
+
const Tt = new Array(3), At = new Array(3);
|
|
1202
|
+
function Ot(t) {
|
|
1174
1203
|
return i(t);
|
|
1175
1204
|
}
|
|
1176
|
-
function
|
|
1205
|
+
function vt(t, e) {
|
|
1177
1206
|
let n = "";
|
|
1178
1207
|
for (let r = 0; r < 4; r++) {
|
|
1179
1208
|
const s = t.getUint8(e + r);
|
|
@@ -1181,27 +1210,27 @@
|
|
|
1181
1210
|
}
|
|
1182
1211
|
return n;
|
|
1183
1212
|
}
|
|
1184
|
-
const
|
|
1185
|
-
function
|
|
1213
|
+
const Mt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
1214
|
+
function St(t, e, n) {
|
|
1186
1215
|
const r = new Uint8Array(t, e, n);
|
|
1187
|
-
return
|
|
1216
|
+
return Mt ? JSON.parse(Mt.decode(r)) : JSON.parse(mt(r));
|
|
1188
1217
|
}
|
|
1189
|
-
function
|
|
1218
|
+
function xt(t, e, n) {
|
|
1190
1219
|
const r = new Uint8Array(t, e, n);
|
|
1191
|
-
return
|
|
1220
|
+
return Mt ? JSON.parse(Mt.decode(r)) : JSON.parse(mt(r));
|
|
1192
1221
|
}
|
|
1193
|
-
function
|
|
1222
|
+
function It(t, e, n) {
|
|
1194
1223
|
return {
|
|
1195
1224
|
offset: e,
|
|
1196
1225
|
byteLength: n
|
|
1197
1226
|
};
|
|
1198
1227
|
}
|
|
1199
|
-
function
|
|
1228
|
+
function Nt(t, e, n, r) {
|
|
1200
1229
|
const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
|
|
1201
|
-
return
|
|
1230
|
+
return Lt[t];
|
|
1202
1231
|
}(i), h = function(t) {
|
|
1203
1232
|
if (!t) return 1;
|
|
1204
|
-
return
|
|
1233
|
+
return Pt[t];
|
|
1205
1234
|
}(o);
|
|
1206
1235
|
return {
|
|
1207
1236
|
byteStride: 0,
|
|
@@ -1212,19 +1241,19 @@
|
|
|
1212
1241
|
array: new a(e, n + s, r * h)
|
|
1213
1242
|
};
|
|
1214
1243
|
}
|
|
1215
|
-
function
|
|
1244
|
+
function Et(t, e, n, r) {
|
|
1216
1245
|
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
1217
|
-
const s =
|
|
1246
|
+
const s = Nt(t, e, n, r);
|
|
1218
1247
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
1219
1248
|
s;
|
|
1220
1249
|
}
|
|
1221
|
-
const
|
|
1250
|
+
const Pt = {
|
|
1222
1251
|
"SCALAR": 1,
|
|
1223
1252
|
"VEC2": 2,
|
|
1224
1253
|
"VEC3": 3,
|
|
1225
1254
|
"VEC4": 4
|
|
1226
1255
|
};
|
|
1227
|
-
const
|
|
1256
|
+
const Lt = {
|
|
1228
1257
|
"BYTE": {
|
|
1229
1258
|
ctor: Int8Array,
|
|
1230
1259
|
type: 5120,
|
|
@@ -1266,27 +1295,27 @@
|
|
|
1266
1295
|
name: "Float64Array"
|
|
1267
1296
|
}
|
|
1268
1297
|
};
|
|
1269
|
-
function
|
|
1270
|
-
for (let e in
|
|
1298
|
+
function Bt(t) {
|
|
1299
|
+
for (let e in Lt) if (t === Lt[e].ctor) return Lt[e].type;
|
|
1271
1300
|
throw new Error("unrecognized ctor:" + t);
|
|
1272
1301
|
}
|
|
1273
|
-
function
|
|
1302
|
+
function Ut(t, e, n, r) {
|
|
1274
1303
|
const s = t, i = e.length / 3;
|
|
1275
1304
|
for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
|
|
1276
1305
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
1277
1306
|
return s;
|
|
1278
1307
|
}
|
|
1279
|
-
function
|
|
1308
|
+
function Ct(t, e, n) {
|
|
1280
1309
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
1281
1310
|
const a = t.buffer;
|
|
1282
1311
|
let c, h, u = {}, f = {};
|
|
1283
|
-
r > 0 && (u =
|
|
1312
|
+
r > 0 && (u = St(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
|
|
1284
1313
|
return {
|
|
1285
1314
|
offset: e,
|
|
1286
1315
|
byteLength: n
|
|
1287
1316
|
};
|
|
1288
|
-
}(0, e, s), e += s), i > 0 && (f =
|
|
1289
|
-
const l =
|
|
1317
|
+
}(0, e, s), e += s), i > 0 && (f = xt(a, e, i), e += i);
|
|
1318
|
+
const l = It(0, e, o);
|
|
1290
1319
|
return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
|
|
1291
1320
|
featureTable: u,
|
|
1292
1321
|
featureTableBin: c,
|
|
@@ -1294,28 +1323,28 @@
|
|
|
1294
1323
|
batchTableBin: h
|
|
1295
1324
|
};
|
|
1296
1325
|
}
|
|
1297
|
-
var
|
|
1326
|
+
var Rt = {
|
|
1298
1327
|
north: [ -1, 0, 0 ],
|
|
1299
1328
|
east: [ 0, 1, 0 ],
|
|
1300
1329
|
up: [ 0, 0, 1 ],
|
|
1301
1330
|
south: [ 1, 0, 0 ],
|
|
1302
1331
|
west: [ 0, -1, 0 ],
|
|
1303
1332
|
down: [ 0, 0, -1 ]
|
|
1304
|
-
},
|
|
1333
|
+
}, Ft = {}, Dt = {
|
|
1305
1334
|
east: [],
|
|
1306
1335
|
north: [],
|
|
1307
1336
|
up: [],
|
|
1308
1337
|
west: [],
|
|
1309
1338
|
south: [],
|
|
1310
1339
|
down: []
|
|
1311
|
-
},
|
|
1312
|
-
const
|
|
1313
|
-
function
|
|
1340
|
+
}, kt = [], zt = [], jt = [];
|
|
1341
|
+
const Vt = [ 0, 0, 0 ];
|
|
1342
|
+
function Gt(t, e, n, r) {
|
|
1314
1343
|
n = n || 0, r = r || n;
|
|
1315
1344
|
var s = Math.abs(t - e);
|
|
1316
1345
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
1317
1346
|
}
|
|
1318
|
-
const
|
|
1347
|
+
const Ht = (Kt = {
|
|
1319
1348
|
up: {
|
|
1320
1349
|
south: "east",
|
|
1321
1350
|
north: "west",
|
|
@@ -1352,54 +1381,54 @@
|
|
|
1352
1381
|
north: "up",
|
|
1353
1382
|
south: "down"
|
|
1354
1383
|
}
|
|
1355
|
-
}[
|
|
1384
|
+
}[qt = "east"][$t = "north"], Ft[Xt = qt + $t] ? Jt = Ft[Xt] : (Jt = function(t, e, n) {
|
|
1356
1385
|
if (function(t, e) {
|
|
1357
1386
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
1358
1387
|
return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
|
|
1359
|
-
}(t,
|
|
1360
|
-
var r =
|
|
1361
|
-
a(
|
|
1362
|
-
a(
|
|
1388
|
+
}(t, Vt)) a(kt, Rt[qt]), a(zt, Rt[$t]), a(jt, Rt[Kt]); else if (Gt(t[0], 0, 1e-14) && Gt(t[1], 0, 1e-14)) {
|
|
1389
|
+
var r = lt(t[2]);
|
|
1390
|
+
a(kt, Rt[qt]), "east" !== qt && "west" !== qt && f(kt, kt, r), a(zt, Rt[$t]), "east" !== $t && "west" !== $t && f(zt, zt, r),
|
|
1391
|
+
a(jt, Rt[Kt]), "east" !== Kt && "west" !== Kt && f(jt, jt, r);
|
|
1363
1392
|
} else {
|
|
1364
1393
|
!function(t, e) {
|
|
1365
|
-
u(e, t,
|
|
1366
|
-
}(t,
|
|
1367
|
-
var s =
|
|
1368
|
-
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(
|
|
1369
|
-
f(
|
|
1370
|
-
}
|
|
1371
|
-
return n[0] =
|
|
1372
|
-
n[6] =
|
|
1394
|
+
u(e, t, bt), l(e, e);
|
|
1395
|
+
}(t, Dt.up);
|
|
1396
|
+
var s = Dt.up, i = Dt.east;
|
|
1397
|
+
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Dt.east, i), m(Dt.north, s, i), f(Dt.down, Dt.up, -1),
|
|
1398
|
+
f(Dt.west, Dt.east, -1), f(Dt.south, Dt.north, -1), kt = Dt[qt], zt = Dt[$t], jt = Dt[Kt];
|
|
1399
|
+
}
|
|
1400
|
+
return n[0] = kt[0], n[1] = kt[1], n[2] = kt[2], n[3] = 0, n[4] = zt[0], n[5] = zt[1],
|
|
1401
|
+
n[6] = zt[2], n[7] = 0, n[8] = jt[0], n[9] = jt[1], n[10] = jt[2], n[11] = 0, n[12] = t[0],
|
|
1373
1402
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
1374
|
-
},
|
|
1403
|
+
}, Ft[Xt] = Jt), Jt);
|
|
1375
1404
|
/*!
|
|
1376
1405
|
* @maptalks/gl v0.65.0
|
|
1377
1406
|
* LICENSE : UNLICENSED
|
|
1378
1407
|
* (c) 2016-2022 maptalks.com
|
|
1379
|
-
*/ var
|
|
1380
|
-
const
|
|
1408
|
+
*/ var qt, $t, Jt, Kt, Xt;
|
|
1409
|
+
const Wt = function() {
|
|
1381
1410
|
if ("undefined" != typeof self) return self;
|
|
1382
1411
|
if ("undefined" != typeof window) return window;
|
|
1383
1412
|
if ("undefined" != typeof global) return global;
|
|
1384
1413
|
throw new Error("unable to locate global object");
|
|
1385
|
-
},
|
|
1386
|
-
|
|
1387
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
1388
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
1414
|
+
}, Zt = Wt(), Qt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1415
|
+
Qt.inject = function(t) {
|
|
1416
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1417
|
+
let i = `${r}\n const _____getGlobal = ${Wt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
1389
1418
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
1390
1419
|
return i += "\n" + e.substring(r.length), i;
|
|
1391
|
-
},
|
|
1392
|
-
|
|
1393
|
-
},
|
|
1394
|
-
return
|
|
1420
|
+
}, Qt.registerTranscoder = function(t, e) {
|
|
1421
|
+
Qt[t] = e;
|
|
1422
|
+
}, Qt.getTranscoder = function(t) {
|
|
1423
|
+
return Qt[t];
|
|
1395
1424
|
};
|
|
1396
|
-
class
|
|
1425
|
+
class Yt {
|
|
1397
1426
|
constructor(t, e, n) {
|
|
1398
1427
|
this.i = t, this.Y = e || st, this.o = n, this.tt = {
|
|
1399
|
-
"image/crn":
|
|
1400
|
-
"image/ktx2":
|
|
1401
|
-
"image/cttf":
|
|
1402
|
-
"draco":
|
|
1428
|
+
"image/crn": Qt.crn && Qt.crn(),
|
|
1429
|
+
"image/ktx2": Qt.ktx2 && Qt.ktx2(),
|
|
1430
|
+
"image/cttf": Qt.ktx2 && Qt.ktx2(),
|
|
1431
|
+
"draco": Qt.draco && Qt.draco()
|
|
1403
1432
|
};
|
|
1404
1433
|
}
|
|
1405
1434
|
static createEmptyB3DM() {
|
|
@@ -1458,15 +1487,15 @@
|
|
|
1458
1487
|
o = h, h = a, u = c, a = 0, c = 0);
|
|
1459
1488
|
const l = [ t ];
|
|
1460
1489
|
let d, m, y;
|
|
1461
|
-
if (a > 0 ? (d =
|
|
1490
|
+
if (a > 0 ? (d = St(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
|
|
1462
1491
|
"BATCH_LENGTH": o
|
|
1463
|
-
}, c > 0 && (f += c), h > 0 && (m =
|
|
1464
|
-
const e =
|
|
1492
|
+
}, c > 0 && (f += c), h > 0 && (m = xt(t, f, h), f += h, u > 0)) {
|
|
1493
|
+
const e = It(0, f, u);
|
|
1465
1494
|
y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
|
|
1466
1495
|
}
|
|
1467
1496
|
const b = d.BATCH_LENGTH, p = {};
|
|
1468
1497
|
if (d && d.BATCH_ID) {
|
|
1469
|
-
p.BATCH_ID =
|
|
1498
|
+
p.BATCH_ID = Et(d.BATCH_ID, t, (void 0).offset, b);
|
|
1470
1499
|
const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
|
|
1471
1500
|
e && l.indexOf(e) < 0 && l.push(e);
|
|
1472
1501
|
}
|
|
@@ -1488,13 +1517,13 @@
|
|
|
1488
1517
|
return null;
|
|
1489
1518
|
}
|
|
1490
1519
|
}
|
|
1491
|
-
class
|
|
1520
|
+
class te {
|
|
1492
1521
|
constructor(t, e, n) {
|
|
1493
1522
|
this.i = t, this.Y = e || st, this.o = n, this.tt = {
|
|
1494
|
-
"image/crn":
|
|
1495
|
-
"image/ktx2":
|
|
1496
|
-
"image/cttf":
|
|
1497
|
-
"draco":
|
|
1523
|
+
"image/crn": Qt.crn && Qt.crn(),
|
|
1524
|
+
"image/ktx2": Qt.ktx2 && Qt.ktx2(),
|
|
1525
|
+
"image/cttf": Qt.ktx2 && Qt.ktx2(),
|
|
1526
|
+
"draco": Qt.draco && Qt.draco()
|
|
1498
1527
|
};
|
|
1499
1528
|
}
|
|
1500
1529
|
load(t, e, n = 0, r = 0) {
|
|
@@ -1528,7 +1557,7 @@
|
|
|
1528
1557
|
supportedFormats: this.o
|
|
1529
1558
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
1530
1559
|
if (0 === i.getUint32(28, !0)) {
|
|
1531
|
-
let r =
|
|
1560
|
+
let r = mt(new Uint8Array(e, o + n, i.byteLength - o));
|
|
1532
1561
|
-1 == r.indexOf("://") && (r = t.substring(0, t.lastIndexOf("/")) + "/" + r);
|
|
1533
1562
|
return r.indexOf(".glb") > 0 ? z.getArrayBuffer(r, {}).then(t => this.ot(r, {
|
|
1534
1563
|
buffer: t.data,
|
|
@@ -1571,7 +1600,7 @@
|
|
|
1571
1600
|
error: t
|
|
1572
1601
|
};
|
|
1573
1602
|
}
|
|
1574
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1603
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Ct(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
|
|
1575
1604
|
if (a.POSITION) {
|
|
1576
1605
|
const {byteOffset: e} = a.POSITION;
|
|
1577
1606
|
f.POSITION = {
|
|
@@ -1594,7 +1623,7 @@
|
|
|
1594
1623
|
}, o.push(f.POSITION.array.buffer);
|
|
1595
1624
|
}
|
|
1596
1625
|
if (a.BATCH_ID) {
|
|
1597
|
-
f.BATCH_ID =
|
|
1626
|
+
f.BATCH_ID = Et(a.BATCH_ID, t, c.offset, l);
|
|
1598
1627
|
const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
|
|
1599
1628
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1600
1629
|
}
|
|
@@ -1665,26 +1694,26 @@
|
|
|
1665
1694
|
}
|
|
1666
1695
|
ct(t) {
|
|
1667
1696
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
1668
|
-
for (let s = 0; s < e; s++)
|
|
1697
|
+
for (let s = 0; s < e; s++) ee(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
1669
1698
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
1670
1699
|
return n;
|
|
1671
1700
|
}
|
|
1672
1701
|
at(t, e, n) {
|
|
1673
|
-
return
|
|
1702
|
+
return Ut(new Float32Array(t.length), t, e, n);
|
|
1674
1703
|
}
|
|
1675
1704
|
rt() {
|
|
1676
1705
|
return null;
|
|
1677
1706
|
}
|
|
1678
1707
|
}
|
|
1679
|
-
function
|
|
1680
|
-
if (t[0] =
|
|
1708
|
+
function ee(t, e, n, r) {
|
|
1709
|
+
if (t[0] = ne(e, r), t[1] = ne(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
1681
1710
|
t[2] < 0) {
|
|
1682
1711
|
const e = t[0];
|
|
1683
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
1712
|
+
t[0] = (1 - Math.abs(t[1])) * re(e), t[1] = (1 - Math.abs(e)) * re(t[1]);
|
|
1684
1713
|
}
|
|
1685
1714
|
return l(t, t);
|
|
1686
1715
|
}
|
|
1687
|
-
function
|
|
1716
|
+
function ne(t, e) {
|
|
1688
1717
|
return function(t, e, n) {
|
|
1689
1718
|
return t < e ? e : t > n ? n : t;
|
|
1690
1719
|
}(t, 0, e = function(t, e) {
|
|
@@ -1692,10 +1721,10 @@
|
|
|
1692
1721
|
return e;
|
|
1693
1722
|
}(e, 255)) / e * 2 - 1;
|
|
1694
1723
|
}
|
|
1695
|
-
function
|
|
1724
|
+
function re(t) {
|
|
1696
1725
|
return t < 0 ? -1 : 1;
|
|
1697
1726
|
}
|
|
1698
|
-
class
|
|
1727
|
+
class se {
|
|
1699
1728
|
constructor() {}
|
|
1700
1729
|
load(t, e, n = 0, r = 0) {
|
|
1701
1730
|
return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : z.getArrayBuffer(t, {}).then(e => {
|
|
@@ -1728,7 +1757,7 @@
|
|
|
1728
1757
|
error: t
|
|
1729
1758
|
};
|
|
1730
1759
|
}
|
|
1731
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1760
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Ct(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
|
|
1732
1761
|
let m, y = {};
|
|
1733
1762
|
if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
|
|
1734
1763
|
y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
|
|
@@ -1736,7 +1765,7 @@
|
|
|
1736
1765
|
attributes: y.properties,
|
|
1737
1766
|
useUniqueIDs: !1
|
|
1738
1767
|
};
|
|
1739
|
-
return this.ut || (this.ut =
|
|
1768
|
+
return this.ut || (this.ut = Qt.draco()), this.ut(m, e).then(e => {
|
|
1740
1769
|
const n = e.attributes;
|
|
1741
1770
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
1742
1771
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -1750,11 +1779,11 @@
|
|
|
1750
1779
|
byteOffset: 0,
|
|
1751
1780
|
itemSize: 1,
|
|
1752
1781
|
count: t.length,
|
|
1753
|
-
componentType:
|
|
1782
|
+
componentType: Bt(t.constructor),
|
|
1754
1783
|
array: t
|
|
1755
1784
|
}, o.push(t.buffer);
|
|
1756
1785
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
1757
|
-
a.BATCH_ID ? r.BATCH_ID =
|
|
1786
|
+
a.BATCH_ID ? r.BATCH_ID = Et(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = ie(d);
|
|
1758
1787
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
1759
1788
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1760
1789
|
}
|
|
@@ -1770,7 +1799,7 @@
|
|
|
1770
1799
|
}
|
|
1771
1800
|
const b = this.ft(t, a, c.offset, d, o, f, l);
|
|
1772
1801
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
1773
|
-
a.BATCH_ID ? b.BATCH_ID =
|
|
1802
|
+
a.BATCH_ID ? b.BATCH_ID = Et(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = ie(d);
|
|
1774
1803
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
1775
1804
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1776
1805
|
}
|
|
@@ -1899,13 +1928,13 @@
|
|
|
1899
1928
|
return a;
|
|
1900
1929
|
}
|
|
1901
1930
|
at(t, e, n) {
|
|
1902
|
-
return
|
|
1931
|
+
return Ut(new Float32Array(t.length), t, e, n);
|
|
1903
1932
|
}
|
|
1904
1933
|
rt() {
|
|
1905
1934
|
return null;
|
|
1906
1935
|
}
|
|
1907
1936
|
}
|
|
1908
|
-
function
|
|
1937
|
+
function ie(t) {
|
|
1909
1938
|
const e = (n = t) < 256 ? Uint8Array : n < 65536 ? Uint16Array : Uint32Array;
|
|
1910
1939
|
var n;
|
|
1911
1940
|
const r = new e(t);
|
|
@@ -1915,11 +1944,11 @@
|
|
|
1915
1944
|
byteOffset: 0,
|
|
1916
1945
|
itemSize: 1,
|
|
1917
1946
|
count: t,
|
|
1918
|
-
componentType:
|
|
1947
|
+
componentType: Bt(e),
|
|
1919
1948
|
array: r
|
|
1920
1949
|
};
|
|
1921
1950
|
}
|
|
1922
|
-
class
|
|
1951
|
+
class oe {
|
|
1923
1952
|
constructor(t, e) {
|
|
1924
1953
|
this.i = t, this.Y = e || st;
|
|
1925
1954
|
}
|
|
@@ -1934,12 +1963,12 @@
|
|
|
1934
1963
|
const s = this.lt(e, t, n, r), i = [];
|
|
1935
1964
|
for (let n = 0; n < s.length; n++) {
|
|
1936
1965
|
let r;
|
|
1937
|
-
if ("b3dm" === s[n].magic) r = new
|
|
1966
|
+
if ("b3dm" === s[n].magic) r = new Yt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new te(this.i, this.Y); else if ("pnts" === s[n].magic) r = new se; else {
|
|
1938
1967
|
if ("cmpt" !== s[n].magic) {
|
|
1939
1968
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
1940
1969
|
continue;
|
|
1941
1970
|
}
|
|
1942
|
-
r = new
|
|
1971
|
+
r = new oe(this.i, this.Y);
|
|
1943
1972
|
}
|
|
1944
1973
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
1945
1974
|
}
|
|
@@ -1960,7 +1989,7 @@
|
|
|
1960
1989
|
const o = [], a = s.getUint32(12, !0);
|
|
1961
1990
|
let c = 16;
|
|
1962
1991
|
for (let e = 0; e < a; e++) {
|
|
1963
|
-
const e =
|
|
1992
|
+
const e = vt(s, c), r = s.getUint32(c + 8, !0);
|
|
1964
1993
|
o.push({
|
|
1965
1994
|
magic: e,
|
|
1966
1995
|
buffer: t,
|
|
@@ -1971,17 +2000,17 @@
|
|
|
1971
2000
|
return o;
|
|
1972
2001
|
}
|
|
1973
2002
|
}
|
|
1974
|
-
function
|
|
2003
|
+
function ae(t, e) {
|
|
1975
2004
|
if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
|
|
1976
2005
|
const r = t.scenes[n].nodes;
|
|
1977
2006
|
for (let n = 0, s = r.length; n < s; n++) {
|
|
1978
2007
|
const s = [];
|
|
1979
|
-
|
|
2008
|
+
ce(r[n], s, t, e);
|
|
1980
2009
|
}
|
|
1981
2010
|
}
|
|
1982
2011
|
}
|
|
1983
|
-
function
|
|
1984
|
-
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++)
|
|
2012
|
+
function ce(t, e, n, r) {
|
|
2013
|
+
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) ce(t.children[s], e, n, r);
|
|
1985
2014
|
if (void 0 !== t.mesh) {
|
|
1986
2015
|
const s = t.mesh, i = n.meshes[s];
|
|
1987
2016
|
if (i) {
|
|
@@ -1993,7 +2022,7 @@
|
|
|
1993
2022
|
}
|
|
1994
2023
|
}
|
|
1995
2024
|
}
|
|
1996
|
-
function
|
|
2025
|
+
function he(t, e) {
|
|
1997
2026
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
1998
2027
|
const a = t.array.buffer, c = n ? st.getTypedArrayCtor(n) : t.array.constructor;
|
|
1999
2028
|
if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
|
|
@@ -2012,27 +2041,27 @@
|
|
|
2012
2041
|
e(new c(h.buffer), t), n.set(h);
|
|
2013
2042
|
}
|
|
2014
2043
|
}
|
|
2015
|
-
const
|
|
2016
|
-
let
|
|
2044
|
+
const ue = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], fe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], le = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
2045
|
+
let de, me = !1;
|
|
2017
2046
|
if ("undefined" != typeof OffscreenCanvas) {
|
|
2018
2047
|
try {
|
|
2019
|
-
|
|
2048
|
+
de = new OffscreenCanvas(2, 2).getContext("2d");
|
|
2020
2049
|
} catch (t) {}
|
|
2021
|
-
|
|
2050
|
+
de && "undefined" != typeof createImageBitmap && (me = !0);
|
|
2022
2051
|
}
|
|
2023
|
-
const
|
|
2024
|
-
class
|
|
2052
|
+
const ye = n([]), be = [ 0, 0, 0 ], pe = [], we = [];
|
|
2053
|
+
class _e {
|
|
2025
2054
|
constructor(t, e, n, r) {
|
|
2026
2055
|
this.id = t, this.options = e, this.dt = this.requestImage.bind(this), this.yt = n,
|
|
2027
2056
|
this.bt = {}, r(null, {}, []);
|
|
2028
2057
|
}
|
|
2029
2058
|
pt(t) {
|
|
2030
|
-
this.wt || (this._t = new
|
|
2059
|
+
this.wt || (this._t = new se, this.wt = new Yt(this.dt, st, t), this.gt = new te(this.dt, st, t));
|
|
2031
2060
|
}
|
|
2032
2061
|
requestImage(t, e) {
|
|
2033
|
-
|
|
2034
|
-
(void 0).width = t.width, (void 0).height = t.height,
|
|
2035
|
-
const n =
|
|
2062
|
+
me ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
2063
|
+
(void 0).width = t.width, (void 0).height = t.height, de.drawImage(t, 0, 0);
|
|
2064
|
+
const n = de.getImageData(0, 0, (void 0).width, (void 0).height);
|
|
2036
2065
|
e(null, {
|
|
2037
2066
|
width: t.width,
|
|
2038
2067
|
height: t.height,
|
|
@@ -2047,14 +2076,14 @@
|
|
|
2047
2076
|
const n = t.url, r = t.arraybuffer;
|
|
2048
2077
|
if (r) {
|
|
2049
2078
|
delete this.bt[n];
|
|
2050
|
-
const s =
|
|
2079
|
+
const s = vt(new DataView(r), 0);
|
|
2051
2080
|
if ("{" === s[0] || " " === s[0]) {
|
|
2052
2081
|
const t = function(t, e, n) {
|
|
2053
|
-
if (
|
|
2082
|
+
if (le) {
|
|
2054
2083
|
const r = new Uint8Array(t, e, n);
|
|
2055
|
-
return
|
|
2084
|
+
return le.decode(r);
|
|
2056
2085
|
}
|
|
2057
|
-
return
|
|
2086
|
+
return mt(new Uint8Array(t, e, n));
|
|
2058
2087
|
}(r, 0, r.byteLength), n = JSON.parse(t);
|
|
2059
2088
|
e(null, n);
|
|
2060
2089
|
} else if ("b3dm" === s) {
|
|
@@ -2078,7 +2107,7 @@
|
|
|
2078
2107
|
e(null, r, i);
|
|
2079
2108
|
});
|
|
2080
2109
|
} else if ("cmpt" === s) {
|
|
2081
|
-
new
|
|
2110
|
+
new oe(this.dt, st).load(n, r).then(n => {
|
|
2082
2111
|
const {content: r, transferables: s} = this.Ot(n, t);
|
|
2083
2112
|
e(null, r, s);
|
|
2084
2113
|
}).catch(t => {
|
|
@@ -2107,13 +2136,13 @@
|
|
|
2107
2136
|
const {magic: i} = n[t];
|
|
2108
2137
|
if ("b3dm" === i) {
|
|
2109
2138
|
const {content: i, transferables: o} = this.Tt(n[t], e);
|
|
2110
|
-
|
|
2139
|
+
Ae(s, o), r.content.push(i);
|
|
2111
2140
|
} else if ("i3dm" === i || "pnts" === i) {
|
|
2112
2141
|
const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.At(n[t], i, o);
|
|
2113
|
-
|
|
2142
|
+
Ae(s, c), r.content.push(a);
|
|
2114
2143
|
} else if ("cmpt" === i) {
|
|
2115
2144
|
const {content: i, transferables: o} = this.Ot(n[t], e);
|
|
2116
|
-
|
|
2145
|
+
Ae(s, o), r.content.push(i);
|
|
2117
2146
|
}
|
|
2118
2147
|
}
|
|
2119
2148
|
return {
|
|
@@ -2134,8 +2163,8 @@
|
|
|
2134
2163
|
let i = r && r.RTC_CENTER || [ 0, 0, 0 ];
|
|
2135
2164
|
if (r.EAST_NORTH_UP && !s.NORMAL_UP && !s.NORMAL_UP_OCT32P) {
|
|
2136
2165
|
const e = new Float32Array(3 * s.POSITION.array.length), n = [], r = [], o = [];
|
|
2137
|
-
|
|
2138
|
-
h(o, t, i),
|
|
2166
|
+
he(s.POSITION, (t, s) => {
|
|
2167
|
+
h(o, t, i), Ht(o, null, n), function(t, e) {
|
|
2139
2168
|
t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8],
|
|
2140
2169
|
t[7] = e[9], t[8] = e[10];
|
|
2141
2170
|
}(r, n);
|
|
@@ -2159,17 +2188,19 @@
|
|
|
2159
2188
|
hmin: 1 / 0,
|
|
2160
2189
|
hmax: -1 / 0
|
|
2161
2190
|
};
|
|
2162
|
-
|
|
2163
|
-
const c =
|
|
2164
|
-
|
|
2165
|
-
t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2]
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
const
|
|
2191
|
+
ge(s.POSITION.array, 3, i, ye, o);
|
|
2192
|
+
const c = Te(o), u = a([], c), f = [ 1 / 0, 1 / 0, 1 / 0 ], l = [ -1 / 0, -1 / 0, -1 / 0 ];
|
|
2193
|
+
he(s.POSITION, t => {
|
|
2194
|
+
t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2],
|
|
2195
|
+
t[0] < f[0] && (f[0] = t[0]), t[1] < f[1] && (f[1] = t[1]), t[2] < f[2] && (f[2] = t[2]),
|
|
2196
|
+
t[0] > l[0] && (l[0] = t[0]), t[1] > l[1] && (l[1] = t[1]), t[2] > l[2] && (l[2] = t[2]);
|
|
2197
|
+
}), s.POSITION.min = f, s.POSITION.max = l, e && y(c, c, e);
|
|
2198
|
+
const d = this.Mt(c);
|
|
2199
|
+
t.rtcCenter = u, t.rtcCoord = d, t.rootIdx = n;
|
|
2200
|
+
const m = t.transferables;
|
|
2170
2201
|
return delete t.transferables, {
|
|
2171
2202
|
content: t,
|
|
2172
|
-
transferables:
|
|
2203
|
+
transferables: m
|
|
2173
2204
|
};
|
|
2174
2205
|
}
|
|
2175
2206
|
vt(t) {
|
|
@@ -2193,8 +2224,8 @@
|
|
|
2193
2224
|
n && n.abort(), delete this.bt[t.url], e(null);
|
|
2194
2225
|
}
|
|
2195
2226
|
convertCoordinates(t, e, s, i) {
|
|
2196
|
-
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c =
|
|
2197
|
-
"X" === (s = s && s.toUpperCase()) ? c =
|
|
2227
|
+
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = ue;
|
|
2228
|
+
"X" === (s = s && s.toUpperCase()) ? c = fe : "Z" === s && (c = ye), t.extensions = t.extensions || {},
|
|
2198
2229
|
t.extensions.CESIUM_RTC || (t.extensions.CESIUM_RTC = {}), o && (t.extensions.CESIUM_RTC.center = o);
|
|
2199
2230
|
const h = {
|
|
2200
2231
|
xmin: 1 / 0,
|
|
@@ -2204,19 +2235,19 @@
|
|
|
2204
2235
|
hmin: 1 / 0,
|
|
2205
2236
|
hmax: -1 / 0
|
|
2206
2237
|
};
|
|
2207
|
-
|
|
2238
|
+
ae(t, t => {
|
|
2208
2239
|
if (!(t.attributes && t.attributes.POSITION)) return;
|
|
2209
|
-
const e = n(
|
|
2240
|
+
const e = n(pe);
|
|
2210
2241
|
if (t.matrices) for (let n = t.matrices.length - 1; n >= 0; n--) r(e, e, t.matrices[n]);
|
|
2211
2242
|
const s = t.attributes.POSITION.array, i = t.attributes.POSITION.itemSize;
|
|
2212
|
-
r(e, c, e),
|
|
2243
|
+
r(e, c, e), ge(s, i, o || be, e, h);
|
|
2213
2244
|
});
|
|
2214
|
-
const u =
|
|
2215
|
-
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (
|
|
2245
|
+
const u = Te(h), f = a([], u);
|
|
2246
|
+
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (ae(t, t => {
|
|
2216
2247
|
if (t.attributes && t.attributes.POSITION) {
|
|
2217
2248
|
const e = t.attributes.POSITION;
|
|
2218
2249
|
if (e.array.buffer.projected && e.array.buffer.projected[e.byteOffset]) return;
|
|
2219
|
-
const s = n(
|
|
2250
|
+
const s = n(pe);
|
|
2220
2251
|
if (t.matrices) for (let e = t.matrices.length - 1; e >= 0; e--) r(s, s, t.matrices[e]);
|
|
2221
2252
|
r(s, c, s);
|
|
2222
2253
|
const i = function(t, e) {
|
|
@@ -2227,19 +2258,22 @@
|
|
|
2227
2258
|
t[8] = (o * I - a * S + h * v) * E, t[9] = (r * S - n * I - i * v) * E, t[10] = (m * A - y * g + p * w) * E,
|
|
2228
2259
|
t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * v) * E, t[13] = (n * x - r * M + s * v) * E,
|
|
2229
2260
|
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
2230
|
-
}(
|
|
2231
|
-
|
|
2232
|
-
y(t, t, s), t[0] = t[0] - f[0], t[1] = t[1] - f[1], t[2] = t[2] - f[2], y(t, t, i)
|
|
2233
|
-
|
|
2261
|
+
}(we, s), o = [ 1 / 0, 1 / 0, 1 / 0 ], a = [ -1 / 0, -1 / 0, -1 / 0 ];
|
|
2262
|
+
he(e, t => {
|
|
2263
|
+
y(t, t, s), t[0] = t[0] - f[0], t[1] = t[1] - f[1], t[2] = t[2] - f[2], y(t, t, i),
|
|
2264
|
+
t[0] < o[0] && (o[0] = t[0]), t[1] < o[1] && (o[1] = t[1]), t[2] < o[2] && (o[2] = t[2]),
|
|
2265
|
+
t[0] > a[0] && (a[0] = t[0]), t[1] > a[1] && (a[1] = t[1]), t[2] > a[2] && (a[2] = t[2]);
|
|
2266
|
+
}), e.min = o, e.max = a, e.array.buffer.projected || (e.array.buffer.projected = {}),
|
|
2267
|
+
e.array.buffer.projected[e.byteOffset] = 1;
|
|
2234
2268
|
}
|
|
2235
2269
|
}), t.extensions.CESIUM_RTC.center = f);
|
|
2236
2270
|
}
|
|
2237
2271
|
Mt(t) {
|
|
2238
|
-
return 0 === w(t) ? c([], 0, 0, -6378137) :
|
|
2272
|
+
return 0 === w(t) ? c([], 0, 0, -6378137) : gt([], t);
|
|
2239
2273
|
}
|
|
2240
2274
|
onRemove() {}
|
|
2241
2275
|
}
|
|
2242
|
-
function
|
|
2276
|
+
function ge(t, e, n, r, s) {
|
|
2243
2277
|
const i = [];
|
|
2244
2278
|
for (let o = 0, a = t.length; o < a; o += e) {
|
|
2245
2279
|
const {xmin: a, ymin: u, xmax: f, ymax: l, hmin: d, hmax: m} = s;
|
|
@@ -2249,23 +2283,23 @@
|
|
|
2249
2283
|
b[1] > l && (s.ymax = b[1]), e > 2 && (b[2] < d && (s.hmin = b[2]), b[2] > m && (s.hmax = b[2]));
|
|
2250
2284
|
}
|
|
2251
2285
|
}
|
|
2252
|
-
function
|
|
2286
|
+
function Te(t) {
|
|
2253
2287
|
const {xmax: e, ymax: n, xmin: r, ymin: s, hmin: i, hmax: o} = t, a = [ (r + e) / 2, (s + n) / 2, (i + o) / 2 ];
|
|
2254
2288
|
return e === -1 / 0 && (a[0] = 0), n === -1 / 0 && (a[1] = 0), o === -1 / 0 && (a[2] = 0),
|
|
2255
2289
|
isNaN(a[2]) && (a[2] = 0), a;
|
|
2256
2290
|
}
|
|
2257
|
-
function
|
|
2291
|
+
function Ae(t, e) {
|
|
2258
2292
|
for (let n = 0; n < e.length; n++) t.indexOf(e[n]) < 0 && t.push(e[n]);
|
|
2259
2293
|
}
|
|
2260
|
-
let
|
|
2261
|
-
class
|
|
2294
|
+
let Oe = 0;
|
|
2295
|
+
class ve {
|
|
2262
2296
|
constructor(t) {
|
|
2263
2297
|
this.workerId = t, this.workers = {}, this.St = {};
|
|
2264
2298
|
}
|
|
2265
2299
|
addLayer({actorId: t, mapId: e, layerId: n, params: r}, s) {
|
|
2266
2300
|
if (this.xt(e, n)) return;
|
|
2267
2301
|
const i = this.It(e, n), o = r.options, a = this.send.bind(this, t);
|
|
2268
|
-
this.workers[i] = new
|
|
2302
|
+
this.workers[i] = new _e(n, o, a, s);
|
|
2269
2303
|
}
|
|
2270
2304
|
removeLayer({mapId: t, layerId: e}, n) {
|
|
2271
2305
|
const r = this.xt(t, e), s = this.It(t, e);
|
|
@@ -2284,7 +2318,7 @@
|
|
|
2284
2318
|
delete this.St[e], n && t.error ? n(new Error(t.error)) : n && n(null, t.data);
|
|
2285
2319
|
}
|
|
2286
2320
|
send(t, e, n, r, s) {
|
|
2287
|
-
const i = s ? `${t}-${
|
|
2321
|
+
const i = s ? `${t}-${Oe++}` : null;
|
|
2288
2322
|
s && (this.St[i] = s), postMessage({
|
|
2289
2323
|
type: "<request>",
|
|
2290
2324
|
workerId: this.workerId,
|
|
@@ -2304,7 +2338,7 @@
|
|
|
2304
2338
|
}
|
|
2305
2339
|
t.initialize = function() {}, t.onmessage = function(t, e) {
|
|
2306
2340
|
const n = t.data;
|
|
2307
|
-
this.dispatcher || (this.dispatcher = new
|
|
2341
|
+
this.dispatcher || (this.dispatcher = new ve(t.workerId)), "<response>" === t.type ? this.dispatcher.workerId === t.workerId && this.dispatcher.receive(t) : this.dispatcher[n.command]({
|
|
2308
2342
|
actorId: n.actorId,
|
|
2309
2343
|
mapId: n.mapId,
|
|
2310
2344
|
layerId: n.layerId,
|
|
@@ -2348,7 +2382,7 @@
|
|
|
2348
2382
|
return !0;
|
|
2349
2383
|
}
|
|
2350
2384
|
function h(t, e) {
|
|
2351
|
-
var n = e
|
|
2385
|
+
var n = e, r = t, s = e, i = r[0], o = r[1], a = r[2], c = Math.abs(i * s[3] + o * s[6] + a * s[9]) + Math.abs(i * s[4] + o * s[7] + a * s[10]) + Math.abs(i * s[5] + o * s[8] + a * s[11]), h = l(t, n);
|
|
2352
2386
|
return !(h <= -c);
|
|
2353
2387
|
}
|
|
2354
2388
|
function u(t) {
|
|
@@ -2357,8 +2391,8 @@
|
|
|
2357
2391
|
f(i[3], o - r, u - c, y - d, _ - p), f(i[4], o - s, u - h, y - m, _ - w), f(i[5], o + s, u + h, y + m, _ + w);
|
|
2358
2392
|
}
|
|
2359
2393
|
function f(t, e, n, r, s) {
|
|
2360
|
-
|
|
2361
|
-
t;
|
|
2394
|
+
var i = 1 / Math.sqrt(e * e + n * n + r * r);
|
|
2395
|
+
return t[0] = e * i, t[1] = n * i, t[2] = r * i, t[3] = s * i, t;
|
|
2362
2396
|
}
|
|
2363
2397
|
function l(t, e) {
|
|
2364
2398
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3];
|
|
@@ -2516,7 +2550,7 @@
|
|
|
2516
2550
|
E(), L(1, 0, 0), L(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
|
|
2517
2551
|
J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
|
|
2518
2552
|
/*!
|
|
2519
|
-
* @maptalks/gltf-loader v0.25.
|
|
2553
|
+
* @maptalks/gltf-loader v0.25.5
|
|
2520
2554
|
* LICENSE : UNLICENSED
|
|
2521
2555
|
* (c) 2016-2022 maptalks.org
|
|
2522
2556
|
*/
|
|
@@ -2527,14 +2561,14 @@
|
|
|
2527
2561
|
function Z(t) {
|
|
2528
2562
|
return !W(t);
|
|
2529
2563
|
}
|
|
2530
|
-
function
|
|
2564
|
+
function Q(t) {
|
|
2531
2565
|
for (let e = 1; e < arguments.length; e++) {
|
|
2532
2566
|
const n = arguments[e];
|
|
2533
2567
|
for (const e in n) t[e] = n[e];
|
|
2534
2568
|
}
|
|
2535
2569
|
return t;
|
|
2536
2570
|
}
|
|
2537
|
-
function
|
|
2571
|
+
function Y(t) {
|
|
2538
2572
|
switch (t) {
|
|
2539
2573
|
case 5120:
|
|
2540
2574
|
return Int8Array;
|
|
@@ -2573,7 +2607,7 @@
|
|
|
2573
2607
|
return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
|
|
2574
2608
|
}([]), at = [ 1, 1, 1 ];
|
|
2575
2609
|
function ct(t, e, n, r, s, i, o) {
|
|
2576
|
-
const a =
|
|
2610
|
+
const a = Y(o);
|
|
2577
2611
|
if ((0 === s || s === r * a.BYTES_PER_ELEMENT) && i % a.BYTES_PER_ELEMENT == 0) {
|
|
2578
2612
|
const s = new a(e, i, n * r);
|
|
2579
2613
|
return t.set(s), t;
|
|
@@ -2741,7 +2775,7 @@
|
|
|
2741
2775
|
});
|
|
2742
2776
|
}
|
|
2743
2777
|
g(t, e, n, r = 0) {
|
|
2744
|
-
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h =
|
|
2778
|
+
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Y(i.componentType), u = o.byteStride || 0, f = {
|
|
2745
2779
|
array: void 0,
|
|
2746
2780
|
name: t,
|
|
2747
2781
|
accessorName: e,
|
|
@@ -2928,7 +2962,7 @@
|
|
|
2928
2962
|
}
|
|
2929
2963
|
createNode(t) {
|
|
2930
2964
|
const e = {};
|
|
2931
|
-
return
|
|
2965
|
+
return Q(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
|
|
2932
2966
|
e;
|
|
2933
2967
|
}
|
|
2934
2968
|
S(t) {
|
|
@@ -2950,7 +2984,7 @@
|
|
|
2950
2984
|
extras: n.extras
|
|
2951
2985
|
}
|
|
2952
2986
|
};
|
|
2953
|
-
|
|
2987
|
+
Q(r, e);
|
|
2954
2988
|
const s = Z(e.sampler) ? this.gltf.samplers[e.sampler] : void 0;
|
|
2955
2989
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
2956
2990
|
});
|
|
@@ -3084,11 +3118,11 @@
|
|
|
3084
3118
|
P(t, e, n, r, s, i, o, a) {
|
|
3085
3119
|
const c = Z(t) ? e.animations : [ e.animations[0] ], h = {};
|
|
3086
3120
|
for (let e = 0; e < c.length; e++) {
|
|
3087
|
-
const u = c[e];
|
|
3088
|
-
if (Z(t) &&
|
|
3089
|
-
const
|
|
3090
|
-
if (
|
|
3091
|
-
const e =
|
|
3121
|
+
const u = c[e], f = u.name || e;
|
|
3122
|
+
if (Z(t) && f !== t) continue;
|
|
3123
|
+
const l = u.channelsMap[n];
|
|
3124
|
+
if (l) for (let t = 0; t < l.length; t++) {
|
|
3125
|
+
const e = l[t];
|
|
3092
3126
|
"translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = B(Tt, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
|
|
3093
3127
|
h.rotation = K(At, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
|
|
3094
3128
|
h.scale = B(Ot, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
|
|
@@ -3227,7 +3261,7 @@
|
|
|
3227
3261
|
let t;
|
|
3228
3262
|
try {
|
|
3229
3263
|
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
3230
|
-
} catch (
|
|
3264
|
+
} catch (qn) {}
|
|
3231
3265
|
t && "undefined" != typeof createImageBitmap && (xt = !0);
|
|
3232
3266
|
}
|
|
3233
3267
|
const It = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
@@ -3292,7 +3326,7 @@
|
|
|
3292
3326
|
return St.getTimeSpanByName(t, e);
|
|
3293
3327
|
}
|
|
3294
3328
|
static getTypedArrayCtor(t) {
|
|
3295
|
-
return
|
|
3329
|
+
return Y(t);
|
|
3296
3330
|
}
|
|
3297
3331
|
static readInterleavedArray(t, e, n, r, s, i, o) {
|
|
3298
3332
|
return ct(t, e, n, r, s, i, o);
|
|
@@ -3395,7 +3429,7 @@
|
|
|
3395
3429
|
const n = t.primitives.map(t => this.Z(t, e)).filter(t => !!t);
|
|
3396
3430
|
return Promise.all(n).then(e => {
|
|
3397
3431
|
const n = {};
|
|
3398
|
-
return
|
|
3432
|
+
return Q(n, t), n.primitives = e, n;
|
|
3399
3433
|
});
|
|
3400
3434
|
}
|
|
3401
3435
|
H() {
|
|
@@ -3501,8 +3535,9 @@
|
|
|
3501
3535
|
let Pt, Lt;
|
|
3502
3536
|
function Bt(t, e) {
|
|
3503
3537
|
Pt || (Pt = new OffscreenCanvas(2, 2), Lt = Pt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
3504
|
-
|
|
3505
|
-
Pt.width = n, Pt.height = r, Lt.drawImage(t, 0, 0),
|
|
3538
|
+
let {width: n, height: r} = t;
|
|
3539
|
+
Ut(n) || (n = Ct(n)), Ut(r) || (r = Ct(r)), Pt.width = n, Pt.height = r, Lt.drawImage(t, 0, 0, n, r),
|
|
3540
|
+
t.close();
|
|
3506
3541
|
const s = Lt.getImageData(0, 0, n, r);
|
|
3507
3542
|
e(null, {
|
|
3508
3543
|
width: n,
|
|
@@ -3513,8 +3548,14 @@
|
|
|
3513
3548
|
console.warn(t), e(t);
|
|
3514
3549
|
});
|
|
3515
3550
|
}
|
|
3516
|
-
|
|
3517
|
-
|
|
3551
|
+
function Ut(t) {
|
|
3552
|
+
return 0 == (t & t - 1) && 0 !== t;
|
|
3553
|
+
}
|
|
3554
|
+
function Ct(t) {
|
|
3555
|
+
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
3556
|
+
}
|
|
3557
|
+
const Rt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3558
|
+
class Ft extends s.worker.Actor {
|
|
3518
3559
|
constructor(t, e) {
|
|
3519
3560
|
super(t), this.mapId = e;
|
|
3520
3561
|
}
|
|
@@ -3567,20 +3608,20 @@
|
|
|
3567
3608
|
const n = new Image;
|
|
3568
3609
|
n.onload = () => {
|
|
3569
3610
|
if (!this.isActive()) return;
|
|
3570
|
-
if (!
|
|
3611
|
+
if (!Rt) return void e(new Error("There is no canvas to draw image!"));
|
|
3571
3612
|
const t = function(t) {
|
|
3572
|
-
if (
|
|
3613
|
+
if (Dt(t.width) && Dt(t.height)) return t;
|
|
3573
3614
|
let e = t.width, n = t.height;
|
|
3574
|
-
|
|
3575
|
-
|
|
3615
|
+
Dt(e) || (e = kt(e));
|
|
3616
|
+
Dt(n) || (n = kt(n));
|
|
3576
3617
|
const r = document.createElement("canvas");
|
|
3577
3618
|
r.width = e, r.height = n, r.getContext("2d").drawImage(t, 0, 0, e, n);
|
|
3578
3619
|
const s = t.src, i = s.lastIndexOf("/") + 1, o = s.substring(i);
|
|
3579
3620
|
return console.warn(`Texture(${o})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${n})`),
|
|
3580
3621
|
r;
|
|
3581
3622
|
}(n);
|
|
3582
|
-
|
|
3583
|
-
const r =
|
|
3623
|
+
Rt.width = t.width, Rt.height = t.height;
|
|
3624
|
+
const r = Rt.getContext("2d");
|
|
3584
3625
|
r.drawImage(t, 0, 0, t.width, t.height);
|
|
3585
3626
|
const s = r.getImageData(0, 0, t.width, t.height), i = {
|
|
3586
3627
|
width: t.width,
|
|
@@ -3593,13 +3634,13 @@
|
|
|
3593
3634
|
}, n.src = t;
|
|
3594
3635
|
}
|
|
3595
3636
|
}
|
|
3596
|
-
function
|
|
3637
|
+
function Dt(t) {
|
|
3597
3638
|
return 0 == (t & t - 1) && 0 !== t;
|
|
3598
3639
|
}
|
|
3599
|
-
function
|
|
3640
|
+
function kt(t) {
|
|
3600
3641
|
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
3601
3642
|
}
|
|
3602
|
-
class
|
|
3643
|
+
class zt {
|
|
3603
3644
|
constructor(t, e) {
|
|
3604
3645
|
this.max = t, this.currentSize = 0, this.onRemove = e, this.reset();
|
|
3605
3646
|
}
|
|
@@ -3679,17 +3720,17 @@
|
|
|
3679
3720
|
for (const n of e) n.current = t;
|
|
3680
3721
|
}
|
|
3681
3722
|
}
|
|
3682
|
-
function
|
|
3723
|
+
function jt(t, e) {
|
|
3683
3724
|
if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
|
|
3684
3725
|
const r = t.scenes[n].nodes;
|
|
3685
3726
|
for (let n = 0, s = r.length; n < s; n++) {
|
|
3686
3727
|
const s = [];
|
|
3687
|
-
|
|
3728
|
+
Vt(r[n], s, t, e);
|
|
3688
3729
|
}
|
|
3689
3730
|
}
|
|
3690
3731
|
}
|
|
3691
|
-
function
|
|
3692
|
-
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++)
|
|
3732
|
+
function Vt(t, e, n, r) {
|
|
3733
|
+
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) Vt(t.children[s], e, n, r);
|
|
3693
3734
|
if (void 0 !== t.mesh) {
|
|
3694
3735
|
const s = t.mesh, i = n.meshes[s];
|
|
3695
3736
|
if (i) {
|
|
@@ -3701,7 +3742,7 @@
|
|
|
3701
3742
|
}
|
|
3702
3743
|
}
|
|
3703
3744
|
}
|
|
3704
|
-
function
|
|
3745
|
+
function Gt(t, e, n) {
|
|
3705
3746
|
let {componentType: r, byteOffset: s, byteStride: i, itemSize: o} = e;
|
|
3706
3747
|
const a = e.array.buffer, c = r ? Nt.getTypedArrayCtor(r) : e.array.constructor;
|
|
3707
3748
|
if (s = void 0 === s ? e.array.byteOffset : s, i = i || 0, !i || i === o * c.BYTES_PER_ELEMENT && s % c.BYTES_PER_ELEMENT == 0) {
|
|
@@ -3712,29 +3753,29 @@
|
|
|
3712
3753
|
const h = new Uint8Array(a, i * n + s, o * c.BYTES_PER_ELEMENT);
|
|
3713
3754
|
return new Uint8Array(t.buffer).set(h), t;
|
|
3714
3755
|
}
|
|
3715
|
-
function
|
|
3756
|
+
function Ht(t, e, n, r) {
|
|
3716
3757
|
t[4 * e] = n[r], t[4 * e + 1] = n[r + 4], t[4 * e + 2] = n[r + 8], t[4 * e + 3] = n[r + 12];
|
|
3717
3758
|
}
|
|
3718
|
-
const
|
|
3719
|
-
function
|
|
3720
|
-
const s =
|
|
3721
|
-
|
|
3722
|
-
R(
|
|
3723
|
-
const o = Math.sqrt(k(
|
|
3759
|
+
const qt = new Array(3), $t = new Array(3), Jt = [ 40680631590769, 40680631590769, 40408299984661.445 ];
|
|
3760
|
+
function Kt(t, e, n, r) {
|
|
3761
|
+
const s = Jt, i = Math.cos(n);
|
|
3762
|
+
qt[0] = i * Math.cos(e), qt[1] = i * Math.sin(e), qt[2] = Math.sin(n), se(qt, qt),
|
|
3763
|
+
R($t, s, qt);
|
|
3764
|
+
const o = Math.sqrt(k(qt, $t));
|
|
3724
3765
|
var a, c, h;
|
|
3725
|
-
return c =
|
|
3726
|
-
F(
|
|
3766
|
+
return c = $t, h = o, (a = $t)[0] = c[0] / h, a[1] = c[1] / h, a[2] = c[2] / h,
|
|
3767
|
+
F(qt, qt, r), function(t, e, n) {
|
|
3727
3768
|
return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
|
|
3728
|
-
}(t,
|
|
3769
|
+
}(t, $t, qt);
|
|
3729
3770
|
}
|
|
3730
|
-
const
|
|
3731
|
-
function
|
|
3732
|
-
const n =
|
|
3733
|
-
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(
|
|
3771
|
+
const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Qt = new Array(3), Yt = new Array(3);
|
|
3772
|
+
function te(t, e) {
|
|
3773
|
+
const n = Wt, r = function(t, e, n, r, s) {
|
|
3774
|
+
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(ee, e, y);
|
|
3734
3775
|
if (m < s) return isFinite(y) ? b : void 0;
|
|
3735
|
-
const p = r[0], w = r[1], _ = r[2], g =
|
|
3776
|
+
const p = r[0], w = r[1], _ = r[2], g = ne;
|
|
3736
3777
|
g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
|
|
3737
|
-
let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) *
|
|
3778
|
+
let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)), B = 0;
|
|
3738
3779
|
do {
|
|
3739
3780
|
L -= B, O = 1 / (1 + L * p), v = 1 / (1 + L * w), M = 1 / (1 + L * _), S = O * O,
|
|
3740
3781
|
x = v * v, I = M * M, N = S * O, E = x * v, P = I * M, T = f * S + l * x + d * I - 1,
|
|
@@ -3742,33 +3783,33 @@
|
|
|
3742
3783
|
B = T / (-2 * A);
|
|
3743
3784
|
} while (Math.abs(T) > 1e-12);
|
|
3744
3785
|
return t[0] = i * O, t[1] = o * v, t[2] = a * M, t;
|
|
3745
|
-
}(
|
|
3746
|
-
let s = V(
|
|
3747
|
-
s =
|
|
3748
|
-
const i = j(
|
|
3786
|
+
}(Zt, e, Xt, n, .1);
|
|
3787
|
+
let s = V(Qt, r, n);
|
|
3788
|
+
s = se(s, s);
|
|
3789
|
+
const i = j(Yt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * re(i);
|
|
3749
3790
|
return t[0] = p(o), t[1] = p(a), t[2] = c, t;
|
|
3750
3791
|
}
|
|
3751
|
-
const
|
|
3752
|
-
function
|
|
3792
|
+
const ee = new Array(3), ne = new Array(3);
|
|
3793
|
+
function re(t) {
|
|
3753
3794
|
return P(t);
|
|
3754
3795
|
}
|
|
3755
|
-
function
|
|
3796
|
+
function se(t, e) {
|
|
3756
3797
|
const n = e[0], r = e[1], s = e[2];
|
|
3757
3798
|
let i = n * n + r * r + s * s;
|
|
3758
3799
|
return i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i),
|
|
3759
3800
|
t;
|
|
3760
3801
|
}
|
|
3761
|
-
function
|
|
3762
|
-
return R(e, t,
|
|
3802
|
+
function ie(t, e) {
|
|
3803
|
+
return R(e, t, Wt), D(e, e);
|
|
3763
3804
|
}
|
|
3764
|
-
var
|
|
3805
|
+
var oe = Object.freeze({
|
|
3765
3806
|
__proto__: null,
|
|
3766
|
-
radianToCartesian3:
|
|
3767
|
-
cartesian3ToDegree:
|
|
3768
|
-
normalizeCartesian:
|
|
3769
|
-
geodeticSurfaceNormal:
|
|
3807
|
+
radianToCartesian3: Kt,
|
|
3808
|
+
cartesian3ToDegree: te,
|
|
3809
|
+
normalizeCartesian: se,
|
|
3810
|
+
geodeticSurfaceNormal: ie
|
|
3770
3811
|
});
|
|
3771
|
-
function
|
|
3812
|
+
function ae(t, e) {
|
|
3772
3813
|
let n = "";
|
|
3773
3814
|
for (let r = 0; r < 4; r++) {
|
|
3774
3815
|
const s = t.getUint8(e + r);
|
|
@@ -3776,27 +3817,27 @@
|
|
|
3776
3817
|
}
|
|
3777
3818
|
return n;
|
|
3778
3819
|
}
|
|
3779
|
-
const
|
|
3780
|
-
function
|
|
3820
|
+
const ce = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
3821
|
+
function he(t, e, n) {
|
|
3781
3822
|
const r = new Uint8Array(t, e, n);
|
|
3782
|
-
return
|
|
3823
|
+
return ce ? JSON.parse(ce.decode(r)) : JSON.parse(T(r));
|
|
3783
3824
|
}
|
|
3784
|
-
function
|
|
3825
|
+
function ue(t, e, n) {
|
|
3785
3826
|
const r = new Uint8Array(t, e, n);
|
|
3786
|
-
return
|
|
3827
|
+
return ce ? JSON.parse(ce.decode(r)) : JSON.parse(T(r));
|
|
3787
3828
|
}
|
|
3788
|
-
function
|
|
3829
|
+
function fe(t, e, n) {
|
|
3789
3830
|
return {
|
|
3790
3831
|
offset: e,
|
|
3791
3832
|
byteLength: n
|
|
3792
3833
|
};
|
|
3793
3834
|
}
|
|
3794
|
-
function
|
|
3835
|
+
function le(t, e, n, r) {
|
|
3795
3836
|
const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
|
|
3796
|
-
return
|
|
3837
|
+
return ye[t];
|
|
3797
3838
|
}(i), h = function(t) {
|
|
3798
3839
|
if (!t) return 1;
|
|
3799
|
-
return
|
|
3840
|
+
return me[t];
|
|
3800
3841
|
}(o);
|
|
3801
3842
|
return {
|
|
3802
3843
|
byteStride: 0,
|
|
@@ -3807,19 +3848,19 @@
|
|
|
3807
3848
|
array: new a(e, n + s, r * h)
|
|
3808
3849
|
};
|
|
3809
3850
|
}
|
|
3810
|
-
function
|
|
3851
|
+
function de(t, e, n, r) {
|
|
3811
3852
|
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
3812
|
-
const s =
|
|
3853
|
+
const s = le(t, e, n, r);
|
|
3813
3854
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
3814
3855
|
s;
|
|
3815
3856
|
}
|
|
3816
|
-
const
|
|
3857
|
+
const me = {
|
|
3817
3858
|
"SCALAR": 1,
|
|
3818
3859
|
"VEC2": 2,
|
|
3819
3860
|
"VEC3": 3,
|
|
3820
3861
|
"VEC4": 4
|
|
3821
3862
|
};
|
|
3822
|
-
const
|
|
3863
|
+
const ye = {
|
|
3823
3864
|
"BYTE": {
|
|
3824
3865
|
ctor: Int8Array,
|
|
3825
3866
|
type: 5120,
|
|
@@ -3861,27 +3902,27 @@
|
|
|
3861
3902
|
name: "Float64Array"
|
|
3862
3903
|
}
|
|
3863
3904
|
};
|
|
3864
|
-
function
|
|
3865
|
-
for (let e in
|
|
3905
|
+
function be(t) {
|
|
3906
|
+
for (let e in ye) if (t === ye[e].ctor) return ye[e].type;
|
|
3866
3907
|
throw new Error("unrecognized ctor:" + t);
|
|
3867
3908
|
}
|
|
3868
|
-
function
|
|
3909
|
+
function pe(t, e, n, r) {
|
|
3869
3910
|
const s = t, i = e.length / 3;
|
|
3870
3911
|
for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
|
|
3871
3912
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
3872
3913
|
return s;
|
|
3873
3914
|
}
|
|
3874
|
-
function
|
|
3915
|
+
function we(t, e, n) {
|
|
3875
3916
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
3876
3917
|
const a = t.buffer;
|
|
3877
3918
|
let c, h, u = {}, f = {};
|
|
3878
|
-
r > 0 && (u =
|
|
3919
|
+
r > 0 && (u = he(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
|
|
3879
3920
|
return {
|
|
3880
3921
|
offset: e,
|
|
3881
3922
|
byteLength: n
|
|
3882
3923
|
};
|
|
3883
|
-
}(0, e, s), e += s), i > 0 && (f =
|
|
3884
|
-
const l =
|
|
3924
|
+
}(0, e, s), e += s), i > 0 && (f = ue(a, e, i), e += i);
|
|
3925
|
+
const l = fe(0, e, o);
|
|
3885
3926
|
return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
|
|
3886
3927
|
featureTable: u,
|
|
3887
3928
|
featureTableBin: c,
|
|
@@ -3889,33 +3930,33 @@
|
|
|
3889
3930
|
batchTableBin: h
|
|
3890
3931
|
};
|
|
3891
3932
|
}
|
|
3892
|
-
var
|
|
3933
|
+
var _e = {
|
|
3893
3934
|
north: [ -1, 0, 0 ],
|
|
3894
3935
|
east: [ 0, 1, 0 ],
|
|
3895
3936
|
up: [ 0, 0, 1 ],
|
|
3896
3937
|
south: [ 1, 0, 0 ],
|
|
3897
3938
|
west: [ 0, -1, 0 ],
|
|
3898
3939
|
down: [ 0, 0, -1 ]
|
|
3899
|
-
},
|
|
3940
|
+
}, ge = {}, Te = {
|
|
3900
3941
|
east: [],
|
|
3901
3942
|
north: [],
|
|
3902
3943
|
up: [],
|
|
3903
3944
|
west: [],
|
|
3904
3945
|
south: [],
|
|
3905
3946
|
down: []
|
|
3906
|
-
},
|
|
3907
|
-
const
|
|
3908
|
-
function
|
|
3947
|
+
}, Ae = [], Oe = [], ve = [];
|
|
3948
|
+
const Me = [ 0, 0, 0 ];
|
|
3949
|
+
function Se(t, e, n, r) {
|
|
3909
3950
|
n = n || 0, r = r || n;
|
|
3910
3951
|
var s = Math.abs(t - e);
|
|
3911
3952
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
3912
3953
|
}
|
|
3913
|
-
function
|
|
3954
|
+
function xe(t, e, n) {
|
|
3914
3955
|
return n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = t[3], n[4] = t[4], n[5] = t[5],
|
|
3915
3956
|
n[6] = t[6], n[7] = t[7], n[8] = t[8], n[9] = t[9], n[10] = t[10], n[11] = t[11],
|
|
3916
3957
|
n[12] = e[0], n[13] = e[1], n[14] = e[2], n[15] = t[15], n;
|
|
3917
3958
|
}
|
|
3918
|
-
const
|
|
3959
|
+
const Ie = (Le = {
|
|
3919
3960
|
up: {
|
|
3920
3961
|
south: "east",
|
|
3921
3962
|
north: "west",
|
|
@@ -3952,39 +3993,39 @@
|
|
|
3952
3993
|
north: "up",
|
|
3953
3994
|
south: "down"
|
|
3954
3995
|
}
|
|
3955
|
-
}[
|
|
3996
|
+
}[Ne = "east"][Ee = "north"], ge[Be = Ne + Ee] ? Pe = ge[Be] : (Pe = function(t, e, n) {
|
|
3956
3997
|
if (function(t, e) {
|
|
3957
3998
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
3958
3999
|
return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
|
|
3959
|
-
}(t,
|
|
4000
|
+
}(t, Me)) B(Ae, _e[Ne]), B(Oe, _e[Ee]), B(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
|
|
3960
4001
|
var r = _(t[2]);
|
|
3961
|
-
B(
|
|
3962
|
-
B(
|
|
4002
|
+
B(Ae, _e[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r), B(Oe, _e[Ee]), "east" !== Ee && "west" !== Ee && F(Oe, Oe, r),
|
|
4003
|
+
B(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
|
|
3963
4004
|
} else {
|
|
3964
|
-
|
|
3965
|
-
var s =
|
|
3966
|
-
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(
|
|
3967
|
-
F(
|
|
4005
|
+
ie(t, Te.up);
|
|
4006
|
+
var s = Te.up, i = Te.east;
|
|
4007
|
+
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(Te.east, i), z(Te.north, s, i), F(Te.down, Te.up, -1),
|
|
4008
|
+
F(Te.west, Te.east, -1), F(Te.south, Te.north, -1), Ae = Te[Ne], Oe = Te[Ee], ve = Te[Le];
|
|
3968
4009
|
}
|
|
3969
|
-
return n[0] =
|
|
3970
|
-
n[6] =
|
|
4010
|
+
return n[0] = Ae[0], n[1] = Ae[1], n[2] = Ae[2], n[3] = 0, n[4] = Oe[0], n[5] = Oe[1],
|
|
4011
|
+
n[6] = Oe[2], n[7] = 0, n[8] = ve[0], n[9] = ve[1], n[10] = ve[2], n[11] = 0, n[12] = t[0],
|
|
3971
4012
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
3972
|
-
},
|
|
3973
|
-
var
|
|
3974
|
-
const
|
|
4013
|
+
}, ge[Be] = Pe), Pe);
|
|
4014
|
+
var Ne, Ee, Pe, Le, Be;
|
|
4015
|
+
const Ue = [], Ce = [], Re = [], Fe = [], De = [], ke = [], ze = [], je = {
|
|
3975
4016
|
x: 0,
|
|
3976
4017
|
y: 0
|
|
3977
|
-
},
|
|
4018
|
+
}, Ve = {
|
|
3978
4019
|
x: 0,
|
|
3979
4020
|
y: 0
|
|
3980
|
-
},
|
|
3981
|
-
const {getTextureMagFilter:
|
|
4021
|
+
}, Ge = Math.PI / 180;
|
|
4022
|
+
const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Qe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ye, logoutIBLResOnCanvas: tn, getIBLResOnCanvas: en, getPBRUniforms: nn} = n.reshader.pbr.PBRUtils, rn = {
|
|
3982
4023
|
factor: 0,
|
|
3983
4024
|
units: 0
|
|
3984
|
-
},
|
|
4025
|
+
}, sn = {
|
|
3985
4026
|
specularStrength: 0,
|
|
3986
4027
|
materialShininess: 1
|
|
3987
|
-
},
|
|
4028
|
+
}, on = [ 1, 1, 1 ], an = n.mat4.identity([]), cn = t => t.material instanceof n.reshader.PhongMaterial, hn = t => t.material instanceof n.reshader.pbr.StandardMaterial, un = [ !0, !0, !0, !0 ], fn = [], ln = new s.Coordinate(0, 0), dn = [], mn = [], yn = {
|
|
3988
4029
|
"POSITION": "POSITION",
|
|
3989
4030
|
"NORMAL": "NORMAL",
|
|
3990
4031
|
"TEXCOORD_0": "TEXCOORD_0",
|
|
@@ -3992,7 +4033,7 @@
|
|
|
3992
4033
|
"COLOR_0": "COLOR_0",
|
|
3993
4034
|
"TANGENT": "TANGENT"
|
|
3994
4035
|
};
|
|
3995
|
-
class
|
|
4036
|
+
class bn {
|
|
3996
4037
|
constructor(t, e) {
|
|
3997
4038
|
this.Nt = e, this.Et = e.getRenderer().canvas, this.Pt = new s.SpatialReference,
|
|
3998
4039
|
this.Lt = t, this.Bt = new n.reshader.Renderer(t), this.Ut = {}, this.Ct = {}, this.Rt = {},
|
|
@@ -4018,16 +4059,16 @@
|
|
|
4018
4059
|
paint(t, e, n, r) {
|
|
4019
4060
|
const s = this.getMap();
|
|
4020
4061
|
if (!t.length || !s) return;
|
|
4021
|
-
const i = this.
|
|
4062
|
+
const i = this.Qt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
|
|
4022
4063
|
let u = [];
|
|
4023
4064
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
4024
|
-
let r = this.
|
|
4065
|
+
let r = this.Yt(t[n].data.node);
|
|
4025
4066
|
if (!r) {
|
|
4026
4067
|
if (r = this.kt[t[n].data.node.id], !r) continue;
|
|
4027
4068
|
r = O(r);
|
|
4028
4069
|
}
|
|
4029
4070
|
const s = t[n].node;
|
|
4030
|
-
let f = a[s.te].polygonOffset ||
|
|
4071
|
+
let f = a[s.te].polygonOffset || rn;
|
|
4031
4072
|
y(f) && (f = f());
|
|
4032
4073
|
const l = a[s.te].ambientLight;
|
|
4033
4074
|
for (let a = 0, d = r.length; a < d; a++) "b3dm" === r[a].properties.magic && (r[a].getBoundingBox && !c(o, r[a].getBoundingBox()) || (r[a].properties.level = t[n].selectionDepth,
|
|
@@ -4040,9 +4081,9 @@
|
|
|
4040
4081
|
}
|
|
4041
4082
|
let f = 0;
|
|
4042
4083
|
const l = this.Wt.getExcludeFilter();
|
|
4043
|
-
f += this.ne(this.re, i, [ n,
|
|
4084
|
+
f += this.ne(this.re, i, [ n, cn, l ], r, h, u), f += this.ne(this.se, i, [ n, hn, l ], r, h, u),
|
|
4044
4085
|
this.Wt.forEachShader((t, e, s) => {
|
|
4045
|
-
const i = this.
|
|
4086
|
+
const i = this.Qt(s);
|
|
4046
4087
|
f += this.ne(t, i, [ n, e ], r, h, u);
|
|
4047
4088
|
});
|
|
4048
4089
|
const d = [];
|
|
@@ -4053,7 +4094,7 @@
|
|
|
4053
4094
|
}
|
|
4054
4095
|
ne(t, e, n, r, s, i) {
|
|
4055
4096
|
t.filter = n.filter(t => !!t), e.debug = !1, this.jt.setMeshes(s), e.stencilEnable = !1,
|
|
4056
|
-
e.debug = !1, e.cullFace = "back", e.colorMask =
|
|
4097
|
+
e.debug = !1, e.cullFace = "back", e.colorMask = un;
|
|
4057
4098
|
let o = 0;
|
|
4058
4099
|
this.jt.setMeshes(i), o += this.Bt.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !1;
|
|
4059
4100
|
const a = [];
|
|
@@ -4108,7 +4149,7 @@
|
|
|
4108
4149
|
}
|
|
4109
4150
|
remove() {
|
|
4110
4151
|
const t = this.Nt;
|
|
4111
|
-
|
|
4152
|
+
tn(t.getRenderer().canvas, t.getMap());
|
|
4112
4153
|
for (const t in this.kt) this.de(t);
|
|
4113
4154
|
this.kt = {};
|
|
4114
4155
|
for (const t in this.Rt) this.le(t);
|
|
@@ -4142,11 +4183,11 @@
|
|
|
4142
4183
|
return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.Ct[t.id] = l,
|
|
4143
4184
|
l;
|
|
4144
4185
|
}
|
|
4145
|
-
|
|
4186
|
+
Yt(t) {
|
|
4146
4187
|
return this.Rt[t.id];
|
|
4147
4188
|
}
|
|
4148
4189
|
has(t) {
|
|
4149
|
-
return this.
|
|
4190
|
+
return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
|
|
4150
4191
|
}
|
|
4151
4192
|
createPntsMesh(t, e, r, s) {
|
|
4152
4193
|
if (this.Ft[e]) {
|
|
@@ -4223,11 +4264,11 @@
|
|
|
4223
4264
|
e(new c(h.buffer), t), n.set(h);
|
|
4224
4265
|
}
|
|
4225
4266
|
}(p, (t, e) => {
|
|
4226
|
-
w ? (
|
|
4227
|
-
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (
|
|
4228
|
-
g ? (
|
|
4229
|
-
n.mat4.fromRotationTranslationScale(B, P, t, L),
|
|
4230
|
-
|
|
4267
|
+
w ? (Gt(S, _, e), Gt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
|
|
4268
|
+
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(U, O, e), n.quat.fromMat3(P, U)) : n.quat.identity(P),
|
|
4269
|
+
g ? (Gt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (Gt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
|
|
4270
|
+
n.mat4.fromRotationTranslationScale(B, P, t, L), Ht(v.instance_vectorA, e, B, 0),
|
|
4271
|
+
Ht(v.instance_vectorB, e, B, 1), Ht(v.instance_vectorC, e, B, 2);
|
|
4231
4272
|
});
|
|
4232
4273
|
const C = {};
|
|
4233
4274
|
for (const t in v) C[t] = {
|
|
@@ -4240,7 +4281,7 @@
|
|
|
4240
4281
|
const R = this.Nt.options.services[r.te].shader || "phong";
|
|
4241
4282
|
let F = 0, D = !0;
|
|
4242
4283
|
const k = [];
|
|
4243
|
-
return
|
|
4284
|
+
return jt(c, (t, s, o, a) => {
|
|
4244
4285
|
let {geometry: c, material: d} = this.Ae(t, s, o, a, r, !0, R);
|
|
4245
4286
|
d && !d.isReady() && (D = !1, F++);
|
|
4246
4287
|
const m = new n.reshader.InstancedMesh(C, l, c, d);
|
|
@@ -4278,7 +4319,7 @@
|
|
|
4278
4319
|
f && (u[2] += f);
|
|
4279
4320
|
const l = this.we(u, r.te), d = this.Nt.options.services[r.te].shader || "phong", m = [];
|
|
4280
4321
|
let y = 0, b = !0;
|
|
4281
|
-
return
|
|
4322
|
+
return jt(c, (s, i, c, f) => {
|
|
4282
4323
|
let {geometry: p, material: w} = this.Ae(s, i, c, f, r, !1, d);
|
|
4283
4324
|
w && !w.isReady() && (b = !1, y++);
|
|
4284
4325
|
const _ = new n.reshader.Mesh(p, w);
|
|
@@ -4303,18 +4344,18 @@
|
|
|
4303
4344
|
const i = this.getMap(), o = this.Nt.options.services[t.te].heightOffset || 0, a = new s.Coordinate(r), c = i.distanceToPointAtRes(100, 0, i.getGLRes(), a).x / 100;
|
|
4304
4345
|
let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
|
|
4305
4346
|
if (e) {
|
|
4306
|
-
|
|
4347
|
+
xe(h, n.vec3.transformMat4(fn, e, h), h);
|
|
4307
4348
|
}
|
|
4308
4349
|
const u = function(t, e, n, r, s, i, o) {
|
|
4309
|
-
e = B(
|
|
4310
|
-
const a =
|
|
4350
|
+
e = B(Ue, e);
|
|
4351
|
+
const a = Kt(Ue, e[0] * Ge, e[1] * Ge, e[2]), c = function(t, e) {
|
|
4311
4352
|
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
|
|
4312
|
-
}(
|
|
4353
|
+
}(Ce, n), h = r.ellipsoid;
|
|
4313
4354
|
var u;
|
|
4314
|
-
u = 0 === G(c) ? U(
|
|
4315
|
-
const f = r.project(
|
|
4316
|
-
|
|
4317
|
-
const l =
|
|
4355
|
+
u = 0 === G(c) ? U(Re, 0, 0, -6378137) : te(Re, c), je.x = u[0], je.y = u[1];
|
|
4356
|
+
const f = r.project(je, Ve);
|
|
4357
|
+
Fe[0] = f.x / s, Fe[1] = f.y / s, Fe[2] = (u[2] + o) * i;
|
|
4358
|
+
const l = Ie(a, h, De), d = function(t, e, n) {
|
|
4318
4359
|
var r = t[0], s = t[1], i = t[2], o = t[4], a = t[5], c = t[6], h = t[8], u = t[9], f = t[10], l = e[0], d = e[1], m = e[2], y = e[3], b = e[4], p = e[5], w = e[6], _ = e[7], g = e[8], T = r * l + o * d + h * m, A = s * l + a * d + u * m, O = i * l + c * d + f * m, v = r * y + o * b + h * p, M = s * y + a * b + u * p, S = i * y + c * b + f * p, x = r * w + o * _ + h * g, I = s * w + a * _ + u * g, N = i * w + c * _ + f * g;
|
|
4319
4360
|
return n[0] = T, n[1] = A, n[2] = O, n[3] = 0, n[4] = v, n[5] = M, n[6] = S, n[7] = 0,
|
|
4320
4361
|
n[8] = x, n[9] = I, n[10] = N, n[11] = 0, n[12] = t[12], n[13] = t[13], n[14] = t[14],
|
|
@@ -4327,19 +4368,19 @@
|
|
|
4327
4368
|
t[8] = (o * I - a * S + h * v) * E, t[9] = (r * S - n * I - i * v) * E, t[10] = (m * A - y * g + p * w) * E,
|
|
4328
4369
|
t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * v) * E, t[13] = (n * x - r * M + s * v) * E,
|
|
4329
4370
|
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
4330
|
-
}(
|
|
4371
|
+
}(ke, l), function(t, e) {
|
|
4331
4372
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6],
|
|
4332
4373
|
t[6] = e[8], t[7] = e[9], t[8] = e[10], t;
|
|
4333
|
-
}(
|
|
4334
|
-
return
|
|
4374
|
+
}(ze, n), t);
|
|
4375
|
+
return xe(t, Fe, d), t;
|
|
4335
4376
|
}(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
|
|
4336
4377
|
return U(t, e[12], e[13], e[14]), t;
|
|
4337
|
-
}(
|
|
4378
|
+
}(mn, u);
|
|
4338
4379
|
let l = this.Nt.options.offset;
|
|
4339
4380
|
if (y(l)) {
|
|
4340
4381
|
l = l(this.Nt.Me(t.id).center);
|
|
4341
4382
|
}
|
|
4342
|
-
return n.vec3.set(
|
|
4383
|
+
return n.vec3.set(dn, l[0], l[1], 0), n.vec3.sub(f, f, dn), xe(u, f, u), u;
|
|
4343
4384
|
}
|
|
4344
4385
|
createCMPTMesh(t, e, n, r) {
|
|
4345
4386
|
if (this.kt[e]) {
|
|
@@ -4379,9 +4420,9 @@
|
|
|
4379
4420
|
const e = this.Se(t, r, i);
|
|
4380
4421
|
c = e.material, h = e.geometry;
|
|
4381
4422
|
} else {
|
|
4382
|
-
h = this.xe(t, i,
|
|
4423
|
+
h = this.xe(t, i, yn);
|
|
4383
4424
|
const e = this.Nt.options.services[s.te].material;
|
|
4384
|
-
c = this.Ie(t.material, r, o, e ||
|
|
4425
|
+
c = this.Ie(t.material, r, o, e || sn);
|
|
4385
4426
|
}
|
|
4386
4427
|
c && !c.isReady() ? c.Ne = s.id : c || (c = this.Kt);
|
|
4387
4428
|
const f = {
|
|
@@ -4407,7 +4448,7 @@
|
|
|
4407
4448
|
}
|
|
4408
4449
|
const o = {};
|
|
4409
4450
|
for (const t in s) {
|
|
4410
|
-
const e =
|
|
4451
|
+
const e = We(this.Lt, s[t], {
|
|
4411
4452
|
dimension: s[t].itemSize
|
|
4412
4453
|
}), n = r[t] || t;
|
|
4413
4454
|
o[n] = {
|
|
@@ -4422,7 +4463,7 @@
|
|
|
4422
4463
|
uv1Attribute: r.TEXCOORD_1,
|
|
4423
4464
|
color0Attribute: r.COLOR_0,
|
|
4424
4465
|
tangentAttribute: r.TANGENT,
|
|
4425
|
-
primitive: void 0 === t.mode ? "triangles" :
|
|
4466
|
+
primitive: void 0 === t.mode ? "triangles" : Xe(t.mode)
|
|
4426
4467
|
});
|
|
4427
4468
|
return a.generateBuffers(this.Lt, {
|
|
4428
4469
|
excludeElementsInVAO: e
|
|
@@ -4430,8 +4471,8 @@
|
|
|
4430
4471
|
}
|
|
4431
4472
|
we(t) {
|
|
4432
4473
|
const e = n.mat4.identity([]), r = this.getMap(), s = this.Ee();
|
|
4433
|
-
|
|
4434
|
-
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(),
|
|
4474
|
+
ln.x = t[0], ln.y = t[1];
|
|
4475
|
+
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), ln);
|
|
4435
4476
|
return n.vec3.set(s, i.x / 100 * 1.01, i.y / 100 * 1.01, i.y / 100), n.mat4.scale(e, e, s),
|
|
4436
4477
|
e;
|
|
4437
4478
|
}
|
|
@@ -4491,7 +4532,7 @@
|
|
|
4491
4532
|
extraCommandProps: s
|
|
4492
4533
|
});
|
|
4493
4534
|
const i = this.Nt;
|
|
4494
|
-
|
|
4535
|
+
Ye(i.getRenderer().canvas, this.Lt, i.getMap());
|
|
4495
4536
|
}
|
|
4496
4537
|
Zt() {
|
|
4497
4538
|
return {
|
|
@@ -4501,7 +4542,7 @@
|
|
|
4501
4542
|
width: () => this.Et ? this.Et.width : 1,
|
|
4502
4543
|
height: () => this.Et ? this.Et.height : 1
|
|
4503
4544
|
},
|
|
4504
|
-
colorMask: (t, e) => e.colorMask ||
|
|
4545
|
+
colorMask: (t, e) => e.colorMask || un,
|
|
4505
4546
|
cull: {
|
|
4506
4547
|
enable: !0,
|
|
4507
4548
|
face: (t, e) => e.cullFace
|
|
@@ -4551,8 +4592,8 @@
|
|
|
4551
4592
|
lightDir: n.vec3.normalize(s, s)
|
|
4552
4593
|
};
|
|
4553
4594
|
}
|
|
4554
|
-
|
|
4555
|
-
const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} =
|
|
4595
|
+
Qt() {
|
|
4596
|
+
const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = en(e), s = nn(t, n, r);
|
|
4556
4597
|
return m(s, {
|
|
4557
4598
|
lightSpecular: [ 1, 1, 1 ],
|
|
4558
4599
|
viewMatrix: t.viewMatrix,
|
|
@@ -4605,15 +4646,15 @@
|
|
|
4605
4646
|
}
|
|
4606
4647
|
S(t) {
|
|
4607
4648
|
const e = {
|
|
4608
|
-
type: t.type ?
|
|
4609
|
-
format: t.format ?
|
|
4649
|
+
type: t.type ? Je(t.type) : "uint8",
|
|
4650
|
+
format: t.format ? Ke(t.format) : "rgba",
|
|
4610
4651
|
flipY: !1
|
|
4611
4652
|
}, r = t.image;
|
|
4612
4653
|
r.array ? e.data = r.array : r.mipmap && (e.mipmap = r.mipmap), e.width = r.width,
|
|
4613
4654
|
e.height = r.height;
|
|
4614
4655
|
const s = t.sampler || t.texture.sampler;
|
|
4615
|
-
return s && (s.magFilter && (e.mag =
|
|
4616
|
-
s.wrapS && (e.wrapS =
|
|
4656
|
+
return s && (s.magFilter && (e.mag = He(s.magFilter)), s.minFilter && (e.min = qe(s.minFilter)),
|
|
4657
|
+
s.wrapS && (e.wrapS = $e(s.wrapS)), s.wrapT && (e.wrapT = $e(s.wrapT))), new n.reshader.Texture2D(e, this.qt);
|
|
4617
4658
|
}
|
|
4618
4659
|
Pe(t) {
|
|
4619
4660
|
const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
|
|
@@ -4634,7 +4675,7 @@
|
|
|
4634
4675
|
}
|
|
4635
4676
|
}
|
|
4636
4677
|
Ee() {
|
|
4637
|
-
return
|
|
4678
|
+
return on;
|
|
4638
4679
|
}
|
|
4639
4680
|
ye(t) {
|
|
4640
4681
|
return this.Nt.ye(t);
|
|
@@ -4652,16 +4693,16 @@
|
|
|
4652
4693
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4653
4694
|
}
|
|
4654
4695
|
ge(t) {
|
|
4655
|
-
return "Y" === t ?
|
|
4696
|
+
return "Y" === t ? Ze : "X" === t ? Qe : an;
|
|
4656
4697
|
}
|
|
4657
4698
|
}
|
|
4658
|
-
class
|
|
4699
|
+
class pn extends s.renderer.CanvasRenderer {
|
|
4659
4700
|
constructor(t) {
|
|
4660
|
-
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new
|
|
4661
|
-
this.bt = {};
|
|
4701
|
+
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new zt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
|
|
4702
|
+
this.bt = {}, this.Le = [];
|
|
4662
4703
|
}
|
|
4663
4704
|
needToRedraw() {
|
|
4664
|
-
return !!this.getMap().isInteracting() || super.needToRedraw();
|
|
4705
|
+
return !!this.getMap().isInteracting() || (!!this.Le.length || super.needToRedraw());
|
|
4665
4706
|
}
|
|
4666
4707
|
drawOnInteracting(t, e, n) {
|
|
4667
4708
|
this.draw(e, n);
|
|
@@ -4669,32 +4710,33 @@
|
|
|
4669
4710
|
draw(t, e) {
|
|
4670
4711
|
const n = this.prepareCanvas();
|
|
4671
4712
|
if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
|
|
4672
|
-
const {root: r, tiles: s} = this.layer.getTiles(), i = s
|
|
4713
|
+
const {root: r, tiles: s} = this.layer.getTiles(), i = s.length;
|
|
4673
4714
|
if (!s || !i) return void this.completeRender();
|
|
4674
|
-
|
|
4675
|
-
|
|
4715
|
+
this.Be();
|
|
4716
|
+
const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
|
|
4717
|
+
c.length && this.loadTiles(c), this.Ce(o, a, e), this.Re(), c.length || this.completeRender();
|
|
4676
4718
|
}
|
|
4677
|
-
|
|
4719
|
+
Ue(t, e) {
|
|
4678
4720
|
let n = [];
|
|
4679
|
-
this.
|
|
4721
|
+
this.Fe();
|
|
4680
4722
|
let r = 0;
|
|
4681
|
-
const s = this.
|
|
4723
|
+
const s = this.De(), i = {};
|
|
4682
4724
|
let o = !1, a = !1;
|
|
4683
|
-
for (
|
|
4725
|
+
for (let t = 0; t < e.length; t++) {
|
|
4684
4726
|
const s = e[t], c = s.node;
|
|
4685
4727
|
if (i[c.id]) continue;
|
|
4686
4728
|
i[c.id] = 1;
|
|
4687
4729
|
let h = !1;
|
|
4688
|
-
const u = this.
|
|
4689
|
-
if (this.
|
|
4730
|
+
const u = this.ke(c.id);
|
|
4731
|
+
if (this.ze(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
|
|
4690
4732
|
o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
|
|
4691
4733
|
!h) continue;
|
|
4692
|
-
if (this.
|
|
4693
|
-
this.
|
|
4734
|
+
if (this.je(s)) o = !0; else {
|
|
4735
|
+
this.Ve(s).length && (o = !0);
|
|
4694
4736
|
}
|
|
4695
4737
|
}
|
|
4696
4738
|
let c = [], h = {};
|
|
4697
|
-
if (o && ({selectedTiles: c, leaves: h} = this.
|
|
4739
|
+
if (o && ({selectedTiles: c, leaves: h} = this.Ge(t)), n.length > 1 && (n.sort(wn),
|
|
4698
4740
|
s)) {
|
|
4699
4741
|
const t = s - r;
|
|
4700
4742
|
n = t > 0 ? n.slice(0, t) : [];
|
|
@@ -4706,14 +4748,14 @@
|
|
|
4706
4748
|
leaves: h
|
|
4707
4749
|
};
|
|
4708
4750
|
}
|
|
4709
|
-
|
|
4751
|
+
Ge(t) {
|
|
4710
4752
|
const e = [], n = {};
|
|
4711
4753
|
let r;
|
|
4712
4754
|
const s = [ t ], i = [];
|
|
4713
4755
|
for (;s.length > 0 || i.length > 0; ) {
|
|
4714
4756
|
if (i.length > 0) {
|
|
4715
4757
|
const t = i[i.length - 1];
|
|
4716
|
-
if (t.
|
|
4758
|
+
if (t.He === s.length) {
|
|
4717
4759
|
i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
|
|
4718
4760
|
continue;
|
|
4719
4761
|
}
|
|
@@ -4725,9 +4767,8 @@
|
|
|
4725
4767
|
t.leave = !0, n[t.node.id] = 1, e.push(t);
|
|
4726
4768
|
continue;
|
|
4727
4769
|
}
|
|
4728
|
-
i.push(t), t.
|
|
4770
|
+
i.push(t), t.He = s.length;
|
|
4729
4771
|
}
|
|
4730
|
-
o.length > 1 && o.sort(bn);
|
|
4731
4772
|
for (let t = 0; t < o.length; t++) s.push(o[t]);
|
|
4732
4773
|
}
|
|
4733
4774
|
return {
|
|
@@ -4735,7 +4776,7 @@
|
|
|
4735
4776
|
leaves: n
|
|
4736
4777
|
};
|
|
4737
4778
|
}
|
|
4738
|
-
|
|
4779
|
+
je(t) {
|
|
4739
4780
|
if (!t.parent) return null;
|
|
4740
4781
|
let e = t.parent;
|
|
4741
4782
|
for (;e && e.level >= 0; ) {
|
|
@@ -4746,27 +4787,27 @@
|
|
|
4746
4787
|
}
|
|
4747
4788
|
return null;
|
|
4748
4789
|
}
|
|
4749
|
-
|
|
4790
|
+
Ve(t) {
|
|
4750
4791
|
const e = [];
|
|
4751
4792
|
if (!t.node.children || !t.node.children.length) return e;
|
|
4752
|
-
const n = t.
|
|
4793
|
+
const n = t.qe + 1, r = [ t.node ];
|
|
4753
4794
|
for (;r.length > 0; ) {
|
|
4754
4795
|
const s = r.pop().children;
|
|
4755
4796
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
4756
|
-
if (!
|
|
4797
|
+
if ((!s[i].content || !s[i].content.url) && s[i].children && s[i].children.length) {
|
|
4757
4798
|
r.push(s[i]);
|
|
4758
4799
|
continue;
|
|
4759
4800
|
}
|
|
4760
4801
|
const o = s[i].id;
|
|
4761
4802
|
if (this.tileCache.has(o)) {
|
|
4762
|
-
const n = this.layer
|
|
4803
|
+
const n = this.layer.$e(s[i], t);
|
|
4763
4804
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4764
|
-
} else s[i].
|
|
4805
|
+
} else s[i].qe <= n && r.push(s[i]);
|
|
4765
4806
|
}
|
|
4766
4807
|
}
|
|
4767
4808
|
return e;
|
|
4768
4809
|
}
|
|
4769
|
-
|
|
4810
|
+
Ce(t, e, n) {
|
|
4770
4811
|
this.tileCache.markAll(!1);
|
|
4771
4812
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
4772
4813
|
const n = t[e].data;
|
|
@@ -4800,7 +4841,7 @@
|
|
|
4800
4841
|
let e = t.content.url;
|
|
4801
4842
|
if (M(e)) {
|
|
4802
4843
|
const n = S(e);
|
|
4803
|
-
return void this
|
|
4844
|
+
return void this.Je(e, n, t);
|
|
4804
4845
|
}
|
|
4805
4846
|
t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
|
|
4806
4847
|
const n = this.layer.options.services[t.te];
|
|
@@ -4810,13 +4851,13 @@
|
|
|
4810
4851
|
let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
|
|
4811
4852
|
const i = s.xhr;
|
|
4812
4853
|
s = s.then(n => {
|
|
4813
|
-
delete this.bt[e], n ? this
|
|
4854
|
+
delete this.bt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
|
|
4814
4855
|
}).catch(n => {
|
|
4815
4856
|
delete this.bt[e], this.onTileError(n, t);
|
|
4816
4857
|
}), this.bt[e] = i;
|
|
4817
|
-
} else this
|
|
4858
|
+
} else this.Je(e, null, t);
|
|
4818
4859
|
}
|
|
4819
|
-
|
|
4860
|
+
Je(t, e, r) {
|
|
4820
4861
|
let s = this.o;
|
|
4821
4862
|
s || (s = n.reshader.Util.getSupportedFormats(this.gl.gl || this.gl), this.o = s),
|
|
4822
4863
|
this.workerConn.loadTile(this.layer.getId(), {
|
|
@@ -4829,30 +4870,41 @@
|
|
|
4829
4870
|
}, (e, n) => {
|
|
4830
4871
|
if (e) return void this.onTileError(e, r);
|
|
4831
4872
|
const {magic: s} = n;
|
|
4832
|
-
"b3dm" === s
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
this.Je(n, r, t, e);
|
|
4836
|
-
}) : "i3dm" === s ? this.painter.createI3DMMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4837
|
-
this.Je(n, r, t, e);
|
|
4838
|
-
}) : "cmpt" === s ? this.painter.createCMPTMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4839
|
-
this.Je(n, r, t, e);
|
|
4873
|
+
"b3dm" === s || "pnts" === s || "i3dm" === s || "cmpt" === s ? this.Le.push({
|
|
4874
|
+
data: n,
|
|
4875
|
+
tile: r
|
|
4840
4876
|
}) : this.onTilesetLoad(n, r, t);
|
|
4841
4877
|
});
|
|
4842
4878
|
}
|
|
4843
|
-
|
|
4879
|
+
Be() {
|
|
4880
|
+
const t = this.getMap(), e = this.layer.options.meshLimitPerFrame;
|
|
4881
|
+
let n = 0;
|
|
4882
|
+
for (;this.Le.length && (n < e || !t.isInteracting()); ) {
|
|
4883
|
+
const {data: t, tile: e} = this.Le.shift(), {magic: r} = t;
|
|
4884
|
+
"b3dm" === r ? this.painter.createB3DMMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4885
|
+
this.Ke(t, e, n, r);
|
|
4886
|
+
}) : "pnts" === r ? this.painter.createPntsMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4887
|
+
this.Ke(t, e, n, r);
|
|
4888
|
+
}) : "i3dm" === r ? this.painter.createI3DMMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4889
|
+
this.Ke(t, e, n, r);
|
|
4890
|
+
}) : "cmpt" === r && this.painter.createCMPTMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4891
|
+
this.Ke(t, e, n, r);
|
|
4892
|
+
}), n++;
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
Ke(t, e, n, r) {
|
|
4844
4896
|
if (n) this.onTileError(n, e); else {
|
|
4845
|
-
const n = this.
|
|
4897
|
+
const n = this.Xe(r);
|
|
4846
4898
|
e.memorySize = n, this.onTileLoad(t, e);
|
|
4847
4899
|
}
|
|
4848
4900
|
}
|
|
4849
|
-
|
|
4901
|
+
Xe(t) {
|
|
4850
4902
|
let e = 0;
|
|
4851
|
-
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.
|
|
4903
|
+
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.Xe(t[n])); else t && (e += t.getMemorySize());
|
|
4852
4904
|
return e;
|
|
4853
4905
|
}
|
|
4854
4906
|
onTileLoad(t, e) {
|
|
4855
|
-
this.layer && (delete this.tilesLoading[e.id], this.
|
|
4907
|
+
this.layer && (delete this.tilesLoading[e.id], this.We(e), this.setToRedraw(), this.layer.fire("tileload", {
|
|
4856
4908
|
node: e
|
|
4857
4909
|
}));
|
|
4858
4910
|
}
|
|
@@ -4863,15 +4915,15 @@
|
|
|
4863
4915
|
if (!this.layer) return;
|
|
4864
4916
|
const n = e.content.url;
|
|
4865
4917
|
console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
|
|
4866
|
-
this.
|
|
4918
|
+
this.We(e), this.setToRedraw(), this.layer.fire("tileerror", {
|
|
4867
4919
|
node: e,
|
|
4868
4920
|
error: t
|
|
4869
4921
|
});
|
|
4870
4922
|
}
|
|
4871
|
-
|
|
4923
|
+
ke(t) {
|
|
4872
4924
|
return this.tileCache.get(t);
|
|
4873
4925
|
}
|
|
4874
|
-
|
|
4926
|
+
We(t) {
|
|
4875
4927
|
const e = {
|
|
4876
4928
|
loadTime: s.Util.now(),
|
|
4877
4929
|
current: !0,
|
|
@@ -4888,7 +4940,7 @@
|
|
|
4888
4940
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4889
4941
|
delete this.bt[e];
|
|
4890
4942
|
}
|
|
4891
|
-
|
|
4943
|
+
Fe() {
|
|
4892
4944
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
4893
4945
|
}
|
|
4894
4946
|
deleteTile(t) {
|
|
@@ -4903,16 +4955,16 @@
|
|
|
4903
4955
|
antialias: t.options.antialias
|
|
4904
4956
|
};
|
|
4905
4957
|
this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
|
|
4906
|
-
this.gl = this.
|
|
4958
|
+
this.gl = this.Ze(this.canvas, e)), this.regl = this.regl || n.createREGL({
|
|
4907
4959
|
gl: this.gl,
|
|
4908
4960
|
attributes: e,
|
|
4909
4961
|
extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
|
|
4910
4962
|
optionalExtensions: t.options.optionalExtensions || []
|
|
4911
|
-
}), this.painter = new
|
|
4963
|
+
}), this.painter = new bn(this.regl, t);
|
|
4912
4964
|
}
|
|
4913
4965
|
prepareWorker() {
|
|
4914
4966
|
const t = this.getMap();
|
|
4915
|
-
this.workerConn || (this.workerConn = new
|
|
4967
|
+
this.workerConn || (this.workerConn = new Ft("@maptalks/3dtiles", t.id));
|
|
4916
4968
|
const e = this.workerConn;
|
|
4917
4969
|
if (!e.isActive()) return;
|
|
4918
4970
|
let n = this.layer.options || {};
|
|
@@ -4930,7 +4982,7 @@
|
|
|
4930
4982
|
super.onRemove();
|
|
4931
4983
|
}
|
|
4932
4984
|
clear() {
|
|
4933
|
-
this.
|
|
4985
|
+
this.Re(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
|
|
4934
4986
|
}
|
|
4935
4987
|
clearCanvas() {
|
|
4936
4988
|
this.regl && this.regl.clear({
|
|
@@ -4945,22 +4997,21 @@
|
|
|
4945
4997
|
getStencilValue() {
|
|
4946
4998
|
return 0;
|
|
4947
4999
|
}
|
|
4948
|
-
|
|
4949
|
-
this.
|
|
5000
|
+
Re(t) {
|
|
5001
|
+
this.Qe || (this.Qe = Date.now());
|
|
4950
5002
|
const e = Date.now();
|
|
4951
|
-
if (t || !(e - this.
|
|
4952
|
-
this.
|
|
5003
|
+
if (t || !(e - this.Qe < this.layer.options.retireInterval)) {
|
|
5004
|
+
this.Qe = e;
|
|
4953
5005
|
for (const e in this.tilesLoading) {
|
|
4954
5006
|
const n = this.tilesLoading[e];
|
|
4955
|
-
!t && n.current ||
|
|
4956
|
-
delete this.tilesLoading[e]);
|
|
5007
|
+
!t && n.current || this.abortTileLoading(n);
|
|
4957
5008
|
}
|
|
4958
5009
|
}
|
|
4959
5010
|
}
|
|
4960
|
-
|
|
5011
|
+
De() {
|
|
4961
5012
|
return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
|
|
4962
5013
|
}
|
|
4963
|
-
|
|
5014
|
+
Ze(t, e) {
|
|
4964
5015
|
const n = [ "webgl", "experimental-webgl" ];
|
|
4965
5016
|
let r = null;
|
|
4966
5017
|
for (let s = 0; s < n.length; ++s) {
|
|
@@ -4971,7 +5022,7 @@
|
|
|
4971
5022
|
}
|
|
4972
5023
|
return r;
|
|
4973
5024
|
}
|
|
4974
|
-
|
|
5025
|
+
ze(t) {
|
|
4975
5026
|
return !!this.tilesLoading[t];
|
|
4976
5027
|
}
|
|
4977
5028
|
getI3DMMeshes() {
|
|
@@ -4984,38 +5035,35 @@
|
|
|
4984
5035
|
return this.painter.getB3DMMeshes();
|
|
4985
5036
|
}
|
|
4986
5037
|
readBatchData(t, e, n) {
|
|
4987
|
-
return
|
|
5038
|
+
return le(t, e, 0, n);
|
|
4988
5039
|
}
|
|
4989
5040
|
}
|
|
4990
|
-
function
|
|
4991
|
-
return
|
|
4992
|
-
}
|
|
4993
|
-
function pn(t, e) {
|
|
4994
|
-
return 0 === t.ce && 0 === e.ce ? t.Ye - e.Ye : t.ce - e.ce;
|
|
5041
|
+
function wn(t, e) {
|
|
5042
|
+
return t.ce - e.ce;
|
|
4995
5043
|
}
|
|
4996
|
-
function
|
|
5044
|
+
function _n(t, e, n) {
|
|
4997
5045
|
return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
|
|
4998
5046
|
}
|
|
4999
|
-
function
|
|
5047
|
+
function gn(t, e, n) {
|
|
5000
5048
|
return Math.sqrt(function(t, e, n) {
|
|
5001
|
-
var r = C(
|
|
5049
|
+
var r = C(Tn, n, t), s = _n(An, e, 0), i = _n(On, e, 1), o = _n(vn, e, 2), a = G(s), c = G(i), h = G(o);
|
|
5002
5050
|
D(s, s), D(i, i), D(o, o);
|
|
5003
|
-
var u =
|
|
5004
|
-
u
|
|
5051
|
+
var u = Mn;
|
|
5052
|
+
u[0] = k(r, s), u[1] = k(r, i), u[2] = k(r, o);
|
|
5005
5053
|
var f, l = 0;
|
|
5006
|
-
u
|
|
5007
|
-
u
|
|
5008
|
-
u
|
|
5054
|
+
u[0] < -a ? (f = u[0] + a, l += f * f) : u[0] > a && (f = u[0] - a, l += f * f);
|
|
5055
|
+
u[1] < -c ? (f = u[1] + c, l += f * f) : u[1] > c && (f = u[1] - c, l += f * f);
|
|
5056
|
+
u[2] < -h ? (f = u[2] + h, l += f * f) : u[2] > h && (f = u[2] - h, l += f * f);
|
|
5009
5057
|
return l;
|
|
5010
5058
|
}(t, e, n));
|
|
5011
5059
|
}
|
|
5012
|
-
const
|
|
5013
|
-
const
|
|
5014
|
-
class
|
|
5060
|
+
const Tn = [], An = [], On = [], vn = [], Mn = [];
|
|
5061
|
+
const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Bn = new s.Point(0, 0), Un = new s.Coordinate(0, 0), Cn = new s.Coordinate(0, 0), Rn = [], Fn = new s.Coordinate(0, 0), Dn = n.mat4.identity([]);
|
|
5062
|
+
class kn extends s.Layer {
|
|
5015
5063
|
constructor(t, e) {
|
|
5016
|
-
super(t, e), this.
|
|
5064
|
+
super(t, e), this.Ye(), this.bt = {}, this.tn = [];
|
|
5017
5065
|
}
|
|
5018
|
-
|
|
5066
|
+
Ye() {
|
|
5019
5067
|
let t = this.options.services.map(t => t.url);
|
|
5020
5068
|
this.en = t.map((t, e) => function(t, e) {
|
|
5021
5069
|
t = w(t);
|
|
@@ -5027,7 +5075,7 @@
|
|
|
5027
5075
|
refine: "replace",
|
|
5028
5076
|
matrix: n.mat4.identity([]),
|
|
5029
5077
|
te: e,
|
|
5030
|
-
|
|
5078
|
+
qe: 0
|
|
5031
5079
|
};
|
|
5032
5080
|
}(t, e)), this.fire("rootready", {
|
|
5033
5081
|
roots: this.en.slice(0)
|
|
@@ -5045,17 +5093,17 @@
|
|
|
5045
5093
|
return this.en[t] && this.en[t].boundingVolume ? this.boundingVolumeToExtent(this.en[t]) : null;
|
|
5046
5094
|
}
|
|
5047
5095
|
boundingVolumeToExtent(t) {
|
|
5048
|
-
const e = t.boundingVolume.nn ?
|
|
5096
|
+
const e = t.boundingVolume.nn ? Dn : t.matrix, r = this.getMap();
|
|
5049
5097
|
if (t.boundingVolume.region) {
|
|
5050
5098
|
const e = t.boundingVolume.region;
|
|
5051
5099
|
return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
|
|
5052
5100
|
}
|
|
5053
5101
|
if (t.boundingVolume.sphere) {
|
|
5054
|
-
const i = t.boundingVolume.sphere, o =
|
|
5102
|
+
const i = t.boundingVolume.sphere, o = te([], n.vec3.transformMat4([], i, e)), a = i[3], c = r.locate(o, -a, a), h = r.locate(o, a, -a);
|
|
5055
5103
|
return new s.Extent(c, h);
|
|
5056
5104
|
}
|
|
5057
5105
|
if (t.boundingVolume.box) {
|
|
5058
|
-
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(
|
|
5106
|
+
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(te([], o)), c = i.slice(3);
|
|
5059
5107
|
n.mat3.multiply(c, n.mat3.fromMat4([], t.matrix), c);
|
|
5060
5108
|
const h = n.vec3.length(c.slice(0, 3)), u = n.vec3.length(c.slice(3, 6)), f = n.vec3.length(c.slice(6, 9)), l = Math.max(h, u, f), d = r.locate(a, -l, l), m = r.locate(a, l, -l);
|
|
5061
5109
|
return new s.Extent(d, m);
|
|
@@ -5066,54 +5114,53 @@
|
|
|
5066
5114
|
return this.en;
|
|
5067
5115
|
}
|
|
5068
5116
|
getTiles() {
|
|
5069
|
-
|
|
5070
|
-
tiles:
|
|
5071
|
-
}
|
|
5072
|
-
}
|
|
5073
|
-
rn() {
|
|
5117
|
+
if (!this.getRenderer().ready) return this.rn(), {
|
|
5118
|
+
tiles: Ln
|
|
5119
|
+
};
|
|
5074
5120
|
const t = this.getMap(), e = t.cameraPosition;
|
|
5075
5121
|
let r, s;
|
|
5076
|
-
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()),
|
|
5077
|
-
r = t.pointToCoord(
|
|
5122
|
+
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Fn.set(e[0], e[1]),
|
|
5123
|
+
r = t.pointToCoord(Fn, t.getGLZoom()); else {
|
|
5078
5124
|
const n = t.getGLRes();
|
|
5079
|
-
s = t.pointAtResToDistance(e[2], 0, n),
|
|
5125
|
+
s = t.pointAtResToDistance(e[2], 0, n), Fn.set(e[0], e[1]), r = t.pointAtResToCoord(Fn, n);
|
|
5080
5126
|
}
|
|
5081
|
-
this.
|
|
5082
|
-
this.
|
|
5127
|
+
this.sn = this.sn || [], n.vec3.set(this.sn, b(r.x), b(r.y), s), this.in = Kt(this.in || [], this.sn[0], this.sn[1], this.sn[2]),
|
|
5128
|
+
this.an = 2 * Math.tan(.5 * b(t.getFov())), this.cn = Sn.project(r).toArray();
|
|
5083
5129
|
const i = t.projViewMatrix, o = {
|
|
5084
5130
|
children: [],
|
|
5085
5131
|
level: -1
|
|
5086
5132
|
};
|
|
5087
5133
|
let a = o;
|
|
5088
|
-
const c =
|
|
5134
|
+
const c = [];
|
|
5089
5135
|
for (let t = 0; t < this.en.length; t++) {
|
|
5090
5136
|
let e = 1 / 0;
|
|
5091
|
-
const n = [ this.en[t] ], r = this.
|
|
5137
|
+
const n = [ this.en[t] ], r = this.hn(t);
|
|
5092
5138
|
for (;n.length > 0; ) {
|
|
5093
5139
|
const t = n.pop();
|
|
5094
|
-
for (this.
|
|
5095
|
-
const s = this.
|
|
5140
|
+
for (t.id || this.un(t); a.level >= t.qe; ) a = a.parent;
|
|
5141
|
+
const s = this.ln(t, r, i);
|
|
5096
5142
|
if (s < 1) {
|
|
5097
5143
|
let n = a;
|
|
5098
5144
|
for (;n && !n.content; ) n = n.parent;
|
|
5099
|
-
0 === s && n && n.content &&
|
|
5145
|
+
0 === s && n && n.content && this.dn(c, n);
|
|
5100
5146
|
if (!1 === this.options.services[t.te].alwaysShow) continue;
|
|
5101
|
-
if (!(0 === s && t.
|
|
5102
|
-
t.content && (e = t.
|
|
5147
|
+
if (!(0 === s && t.qe <= e)) continue;
|
|
5148
|
+
t.content && (e = t.qe);
|
|
5103
5149
|
}
|
|
5104
|
-
t.ce < 1 / 0 && this.
|
|
5105
|
-
const o = this
|
|
5150
|
+
t.ce < 1 / 0 && this.mn(t);
|
|
5151
|
+
const o = this.$e(t, a);
|
|
5106
5152
|
a.children.push(o);
|
|
5107
5153
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5108
|
-
if (!u && f && this.
|
|
5109
|
-
f && "add" === t.refine && this.
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5154
|
+
if (!u && f && this.dn(c, o), u) {
|
|
5155
|
+
f && "add" === t.refine && this.dn(c, o), a = o;
|
|
5156
|
+
const e = h[0].parent;
|
|
5157
|
+
for (let r = 0, s = h.length; r < s; r++) {
|
|
5158
|
+
if (!e) {
|
|
5159
|
+
h[r].parent = t, h[r].Te = t.Te, h[r].baseUrl = t.baseUrl;
|
|
5160
|
+
const e = h[r].content && (h[r].content.url || h[r].content.uri);
|
|
5161
|
+
e && (M(e) ? h[r].baseUrl = t.baseUrl : -1 === e.indexOf("http://") && -1 === e.indexOf("https://") ? h[r].content.url = t.baseUrl + e : h[r].baseUrl = e.substring(0, e.lastIndexOf("/") + 1));
|
|
5115
5162
|
}
|
|
5116
|
-
n.push(h[
|
|
5163
|
+
n.push(h[r]);
|
|
5117
5164
|
}
|
|
5118
5165
|
}
|
|
5119
5166
|
}
|
|
@@ -5123,14 +5170,15 @@
|
|
|
5123
5170
|
tiles: c
|
|
5124
5171
|
};
|
|
5125
5172
|
}
|
|
5126
|
-
|
|
5127
|
-
|
|
5173
|
+
dn(t, e) {
|
|
5174
|
+
const {viewerRequestVolume: n} = e.node;
|
|
5175
|
+
n && !function(t, e, n) {
|
|
5128
5176
|
if (n.region) {
|
|
5129
5177
|
const e = n.region;
|
|
5130
5178
|
if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
|
|
5131
5179
|
} else {
|
|
5132
|
-
if (n.sphere) return
|
|
5133
|
-
if (n.box) return 0 ===
|
|
5180
|
+
if (n.sphere) return zn(n, e);
|
|
5181
|
+
if (n.box) return 0 === jn(n, e);
|
|
5134
5182
|
}
|
|
5135
5183
|
return !1;
|
|
5136
5184
|
}
|
|
@@ -5138,52 +5186,48 @@
|
|
|
5138
5186
|
* @maptalks/gl v0.65.0
|
|
5139
5187
|
* LICENSE : UNLICENSED
|
|
5140
5188
|
* (c) 2016-2022 maptalks.com
|
|
5141
|
-
*/ (this.
|
|
5189
|
+
*/ (this.sn, this.in, n) || t.push(e);
|
|
5142
5190
|
}
|
|
5143
|
-
|
|
5191
|
+
$e(t, e) {
|
|
5144
5192
|
return {
|
|
5145
5193
|
id: t.id,
|
|
5146
5194
|
node: t,
|
|
5147
5195
|
children: [],
|
|
5148
|
-
level: t.
|
|
5196
|
+
level: t.qe,
|
|
5149
5197
|
parent: e,
|
|
5150
|
-
content:
|
|
5198
|
+
content: t.content && t.content.url
|
|
5151
5199
|
};
|
|
5152
5200
|
}
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
t.
|
|
5156
|
-
|
|
5201
|
+
un(t) {
|
|
5202
|
+
t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]), t.yn = this.bn(t),
|
|
5203
|
+
t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix), t.te = t.parent.te,
|
|
5204
|
+
void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
|
|
5157
5205
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5158
|
-
this.
|
|
5206
|
+
this.pn(t);
|
|
5159
5207
|
}
|
|
5160
|
-
|
|
5208
|
+
pn(t) {
|
|
5161
5209
|
const e = t.boundingVolume;
|
|
5162
5210
|
if (!e || e.nn) return;
|
|
5163
5211
|
const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
|
|
5164
|
-
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix,
|
|
5212
|
+
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Dn) && !i) return;
|
|
5165
5213
|
const {region: o, box: a, sphere: c} = e;
|
|
5166
5214
|
if (o) {
|
|
5167
|
-
const t = this.
|
|
5215
|
+
const t = this.wn([ p(o[0]), p(o[1]) ]);
|
|
5168
5216
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5169
|
-
const e = this.
|
|
5217
|
+
const e = this.wn([ p(o[2]), p(o[3]) ]);
|
|
5170
5218
|
o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
|
|
5171
5219
|
} else if (a || c) {
|
|
5172
|
-
const e = a || c, s = n.vec3.transformMat4(
|
|
5173
|
-
i[0] = o.x, i[1] = o.y, i[2] += r,
|
|
5220
|
+
const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.wn([ i[0], i[1] ]);
|
|
5221
|
+
i[0] = o.x, i[1] = o.y, i[2] += r, Kt(e, b(i[0]), b(i[1]), i[2]);
|
|
5174
5222
|
}
|
|
5175
5223
|
e.nn = !0;
|
|
5176
5224
|
}
|
|
5177
|
-
|
|
5225
|
+
bn(t) {
|
|
5178
5226
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5179
5227
|
}
|
|
5180
|
-
|
|
5181
|
-
return t.content && t.content.url;
|
|
5182
|
-
}
|
|
5183
|
-
bn(t) {
|
|
5228
|
+
mn(t) {
|
|
5184
5229
|
let e = t.parent;
|
|
5185
|
-
for (;e && e.
|
|
5186
|
-
e = t.parent;
|
|
5230
|
+
for (;e && e.yn && !(e.ce <= t.ce); ) e.ce = t.ce, e = t.parent;
|
|
5187
5231
|
}
|
|
5188
5232
|
onTilesetLoad(t, e, r) {
|
|
5189
5233
|
if (!t) return void console.warn("invalid tileset at : " + r);
|
|
@@ -5193,73 +5237,71 @@
|
|
|
5193
5237
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5194
5238
|
const s = t.root.transform;
|
|
5195
5239
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5196
|
-
this.
|
|
5197
|
-
|
|
5240
|
+
this.pn(e), e._n = e.content, delete e.content, t.root.content && (e.content = t.root.content),
|
|
5241
|
+
e.yn = this.bn(e);
|
|
5198
5242
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5199
5243
|
i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
|
|
5200
5244
|
}
|
|
5201
|
-
this.
|
|
5245
|
+
this.rn(), this.fire("loadtileset", {
|
|
5202
5246
|
tileset: t,
|
|
5203
5247
|
index: e.te,
|
|
5204
5248
|
url: r
|
|
5205
5249
|
});
|
|
5206
5250
|
}
|
|
5207
|
-
|
|
5208
|
-
if (t.ce = 1 / 0, 0 === t.
|
|
5209
|
-
if (
|
|
5251
|
+
ln(t, e, n) {
|
|
5252
|
+
if (t.ce = 1 / 0, 0 === t.qe || t.yn) return 1;
|
|
5253
|
+
if (!this.gn(t, e, n)) return -1;
|
|
5210
5254
|
if (0 === t.geometricError) return 1;
|
|
5211
5255
|
let r = this.options.services[t.te].maximumScreenSpaceError;
|
|
5212
5256
|
null == r && (r = 8);
|
|
5213
|
-
let s = this.
|
|
5257
|
+
let s = this.Tn(t);
|
|
5214
5258
|
return 0 === s && t.parent && (s = .5 * (t.parent.An || 0)), s >= r ? 1 : 0;
|
|
5215
5259
|
}
|
|
5216
|
-
ye(t) {
|
|
5217
|
-
|
|
5218
|
-
|
|
5260
|
+
ye(t, e) {
|
|
5261
|
+
e || (e = new s.Point(0, 0));
|
|
5262
|
+
const n = this.getMap();
|
|
5263
|
+
return n.getGLZoom ? n.coordToPoint(t, n.getGLZoom(), e) : n.coordToPointAtRes(t, n.getGLRes(), e);
|
|
5219
5264
|
}
|
|
5220
|
-
|
|
5221
|
-
if (!this.getMap()) return !1;
|
|
5265
|
+
gn(t, e, r) {
|
|
5222
5266
|
const o = t.id;
|
|
5223
5267
|
let a = this.tn[o];
|
|
5224
|
-
|
|
5225
|
-
if (!a
|
|
5268
|
+
const {boundingVolume: f} = t, d = f.sphere, m = f.region, y = f.box;
|
|
5269
|
+
if (!a) {
|
|
5226
5270
|
let e, r, i;
|
|
5227
|
-
if (
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
a = this.tn[o] = [ ...c, ...u ], a.center = new s.Coordinate(r);
|
|
5271
|
+
if (m) {
|
|
5272
|
+
e = xn.set(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
|
|
5273
|
+
const t = e.getCenter(), n = this.On(t);
|
|
5274
|
+
e = e.convertTo(t => this.ye(t, Bn), In), i = m[4], r = m[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
|
|
5275
|
+
a.center = t;
|
|
5276
|
+
} else if (d) {
|
|
5277
|
+
const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Bn).toArray(), r = this.On(e);
|
|
5278
|
+
n.push(t[2] * r[2]), a = this.tn[o] = [ n, d[3] * r[2] ], a.center = e;
|
|
5279
|
+
} else if (y) {
|
|
5280
|
+
const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Bn).toArray(), c = this.On(r);
|
|
5281
|
+
i.push(e[2] * c[2]);
|
|
5282
|
+
const h = y.slice(3);
|
|
5283
|
+
n.mat4.exactEquals(t.matrix, Dn) || n.mat3.multiply(h, n.mat3.fromMat4(Rn, t.matrix), h);
|
|
5284
|
+
for (let t = 0; t < h.length; t++) h[t] *= c[t % 3], y[3 + t] = h[t];
|
|
5285
|
+
a = this.tn[o] = [ ...i, ...h ], a.center = r;
|
|
5243
5286
|
}
|
|
5244
5287
|
}
|
|
5245
5288
|
if (e) {
|
|
5246
|
-
if (
|
|
5247
|
-
Sn.ymax = a[1][1]; else if (t.boundingVolume.sphere) {
|
|
5289
|
+
if (m) xn.xmin = a[0][0], xn.ymin = a[0][1], xn.xmax = a[1][0], xn.ymax = a[1][1]; else if (d) {
|
|
5248
5290
|
const t = a[2];
|
|
5249
|
-
|
|
5250
|
-
} else if (
|
|
5291
|
+
xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - t, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + t;
|
|
5292
|
+
} else if (y) {
|
|
5251
5293
|
const t = a[1], e = a[2];
|
|
5252
|
-
|
|
5294
|
+
xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - e, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + e;
|
|
5253
5295
|
}
|
|
5254
|
-
if (!e.intersects(
|
|
5296
|
+
if (!e.intersects(xn)) return !1;
|
|
5255
5297
|
}
|
|
5256
|
-
return
|
|
5298
|
+
return m ? c(r, a) : d ? function(t, e, n) {
|
|
5257
5299
|
u(t);
|
|
5258
5300
|
for (var r = e[0], s = -e[1], o = 0; o < 6; o++) {
|
|
5259
5301
|
if (!n || "0" !== n.charAt(o)) if (l(i[o], r) < s) return !1;
|
|
5260
5302
|
}
|
|
5261
5303
|
return !0;
|
|
5262
|
-
}(r, a) : !!
|
|
5304
|
+
}(r, a) : !!y && function(t, e, n) {
|
|
5263
5305
|
u(t);
|
|
5264
5306
|
for (var r = 0; r < 6; r++) {
|
|
5265
5307
|
if (!n || "0" !== n.charAt(r)) if (!h(i[r], e)) return !1;
|
|
@@ -5267,11 +5309,11 @@
|
|
|
5267
5309
|
return !0;
|
|
5268
5310
|
}(r, a);
|
|
5269
5311
|
}
|
|
5270
|
-
|
|
5312
|
+
On(t) {
|
|
5271
5313
|
const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
|
|
5272
|
-
return n.vec3.set(
|
|
5314
|
+
return n.vec3.set(Pn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Pn;
|
|
5273
5315
|
}
|
|
5274
|
-
|
|
5316
|
+
wn(t) {
|
|
5275
5317
|
Array.isArray(t) && (t = new s.Coordinate(t));
|
|
5276
5318
|
let e = this.options.offset;
|
|
5277
5319
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
@@ -5280,48 +5322,39 @@
|
|
|
5280
5322
|
}
|
|
5281
5323
|
return t;
|
|
5282
5324
|
}
|
|
5283
|
-
|
|
5325
|
+
hn(t) {
|
|
5284
5326
|
const e = this.options.services[t].maxExtent;
|
|
5285
5327
|
if (!e) return null;
|
|
5286
5328
|
const n = this.en[t];
|
|
5287
5329
|
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
|
|
5288
5330
|
n.maxExtent;
|
|
5289
5331
|
}
|
|
5290
|
-
|
|
5291
|
-
const e = this.
|
|
5292
|
-
if (0 ===
|
|
5293
|
-
const
|
|
5294
|
-
let
|
|
5332
|
+
Tn(t) {
|
|
5333
|
+
const e = this.an, n = t.geometricError;
|
|
5334
|
+
if (0 === n) return 0;
|
|
5335
|
+
const r = this.getMap();
|
|
5336
|
+
let s;
|
|
5295
5337
|
if (t.boundingVolume.region) {
|
|
5296
|
-
const e = this.tn[t.id].center,
|
|
5297
|
-
|
|
5338
|
+
const e = this.tn[t.id].center, n = (r.getGLZoom ? r.distanceToPoint(100, 0, r.getGLZoom(), e) : r.distanceToPointAtRes(100, 0, r.getGLRes(), e)).x / 100;
|
|
5339
|
+
s = function(t, e, n, r) {
|
|
5298
5340
|
const s = t.boundingVolume.region;
|
|
5299
|
-
let i = t.
|
|
5300
|
-
i || (i = t.
|
|
5301
|
-
t.
|
|
5302
|
-
t.
|
|
5341
|
+
let i = t.vn;
|
|
5342
|
+
i || (i = t.vn = [ Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]), Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]) ],
|
|
5343
|
+
t.Mn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
|
|
5344
|
+
t.Sn = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
|
|
5303
5345
|
if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
|
|
5304
|
-
const o = (a = t.
|
|
5346
|
+
const o = (a = t.Mn, c = t.Sn, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
|
|
5305
5347
|
f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
|
|
5306
5348
|
var a, c, h, u, f;
|
|
5307
5349
|
let l = 0;
|
|
5308
5350
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5309
5351
|
return Math.sqrt(o * o + l * l);
|
|
5310
|
-
}(t, this.
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
return n.vec3.dist(r, e);
|
|
5317
|
-
}(t, this.an)) : t.boundingVolume.box && (i = Un(t.boundingVolume, this.an), o = function(t, e) {
|
|
5318
|
-
const r = t.boundingVolume.box;
|
|
5319
|
-
return n.vec3.dist(r, e);
|
|
5320
|
-
}(t, this.an));
|
|
5321
|
-
const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
|
|
5322
|
-
return t.ce = i, t.Ye = o, t.An = c, c;
|
|
5323
|
-
}
|
|
5324
|
-
sn() {
|
|
5352
|
+
}(t, this.cn, this.sn, n);
|
|
5353
|
+
} else t.boundingVolume.sphere ? s = zn(t.boundingVolume, this.in) : t.boundingVolume.box && (s = jn(t.boundingVolume, this.in));
|
|
5354
|
+
const i = Math.max(Math.abs(s), 1e-7), o = n * r.height / (i * e);
|
|
5355
|
+
return t.ce = s, t.An = o, o;
|
|
5356
|
+
}
|
|
5357
|
+
rn() {
|
|
5325
5358
|
const t = this.getRenderer();
|
|
5326
5359
|
t && t.setToRedraw();
|
|
5327
5360
|
}
|
|
@@ -5329,15 +5362,18 @@
|
|
|
5329
5362
|
return this.tn[t];
|
|
5330
5363
|
}
|
|
5331
5364
|
}
|
|
5332
|
-
function
|
|
5365
|
+
function zn(t, e) {
|
|
5333
5366
|
const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
|
|
5334
5367
|
return s < i ? 0 : s - i;
|
|
5335
5368
|
}
|
|
5336
|
-
function
|
|
5337
|
-
const
|
|
5338
|
-
return
|
|
5369
|
+
function jn(t, e) {
|
|
5370
|
+
const r = t.box;
|
|
5371
|
+
return gn(n.vec3.set(Nn, r[0], r[1], r[2]), n.mat3.set(Rn, r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11]), e);
|
|
5372
|
+
}
|
|
5373
|
+
function Vn(t, e) {
|
|
5374
|
+
return Un.x = p(t), Un.y = p(e), Sn.project(Un, Cn).toArray();
|
|
5339
5375
|
}
|
|
5340
|
-
|
|
5376
|
+
kn.mergeOptions({
|
|
5341
5377
|
"maxGPUMemory": 512,
|
|
5342
5378
|
"retireInterval": 2e3,
|
|
5343
5379
|
"loadingLimitOnInteracting": 5,
|
|
@@ -5348,39 +5384,35 @@
|
|
|
5348
5384
|
"forceRenderOnMoving": !0,
|
|
5349
5385
|
"debug": !1,
|
|
5350
5386
|
"debugOutline": [ 0, 1, 0 ],
|
|
5387
|
+
"meshLimitPerFrame": 1,
|
|
5351
5388
|
"antialias": !1,
|
|
5352
5389
|
"sRGBTolinear": !1,
|
|
5353
5390
|
"optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
|
|
5354
5391
|
"offset": [ 0, 0 ]
|
|
5355
|
-
}),
|
|
5356
|
-
const
|
|
5357
|
-
function Fn(t, e) {
|
|
5358
|
-
const n = new s.Coordinate(p(t), p(e));
|
|
5359
|
-
return Mn.project(n).toArray();
|
|
5360
|
-
}
|
|
5361
|
-
const Dn = function() {
|
|
5392
|
+
}), kn.registerRenderer("gl", pn);
|
|
5393
|
+
const Gn = function() {
|
|
5362
5394
|
if ("undefined" != typeof self) return self;
|
|
5363
5395
|
if ("undefined" != typeof window) return window;
|
|
5364
5396
|
if ("undefined" != typeof global) return global;
|
|
5365
5397
|
throw new Error("unable to locate global object");
|
|
5366
|
-
},
|
|
5367
|
-
|
|
5368
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
5369
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
5398
|
+
}, Hn = Gn(), qn = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
|
|
5399
|
+
qn.inject = function(t) {
|
|
5400
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
|
|
5401
|
+
let i = `${r}\n const _____getGlobal = ${Gn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
5370
5402
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
5371
5403
|
return i += "\n" + e.substring(r.length), i;
|
|
5372
|
-
},
|
|
5373
|
-
|
|
5374
|
-
},
|
|
5375
|
-
return
|
|
5404
|
+
}, qn.registerTranscoder = function(t, e) {
|
|
5405
|
+
qn[t] = e;
|
|
5406
|
+
}, qn.getTranscoder = function(t) {
|
|
5407
|
+
return qn[t];
|
|
5376
5408
|
};
|
|
5377
|
-
class
|
|
5409
|
+
class $n {
|
|
5378
5410
|
constructor(t, e, n) {
|
|
5379
5411
|
this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
|
|
5380
|
-
"image/crn":
|
|
5381
|
-
"image/ktx2":
|
|
5382
|
-
"image/cttf":
|
|
5383
|
-
"draco":
|
|
5412
|
+
"image/crn": qn.crn && qn.crn(),
|
|
5413
|
+
"image/ktx2": qn.ktx2 && qn.ktx2(),
|
|
5414
|
+
"image/cttf": qn.ktx2 && qn.ktx2(),
|
|
5415
|
+
"draco": qn.draco && qn.draco()
|
|
5384
5416
|
};
|
|
5385
5417
|
}
|
|
5386
5418
|
static createEmptyB3DM() {
|
|
@@ -5439,15 +5471,15 @@
|
|
|
5439
5471
|
o = h, h = a, u = c, a = 0, c = 0);
|
|
5440
5472
|
const l = [ t ];
|
|
5441
5473
|
let d, m, y;
|
|
5442
|
-
if (a > 0 ? (d =
|
|
5474
|
+
if (a > 0 ? (d = he(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
|
|
5443
5475
|
"BATCH_LENGTH": o
|
|
5444
|
-
}, c > 0 && (f += c), h > 0 && (m =
|
|
5445
|
-
const e =
|
|
5476
|
+
}, c > 0 && (f += c), h > 0 && (m = ue(t, f, h), f += h, u > 0)) {
|
|
5477
|
+
const e = fe(0, f, u);
|
|
5446
5478
|
y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
|
|
5447
5479
|
}
|
|
5448
5480
|
const b = d.BATCH_LENGTH, p = {};
|
|
5449
5481
|
if (d && d.BATCH_ID) {
|
|
5450
|
-
p.BATCH_ID =
|
|
5482
|
+
p.BATCH_ID = de(d.BATCH_ID, t, (void 0).offset, b);
|
|
5451
5483
|
const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
|
|
5452
5484
|
e && l.indexOf(e) < 0 && l.push(e);
|
|
5453
5485
|
}
|
|
@@ -5469,13 +5501,13 @@
|
|
|
5469
5501
|
return null;
|
|
5470
5502
|
}
|
|
5471
5503
|
}
|
|
5472
|
-
class
|
|
5504
|
+
class Jn {
|
|
5473
5505
|
constructor(t, e, n) {
|
|
5474
5506
|
this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
|
|
5475
|
-
"image/crn":
|
|
5476
|
-
"image/ktx2":
|
|
5477
|
-
"image/cttf":
|
|
5478
|
-
"draco":
|
|
5507
|
+
"image/crn": qn.crn && qn.crn(),
|
|
5508
|
+
"image/ktx2": qn.ktx2 && qn.ktx2(),
|
|
5509
|
+
"image/cttf": qn.ktx2 && qn.ktx2(),
|
|
5510
|
+
"draco": qn.draco && qn.draco()
|
|
5479
5511
|
};
|
|
5480
5512
|
}
|
|
5481
5513
|
load(t, e, n = 0, r = 0) {
|
|
@@ -5552,7 +5584,7 @@
|
|
|
5552
5584
|
error: t
|
|
5553
5585
|
};
|
|
5554
5586
|
}
|
|
5555
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
5587
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = we(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
|
|
5556
5588
|
if (a.POSITION) {
|
|
5557
5589
|
const {byteOffset: e} = a.POSITION;
|
|
5558
5590
|
f.POSITION = {
|
|
@@ -5575,7 +5607,7 @@
|
|
|
5575
5607
|
}, o.push(f.POSITION.array.buffer);
|
|
5576
5608
|
}
|
|
5577
5609
|
if (a.BATCH_ID) {
|
|
5578
|
-
f.BATCH_ID =
|
|
5610
|
+
f.BATCH_ID = de(a.BATCH_ID, t, c.offset, l);
|
|
5579
5611
|
const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
|
|
5580
5612
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5581
5613
|
}
|
|
@@ -5646,26 +5678,26 @@
|
|
|
5646
5678
|
}
|
|
5647
5679
|
ct(t) {
|
|
5648
5680
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
5649
|
-
for (let s = 0; s < e; s++)
|
|
5681
|
+
for (let s = 0; s < e; s++) Kn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
5650
5682
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
5651
5683
|
return n;
|
|
5652
5684
|
}
|
|
5653
5685
|
at(t, e, n) {
|
|
5654
|
-
return
|
|
5686
|
+
return pe(new Float32Array(t.length), t, e, n);
|
|
5655
5687
|
}
|
|
5656
5688
|
rt() {
|
|
5657
5689
|
return null;
|
|
5658
5690
|
}
|
|
5659
5691
|
}
|
|
5660
|
-
function
|
|
5661
|
-
if (t[0] =
|
|
5692
|
+
function Kn(t, e, n, r) {
|
|
5693
|
+
if (t[0] = Xn(e, r), t[1] = Xn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
5662
5694
|
t[2] < 0) {
|
|
5663
5695
|
const e = t[0];
|
|
5664
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
5696
|
+
t[0] = (1 - Math.abs(t[1])) * Wn(e), t[1] = (1 - Math.abs(e)) * Wn(t[1]);
|
|
5665
5697
|
}
|
|
5666
5698
|
return D(t, t);
|
|
5667
5699
|
}
|
|
5668
|
-
function
|
|
5700
|
+
function Xn(t, e) {
|
|
5669
5701
|
return function(t, e, n) {
|
|
5670
5702
|
return t < e ? e : t > n ? n : t;
|
|
5671
5703
|
}(t, 0, e = function(t, e) {
|
|
@@ -5673,10 +5705,10 @@
|
|
|
5673
5705
|
return e;
|
|
5674
5706
|
}(e, 255)) / e * 2 - 1;
|
|
5675
5707
|
}
|
|
5676
|
-
function
|
|
5708
|
+
function Wn(t) {
|
|
5677
5709
|
return t < 0 ? -1 : 1;
|
|
5678
5710
|
}
|
|
5679
|
-
class
|
|
5711
|
+
class Zn {
|
|
5680
5712
|
constructor() {}
|
|
5681
5713
|
load(t, e, n = 0, r = 0) {
|
|
5682
5714
|
return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
@@ -5709,7 +5741,7 @@
|
|
|
5709
5741
|
error: t
|
|
5710
5742
|
};
|
|
5711
5743
|
}
|
|
5712
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
5744
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = we(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
|
|
5713
5745
|
let m, y = {};
|
|
5714
5746
|
if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
|
|
5715
5747
|
y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
|
|
@@ -5717,7 +5749,7 @@
|
|
|
5717
5749
|
attributes: y.properties,
|
|
5718
5750
|
useUniqueIDs: !1
|
|
5719
5751
|
};
|
|
5720
|
-
return this.ut || (this.ut =
|
|
5752
|
+
return this.ut || (this.ut = qn.draco()), this.ut(m, e).then(e => {
|
|
5721
5753
|
const n = e.attributes;
|
|
5722
5754
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
5723
5755
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -5731,11 +5763,11 @@
|
|
|
5731
5763
|
byteOffset: 0,
|
|
5732
5764
|
itemSize: 1,
|
|
5733
5765
|
count: t.length,
|
|
5734
|
-
componentType:
|
|
5766
|
+
componentType: be(t.constructor),
|
|
5735
5767
|
array: t
|
|
5736
5768
|
}, o.push(t.buffer);
|
|
5737
5769
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
5738
|
-
a.BATCH_ID ? r.BATCH_ID =
|
|
5770
|
+
a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Qn(d);
|
|
5739
5771
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
5740
5772
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5741
5773
|
}
|
|
@@ -5751,7 +5783,7 @@
|
|
|
5751
5783
|
}
|
|
5752
5784
|
const b = this.ft(t, a, c.offset, d, o, f, l);
|
|
5753
5785
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
5754
|
-
a.BATCH_ID ? b.BATCH_ID =
|
|
5786
|
+
a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Qn(d);
|
|
5755
5787
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
5756
5788
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5757
5789
|
}
|
|
@@ -5880,13 +5912,13 @@
|
|
|
5880
5912
|
return a;
|
|
5881
5913
|
}
|
|
5882
5914
|
at(t, e, n) {
|
|
5883
|
-
return
|
|
5915
|
+
return pe(new Float32Array(t.length), t, e, n);
|
|
5884
5916
|
}
|
|
5885
5917
|
rt() {
|
|
5886
5918
|
return null;
|
|
5887
5919
|
}
|
|
5888
5920
|
}
|
|
5889
|
-
function
|
|
5921
|
+
function Qn(t) {
|
|
5890
5922
|
const e = v(t), n = new e(t);
|
|
5891
5923
|
for (let e = 0; e < t; e++) n[e] = e;
|
|
5892
5924
|
return {
|
|
@@ -5894,11 +5926,11 @@
|
|
|
5894
5926
|
byteOffset: 0,
|
|
5895
5927
|
itemSize: 1,
|
|
5896
5928
|
count: t,
|
|
5897
|
-
componentType:
|
|
5929
|
+
componentType: be(e),
|
|
5898
5930
|
array: n
|
|
5899
5931
|
};
|
|
5900
5932
|
}
|
|
5901
|
-
class
|
|
5933
|
+
class Yn {
|
|
5902
5934
|
constructor(t, e) {
|
|
5903
5935
|
this.i = t, this.Y = e || Nt;
|
|
5904
5936
|
}
|
|
@@ -5913,12 +5945,12 @@
|
|
|
5913
5945
|
const s = this.lt(e, t, n, r), i = [];
|
|
5914
5946
|
for (let n = 0; n < s.length; n++) {
|
|
5915
5947
|
let r;
|
|
5916
|
-
if ("b3dm" === s[n].magic) r = new
|
|
5948
|
+
if ("b3dm" === s[n].magic) r = new $n(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Jn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new Zn; else {
|
|
5917
5949
|
if ("cmpt" !== s[n].magic) {
|
|
5918
5950
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
5919
5951
|
continue;
|
|
5920
5952
|
}
|
|
5921
|
-
r = new
|
|
5953
|
+
r = new Yn(this.i, this.Y);
|
|
5922
5954
|
}
|
|
5923
5955
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
5924
5956
|
}
|
|
@@ -5939,7 +5971,7 @@
|
|
|
5939
5971
|
const o = [], a = s.getUint32(12, !0);
|
|
5940
5972
|
let c = 16;
|
|
5941
5973
|
for (let e = 0; e < a; e++) {
|
|
5942
|
-
const e =
|
|
5974
|
+
const e = ae(s, c), r = s.getUint32(c + 8, !0);
|
|
5943
5975
|
o.push({
|
|
5944
5976
|
magic: e,
|
|
5945
5977
|
buffer: t,
|
|
@@ -5950,9 +5982,9 @@
|
|
|
5950
5982
|
return o;
|
|
5951
5983
|
}
|
|
5952
5984
|
}
|
|
5953
|
-
t.B3DMLoader =
|
|
5954
|
-
t.Geo3DTransform =
|
|
5985
|
+
t.B3DMLoader = $n, t.CMPTLoader = Yn, t.Geo3DTilesLayer = kn, t.Geo3DTilesUtil = x,
|
|
5986
|
+
t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
|
|
5955
5987
|
value: !0
|
|
5956
5988
|
});
|
|
5957
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.
|
|
5989
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.7");
|
|
5958
5990
|
}));
|