@maptalks/3dtiles 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptalks.3dtiles.js +294 -274
- package/package.json +2 -2
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.11.
|
|
2
|
+
* @maptalks/3dtiles v0.11.3
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
t;
|
|
44
44
|
}
|
|
45
45
|
function r(t, e, n) {
|
|
46
|
-
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15],
|
|
47
|
-
return t[0] =
|
|
48
|
-
t[2] =
|
|
49
|
-
|
|
50
|
-
t[6] =
|
|
51
|
-
|
|
52
|
-
t[10] =
|
|
53
|
-
|
|
54
|
-
t[14] =
|
|
46
|
+
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15], g = n[0], _ = n[1], T = n[2], A = n[3];
|
|
47
|
+
return t[0] = g * r + _ * a + T * f + A * y, t[1] = g * s + _ * c + T * l + A * b,
|
|
48
|
+
t[2] = g * i + _ * h + T * d + A * p, t[3] = g * o + _ * u + T * m + A * w, g = n[4],
|
|
49
|
+
_ = n[5], T = n[6], A = n[7], t[4] = g * r + _ * a + T * f + A * y, t[5] = g * s + _ * c + T * l + A * b,
|
|
50
|
+
t[6] = g * i + _ * h + T * d + A * p, t[7] = g * o + _ * u + T * m + A * w, g = n[8],
|
|
51
|
+
_ = n[9], T = n[10], A = n[11], t[8] = g * r + _ * a + T * f + A * y, t[9] = g * s + _ * c + T * l + A * b,
|
|
52
|
+
t[10] = g * i + _ * h + T * d + A * p, t[11] = g * o + _ * u + T * m + A * w, g = n[12],
|
|
53
|
+
_ = n[13], T = n[14], A = n[15], t[12] = g * r + _ * a + T * f + A * y, t[13] = g * s + _ * c + T * l + A * b,
|
|
54
|
+
t[14] = g * i + _ * h + T * d + A * p, t[15] = g * o + _ * u + T * m + A * w, t;
|
|
55
55
|
}
|
|
56
56
|
function s() {
|
|
57
57
|
var t = new e(3);
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
var b = function(t, e, n) {
|
|
101
101
|
return t[0] = e[0] - n[0], t[1] = e[1] - n[1], t[2] = e[2] - n[2], t;
|
|
102
102
|
}, p = u, w = i;
|
|
103
|
-
function
|
|
103
|
+
function g(t, e, n, r, s) {
|
|
104
104
|
return t[0] = e, t[1] = n, t[2] = r, t[3] = s, t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function _() {
|
|
107
107
|
var t = new e(4);
|
|
108
108
|
return e != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t;
|
|
109
109
|
}
|
|
@@ -118,17 +118,17 @@
|
|
|
118
118
|
var t, n = (t = new e(4), e != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0),
|
|
119
119
|
t);
|
|
120
120
|
}();
|
|
121
|
-
var A,
|
|
121
|
+
var A, v = function(t, e) {
|
|
122
122
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t;
|
|
123
123
|
};
|
|
124
|
-
s(), o(1, 0, 0), o(0, 1, 0),
|
|
124
|
+
s(), o(1, 0, 0), o(0, 1, 0), _(), _(), A = new e(9), e != Float32Array && (A[1] = 0,
|
|
125
125
|
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
126
|
/*!
|
|
127
|
-
* @maptalks/gltf-loader v0.23.
|
|
127
|
+
* @maptalks/gltf-loader v0.23.1
|
|
128
128
|
* LICENSE : UNLICENSED
|
|
129
129
|
* (c) 2016-2022 maptalks.org
|
|
130
130
|
*/
|
|
131
|
-
let
|
|
131
|
+
let O = 0;
|
|
132
132
|
function M(t) {
|
|
133
133
|
return null == t;
|
|
134
134
|
}
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
return e && e.jsonp ? j.jsonp(t) : ((e = e || {}).responseType = "json", j.get(t, e));
|
|
236
236
|
},
|
|
237
237
|
jsonp: function(t) {
|
|
238
|
-
const e = "_maptalks_jsonp_" +
|
|
238
|
+
const e = "_maptalks_jsonp_" + O++;
|
|
239
239
|
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
240
240
|
let n = document.createElement("script");
|
|
241
241
|
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
}
|
|
401
401
|
return e;
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
g(t) {
|
|
404
404
|
const e = {};
|
|
405
405
|
for (const n in t) {
|
|
406
406
|
const r = t[n];
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
}
|
|
418
418
|
return e;
|
|
419
419
|
}
|
|
420
|
-
|
|
420
|
+
_(t) {
|
|
421
421
|
if (t.bufferView || t.extensions && (t.extensions.KHR_binary_glTF || t.extensions.binary_glTF)) {
|
|
422
422
|
const e = t.bufferView ? t : t.extensions.KHR_binary_glTF || t.extensions.binary_glTF;
|
|
423
423
|
if (t.extensions && (t.mimeType = e.mimeType, t.width = e.width, t.height = e.height),
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
const e = this.gltf.textures[t];
|
|
438
438
|
if (!e) return null;
|
|
439
439
|
const n = this.gltf.images[e.source];
|
|
440
|
-
return this.
|
|
440
|
+
return this._(n).then(t => {
|
|
441
441
|
const r = this.gltf.samplers[e.sampler];
|
|
442
442
|
return {
|
|
443
443
|
image: {
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
const e = this.gltf.textures[t];
|
|
499
499
|
if (!e) return null;
|
|
500
500
|
const n = this.gltf.images[e.source];
|
|
501
|
-
return this.
|
|
501
|
+
return this._(n).then(t => {
|
|
502
502
|
if (!t) return null;
|
|
503
503
|
const r = {
|
|
504
504
|
image: {
|
|
@@ -517,18 +517,18 @@
|
|
|
517
517
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
|
-
|
|
521
|
-
if (!S(t.bufferView)) return this.
|
|
520
|
+
_(t) {
|
|
521
|
+
if (!S(t.bufferView)) return this.v(t);
|
|
522
522
|
{
|
|
523
523
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
524
524
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
525
525
|
const n = this.gltf.buffers[e.buffer];
|
|
526
|
-
if (n.uri) return this.
|
|
526
|
+
if (n.uri) return this.O(n, e, t);
|
|
527
527
|
if (this.glbBuffer) return this.M(e, t);
|
|
528
528
|
}
|
|
529
529
|
return null;
|
|
530
530
|
}
|
|
531
|
-
|
|
531
|
+
v(t) {
|
|
532
532
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
533
533
|
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.S(t.id, e);
|
|
534
534
|
}
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
return this.S(e.id, r);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
|
|
547
|
+
O(t, e, n) {
|
|
548
548
|
if (this.buffers[t.id]) {
|
|
549
549
|
const r = this.buffers[t.id], s = this.N(e, r);
|
|
550
550
|
return this.I(s, n);
|
|
@@ -605,13 +605,13 @@
|
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
const
|
|
609
|
-
class
|
|
608
|
+
const q = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
609
|
+
class $ {
|
|
610
610
|
static read(t, e = 0, n = 0) {
|
|
611
611
|
n || (n = t.byteLength);
|
|
612
612
|
const r = new DataView(t, e, n), s = r.getUint32(4, !0);
|
|
613
|
-
if (1 === s) return
|
|
614
|
-
if (2 === s) return
|
|
613
|
+
if (1 === s) return $.readV1(r, e);
|
|
614
|
+
if (2 === s) return $.readV2(t, e);
|
|
615
615
|
throw new Error("Unsupported glb version : " + s);
|
|
616
616
|
}
|
|
617
617
|
static readV1(t, e) {
|
|
@@ -652,9 +652,9 @@
|
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
function J(t, e, n) {
|
|
655
|
-
if (
|
|
655
|
+
if (q) {
|
|
656
656
|
const r = new Uint8Array(t, e, n);
|
|
657
|
-
return
|
|
657
|
+
return q.decode(r);
|
|
658
658
|
}
|
|
659
659
|
return function(t) {
|
|
660
660
|
const e = t.length;
|
|
@@ -695,7 +695,7 @@
|
|
|
695
695
|
if (l) for (let t = 0; t < l.length; t++) {
|
|
696
696
|
const e = l[t];
|
|
697
697
|
"translation" === e.target.path ? (this.U(s, f.samplers[e.sampler], r, 1), u.translation = a(X, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
|
|
698
|
-
u.rotation =
|
|
698
|
+
u.rotation = v(Z, i)) : "scale" === e.target.path ? (this.U(o, f.samplers[e.sampler], r, 1),
|
|
699
699
|
u.scale = a(W, o)) : "weights" === e.target.path && c && (this.U(c, f.samplers[e.sampler], r, c.length),
|
|
700
700
|
u.weights = c);
|
|
701
701
|
}
|
|
@@ -745,7 +745,7 @@
|
|
|
745
745
|
case "STEP":
|
|
746
746
|
{
|
|
747
747
|
const r = this.L(Q, e, n, 1);
|
|
748
|
-
r && (t =
|
|
748
|
+
r && (t = g(t, ...r.PREVIOUS));
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
751
|
|
|
@@ -802,7 +802,7 @@
|
|
|
802
802
|
},
|
|
803
803
|
getAnimationClip(t, e, n, r) {
|
|
804
804
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
805
|
-
return c(X, ...Y.TRANSLATION),
|
|
805
|
+
return c(X, ...Y.TRANSLATION), g(Z, ...Y.ROTATION), c(W, ...Y.SCALE), this.C(r, t, e, n, X, Z, W, s);
|
|
806
806
|
},
|
|
807
807
|
getTimeSpan(t) {
|
|
808
808
|
if (!t.animations) return null;
|
|
@@ -828,13 +828,19 @@
|
|
|
828
828
|
}
|
|
829
829
|
};
|
|
830
830
|
let et = !1;
|
|
831
|
-
"undefined" != typeof OffscreenCanvas
|
|
831
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
832
|
+
let t;
|
|
833
|
+
try {
|
|
834
|
+
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
835
|
+
} catch (Xt) {}
|
|
836
|
+
t && "undefined" != typeof createImageBitmap && (et = !0);
|
|
837
|
+
}
|
|
832
838
|
const nt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
833
839
|
class rt {
|
|
834
840
|
constructor(t, e, n) {
|
|
835
841
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
836
842
|
e.buffer instanceof ArrayBuffer) {
|
|
837
|
-
const {json: n, glbBuffer: r} =
|
|
843
|
+
const {json: n, glbBuffer: r} = $.read(e.buffer, e.byteOffset, e.byteLength);
|
|
838
844
|
this.D(t, n, r);
|
|
839
845
|
} else this.D(t, e);
|
|
840
846
|
this.k = new V(this.rootPath, this.gltf, this.glbBuffer), this.j();
|
|
@@ -853,7 +859,7 @@
|
|
|
853
859
|
}
|
|
854
860
|
load(t) {
|
|
855
861
|
t = t || {};
|
|
856
|
-
const e = this.G(t), n = this.H(), r = this
|
|
862
|
+
const e = this.G(t), n = this.H(), r = this.q(), s = this.V();
|
|
857
863
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
858
864
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
859
865
|
t[0]));
|
|
@@ -898,7 +904,7 @@
|
|
|
898
904
|
}
|
|
899
905
|
D(t, e, n) {
|
|
900
906
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
901
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = this.options.requestImage ||
|
|
907
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = et ? at : this.options.requestImage || st,
|
|
902
908
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new H(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
903
909
|
this.adapter.iterate((t, e, n) => {
|
|
904
910
|
e.id = "buffer_" + n;
|
|
@@ -910,14 +916,14 @@
|
|
|
910
916
|
e.id = "accessor_" + n;
|
|
911
917
|
}, "accessors"));
|
|
912
918
|
}
|
|
913
|
-
|
|
919
|
+
$(t, e) {
|
|
914
920
|
if (t.children && t.children.length > 0) {
|
|
915
921
|
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
916
922
|
return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
917
923
|
}(t.children[0]))) return t;
|
|
918
924
|
const r = t.children.map(t => {
|
|
919
925
|
const n = e[t];
|
|
920
|
-
return n.nodeIndex = t, this
|
|
926
|
+
return n.nodeIndex = t, this.$(n, e);
|
|
921
927
|
});
|
|
922
928
|
t.children = r;
|
|
923
929
|
}
|
|
@@ -928,7 +934,7 @@
|
|
|
928
934
|
return this.J(t).then(t => {
|
|
929
935
|
const e = this.scenes = [];
|
|
930
936
|
let n;
|
|
931
|
-
for (const e in t) t[e] = this
|
|
937
|
+
for (const e in t) t[e] = this.$(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
932
938
|
this.adapter.iterate((r, s, i) => {
|
|
933
939
|
const o = {};
|
|
934
940
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -944,7 +950,7 @@
|
|
|
944
950
|
skins: this.skins
|
|
945
951
|
};
|
|
946
952
|
if (this.gltf.extensions && (r.extensions = this.gltf.extensions), 1 === this.version) {
|
|
947
|
-
const t = this.adapter.
|
|
953
|
+
const t = this.adapter.g(this.gltf.materials);
|
|
948
954
|
r.materials = t;
|
|
949
955
|
}
|
|
950
956
|
return r;
|
|
@@ -994,7 +1000,7 @@
|
|
|
994
1000
|
return x(n, t), n.primitives = e, n;
|
|
995
1001
|
});
|
|
996
1002
|
}
|
|
997
|
-
|
|
1003
|
+
q() {
|
|
998
1004
|
const t = this.gltf.textures;
|
|
999
1005
|
if (!t) return null;
|
|
1000
1006
|
const e = [];
|
|
@@ -1124,16 +1130,16 @@
|
|
|
1124
1130
|
const n = dt, r = function(t, e, n, r, s) {
|
|
1125
1131
|
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(wt, e, b);
|
|
1126
1132
|
if (y < s) return isFinite(b) ? p : void 0;
|
|
1127
|
-
const w = r[0],
|
|
1128
|
-
T[0] = p[0] * w * 2, T[1] = p[1] *
|
|
1129
|
-
let A,
|
|
1133
|
+
const w = r[0], g = r[1], _ = r[2], T = gt;
|
|
1134
|
+
T[0] = p[0] * w * 2, T[1] = p[1] * g * 2, T[2] = p[2] * _ * 2;
|
|
1135
|
+
let A, v, O, M, S, x, I, N, P, E, C, U = (1 - b) * _t(e) / (.5 * _t(T)), B = 0;
|
|
1130
1136
|
do {
|
|
1131
|
-
U -= B,
|
|
1132
|
-
I = M * M, N = S * S, P = x *
|
|
1133
|
-
|
|
1134
|
-
B = A / (-2 *
|
|
1137
|
+
U -= B, O = 1 / (1 + U * w), M = 1 / (1 + U * g), S = 1 / (1 + U * _), x = O * O,
|
|
1138
|
+
I = M * M, N = S * S, P = x * O, E = I * M, C = N * S, A = l * x + d * I + m * N - 1,
|
|
1139
|
+
v = l * P * w + d * E * g + m * C * _;
|
|
1140
|
+
B = A / (-2 * v);
|
|
1135
1141
|
} while (Math.abs(A) > 1e-12);
|
|
1136
|
-
return t[0] = i *
|
|
1142
|
+
return t[0] = i * O, t[1] = o * M, t[2] = a * S, t;
|
|
1137
1143
|
}(mt, e, lt, n, .1);
|
|
1138
1144
|
let s = p(yt, r, n);
|
|
1139
1145
|
s = function(t, e) {
|
|
@@ -1142,11 +1148,11 @@
|
|
|
1142
1148
|
i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i);
|
|
1143
1149
|
return t;
|
|
1144
1150
|
}(s, s);
|
|
1145
|
-
const i = b(bt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ht(d(i, e)) *
|
|
1151
|
+
const i = b(bt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ht(d(i, e)) * _t(i);
|
|
1146
1152
|
return t[0] = ct(o), t[1] = ct(a), t[2] = c, t;
|
|
1147
1153
|
}
|
|
1148
|
-
const wt = new Array(3),
|
|
1149
|
-
function
|
|
1154
|
+
const wt = new Array(3), gt = new Array(3);
|
|
1155
|
+
function _t(t) {
|
|
1150
1156
|
return i(t);
|
|
1151
1157
|
}
|
|
1152
1158
|
function Tt(t, e) {
|
|
@@ -1158,11 +1164,11 @@
|
|
|
1158
1164
|
return n;
|
|
1159
1165
|
}
|
|
1160
1166
|
const At = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
1161
|
-
function
|
|
1167
|
+
function vt(t, e, n) {
|
|
1162
1168
|
const r = new Uint8Array(t, e, n);
|
|
1163
1169
|
return At ? JSON.parse(At.decode(r)) : JSON.parse(ft(r));
|
|
1164
1170
|
}
|
|
1165
|
-
function
|
|
1171
|
+
function Ot(t, e, n) {
|
|
1166
1172
|
const r = new Uint8Array(t, e, n);
|
|
1167
1173
|
return At ? JSON.parse(At.decode(r)) : JSON.parse(ft(r));
|
|
1168
1174
|
}
|
|
@@ -1255,12 +1261,12 @@
|
|
|
1255
1261
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
1256
1262
|
const a = t.buffer;
|
|
1257
1263
|
let c, h, u = {}, f = {};
|
|
1258
|
-
r > 0 && (u =
|
|
1264
|
+
r > 0 && (u = vt(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
|
|
1259
1265
|
return {
|
|
1260
1266
|
offset: e,
|
|
1261
1267
|
byteLength: n
|
|
1262
1268
|
};
|
|
1263
|
-
}(0, e, s), e += s), i > 0 && (f =
|
|
1269
|
+
}(0, e, s), e += s), i > 0 && (f = Ot(a, e, i), e += i);
|
|
1264
1270
|
const l = Mt(0, e, o);
|
|
1265
1271
|
return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
|
|
1266
1272
|
featureTable: u,
|
|
@@ -1290,7 +1296,7 @@
|
|
|
1290
1296
|
var s = Math.abs(t - e);
|
|
1291
1297
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
1292
1298
|
}
|
|
1293
|
-
const zt = (
|
|
1299
|
+
const zt = (qt = {
|
|
1294
1300
|
up: {
|
|
1295
1301
|
south: "east",
|
|
1296
1302
|
north: "west",
|
|
@@ -1327,31 +1333,31 @@
|
|
|
1327
1333
|
north: "up",
|
|
1328
1334
|
south: "down"
|
|
1329
1335
|
}
|
|
1330
|
-
}[Vt = "east"][Gt = "north"], Bt[
|
|
1336
|
+
}[Vt = "east"][Gt = "north"], Bt[$t = Vt + Gt] ? Ht = Bt[$t] : (Ht = function(t, e, n) {
|
|
1331
1337
|
if (function(t, e) {
|
|
1332
1338
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
1333
1339
|
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));
|
|
1334
|
-
}(t, kt)) a(Rt, Ut[Vt]), a(Ft, Ut[Gt]), a(Dt, Ut[
|
|
1340
|
+
}(t, kt)) a(Rt, Ut[Vt]), a(Ft, Ut[Gt]), a(Dt, Ut[qt]); else if (jt(t[0], 0, 1e-14) && jt(t[1], 0, 1e-14)) {
|
|
1335
1341
|
var r = ht(t[2]);
|
|
1336
1342
|
a(Rt, Ut[Vt]), "east" !== Vt && "west" !== Vt && f(Rt, Rt, r), a(Ft, Ut[Gt]), "east" !== Gt && "west" !== Gt && f(Ft, Ft, r),
|
|
1337
|
-
a(Dt, Ut[
|
|
1343
|
+
a(Dt, Ut[qt]), "east" !== qt && "west" !== qt && f(Dt, Dt, r);
|
|
1338
1344
|
} else {
|
|
1339
1345
|
!function(t, e) {
|
|
1340
1346
|
u(e, t, dt), l(e, e);
|
|
1341
1347
|
}(t, Lt.up);
|
|
1342
1348
|
var s = Lt.up, i = Lt.east;
|
|
1343
1349
|
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Lt.east, i), m(Lt.north, s, i), f(Lt.down, Lt.up, -1),
|
|
1344
|
-
f(Lt.west, Lt.east, -1), f(Lt.south, Lt.north, -1), Rt = Lt[Vt], Ft = Lt[Gt], Dt = Lt[
|
|
1350
|
+
f(Lt.west, Lt.east, -1), f(Lt.south, Lt.north, -1), Rt = Lt[Vt], Ft = Lt[Gt], Dt = Lt[qt];
|
|
1345
1351
|
}
|
|
1346
1352
|
return n[0] = Rt[0], n[1] = Rt[1], n[2] = Rt[2], n[3] = 0, n[4] = Ft[0], n[5] = Ft[1],
|
|
1347
1353
|
n[6] = Ft[2], n[7] = 0, n[8] = Dt[0], n[9] = Dt[1], n[10] = Dt[2], n[11] = 0, n[12] = t[0],
|
|
1348
1354
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
1349
|
-
}, Bt[
|
|
1355
|
+
}, Bt[$t] = Ht), Ht);
|
|
1350
1356
|
/*!
|
|
1351
1357
|
* @maptalks/gl v0.64.0
|
|
1352
1358
|
* LICENSE : UNLICENSED
|
|
1353
1359
|
* (c) 2016-2022 maptalks.com
|
|
1354
|
-
*/ var Vt, Gt, Ht, $t
|
|
1360
|
+
*/ var Vt, Gt, Ht, qt, $t;
|
|
1355
1361
|
const Jt = function() {
|
|
1356
1362
|
if ("undefined" != typeof self) return self;
|
|
1357
1363
|
if ("undefined" != typeof window) return window;
|
|
@@ -1395,6 +1401,7 @@
|
|
|
1395
1401
|
if (s.error) return Promise.resolve(s);
|
|
1396
1402
|
const i = t.substring(0, t.lastIndexOf("/")), o = new this.tt(i, s.glb, {
|
|
1397
1403
|
transferable: !0,
|
|
1404
|
+
requestImage: this.A,
|
|
1398
1405
|
decoders: this.et
|
|
1399
1406
|
});
|
|
1400
1407
|
return o.load().then(e => {
|
|
@@ -1431,9 +1438,9 @@
|
|
|
1431
1438
|
o = h, h = a, u = c, a = 0, c = 0);
|
|
1432
1439
|
const l = [ t ];
|
|
1433
1440
|
let d, m, y;
|
|
1434
|
-
if (a > 0 ? (d =
|
|
1441
|
+
if (a > 0 ? (d = vt(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
|
|
1435
1442
|
"BATCH_LENGTH": o
|
|
1436
|
-
}, c > 0 && (f += c), h > 0 && (m =
|
|
1443
|
+
}, c > 0 && (f += c), h > 0 && (m = Ot(t, f, h), f += h, u > 0)) {
|
|
1437
1444
|
const e = Mt(0, f, u);
|
|
1438
1445
|
y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
|
|
1439
1446
|
}
|
|
@@ -1496,6 +1503,7 @@
|
|
|
1496
1503
|
it(t, e, n, r) {
|
|
1497
1504
|
const s = {
|
|
1498
1505
|
transferable: !0,
|
|
1506
|
+
requestImage: this.A,
|
|
1499
1507
|
decoders: this.et
|
|
1500
1508
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
1501
1509
|
if (0 === i.getUint32(28, !0)) {
|
|
@@ -1990,33 +1998,37 @@
|
|
|
1990
1998
|
}
|
|
1991
1999
|
}
|
|
1992
2000
|
const ae = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], ce = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], he = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
1993
|
-
let ue, fe
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2001
|
+
let ue, fe = !1;
|
|
2002
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
2003
|
+
try {
|
|
2004
|
+
ue = new OffscreenCanvas(2, 2).getContext("2d");
|
|
2005
|
+
} catch (t) {}
|
|
2006
|
+
ue && "undefined" != typeof createImageBitmap && (fe = !0);
|
|
2007
|
+
}
|
|
2008
|
+
const le = n([]), de = [ 0, 0, 0 ], me = [], ye = [];
|
|
2009
|
+
class be {
|
|
1998
2010
|
constructor(t, e, n, r) {
|
|
1999
2011
|
this.id = t, this.options = e, this.yt = this.requestImage.bind(this), this.bt = new ee,
|
|
2000
|
-
this.pt = new Zt(this.yt, rt), this.wt = new Wt(this.yt, rt), this.
|
|
2001
|
-
r();
|
|
2012
|
+
this.pt = new Zt(this.yt, rt), this.wt = new Wt(this.yt, rt), this.gt = n, this._t = {},
|
|
2013
|
+
r(null, {}, []);
|
|
2002
2014
|
}
|
|
2003
2015
|
requestImage(t, e) {
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
const n =
|
|
2016
|
+
fe ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
2017
|
+
(void 0).width = t.width, (void 0).height = t.height, ue.drawImage(t, 0, 0);
|
|
2018
|
+
const n = ue.getImageData(0, 0, (void 0).width, (void 0).height);
|
|
2007
2019
|
e(null, {
|
|
2008
2020
|
width: t.width,
|
|
2009
2021
|
height: t.height,
|
|
2010
2022
|
data: new Uint8Array(n.data)
|
|
2011
2023
|
});
|
|
2012
|
-
}) : this.
|
|
2024
|
+
}) : this.gt("requestImage", {
|
|
2013
2025
|
url: t
|
|
2014
2026
|
}, null, e);
|
|
2015
2027
|
}
|
|
2016
2028
|
loadTile(t, e) {
|
|
2017
2029
|
const n = t.url, r = t.arraybuffer;
|
|
2018
2030
|
if (r) {
|
|
2019
|
-
delete this.
|
|
2031
|
+
delete this._t[n];
|
|
2020
2032
|
const s = Tt(new DataView(r), 0);
|
|
2021
2033
|
if ("{" === s[0] || " " === s[0]) {
|
|
2022
2034
|
const t = function(t, e, n) {
|
|
@@ -2049,7 +2061,7 @@
|
|
|
2049
2061
|
});
|
|
2050
2062
|
} else if ("cmpt" === s) {
|
|
2051
2063
|
new re(this.yt, rt).load(n, r).then(n => {
|
|
2052
|
-
const {content: r, transferables: s} = this.
|
|
2064
|
+
const {content: r, transferables: s} = this.vt(n, t);
|
|
2053
2065
|
e(null, r, s);
|
|
2054
2066
|
}).catch(t => {
|
|
2055
2067
|
e(t);
|
|
@@ -2062,13 +2074,13 @@
|
|
|
2062
2074
|
let i = j.getArrayBuffer(n + (s || ""), r.ajaxOptions);
|
|
2063
2075
|
const o = i.xhr;
|
|
2064
2076
|
i = i.then(r => {
|
|
2065
|
-
delete this.
|
|
2077
|
+
delete this._t[n], t.arraybuffer = r && r.data, this.loadTile(t, e);
|
|
2066
2078
|
}).catch(t => {
|
|
2067
|
-
delete this.
|
|
2068
|
-
}), this.
|
|
2079
|
+
delete this._t[n], e(t);
|
|
2080
|
+
}), this._t[n] = o;
|
|
2069
2081
|
}
|
|
2070
2082
|
}
|
|
2071
|
-
|
|
2083
|
+
vt(t, e) {
|
|
2072
2084
|
const {tiles: n} = t, r = {
|
|
2073
2085
|
magic: "cmpt",
|
|
2074
2086
|
content: []
|
|
@@ -2082,7 +2094,7 @@
|
|
|
2082
2094
|
const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.At(n[t], i, o);
|
|
2083
2095
|
ge(s, c), r.content.push(a);
|
|
2084
2096
|
} else if ("cmpt" === i) {
|
|
2085
|
-
const {content: i, transferables: o} = this.
|
|
2097
|
+
const {content: i, transferables: o} = this.vt(n[t], e);
|
|
2086
2098
|
ge(s, o), r.content.push(i);
|
|
2087
2099
|
}
|
|
2088
2100
|
}
|
|
@@ -2093,7 +2105,7 @@
|
|
|
2093
2105
|
}
|
|
2094
2106
|
Tt(t, e) {
|
|
2095
2107
|
const {gltf: n, transferables: r, featureTable: s} = t;
|
|
2096
|
-
return this.
|
|
2108
|
+
return this.Ot(t.gltf), this.convertCoordinates(n, s, e.upAxis, e.transform), delete t.transferables,
|
|
2097
2109
|
{
|
|
2098
2110
|
content: t,
|
|
2099
2111
|
transferables: r
|
|
@@ -2129,8 +2141,8 @@
|
|
|
2129
2141
|
hmin: 1 / 0,
|
|
2130
2142
|
hmax: -1 / 0
|
|
2131
2143
|
};
|
|
2132
|
-
|
|
2133
|
-
const c =
|
|
2144
|
+
pe(s.POSITION.array, 3, i, le, o);
|
|
2145
|
+
const c = we(o), u = a([], c);
|
|
2134
2146
|
oe(s.POSITION, t => {
|
|
2135
2147
|
t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2];
|
|
2136
2148
|
}), e && y(c, c, e);
|
|
@@ -2142,7 +2154,7 @@
|
|
|
2142
2154
|
transferables: l
|
|
2143
2155
|
};
|
|
2144
2156
|
}
|
|
2145
|
-
|
|
2157
|
+
Ot(t) {
|
|
2146
2158
|
if (!Array.isArray(t.textures)) return;
|
|
2147
2159
|
const e = t.textures;
|
|
2148
2160
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -2159,12 +2171,12 @@
|
|
|
2159
2171
|
}
|
|
2160
2172
|
}
|
|
2161
2173
|
abortTileLoading(t, e) {
|
|
2162
|
-
const n = this.
|
|
2163
|
-
n && n.abort(), delete this.
|
|
2174
|
+
const n = this._t[t.url];
|
|
2175
|
+
n && n.abort(), delete this._t[t.url], e(null);
|
|
2164
2176
|
}
|
|
2165
2177
|
convertCoordinates(t, e, s, i) {
|
|
2166
2178
|
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = ae;
|
|
2167
|
-
"X" === (s = s && s.toUpperCase()) ? c = ce : "Z" === s && (c =
|
|
2179
|
+
"X" === (s = s && s.toUpperCase()) ? c = ce : "Z" === s && (c = le), t.extensions = t.extensions || {},
|
|
2168
2180
|
t.extensions.CESIUM_RTC || (t.extensions.CESIUM_RTC = {}), o && (t.extensions.CESIUM_RTC.center = o);
|
|
2169
2181
|
const h = {
|
|
2170
2182
|
xmin: 1 / 0,
|
|
@@ -2176,28 +2188,28 @@
|
|
|
2176
2188
|
};
|
|
2177
2189
|
se(t, t => {
|
|
2178
2190
|
if (!(t.attributes && t.attributes.POSITION)) return;
|
|
2179
|
-
const e = n(
|
|
2191
|
+
const e = n(me);
|
|
2180
2192
|
if (t.matrices) for (let n = t.matrices.length - 1; n >= 0; n--) r(e, e, t.matrices[n]);
|
|
2181
2193
|
const s = t.attributes.POSITION.array, i = t.attributes.POSITION.itemSize;
|
|
2182
|
-
r(e, c, e),
|
|
2194
|
+
r(e, c, e), pe(s, i, o || de, e, h);
|
|
2183
2195
|
});
|
|
2184
|
-
const u =
|
|
2196
|
+
const u = we(h), f = a([], u);
|
|
2185
2197
|
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (se(t, t => {
|
|
2186
2198
|
if (t.attributes && t.attributes.POSITION) {
|
|
2187
2199
|
const e = t.attributes.POSITION;
|
|
2188
2200
|
if (e.array.buffer.projected && e.array.buffer.projected[e.byteOffset]) return;
|
|
2189
|
-
const s = n(
|
|
2201
|
+
const s = n(me);
|
|
2190
2202
|
if (t.matrices) for (let e = t.matrices.length - 1; e >= 0; e--) r(s, s, t.matrices[e]);
|
|
2191
2203
|
r(s, c, s);
|
|
2192
2204
|
const i = function(t, e) {
|
|
2193
|
-
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o,
|
|
2205
|
+
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o, g = n * c - s * o, _ = n * h - i * o, T = r * c - s * a, A = r * h - i * a, v = s * h - i * c, O = u * y - f * m, M = u * b - l * m, S = u * p - d * m, x = f * b - l * y, I = f * p - d * y, N = l * p - d * b, P = w * N - g * I + _ * x + T * S - A * M + v * O;
|
|
2194
2206
|
return P ? (P = 1 / P, t[0] = (a * N - c * I + h * x) * P, t[1] = (s * I - r * N - i * x) * P,
|
|
2195
|
-
t[2] = (y *
|
|
2196
|
-
t[5] = (n * N - s * S + i * M) * P, t[6] = (b *
|
|
2197
|
-
t[8] = (o * I - a * S + h *
|
|
2198
|
-
t[11] = (f *
|
|
2199
|
-
t[14] = (y *
|
|
2200
|
-
}(
|
|
2207
|
+
t[2] = (y * v - b * A + p * T) * P, t[3] = (l * A - f * v - d * T) * P, t[4] = (c * S - o * N - h * M) * P,
|
|
2208
|
+
t[5] = (n * N - s * S + i * M) * P, t[6] = (b * _ - m * v - p * g) * P, t[7] = (u * v - l * _ + d * g) * P,
|
|
2209
|
+
t[8] = (o * I - a * S + h * O) * P, t[9] = (r * S - n * I - i * O) * P, t[10] = (m * A - y * _ + p * w) * P,
|
|
2210
|
+
t[11] = (f * _ - u * A - d * w) * P, t[12] = (a * M - o * x - c * O) * P, t[13] = (n * x - r * M + s * O) * P,
|
|
2211
|
+
t[14] = (y * g - m * T - b * w) * P, t[15] = (u * T - f * g + l * w) * P, t) : null;
|
|
2212
|
+
}(ye, s);
|
|
2201
2213
|
oe(e, t => {
|
|
2202
2214
|
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);
|
|
2203
2215
|
}), e.array.buffer.projected || (e.array.buffer.projected = {}), e.array.buffer.projected[e.byteOffset] = 1;
|
|
@@ -2209,7 +2221,7 @@
|
|
|
2209
2221
|
}
|
|
2210
2222
|
onRemove() {}
|
|
2211
2223
|
}
|
|
2212
|
-
function
|
|
2224
|
+
function pe(t, e, n, r, s) {
|
|
2213
2225
|
const i = [];
|
|
2214
2226
|
for (let o = 0, a = t.length; o < a; o += e) {
|
|
2215
2227
|
const {xmin: a, ymin: u, xmax: f, ymax: l, hmin: d, hmax: m} = s;
|
|
@@ -2219,7 +2231,7 @@
|
|
|
2219
2231
|
b[1] > l && (s.ymax = b[1]), e > 2 && (b[2] < d && (s.hmin = b[2]), b[2] > m && (s.hmax = b[2]));
|
|
2220
2232
|
}
|
|
2221
2233
|
}
|
|
2222
|
-
function
|
|
2234
|
+
function we(t) {
|
|
2223
2235
|
const {xmax: e, ymax: n, xmin: r, ymin: s, hmin: i, hmax: o} = t, a = [ (r + e) / 2, (s + n) / 2, (i + o) / 2 ];
|
|
2224
2236
|
return e === -1 / 0 && (a[0] = 0), n === -1 / 0 && (a[1] = 0), o === -1 / 0 && (a[2] = 0),
|
|
2225
2237
|
isNaN(a[2]) && (a[2] = 0), a;
|
|
@@ -2227,15 +2239,15 @@
|
|
|
2227
2239
|
function ge(t, e) {
|
|
2228
2240
|
for (let n = 0; n < e.length; n++) t.indexOf(e[n]) < 0 && t.push(e[n]);
|
|
2229
2241
|
}
|
|
2230
|
-
let
|
|
2231
|
-
class
|
|
2242
|
+
let _e = 0;
|
|
2243
|
+
class Te {
|
|
2232
2244
|
constructor(t) {
|
|
2233
2245
|
this.workerId = t, this.workers = {}, this.St = {};
|
|
2234
2246
|
}
|
|
2235
2247
|
addLayer({actorId: t, mapId: e, layerId: n, params: r}, s) {
|
|
2236
2248
|
if (this.xt(e, n)) return;
|
|
2237
2249
|
const i = this.It(e, n), o = r.options, a = this.send.bind(this, t);
|
|
2238
|
-
this.workers[i] = new
|
|
2250
|
+
this.workers[i] = new be(n, o, a, s);
|
|
2239
2251
|
}
|
|
2240
2252
|
removeLayer({mapId: t, layerId: e}, n) {
|
|
2241
2253
|
const r = this.xt(t, e), s = this.It(t, e);
|
|
@@ -2254,7 +2266,7 @@
|
|
|
2254
2266
|
delete this.St[e], n && t.error ? n(new Error(t.error)) : n && n(null, t.data);
|
|
2255
2267
|
}
|
|
2256
2268
|
send(t, e, n, r, s) {
|
|
2257
|
-
const i = s ? `${t}-${
|
|
2269
|
+
const i = s ? `${t}-${_e++}` : null;
|
|
2258
2270
|
s && (this.St[i] = s), postMessage({
|
|
2259
2271
|
type: "<request>",
|
|
2260
2272
|
workerId: this.workerId,
|
|
@@ -2274,7 +2286,7 @@
|
|
|
2274
2286
|
}
|
|
2275
2287
|
t.initialize = function() {}, t.onmessage = function(t, e) {
|
|
2276
2288
|
const n = t.data;
|
|
2277
|
-
this.dispatcher || (this.dispatcher = new
|
|
2289
|
+
this.dispatcher || (this.dispatcher = new Te(t.workerId)), "<response>" === t.type ? this.dispatcher.workerId === t.workerId && this.dispatcher.receive(t) : this.dispatcher[n.command]({
|
|
2278
2290
|
actorId: n.actorId,
|
|
2279
2291
|
mapId: n.mapId,
|
|
2280
2292
|
layerId: n.layerId,
|
|
@@ -2322,9 +2334,9 @@
|
|
|
2322
2334
|
return !(h <= -c);
|
|
2323
2335
|
}
|
|
2324
2336
|
function u(t) {
|
|
2325
|
-
var e = t, n = e[0], r = e[1], s = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], l = e[8], d = e[9], m = e[10], y = e[11], b = e[12], p = e[13], w = e[14],
|
|
2326
|
-
f(i[0], o - n, u - a, y - l,
|
|
2327
|
-
f(i[3], o - r, u - c, y - d,
|
|
2337
|
+
var e = t, n = e[0], r = e[1], s = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], l = e[8], d = e[9], m = e[10], y = e[11], b = e[12], p = e[13], w = e[14], g = e[15];
|
|
2338
|
+
f(i[0], o - n, u - a, y - l, g - b), f(i[1], o + n, u + a, y + l, g + b), f(i[2], o + r, u + c, y + d, g + p),
|
|
2339
|
+
f(i[3], o - r, u - c, y - d, g - p), f(i[4], o - s, u - h, y - m, g - w), f(i[5], o + s, u + h, y + m, g + w);
|
|
2328
2340
|
}
|
|
2329
2341
|
function f(t, e, n, r, s) {
|
|
2330
2342
|
return t[0] = e * (1 / 6), t[1] = n * (1 / 6), t[2] = r * (1 / 6), t[3] = s * (1 / 6),
|
|
@@ -2356,17 +2368,17 @@
|
|
|
2356
2368
|
let e = document.createElement("a");
|
|
2357
2369
|
return e.href = t, t = e.href, e = null, t;
|
|
2358
2370
|
}
|
|
2359
|
-
function
|
|
2371
|
+
function g(t) {
|
|
2360
2372
|
return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : t > 0 ? 1 : -1;
|
|
2361
2373
|
}
|
|
2362
|
-
const
|
|
2374
|
+
const _ = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
2363
2375
|
function T(t) {
|
|
2364
2376
|
const e = t.length;
|
|
2365
2377
|
let n = "";
|
|
2366
2378
|
for (let r = 0; r < e; ) {
|
|
2367
2379
|
let s = t[r++];
|
|
2368
2380
|
if (128 & s) {
|
|
2369
|
-
let n =
|
|
2381
|
+
let n = _[s >> 3 & 7];
|
|
2370
2382
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
2371
2383
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
2372
2384
|
const e = t[r++];
|
|
@@ -2381,10 +2393,10 @@
|
|
|
2381
2393
|
function A(t, e, n) {
|
|
2382
2394
|
return t[3 * n] = e[0], t[3 * n + 1] = e[1], t[3 * n + 2] = e[2], t;
|
|
2383
2395
|
}
|
|
2384
|
-
function
|
|
2396
|
+
function v(t) {
|
|
2385
2397
|
return t.flat ? t.flat(1 / 0) : t.reduce((t, e) => t.concat(e), []);
|
|
2386
2398
|
}
|
|
2387
|
-
function
|
|
2399
|
+
function O(t) {
|
|
2388
2400
|
return t < 256 ? Uint8Array : t < 65536 ? Uint16Array : Uint32Array;
|
|
2389
2401
|
}
|
|
2390
2402
|
function M(t) {
|
|
@@ -2403,24 +2415,24 @@
|
|
|
2403
2415
|
toRadian: b,
|
|
2404
2416
|
toDegree: p,
|
|
2405
2417
|
getAbsoluteURL: w,
|
|
2406
|
-
sign:
|
|
2418
|
+
sign: g,
|
|
2407
2419
|
stringFromUTF8Array: T,
|
|
2408
2420
|
setColumn3: A,
|
|
2409
|
-
flatArr:
|
|
2410
|
-
getBatchIdArrayType:
|
|
2421
|
+
flatArr: v,
|
|
2422
|
+
getBatchIdArrayType: O,
|
|
2411
2423
|
isBase64: M,
|
|
2412
2424
|
base64URLToArrayBuffer: S
|
|
2413
2425
|
}), I = "undefined" != typeof Float32Array ? Float32Array : Array;
|
|
2414
2426
|
function N(t, e, n) {
|
|
2415
|
-
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15],
|
|
2416
|
-
return t[0] =
|
|
2417
|
-
t[2] =
|
|
2418
|
-
|
|
2419
|
-
t[6] =
|
|
2420
|
-
|
|
2421
|
-
t[10] =
|
|
2422
|
-
|
|
2423
|
-
t[14] =
|
|
2427
|
+
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15], g = n[0], _ = n[1], T = n[2], A = n[3];
|
|
2428
|
+
return t[0] = g * r + _ * a + T * f + A * y, t[1] = g * s + _ * c + T * l + A * b,
|
|
2429
|
+
t[2] = g * i + _ * h + T * d + A * p, t[3] = g * o + _ * u + T * m + A * w, g = n[4],
|
|
2430
|
+
_ = n[5], T = n[6], A = n[7], t[4] = g * r + _ * a + T * f + A * y, t[5] = g * s + _ * c + T * l + A * b,
|
|
2431
|
+
t[6] = g * i + _ * h + T * d + A * p, t[7] = g * o + _ * u + T * m + A * w, g = n[8],
|
|
2432
|
+
_ = n[9], T = n[10], A = n[11], t[8] = g * r + _ * a + T * f + A * y, t[9] = g * s + _ * c + T * l + A * b,
|
|
2433
|
+
t[10] = g * i + _ * h + T * d + A * p, t[11] = g * o + _ * u + T * m + A * w, g = n[12],
|
|
2434
|
+
_ = n[13], T = n[14], A = n[15], t[12] = g * r + _ * a + T * f + A * y, t[13] = g * s + _ * c + T * l + A * b,
|
|
2435
|
+
t[14] = g * i + _ * h + T * d + A * p, t[15] = g * o + _ * u + T * m + A * w, t;
|
|
2424
2436
|
}
|
|
2425
2437
|
function P() {
|
|
2426
2438
|
var t = new I(3);
|
|
@@ -2465,11 +2477,11 @@
|
|
|
2465
2477
|
function H(t, e, n, r, s) {
|
|
2466
2478
|
return t[0] = e, t[1] = n, t[2] = r, t[3] = s, t;
|
|
2467
2479
|
}
|
|
2468
|
-
function
|
|
2480
|
+
function q() {
|
|
2469
2481
|
var t = new I(4);
|
|
2470
2482
|
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t;
|
|
2471
2483
|
}
|
|
2472
|
-
function
|
|
2484
|
+
function $(t, e, n, r) {
|
|
2473
2485
|
var s = e[0], i = e[1], o = e[2], a = e[3], c = n[0], h = n[1], u = n[2], f = n[3], l = void 0, d = void 0, m = void 0, y = void 0, b = void 0;
|
|
2474
2486
|
return (d = s * c + i * h + o * u + a * f) < 0 && (d = -d, c = -c, h = -h, u = -u,
|
|
2475
2487
|
f = -f), 1 - d > 1e-6 ? (l = Math.acos(d), m = Math.sin(l), y = Math.sin((1 - r) * l) / m,
|
|
@@ -2483,10 +2495,10 @@
|
|
|
2483
2495
|
var J, K = function(t, e) {
|
|
2484
2496
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t;
|
|
2485
2497
|
};
|
|
2486
|
-
P(), C(1, 0, 0), C(0, 1, 0),
|
|
2498
|
+
P(), C(1, 0, 0), C(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
|
|
2487
2499
|
J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
|
|
2488
2500
|
/*!
|
|
2489
|
-
* @maptalks/gltf-loader v0.23.
|
|
2501
|
+
* @maptalks/gltf-loader v0.23.1
|
|
2490
2502
|
* LICENSE : UNLICENSED
|
|
2491
2503
|
* (c) 2016-2022 maptalks.org
|
|
2492
2504
|
*/
|
|
@@ -2766,7 +2778,7 @@
|
|
|
2766
2778
|
}
|
|
2767
2779
|
return e;
|
|
2768
2780
|
}
|
|
2769
|
-
|
|
2781
|
+
g(t) {
|
|
2770
2782
|
const e = {};
|
|
2771
2783
|
for (const n in t) {
|
|
2772
2784
|
const r = t[n];
|
|
@@ -2783,7 +2795,7 @@
|
|
|
2783
2795
|
}
|
|
2784
2796
|
return e;
|
|
2785
2797
|
}
|
|
2786
|
-
|
|
2798
|
+
_(t) {
|
|
2787
2799
|
if (t.bufferView || t.extensions && (t.extensions.KHR_binary_glTF || t.extensions.binary_glTF)) {
|
|
2788
2800
|
const e = t.bufferView ? t : t.extensions.KHR_binary_glTF || t.extensions.binary_glTF;
|
|
2789
2801
|
if (t.extensions && (t.mimeType = e.mimeType, t.width = e.width, t.height = e.height),
|
|
@@ -2803,7 +2815,7 @@
|
|
|
2803
2815
|
const e = this.gltf.textures[t];
|
|
2804
2816
|
if (!e) return null;
|
|
2805
2817
|
const n = this.gltf.images[e.source];
|
|
2806
|
-
return this.
|
|
2818
|
+
return this._(n).then(t => {
|
|
2807
2819
|
const r = this.gltf.samplers[e.sampler];
|
|
2808
2820
|
return {
|
|
2809
2821
|
image: {
|
|
@@ -2864,7 +2876,7 @@
|
|
|
2864
2876
|
const e = this.gltf.textures[t];
|
|
2865
2877
|
if (!e) return null;
|
|
2866
2878
|
const n = this.gltf.images[e.source];
|
|
2867
|
-
return this.
|
|
2879
|
+
return this._(n).then(t => {
|
|
2868
2880
|
if (!t) return null;
|
|
2869
2881
|
const r = {
|
|
2870
2882
|
image: {
|
|
@@ -2883,18 +2895,18 @@
|
|
|
2883
2895
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
2884
2896
|
});
|
|
2885
2897
|
}
|
|
2886
|
-
|
|
2887
|
-
if (!W(t.bufferView)) return this.
|
|
2898
|
+
_(t) {
|
|
2899
|
+
if (!W(t.bufferView)) return this.v(t);
|
|
2888
2900
|
{
|
|
2889
2901
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
2890
2902
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
2891
2903
|
const n = this.gltf.buffers[e.buffer];
|
|
2892
|
-
if (n.uri) return this.
|
|
2904
|
+
if (n.uri) return this.O(n, e, t);
|
|
2893
2905
|
if (this.glbBuffer) return this.M(e, t);
|
|
2894
2906
|
}
|
|
2895
2907
|
return null;
|
|
2896
2908
|
}
|
|
2897
|
-
|
|
2909
|
+
v(t) {
|
|
2898
2910
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
2899
2911
|
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.S(t.id, e);
|
|
2900
2912
|
}
|
|
@@ -2910,7 +2922,7 @@
|
|
|
2910
2922
|
return this.S(e.id, r);
|
|
2911
2923
|
}
|
|
2912
2924
|
}
|
|
2913
|
-
|
|
2925
|
+
O(t, e, n) {
|
|
2914
2926
|
if (this.buffers[t.id]) {
|
|
2915
2927
|
const r = this.buffers[t.id], s = this.N(e, r);
|
|
2916
2928
|
return this.I(s, n);
|
|
@@ -3028,7 +3040,7 @@
|
|
|
3028
3040
|
for (let r = 0; r < e; ) {
|
|
3029
3041
|
let s = t[r++];
|
|
3030
3042
|
if (128 & s) {
|
|
3031
|
-
let n =
|
|
3043
|
+
let n = gt[s >> 3 & 7];
|
|
3032
3044
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
3033
3045
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
3034
3046
|
const e = t[r++];
|
|
@@ -3041,11 +3053,11 @@
|
|
|
3041
3053
|
return n;
|
|
3042
3054
|
}(new Uint8Array(t, e, n));
|
|
3043
3055
|
}
|
|
3044
|
-
const
|
|
3056
|
+
const gt = [ 1, 1, 1, 1, 2, 2, 3, 0 ], _t = [ 0, 0, 0 ], Tt = [ 0, 0, 0, 1 ], At = [ 1, 1, 1 ], vt = {
|
|
3045
3057
|
TRANSLATION: [ 0, 0, 0 ],
|
|
3046
3058
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
3047
3059
|
SCALE: [ 1, 1, 1 ]
|
|
3048
|
-
},
|
|
3060
|
+
}, Ot = {
|
|
3049
3061
|
PREVIOUS: null,
|
|
3050
3062
|
NEXT: null,
|
|
3051
3063
|
PREINDEX: null,
|
|
@@ -3060,7 +3072,7 @@
|
|
|
3060
3072
|
const f = u.channelsMap[n];
|
|
3061
3073
|
if (f) for (let t = 0; t < f.length; t++) {
|
|
3062
3074
|
const e = f[t];
|
|
3063
|
-
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation = U(
|
|
3075
|
+
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation = U(_t, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
|
|
3064
3076
|
h.rotation = K(Tt, i)) : "scale" === e.target.path ? (this.U(o, u.samplers[e.sampler], r, 1),
|
|
3065
3077
|
h.scale = U(At, o)) : "weights" === e.target.path && a && (this.U(a, u.samplers[e.sampler], r, a.length),
|
|
3066
3078
|
h.weights = a);
|
|
@@ -3072,7 +3084,7 @@
|
|
|
3072
3084
|
switch (e.interpolation) {
|
|
3073
3085
|
case "LINEAR":
|
|
3074
3086
|
{
|
|
3075
|
-
const s = this.L(
|
|
3087
|
+
const s = this.L(Ot, e, n, 1 * r);
|
|
3076
3088
|
s && (t = function(t, e, n, r) {
|
|
3077
3089
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
3078
3090
|
return t;
|
|
@@ -3082,7 +3094,7 @@
|
|
|
3082
3094
|
|
|
3083
3095
|
case "STEP":
|
|
3084
3096
|
{
|
|
3085
|
-
const s = this.L(
|
|
3097
|
+
const s = this.L(Ot, e, n, 1 * r);
|
|
3086
3098
|
s && (t = function(t, e) {
|
|
3087
3099
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
3088
3100
|
return t;
|
|
@@ -3092,7 +3104,7 @@
|
|
|
3092
3104
|
|
|
3093
3105
|
case "CUBICSPLINE":
|
|
3094
3106
|
{
|
|
3095
|
-
const s = this.L(
|
|
3107
|
+
const s = this.L(Ot, e, n, 3 * r);
|
|
3096
3108
|
s && (t = this.R(t, s, e.input.array, 3 * r));
|
|
3097
3109
|
break;
|
|
3098
3110
|
}
|
|
@@ -3103,21 +3115,21 @@
|
|
|
3103
3115
|
switch (e.interpolation) {
|
|
3104
3116
|
case "LINEAR":
|
|
3105
3117
|
{
|
|
3106
|
-
const r = this.L(
|
|
3107
|
-
r &&
|
|
3118
|
+
const r = this.L(Ot, e, n, 1);
|
|
3119
|
+
r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
3108
3120
|
break;
|
|
3109
3121
|
}
|
|
3110
3122
|
|
|
3111
3123
|
case "STEP":
|
|
3112
3124
|
{
|
|
3113
|
-
const r = this.L(
|
|
3125
|
+
const r = this.L(Ot, e, n, 1);
|
|
3114
3126
|
r && (t = H(t, ...r.PREVIOUS));
|
|
3115
3127
|
break;
|
|
3116
3128
|
}
|
|
3117
3129
|
|
|
3118
3130
|
case "CUBICSPLINE":
|
|
3119
3131
|
{
|
|
3120
|
-
const r = this.L(
|
|
3132
|
+
const r = this.L(Ot, e, n, 3);
|
|
3121
3133
|
if (r) {
|
|
3122
3134
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
3123
3135
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
@@ -3168,7 +3180,7 @@
|
|
|
3168
3180
|
},
|
|
3169
3181
|
getAnimationClip(t, e, n, r) {
|
|
3170
3182
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
3171
|
-
return B(
|
|
3183
|
+
return B(_t, ...vt.TRANSLATION), H(Tt, ...vt.ROTATION), B(At, ...vt.SCALE), this.C(r, t, e, n, _t, Tt, At, s);
|
|
3172
3184
|
},
|
|
3173
3185
|
getTimeSpan(t) {
|
|
3174
3186
|
if (!t.animations) return null;
|
|
@@ -3194,7 +3206,13 @@
|
|
|
3194
3206
|
}
|
|
3195
3207
|
};
|
|
3196
3208
|
let St = !1;
|
|
3197
|
-
"undefined" != typeof OffscreenCanvas
|
|
3209
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
3210
|
+
let t;
|
|
3211
|
+
try {
|
|
3212
|
+
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
3213
|
+
} catch (Dn) {}
|
|
3214
|
+
t && "undefined" != typeof createImageBitmap && (St = !0);
|
|
3215
|
+
}
|
|
3198
3216
|
const xt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3199
3217
|
class It {
|
|
3200
3218
|
constructor(t, e, n) {
|
|
@@ -3219,7 +3237,7 @@
|
|
|
3219
3237
|
}
|
|
3220
3238
|
load(t) {
|
|
3221
3239
|
t = t || {};
|
|
3222
|
-
const e = this.G(t), n = this.H(), r = this
|
|
3240
|
+
const e = this.G(t), n = this.H(), r = this.q(), s = this.V();
|
|
3223
3241
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
3224
3242
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
3225
3243
|
t[0]));
|
|
@@ -3264,7 +3282,7 @@
|
|
|
3264
3282
|
}
|
|
3265
3283
|
D(t, e, n) {
|
|
3266
3284
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
3267
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = this.options.requestImage ||
|
|
3285
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = St ? Ct : this.options.requestImage || Nt,
|
|
3268
3286
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new yt(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
3269
3287
|
this.adapter.iterate((t, e, n) => {
|
|
3270
3288
|
e.id = "buffer_" + n;
|
|
@@ -3276,14 +3294,14 @@
|
|
|
3276
3294
|
e.id = "accessor_" + n;
|
|
3277
3295
|
}, "accessors"));
|
|
3278
3296
|
}
|
|
3279
|
-
|
|
3297
|
+
$(t, e) {
|
|
3280
3298
|
if (t.children && t.children.length > 0) {
|
|
3281
3299
|
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
3282
3300
|
return !Z(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
3283
3301
|
}(t.children[0]))) return t;
|
|
3284
3302
|
const r = t.children.map(t => {
|
|
3285
3303
|
const n = e[t];
|
|
3286
|
-
return n.nodeIndex = t, this
|
|
3304
|
+
return n.nodeIndex = t, this.$(n, e);
|
|
3287
3305
|
});
|
|
3288
3306
|
t.children = r;
|
|
3289
3307
|
}
|
|
@@ -3294,7 +3312,7 @@
|
|
|
3294
3312
|
return this.J(t).then(t => {
|
|
3295
3313
|
const e = this.scenes = [];
|
|
3296
3314
|
let n;
|
|
3297
|
-
for (const e in t) t[e] = this
|
|
3315
|
+
for (const e in t) t[e] = this.$(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
3298
3316
|
this.adapter.iterate((r, s, i) => {
|
|
3299
3317
|
const o = {};
|
|
3300
3318
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -3310,7 +3328,7 @@
|
|
|
3310
3328
|
skins: this.skins
|
|
3311
3329
|
};
|
|
3312
3330
|
if (this.gltf.extensions && (r.extensions = this.gltf.extensions), 1 === this.version) {
|
|
3313
|
-
const t = this.adapter.
|
|
3331
|
+
const t = this.adapter.g(this.gltf.materials);
|
|
3314
3332
|
r.materials = t;
|
|
3315
3333
|
}
|
|
3316
3334
|
return r;
|
|
@@ -3360,7 +3378,7 @@
|
|
|
3360
3378
|
return Y(n, t), n.primitives = e, n;
|
|
3361
3379
|
});
|
|
3362
3380
|
}
|
|
3363
|
-
|
|
3381
|
+
q() {
|
|
3364
3382
|
const t = this.gltf.textures;
|
|
3365
3383
|
if (!t) return null;
|
|
3366
3384
|
const e = [];
|
|
@@ -3661,7 +3679,7 @@
|
|
|
3661
3679
|
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];
|
|
3662
3680
|
}
|
|
3663
3681
|
const Vt = new Array(3), Gt = new Array(3), Ht = [ 40680631590769, 40680631590769, 40408299984661.445 ];
|
|
3664
|
-
function
|
|
3682
|
+
function qt(t, e, n, r) {
|
|
3665
3683
|
const s = Ht, i = Math.cos(n);
|
|
3666
3684
|
Vt[0] = i * Math.cos(e), Vt[1] = i * Math.sin(e), Vt[2] = Math.sin(n), ee(Vt, Vt),
|
|
3667
3685
|
R(Gt, s, Vt);
|
|
@@ -3672,25 +3690,25 @@
|
|
|
3672
3690
|
return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
|
|
3673
3691
|
}(t, Gt, Vt);
|
|
3674
3692
|
}
|
|
3675
|
-
const
|
|
3693
|
+
const $t = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Jt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Kt = new Array(3), Xt = new Array(3), Zt = new Array(3);
|
|
3676
3694
|
function Wt(t, e) {
|
|
3677
3695
|
const n = Jt, r = function(t, e, n, r, s) {
|
|
3678
3696
|
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(Yt, e, y);
|
|
3679
3697
|
if (m < s) return isFinite(y) ? b : void 0;
|
|
3680
|
-
const p = r[0], w = r[1],
|
|
3681
|
-
|
|
3682
|
-
let T, A,
|
|
3698
|
+
const p = r[0], w = r[1], g = r[2], _ = Qt;
|
|
3699
|
+
_[0] = b[0] * p * 2, _[1] = b[1] * w * 2, _[2] = b[2] * g * 2;
|
|
3700
|
+
let T, A, v, O, M, S, x, I, N, P, E, C = (1 - y) * te(e) / (.5 * te(_)), U = 0;
|
|
3683
3701
|
do {
|
|
3684
|
-
C -= U,
|
|
3685
|
-
x =
|
|
3686
|
-
A = f * N * p + l * P * w + d * E *
|
|
3702
|
+
C -= U, v = 1 / (1 + C * p), O = 1 / (1 + C * w), M = 1 / (1 + C * g), S = v * v,
|
|
3703
|
+
x = O * O, I = M * M, N = S * v, P = x * O, E = I * M, T = f * S + l * x + d * I - 1,
|
|
3704
|
+
A = f * N * p + l * P * w + d * E * g;
|
|
3687
3705
|
U = T / (-2 * A);
|
|
3688
3706
|
} while (Math.abs(T) > 1e-12);
|
|
3689
|
-
return t[0] = i *
|
|
3690
|
-
}(Kt, e,
|
|
3707
|
+
return t[0] = i * v, t[1] = o * O, t[2] = a * M, t;
|
|
3708
|
+
}(Kt, e, $t, n, .1);
|
|
3691
3709
|
let s = V(Xt, r, n);
|
|
3692
3710
|
s = ee(s, s);
|
|
3693
|
-
const i = z(Zt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c =
|
|
3711
|
+
const i = z(Zt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = g(k(i, e)) * te(i);
|
|
3694
3712
|
return t[0] = p(o), t[1] = p(a), t[2] = c, t;
|
|
3695
3713
|
}
|
|
3696
3714
|
const Yt = new Array(3), Qt = new Array(3);
|
|
@@ -3708,7 +3726,7 @@
|
|
|
3708
3726
|
}
|
|
3709
3727
|
var re = Object.freeze({
|
|
3710
3728
|
__proto__: null,
|
|
3711
|
-
radianToCartesian3:
|
|
3729
|
+
radianToCartesian3: qt,
|
|
3712
3730
|
cartesian3ToDegree: Wt,
|
|
3713
3731
|
normalizeCartesian: ee,
|
|
3714
3732
|
geodeticSurfaceNormal: ne
|
|
@@ -3847,14 +3865,14 @@
|
|
|
3847
3865
|
west: [],
|
|
3848
3866
|
south: [],
|
|
3849
3867
|
down: []
|
|
3850
|
-
},
|
|
3868
|
+
}, ge = [], _e = [], Te = [];
|
|
3851
3869
|
const Ae = [ 0, 0, 0 ];
|
|
3852
|
-
function
|
|
3870
|
+
function ve(t, e, n, r) {
|
|
3853
3871
|
n = n || 0, r = r || n;
|
|
3854
3872
|
var s = Math.abs(t - e);
|
|
3855
3873
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
3856
3874
|
}
|
|
3857
|
-
function
|
|
3875
|
+
function Oe(t, e, n) {
|
|
3858
3876
|
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],
|
|
3859
3877
|
n[6] = t[6], n[7] = t[7], n[8] = t[8], n[9] = t[9], n[10] = t[10], n[11] = t[11],
|
|
3860
3878
|
n[12] = e[0], n[13] = e[1], n[14] = e[2], n[15] = t[15], n;
|
|
@@ -3900,18 +3918,18 @@
|
|
|
3900
3918
|
if (function(t, e) {
|
|
3901
3919
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
3902
3920
|
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));
|
|
3903
|
-
}(t, Ae)) U(
|
|
3904
|
-
var r =
|
|
3905
|
-
U(
|
|
3921
|
+
}(t, Ae)) U(ge, be[Se]), U(_e, be[xe]), U(Te, be[Ne]); else if (ve(t[0], 0, 1e-14) && ve(t[1], 0, 1e-14)) {
|
|
3922
|
+
var r = g(t[2]);
|
|
3923
|
+
U(ge, be[Se]), "east" !== Se && "west" !== Se && F(ge, ge, r), U(_e, be[xe]), "east" !== xe && "west" !== xe && F(_e, _e, r),
|
|
3906
3924
|
U(Te, be[Ne]), "east" !== Ne && "west" !== Ne && F(Te, Te, r);
|
|
3907
3925
|
} else {
|
|
3908
3926
|
ne(t, we.up);
|
|
3909
3927
|
var s = we.up, i = we.east;
|
|
3910
3928
|
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(we.east, i), j(we.north, s, i), F(we.down, we.up, -1),
|
|
3911
|
-
F(we.west, we.east, -1), F(we.south, we.north, -1),
|
|
3929
|
+
F(we.west, we.east, -1), F(we.south, we.north, -1), ge = we[Se], _e = we[xe], Te = we[Ne];
|
|
3912
3930
|
}
|
|
3913
|
-
return n[0] =
|
|
3914
|
-
n[6] =
|
|
3931
|
+
return n[0] = ge[0], n[1] = ge[1], n[2] = ge[2], n[3] = 0, n[4] = _e[0], n[5] = _e[1],
|
|
3932
|
+
n[6] = _e[2], n[7] = 0, n[8] = Te[0], n[9] = Te[1], n[10] = Te[2], n[11] = 0, n[12] = t[0],
|
|
3915
3933
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
3916
3934
|
}, pe[Pe] = Ie), Ie);
|
|
3917
3935
|
var Se, xe, Ie, Ne, Pe;
|
|
@@ -3922,7 +3940,7 @@
|
|
|
3922
3940
|
x: 0,
|
|
3923
3941
|
y: 0
|
|
3924
3942
|
}, je = Math.PI / 180;
|
|
3925
|
-
const {getTextureMagFilter: ze, getTextureMinFilter: Ve, getTextureWrap: Ge, getMaterialType: He, getMaterialFormat:
|
|
3943
|
+
const {getTextureMagFilter: ze, getTextureMinFilter: Ve, getTextureWrap: Ge, getMaterialType: He, getMaterialFormat: qe, getPrimitive: $e, getUniqueREGLBuffer: Je} = n.reshader.REGLHelper, Ke = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Xe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ze, logoutIBLResOnCanvas: We, getIBLResOnCanvas: Ye, getPBRUniforms: Qe} = n.reshader.pbr.PBRUtils, tn = {
|
|
3926
3944
|
factor: 0,
|
|
3927
3945
|
units: 0
|
|
3928
3946
|
}, en = [ 1, 1, 1 ], nn = n.mat4.identity([]), rn = t => t.material instanceof n.reshader.PhongMaterial, sn = t => t.material instanceof n.reshader.pbr.StandardMaterial, on = [ !1, !1, !1, !1 ], an = [ !0, !0, !0, !0 ], cn = [], hn = new s.Coordinate(0, 0), un = [], fn = [], ln = {
|
|
@@ -3939,10 +3957,10 @@
|
|
|
3939
3957
|
this.Ct = t, this.Ut = new n.reshader.Renderer(t), this.Bt = {}, this.Lt = {}, this.Rt = {},
|
|
3940
3958
|
this.Ft = {}, this.Dt = {}, this.kt = {}, this.jt = {}, this.zt = new n.reshader.Scene,
|
|
3941
3959
|
this.Vt = new n.reshader.Scene, this.Gt = new n.reshader.Scene, this.Ht = new n.reshader.Scene,
|
|
3942
|
-
this
|
|
3960
|
+
this.qt = new n.reshader.ResourceLoader(t.texture(2)), this.$t = this.Jt.bind(this),
|
|
3943
3961
|
this.Kt = new n.reshader.PhongMaterial({
|
|
3944
3962
|
"baseColorFactor": [ 1, 1, 1, 1 ]
|
|
3945
|
-
}), this.Xt(), this.Zt = new n.reshader.KHRTechniquesWebglManager(this.Ct, this.Wt(), this
|
|
3963
|
+
}), this.Xt(), this.Zt = new n.reshader.KHRTechniquesWebglManager(this.Ct, this.Wt(), this.qt);
|
|
3946
3964
|
}
|
|
3947
3965
|
getI3DMMeshes() {
|
|
3948
3966
|
return this.Dt;
|
|
@@ -3965,7 +3983,7 @@
|
|
|
3965
3983
|
let r = this.Qt(t[n].data.node);
|
|
3966
3984
|
if (!r) {
|
|
3967
3985
|
if (r = this.kt[t[n].data.node.id], !r) continue;
|
|
3968
|
-
r =
|
|
3986
|
+
r = v(r);
|
|
3969
3987
|
}
|
|
3970
3988
|
const s = t[n].node;
|
|
3971
3989
|
let f = a[s.te].polygonOffset || tn;
|
|
@@ -4030,7 +4048,7 @@
|
|
|
4030
4048
|
}
|
|
4031
4049
|
de(t) {
|
|
4032
4050
|
let e = this.kt[t];
|
|
4033
|
-
e =
|
|
4051
|
+
e = v(e);
|
|
4034
4052
|
for (let t = 0; t < e.length; t++) {
|
|
4035
4053
|
const {id: n} = e[t].properties;
|
|
4036
4054
|
this.le(n);
|
|
@@ -4108,7 +4126,7 @@
|
|
|
4108
4126
|
i.RGB ? u.HAS_RGB = 1 : i.RGBA ? u.HAS_RGBA = 1 : i.RGB565 && (u.HAS_RGB565 = 1),
|
|
4109
4127
|
(i.NORMAL || i.NORMAL_OCT16P) && (u.HAS_NORMAL = 1, i.NORMAL_OCT16P && (u.HAS_NORMAL_OCT16P = 1)),
|
|
4110
4128
|
t.featureTable.CONSTANT_RGBA && (t.featureTable.CONSTANT_RGBA = t.featureTable.CONSTANT_RGBA.map(t => t / 255));
|
|
4111
|
-
const {rtcCenter: f, rtcCoord: l} = t, d = this.we(l), m = this.
|
|
4129
|
+
const {rtcCenter: f, rtcCoord: l} = t, d = this.we(l), m = this.ge(r, f, l);
|
|
4112
4130
|
n.mat4.multiply(m, m, d);
|
|
4113
4131
|
const y = this.Nt.options.services[a], b = new n.reshader.Mesh(h);
|
|
4114
4132
|
return b.properties.magic = "pnts", b.properties.id = e, b.properties.count = c,
|
|
@@ -4141,7 +4159,7 @@
|
|
|
4141
4159
|
mesh: t
|
|
4142
4160
|
}), t;
|
|
4143
4161
|
}
|
|
4144
|
-
const i = this.
|
|
4162
|
+
const i = this._e(r.Te), {i3dm: o, featureTable: a, gltf: c, batchTable: h, batchTableBin: u, count: f} = t, l = a.INSTANCES_LENGTH, {rtcCenter: d, rtcCoord: m} = t, y = this.we(m), b = this.ge(r, d, m), {POSITION: p, NORMAL_UP: w, NORMAL_RIGHT: g, SCALE: _, SCALE_NON_UNIFORM: T, INSTANCE_ROTATION: v} = o, O = {
|
|
4145
4163
|
"instance_vectorA": new Float32Array(4 * l),
|
|
4146
4164
|
"instance_vectorB": new Float32Array(4 * l),
|
|
4147
4165
|
"instance_vectorC": new Float32Array(4 * l)
|
|
@@ -4165,17 +4183,17 @@
|
|
|
4165
4183
|
e(new c(h.buffer), t), n.set(h);
|
|
4166
4184
|
}
|
|
4167
4185
|
}(p, (t, e) => {
|
|
4168
|
-
w ? (jt(S,
|
|
4169
|
-
A(P, M, 1), A(P, x, 2), n.quat.fromMat3(E, P)) :
|
|
4170
|
-
|
|
4171
|
-
n.mat4.fromRotationTranslationScale(U, E, t, C), zt(
|
|
4172
|
-
zt(
|
|
4186
|
+
w ? (jt(S, g, e), jt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(P, S, 0),
|
|
4187
|
+
A(P, M, 1), A(P, x, 2), n.quat.fromMat3(E, P)) : v ? (jt(B, v, e), n.quat.fromMat3(E, B)) : n.quat.identity(E),
|
|
4188
|
+
_ ? (jt(I, _, e), n.vec3.set(C, I[0], I[0], I[0])) : T ? (jt(N, T, e), n.vec3.set(C, ...N)) : n.vec3.set(C, 1, 1, 1),
|
|
4189
|
+
n.mat4.fromRotationTranslationScale(U, E, t, C), zt(O.instance_vectorA, e, U, 0),
|
|
4190
|
+
zt(O.instance_vectorB, e, U, 1), zt(O.instance_vectorC, e, U, 2);
|
|
4173
4191
|
});
|
|
4174
4192
|
const L = {};
|
|
4175
|
-
for (const t in
|
|
4193
|
+
for (const t in O) L[t] = {
|
|
4176
4194
|
buffer: this.Ct.buffer({
|
|
4177
|
-
dimension:
|
|
4178
|
-
data:
|
|
4195
|
+
dimension: O[t].length / l,
|
|
4196
|
+
data: O[t]
|
|
4179
4197
|
}),
|
|
4180
4198
|
divisor: 1
|
|
4181
4199
|
};
|
|
@@ -4188,7 +4206,7 @@
|
|
|
4188
4206
|
const m = new n.reshader.InstancedMesh(L, l, c, d);
|
|
4189
4207
|
m.properties.magic = "i3dm", m.properties.id = e, m.properties.count = f, m.properties.batchTable = h,
|
|
4190
4208
|
m.properties.batchTableBin = u;
|
|
4191
|
-
const p = this.
|
|
4209
|
+
const p = this.ve(t, c, d, r.te), w = n.mat4.identity([]);
|
|
4192
4210
|
if (t.matrices && t.matrices.length) for (let e = 0; e < t.matrices.length; e++) n.mat4.multiply(w, w, t.matrices[e]);
|
|
4193
4211
|
n.mat4.multiply(w, i, w), m.setPositionMatrix(w), n.mat4.multiply(y, b, y), m.setLocalTransform(y),
|
|
4194
4212
|
m.setDefines(p), m.properties.polygonOffset = {
|
|
@@ -4201,7 +4219,7 @@
|
|
|
4201
4219
|
})) : (this.Bt[e] = {
|
|
4202
4220
|
meshes: k,
|
|
4203
4221
|
count: F
|
|
4204
|
-
}, k.
|
|
4222
|
+
}, k.Oe = s), k;
|
|
4205
4223
|
}
|
|
4206
4224
|
createB3DMMesh(t, e, r, i) {
|
|
4207
4225
|
if (this.Rt[e] || this.Bt[e]) {
|
|
@@ -4216,40 +4234,40 @@
|
|
|
4216
4234
|
const t = new s.Extent(r.maxExtent).convertTo(t => this._pointToPrj(t));
|
|
4217
4235
|
o = [ t.xmin, t.ymin, t.xmax, t.ymax ];
|
|
4218
4236
|
}
|
|
4219
|
-
const a = this.
|
|
4237
|
+
const a = this._e(r.Te), c = t.gltf, {center: h, coord: u} = c.extensions.CESIUM_RTC, f = this.Nt.options.services[r.te].heightOffset || 0;
|
|
4220
4238
|
f && (u[2] += f);
|
|
4221
4239
|
const l = this.we(u, r.te), d = this.Nt.options.services[r.te].shader || "phong", m = [];
|
|
4222
4240
|
let y = 0, b = !0;
|
|
4223
4241
|
return Dt(c, (s, i, c, f) => {
|
|
4224
4242
|
let {geometry: p, material: w} = this.Ae(s, i, c, f, r, !1, d);
|
|
4225
4243
|
w && !w.isReady() && (b = !1, y++);
|
|
4226
|
-
const
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
const
|
|
4230
|
-
|
|
4244
|
+
const g = new n.reshader.Mesh(p, w);
|
|
4245
|
+
g.properties.magic = "b3dm", g.properties.id = e, g.properties.batchTable = t.batchTable,
|
|
4246
|
+
g.properties.batchTableBin = t.batchTableBin, g.properties.count = t.featureTable.BATCH_LENGTH;
|
|
4247
|
+
const _ = this.ve(s, p, w, r.te);
|
|
4248
|
+
g.setDefines(_), o && (_.USE_MAX_EXTENT = 1, g.setUniform("maxPrjExtent", o));
|
|
4231
4249
|
let T = n.mat4.identity([]);
|
|
4232
4250
|
if (s.matrices && s.matrices.length) for (let t = 0; t < s.matrices.length; t++) n.mat4.multiply(T, T, s.matrices[t]);
|
|
4233
|
-
const A = this.
|
|
4234
|
-
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T),
|
|
4235
|
-
m.push(
|
|
4251
|
+
const A = this.ge(r, h, u);
|
|
4252
|
+
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T), g.setLocalTransform(T),
|
|
4253
|
+
m.push(g);
|
|
4236
4254
|
}), b ? (this.Rt[e] = m, i(null, {
|
|
4237
4255
|
id: e,
|
|
4238
4256
|
mesh: m
|
|
4239
4257
|
})) : (this.Bt[e] = {
|
|
4240
4258
|
meshes: m,
|
|
4241
4259
|
count: y
|
|
4242
|
-
}, m.
|
|
4260
|
+
}, m.Oe = i), m;
|
|
4243
4261
|
}
|
|
4244
|
-
|
|
4262
|
+
ge(t, e, r) {
|
|
4245
4263
|
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;
|
|
4246
4264
|
let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
|
|
4247
4265
|
if (e) {
|
|
4248
|
-
|
|
4266
|
+
Oe(h, n.vec3.transformMat4(cn, e, h), h);
|
|
4249
4267
|
}
|
|
4250
4268
|
const u = function(t, e, n, r, s, i, o) {
|
|
4251
4269
|
e = U(Ee, e);
|
|
4252
|
-
const a =
|
|
4270
|
+
const a = qt(Ee, e[0] * je, e[1] * je, e[2]), c = function(t, e) {
|
|
4253
4271
|
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
|
|
4254
4272
|
}(Ce, n), h = r.ellipsoid;
|
|
4255
4273
|
var u;
|
|
@@ -4257,23 +4275,23 @@
|
|
|
4257
4275
|
const f = r.project(De, ke);
|
|
4258
4276
|
Be[0] = f.x / s, Be[1] = f.y / s, Be[2] = (u[2] + o) * i;
|
|
4259
4277
|
const l = Me(a, h, Le), d = function(t, e, n) {
|
|
4260
|
-
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],
|
|
4261
|
-
return n[0] = T, n[1] = A, n[2] =
|
|
4278
|
+
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], g = e[7], _ = e[8], T = r * l + o * d + h * m, A = s * l + a * d + u * m, v = i * l + c * d + f * m, O = r * y + o * b + h * p, M = s * y + a * b + u * p, S = i * y + c * b + f * p, x = r * w + o * g + h * _, I = s * w + a * g + u * _, N = i * w + c * g + f * _;
|
|
4279
|
+
return n[0] = T, n[1] = A, n[2] = v, n[3] = 0, n[4] = O, n[5] = M, n[6] = S, n[7] = 0,
|
|
4262
4280
|
n[8] = x, n[9] = I, n[10] = N, n[11] = 0, n[12] = t[12], n[13] = t[13], n[14] = t[14],
|
|
4263
4281
|
n[15] = t[15], n;
|
|
4264
4282
|
}(function(t, e) {
|
|
4265
|
-
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o,
|
|
4283
|
+
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o, g = n * c - s * o, _ = n * h - i * o, T = r * c - s * a, A = r * h - i * a, v = s * h - i * c, O = u * y - f * m, M = u * b - l * m, S = u * p - d * m, x = f * b - l * y, I = f * p - d * y, N = l * p - d * b, P = w * N - g * I + _ * x + T * S - A * M + v * O;
|
|
4266
4284
|
return P ? (P = 1 / P, t[0] = (a * N - c * I + h * x) * P, t[1] = (s * I - r * N - i * x) * P,
|
|
4267
|
-
t[2] = (y *
|
|
4268
|
-
t[5] = (n * N - s * S + i * M) * P, t[6] = (b *
|
|
4269
|
-
t[8] = (o * I - a * S + h *
|
|
4270
|
-
t[11] = (f *
|
|
4271
|
-
t[14] = (y *
|
|
4285
|
+
t[2] = (y * v - b * A + p * T) * P, t[3] = (l * A - f * v - d * T) * P, t[4] = (c * S - o * N - h * M) * P,
|
|
4286
|
+
t[5] = (n * N - s * S + i * M) * P, t[6] = (b * _ - m * v - p * g) * P, t[7] = (u * v - l * _ + d * g) * P,
|
|
4287
|
+
t[8] = (o * I - a * S + h * O) * P, t[9] = (r * S - n * I - i * O) * P, t[10] = (m * A - y * _ + p * w) * P,
|
|
4288
|
+
t[11] = (f * _ - u * A - d * w) * P, t[12] = (a * M - o * x - c * O) * P, t[13] = (n * x - r * M + s * O) * P,
|
|
4289
|
+
t[14] = (y * g - m * T - b * w) * P, t[15] = (u * T - f * g + l * w) * P, t) : null;
|
|
4272
4290
|
}(Re, l), function(t, e) {
|
|
4273
4291
|
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],
|
|
4274
4292
|
t[6] = e[8], t[7] = e[9], t[8] = e[10], t;
|
|
4275
4293
|
}(Fe, n), t);
|
|
4276
|
-
return
|
|
4294
|
+
return Oe(t, Be, d), t;
|
|
4277
4295
|
}(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
|
|
4278
4296
|
return B(t, e[12], e[13], e[14]), t;
|
|
4279
4297
|
}(fn, u);
|
|
@@ -4281,7 +4299,7 @@
|
|
|
4281
4299
|
if (y(l)) {
|
|
4282
4300
|
l = l(this.Nt.Me(t.id).center);
|
|
4283
4301
|
}
|
|
4284
|
-
return n.vec3.set(un, l[0], l[1], 0), n.vec3.sub(f, f, un),
|
|
4302
|
+
return n.vec3.set(un, l[0], l[1], 0), n.vec3.sub(f, f, un), Oe(u, f, u), u;
|
|
4285
4303
|
}
|
|
4286
4304
|
createCMPTMesh(t, e, r, s) {
|
|
4287
4305
|
if (this.kt[e]) {
|
|
@@ -4314,7 +4332,7 @@
|
|
|
4314
4332
|
if (!t) return null;
|
|
4315
4333
|
if (e.boundingBox) t.combine(e.boundingBox); else for (let n = 0; n < e.length; n++) e[n] && t.combine(e[n].getBoundingBox());
|
|
4316
4334
|
}
|
|
4317
|
-
|
|
4335
|
+
ve(t, e, n, r) {
|
|
4318
4336
|
return ("phong" === (this.Nt.options.services[r].shader || "phong") ? this.re : this.se).getGeometryDefines(e);
|
|
4319
4337
|
}
|
|
4320
4338
|
Ae(t, e, n, r, s, i, o) {
|
|
@@ -4365,7 +4383,7 @@
|
|
|
4365
4383
|
uv1Attribute: r.TEXCOORD_1,
|
|
4366
4384
|
color0Attribute: r.COLOR_0,
|
|
4367
4385
|
tangentAttribute: r.TANGENT,
|
|
4368
|
-
primitive: void 0 === t.mode ? "triangles" :
|
|
4386
|
+
primitive: void 0 === t.mode ? "triangles" : $e(t.mode)
|
|
4369
4387
|
});
|
|
4370
4388
|
return a.generateBuffers(this.Ct, {
|
|
4371
4389
|
excludeElementsInVAO: e
|
|
@@ -4544,13 +4562,13 @@
|
|
|
4544
4562
|
}
|
|
4545
4563
|
}
|
|
4546
4564
|
let o = new n.reshader.pbr.StandardMaterial(i);
|
|
4547
|
-
return "phong" === r && (o = n.reshader.PhongMaterial.convertFrom(o)), o.once("complete", this
|
|
4565
|
+
return "phong" === r && (o = n.reshader.PhongMaterial.convertFrom(o)), o.once("complete", this.$t),
|
|
4548
4566
|
o;
|
|
4549
4567
|
}
|
|
4550
4568
|
T(t, e) {
|
|
4551
4569
|
const r = {
|
|
4552
4570
|
type: t.type ? He(t.type) : "uint8",
|
|
4553
|
-
format: t.format ?
|
|
4571
|
+
format: t.format ? qe(t.format) : "rgba",
|
|
4554
4572
|
flipY: !1
|
|
4555
4573
|
};
|
|
4556
4574
|
if (e && e.baseColorTexture) r.url = this.Ce(t); else {
|
|
@@ -4559,7 +4577,7 @@
|
|
|
4559
4577
|
}
|
|
4560
4578
|
const s = t.sampler || t.texture.sampler;
|
|
4561
4579
|
return s && (s.magFilter && (r.mag = ze(s.magFilter)), s.minFilter && (r.min = Ve(s.minFilter)),
|
|
4562
|
-
s.wrapS && (r.wrapS = Ge(s.wrapS)), s.wrapT && (r.wrapT = Ge(s.wrapT))), new n.reshader.Texture2D(r, this
|
|
4580
|
+
s.wrapS && (r.wrapS = Ge(s.wrapS)), s.wrapT && (r.wrapT = Ge(s.wrapT))), new n.reshader.Texture2D(r, this.qt);
|
|
4563
4581
|
}
|
|
4564
4582
|
Ce(t) {
|
|
4565
4583
|
const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
|
|
@@ -4572,8 +4590,8 @@
|
|
|
4572
4590
|
if (n.count--, !n.count) {
|
|
4573
4591
|
const t = n.meshes;
|
|
4574
4592
|
this.Rt[e] = t, delete this.Bt[e];
|
|
4575
|
-
const r = t.
|
|
4576
|
-
delete t.
|
|
4593
|
+
const r = t.Oe;
|
|
4594
|
+
delete t.Oe, r(null, {
|
|
4577
4595
|
mesh: n.meshes,
|
|
4578
4596
|
id: e
|
|
4579
4597
|
});
|
|
@@ -4597,14 +4615,14 @@
|
|
|
4597
4615
|
const e = this.getMap();
|
|
4598
4616
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4599
4617
|
}
|
|
4600
|
-
|
|
4618
|
+
_e(t) {
|
|
4601
4619
|
return "Y" === t ? Ke : "X" === t ? Xe : nn;
|
|
4602
4620
|
}
|
|
4603
4621
|
}
|
|
4604
4622
|
class mn extends s.renderer.CanvasRenderer {
|
|
4605
4623
|
constructor(t) {
|
|
4606
4624
|
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new Ft(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
|
|
4607
|
-
this.
|
|
4625
|
+
this._t = {};
|
|
4608
4626
|
}
|
|
4609
4627
|
needToRedraw() {
|
|
4610
4628
|
return !!this.getMap().isInteracting() || super.needToRedraw();
|
|
@@ -4699,13 +4717,13 @@
|
|
|
4699
4717
|
for (;r.length > 0; ) {
|
|
4700
4718
|
const s = r.pop().children;
|
|
4701
4719
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
4702
|
-
if (!this.layer
|
|
4720
|
+
if (!this.layer.qe(s[i]) && s[i].children && s[i].children.length) {
|
|
4703
4721
|
r.push(s[i]);
|
|
4704
4722
|
continue;
|
|
4705
4723
|
}
|
|
4706
4724
|
const o = s[i].id;
|
|
4707
4725
|
if (this.tileCache.has(o)) {
|
|
4708
|
-
const n = this.layer
|
|
4726
|
+
const n = this.layer.$e(s[i], t);
|
|
4709
4727
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4710
4728
|
} else s[i].He <= n && r.push(s[i]);
|
|
4711
4729
|
}
|
|
@@ -4756,10 +4774,10 @@
|
|
|
4756
4774
|
let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
|
|
4757
4775
|
const i = s.xhr;
|
|
4758
4776
|
s = s.then(n => {
|
|
4759
|
-
delete this.
|
|
4777
|
+
delete this._t[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
|
|
4760
4778
|
}).catch(n => {
|
|
4761
|
-
delete this.
|
|
4762
|
-
}), this.
|
|
4779
|
+
delete this._t[e], this.onTileError(n, t);
|
|
4780
|
+
}), this._t[e] = i;
|
|
4763
4781
|
} else this.Je(e, null, t);
|
|
4764
4782
|
}
|
|
4765
4783
|
Je(t, e, n) {
|
|
@@ -4833,10 +4851,10 @@
|
|
|
4833
4851
|
if (!t || !this.workerConn) return;
|
|
4834
4852
|
const e = t.node.content.url;
|
|
4835
4853
|
if (this.layer.options.services[t.node.te].ajaxInMainThread) {
|
|
4836
|
-
const t = this.
|
|
4854
|
+
const t = this._t[e];
|
|
4837
4855
|
t && t.abort();
|
|
4838
4856
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4839
|
-
delete this.
|
|
4857
|
+
delete this._t[e];
|
|
4840
4858
|
}
|
|
4841
4859
|
Re() {
|
|
4842
4860
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
@@ -4948,9 +4966,9 @@
|
|
|
4948
4966
|
}
|
|
4949
4967
|
function wn(t, e, n) {
|
|
4950
4968
|
return Math.sqrt(function(t, e, n) {
|
|
4951
|
-
var r = L(
|
|
4969
|
+
var r = L(gn, n, t), s = pn(_n, e, 0), i = pn(Tn, e, 1), o = pn(An, e, 2), a = G(s), c = G(i), h = G(o);
|
|
4952
4970
|
D(s, s), D(i, i), D(o, o);
|
|
4953
|
-
var u =
|
|
4971
|
+
var u = vn;
|
|
4954
4972
|
u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
|
|
4955
4973
|
var f, l = 0;
|
|
4956
4974
|
u.x < -a ? (f = u.x + a, l += f * f) : u.x > a && (f = u.x - a, l += f * f);
|
|
@@ -4959,11 +4977,11 @@
|
|
|
4959
4977
|
return l;
|
|
4960
4978
|
}(t, e, n));
|
|
4961
4979
|
}
|
|
4962
|
-
const
|
|
4963
|
-
const
|
|
4980
|
+
const gn = [], _n = [], Tn = [], An = [], vn = [];
|
|
4981
|
+
const On = s.projection.EPSG3857, Mn = new s.Extent(0, 0, 0, 0), Sn = [], xn = [], In = new s.Coordinate(0, 0), Nn = n.mat4.identity([]);
|
|
4964
4982
|
class Pn extends s.Layer {
|
|
4965
4983
|
constructor(t, e) {
|
|
4966
|
-
super(t, e), this.nn(), this.
|
|
4984
|
+
super(t, e), this.nn(), this._t = {}, this.rn = {};
|
|
4967
4985
|
}
|
|
4968
4986
|
nn() {
|
|
4969
4987
|
let t = this.options.services.map(t => t.url);
|
|
@@ -5028,8 +5046,8 @@
|
|
|
5028
5046
|
const n = t.getGLRes();
|
|
5029
5047
|
s = t.pointAtResToDistance(e[2], 0, n), In.set(e[0], e[1]), r = t.pointAtResToCoord(In, n);
|
|
5030
5048
|
}
|
|
5031
|
-
this.hn = this.hn || [], n.vec3.set(this.hn, b(r.x), b(r.y), s), this.un =
|
|
5032
|
-
this.ln = 2 * Math.tan(.5 * b(t.getFov())), this.dn =
|
|
5049
|
+
this.hn = this.hn || [], n.vec3.set(this.hn, b(r.x), b(r.y), s), this.un = qt(this.un || [], this.hn[0], this.hn[1], this.hn[2]),
|
|
5050
|
+
this.ln = 2 * Math.tan(.5 * b(t.getFov())), this.dn = On.project(r).toArray();
|
|
5033
5051
|
const i = t.projViewMatrix, o = {
|
|
5034
5052
|
children: [],
|
|
5035
5053
|
level: -1
|
|
@@ -5051,8 +5069,8 @@
|
|
|
5051
5069
|
if (!(0 === s && t.He <= e)) continue;
|
|
5052
5070
|
t.content && (e = t.He);
|
|
5053
5071
|
}
|
|
5054
|
-
t.ce < 1 / 0 && this.
|
|
5055
|
-
const o = this
|
|
5072
|
+
t.ce < 1 / 0 && this.gn(t);
|
|
5073
|
+
const o = this.$e(t, a);
|
|
5056
5074
|
a.children.push(o);
|
|
5057
5075
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5058
5076
|
if (!u && f && this.wn(c, o), u) {
|
|
@@ -5090,19 +5108,19 @@
|
|
|
5090
5108
|
* (c) 2016-2022 maptalks.com
|
|
5091
5109
|
*/ (this.hn, this.un, e.node.viewerRequestVolume) || (t[e.node.id] = e);
|
|
5092
5110
|
}
|
|
5093
|
-
|
|
5111
|
+
$e(t, e) {
|
|
5094
5112
|
return {
|
|
5095
5113
|
id: t.id,
|
|
5096
5114
|
node: t,
|
|
5097
5115
|
children: [],
|
|
5098
5116
|
level: t.He,
|
|
5099
5117
|
parent: e,
|
|
5100
|
-
content: this
|
|
5118
|
+
content: this.qe(t)
|
|
5101
5119
|
};
|
|
5102
5120
|
}
|
|
5103
5121
|
yn(t) {
|
|
5104
5122
|
void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
|
|
5105
|
-
t.
|
|
5123
|
+
t._n = this.Tn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
|
|
5106
5124
|
t.te = t.parent.te, void 0 === t.He && (t.He = t.parent.He + 1), t.maxExtent = t.parent.maxExtent),
|
|
5107
5125
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5108
5126
|
this.An(t));
|
|
@@ -5114,25 +5132,25 @@
|
|
|
5114
5132
|
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Nn) && !i) return;
|
|
5115
5133
|
const {region: o, box: a, sphere: c} = e;
|
|
5116
5134
|
if (o) {
|
|
5117
|
-
const t = this.
|
|
5135
|
+
const t = this.vn([ p(o[0]), p(o[1]) ]);
|
|
5118
5136
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5119
|
-
const e = this.
|
|
5137
|
+
const e = this.vn([ p(o[2]), p(o[3]) ]);
|
|
5120
5138
|
o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
|
|
5121
5139
|
} else if (a || c) {
|
|
5122
|
-
const e = a || c, s = n.vec3.transformMat4(Sn, e, t.matrix), i = Wt(xn, s), o = this.
|
|
5123
|
-
i[0] = o.x, i[1] = o.y, i[2] += r,
|
|
5140
|
+
const e = a || c, s = n.vec3.transformMat4(Sn, e, t.matrix), i = Wt(xn, s), o = this.vn([ i[0], i[1] ]);
|
|
5141
|
+
i[0] = o.x, i[1] = o.y, i[2] += r, qt(e, b(i[0]), b(i[1]), i[2]);
|
|
5124
5142
|
}
|
|
5125
5143
|
e.in = !0;
|
|
5126
5144
|
}
|
|
5127
5145
|
Tn(t) {
|
|
5128
5146
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5129
5147
|
}
|
|
5130
|
-
|
|
5148
|
+
qe(t) {
|
|
5131
5149
|
return t.content && t.content.url;
|
|
5132
5150
|
}
|
|
5133
|
-
|
|
5151
|
+
gn(t) {
|
|
5134
5152
|
let e = t.parent;
|
|
5135
|
-
for (;e && e.
|
|
5153
|
+
for (;e && e._n && !(e.ce <= t.ce && e.en <= t.en); ) e.ce = t.ce, e.en = t.en,
|
|
5136
5154
|
e = t.parent;
|
|
5137
5155
|
}
|
|
5138
5156
|
onTilesetLoad(t, e, r) {
|
|
@@ -5143,8 +5161,8 @@
|
|
|
5143
5161
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5144
5162
|
const s = t.root.transform;
|
|
5145
5163
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5146
|
-
this.An(e), e.children && e.children.length && (e.
|
|
5147
|
-
t.root.content && (e.content = t.root.content)), e.
|
|
5164
|
+
this.An(e), e.children && e.children.length && (e.On = e.content, delete e.content,
|
|
5165
|
+
t.root.content && (e.content = t.root.content)), e._n = this.Tn(e);
|
|
5148
5166
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5149
5167
|
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);
|
|
5150
5168
|
}
|
|
@@ -5155,7 +5173,7 @@
|
|
|
5155
5173
|
});
|
|
5156
5174
|
}
|
|
5157
5175
|
bn(t, e, n) {
|
|
5158
|
-
if (t.ce = 1 / 0, 0 === t.He || t.
|
|
5176
|
+
if (t.ce = 1 / 0, 0 === t.He || t._n) return 1;
|
|
5159
5177
|
if (t.Mn = 1 / 0, !this.Sn(t, e, n)) return -1;
|
|
5160
5178
|
if (0 === t.geometricError) return 1;
|
|
5161
5179
|
let r = this.options.services[t.te].maximumScreenSpaceError;
|
|
@@ -5220,7 +5238,7 @@
|
|
|
5220
5238
|
return !0;
|
|
5221
5239
|
}(r, f);
|
|
5222
5240
|
}
|
|
5223
|
-
|
|
5241
|
+
vn(t) {
|
|
5224
5242
|
Array.isArray(t) && (t = new s.Coordinate(t));
|
|
5225
5243
|
let e = this.options.offset;
|
|
5226
5244
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
@@ -5257,7 +5275,7 @@
|
|
|
5257
5275
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5258
5276
|
return Math.sqrt(o * o + l * l);
|
|
5259
5277
|
}(t, this.dn, this.hn, r), o = function(t, e) {
|
|
5260
|
-
const r = t.boundingVolume.region, s =
|
|
5278
|
+
const r = t.boundingVolume.region, s = qt(Un, r[0], r[1], r[4]), i = qt(Bn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
|
|
5261
5279
|
return n.vec3.dist(o, e);
|
|
5262
5280
|
}(t, this.un);
|
|
5263
5281
|
} else t.boundingVolume.sphere ? (i = En(t.boundingVolume, this.un), o = function(t, e) {
|
|
@@ -5305,7 +5323,7 @@
|
|
|
5305
5323
|
const Un = [], Bn = [];
|
|
5306
5324
|
function Ln(t, e) {
|
|
5307
5325
|
const n = new s.Coordinate(p(t), p(e));
|
|
5308
|
-
return
|
|
5326
|
+
return On.project(n).toArray();
|
|
5309
5327
|
}
|
|
5310
5328
|
const Rn = function() {
|
|
5311
5329
|
if ("undefined" != typeof self) return self;
|
|
@@ -5350,6 +5368,7 @@
|
|
|
5350
5368
|
if (s.error) return Promise.resolve(s);
|
|
5351
5369
|
const i = t.substring(0, t.lastIndexOf("/")), o = new this.tt(i, s.glb, {
|
|
5352
5370
|
transferable: !0,
|
|
5371
|
+
requestImage: this.A,
|
|
5353
5372
|
decoders: this.et
|
|
5354
5373
|
});
|
|
5355
5374
|
return o.load().then(e => {
|
|
@@ -5451,6 +5470,7 @@
|
|
|
5451
5470
|
it(t, e, n, r) {
|
|
5452
5471
|
const s = {
|
|
5453
5472
|
transferable: !0,
|
|
5473
|
+
requestImage: this.A,
|
|
5454
5474
|
decoders: this.et
|
|
5455
5475
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
5456
5476
|
if (0 === i.getUint32(28, !0)) {
|
|
@@ -5680,7 +5700,7 @@
|
|
|
5680
5700
|
array: t
|
|
5681
5701
|
}, o.push(t.buffer);
|
|
5682
5702
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
5683
|
-
a.BATCH_ID ? r.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID =
|
|
5703
|
+
a.BATCH_ID ? r.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = qn(d);
|
|
5684
5704
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
5685
5705
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5686
5706
|
}
|
|
@@ -5696,7 +5716,7 @@
|
|
|
5696
5716
|
}
|
|
5697
5717
|
const b = this.lt(t, a, c.offset, d, o, f, l);
|
|
5698
5718
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
5699
|
-
a.BATCH_ID ? b.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID =
|
|
5719
|
+
a.BATCH_ID ? b.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = qn(d);
|
|
5700
5720
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
5701
5721
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5702
5722
|
}
|
|
@@ -5831,8 +5851,8 @@
|
|
|
5831
5851
|
return null;
|
|
5832
5852
|
}
|
|
5833
5853
|
}
|
|
5834
|
-
function
|
|
5835
|
-
const e =
|
|
5854
|
+
function qn(t) {
|
|
5855
|
+
const e = O(t), n = new e(t);
|
|
5836
5856
|
for (let e = 0; e < t; e++) n[e] = e;
|
|
5837
5857
|
return {
|
|
5838
5858
|
byteStride: 0,
|
|
@@ -5843,7 +5863,7 @@
|
|
|
5843
5863
|
array: n
|
|
5844
5864
|
};
|
|
5845
5865
|
}
|
|
5846
|
-
class
|
|
5866
|
+
class $n {
|
|
5847
5867
|
constructor(t, e) {
|
|
5848
5868
|
this.A = t, this.tt = e || It;
|
|
5849
5869
|
}
|
|
@@ -5863,7 +5883,7 @@
|
|
|
5863
5883
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
5864
5884
|
continue;
|
|
5865
5885
|
}
|
|
5866
|
-
r = new
|
|
5886
|
+
r = new $n(this.A, this.tt);
|
|
5867
5887
|
}
|
|
5868
5888
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
5869
5889
|
}
|
|
@@ -5901,9 +5921,9 @@
|
|
|
5901
5921
|
return o;
|
|
5902
5922
|
}
|
|
5903
5923
|
}
|
|
5904
|
-
t.B3DMLoader = kn, t.CMPTLoader =
|
|
5924
|
+
t.B3DMLoader = kn, t.CMPTLoader = $n, t.Geo3DTilesLayer = Pn, t.Geo3DTilesUtil = x,
|
|
5905
5925
|
t.Geo3DTransform = re, Object.defineProperty(t, "t", {
|
|
5906
5926
|
value: !0
|
|
5907
5927
|
});
|
|
5908
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.
|
|
5928
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.3");
|
|
5909
5929
|
}));
|