@navaramap/font 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -5
- package/dist/index.js +229 -186
- package/dist/index.umd.cjs +1 -1
- package/package.json +6 -6
- package/src/FontManager.test.ts +5 -15
- package/src/FontManager.ts +20 -13
- package/src/FontWorkerClient.test.ts +114 -0
- package/src/FontWorkerClient.ts +62 -23
- package/src/cssFontFamily.ts +12 -6
- package/src/fontWorker.ts +3 -0
- package/src/index.ts +2 -0
- package/src/types.ts +34 -0
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import e, { parseCssUnicodeRange as t, parseFontFamilyFromCss as n } from "@navaramap/engine-api";
|
|
2
|
-
|
|
3
|
-
var r;
|
|
2
|
+
// src/cssFontFamily.ts
|
|
3
|
+
var r = Symbol.for("@navaramap/engine-api/init");
|
|
4
4
|
function i() {
|
|
5
|
-
|
|
5
|
+
let t = globalThis;
|
|
6
|
+
return t[r] ??= e().catch((e) => {
|
|
7
|
+
throw t[r] = void 0, e;
|
|
8
|
+
});
|
|
6
9
|
}
|
|
7
10
|
async function a(e) {
|
|
8
11
|
return await i(), t(e);
|
|
@@ -98,7 +101,6 @@ var P = class {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}, F = /* @__PURE__ */ "00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff".split(".");
|
|
101
|
-
Math.PI / 180, 180 / Math.PI;
|
|
102
104
|
function ne() {
|
|
103
105
|
let e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, r = Math.random() * 4294967295 | 0;
|
|
104
106
|
return (F[e & 255] + F[e >> 8 & 255] + F[e >> 16 & 255] + F[e >> 24 & 255] + "-" + F[t & 255] + F[t >> 8 & 255] + "-" + F[t >> 16 & 15 | 64] + F[t >> 24 & 255] + "-" + F[n & 63 | 128] + F[n >> 8 & 255] + "-" + F[n >> 16 & 255] + F[n >> 24 & 255] + F[r & 255] + F[r >> 8 & 255] + F[r >> 16 & 255] + F[r >> 24 & 255]).toLowerCase();
|
|
@@ -304,7 +306,7 @@ var ae = class e {
|
|
|
304
306
|
*[Symbol.iterator]() {
|
|
305
307
|
yield this.x, yield this.y;
|
|
306
308
|
}
|
|
307
|
-
},
|
|
309
|
+
}, oe = class {
|
|
308
310
|
constructor(e = 0, t = 0, n = 0, r = 1) {
|
|
309
311
|
this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = r;
|
|
310
312
|
}
|
|
@@ -492,7 +494,7 @@ var ae = class e {
|
|
|
492
494
|
*[Symbol.iterator]() {
|
|
493
495
|
yield this._x, yield this._y, yield this._z, yield this._w;
|
|
494
496
|
}
|
|
495
|
-
},
|
|
497
|
+
}, L = class e {
|
|
496
498
|
static {
|
|
497
499
|
e.prototype.isVector3 = !0;
|
|
498
500
|
}
|
|
@@ -574,10 +576,10 @@ var ae = class e {
|
|
|
574
576
|
return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this;
|
|
575
577
|
}
|
|
576
578
|
applyEuler(e) {
|
|
577
|
-
return this.applyQuaternion(
|
|
579
|
+
return this.applyQuaternion(ce.setFromEuler(e));
|
|
578
580
|
}
|
|
579
581
|
applyAxisAngle(e, t) {
|
|
580
|
-
return this.applyQuaternion(
|
|
582
|
+
return this.applyQuaternion(ce.setFromAxisAngle(e, t));
|
|
581
583
|
}
|
|
582
584
|
applyMatrix3(e) {
|
|
583
585
|
let t = this.x, n = this.y, r = this.z, i = e.elements;
|
|
@@ -679,10 +681,10 @@ var ae = class e {
|
|
|
679
681
|
return this.copy(e).multiplyScalar(n);
|
|
680
682
|
}
|
|
681
683
|
projectOnPlane(e) {
|
|
682
|
-
return
|
|
684
|
+
return se.copy(this).projectOnVector(e), this.sub(se);
|
|
683
685
|
}
|
|
684
686
|
reflect(e) {
|
|
685
|
-
return this.sub(
|
|
687
|
+
return this.sub(se.copy(e).multiplyScalar(2 * this.dot(e)));
|
|
686
688
|
}
|
|
687
689
|
angleTo(e) {
|
|
688
690
|
let t = Math.sqrt(this.lengthSq() * e.lengthSq());
|
|
@@ -755,7 +757,7 @@ var ae = class e {
|
|
|
755
757
|
*[Symbol.iterator]() {
|
|
756
758
|
yield this.x, yield this.y, yield this.z;
|
|
757
759
|
}
|
|
758
|
-
},
|
|
760
|
+
}, se = /*@__PURE__*/ new L(), ce = /*@__PURE__*/ new oe(), le = class e {
|
|
759
761
|
static {
|
|
760
762
|
e.prototype.isMatrix3 = !0;
|
|
761
763
|
}
|
|
@@ -830,13 +832,13 @@ var ae = class e {
|
|
|
830
832
|
return this.set(n * s, n * c, -n * (s * a + c * o) + a + e, -r * c, r * s, -r * (-c * a + s * o) + o + t, 0, 0, 1), this;
|
|
831
833
|
}
|
|
832
834
|
scale(e, t) {
|
|
833
|
-
return N("Matrix3: .scale() is deprecated. Use .makeScale() instead."), this.premultiply(
|
|
835
|
+
return N("Matrix3: .scale() is deprecated. Use .makeScale() instead."), this.premultiply(ue.makeScale(e, t)), this;
|
|
834
836
|
}
|
|
835
837
|
rotate(e) {
|
|
836
|
-
return N("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."), this.premultiply(
|
|
838
|
+
return N("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."), this.premultiply(ue.makeRotation(-e)), this;
|
|
837
839
|
}
|
|
838
840
|
translate(e, t) {
|
|
839
|
-
return N("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."), this.premultiply(
|
|
841
|
+
return N("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."), this.premultiply(ue.makeTranslation(e, t)), this;
|
|
840
842
|
}
|
|
841
843
|
makeTranslation(e, t) {
|
|
842
844
|
return e.isVector2 ? this.set(1, 0, e.x, 0, 1, e.y, 0, 0, 1) : this.set(1, 0, e, 0, 1, t, 0, 0, 1), this;
|
|
@@ -864,14 +866,14 @@ var ae = class e {
|
|
|
864
866
|
clone() {
|
|
865
867
|
return new this.constructor().fromArray(this.elements);
|
|
866
868
|
}
|
|
867
|
-
},
|
|
868
|
-
function
|
|
869
|
+
}, ue = /*@__PURE__*/ new le(), de = /*@__PURE__*/ new le().set(.4123908, .3575843, .1804808, .212639, .7151687, .0721923, .0193308, .1191948, .9505322), fe = /*@__PURE__*/ new le().set(3.2409699, -1.5373832, -.4986108, -.9692436, 1.8759675, .0415551, .0556301, -.203977, 1.0569715);
|
|
870
|
+
function pe() {
|
|
869
871
|
let e = {
|
|
870
872
|
enabled: !0,
|
|
871
873
|
workingColorSpace: T,
|
|
872
874
|
spaces: {},
|
|
873
875
|
convert: function(e, t, n) {
|
|
874
|
-
return this.enabled === !1 || t === n || !t || !n
|
|
876
|
+
return this.enabled === !1 || t === n || !t || !n || (this.spaces[t].transfer === "srgb" && (e.r = z(e.r), e.g = z(e.g), e.b = z(e.b)), this.spaces[t].primaries !== this.spaces[n].primaries && (e.applyMatrix3(this.spaces[t].toXYZ), e.applyMatrix3(this.spaces[n].fromXYZ)), this.spaces[n].transfer === "srgb" && (e.r = B(e.r), e.g = B(e.g), e.b = B(e.b))), e;
|
|
875
877
|
},
|
|
876
878
|
workingToColorSpace: function(e, t) {
|
|
877
879
|
return this.convert(e, this.workingColorSpace, t);
|
|
@@ -926,8 +928,8 @@ function fe() {
|
|
|
926
928
|
primaries: t,
|
|
927
929
|
whitePoint: r,
|
|
928
930
|
transfer: E,
|
|
929
|
-
toXYZ:
|
|
930
|
-
fromXYZ:
|
|
931
|
+
toXYZ: de,
|
|
932
|
+
fromXYZ: fe,
|
|
931
933
|
luminanceCoefficients: n,
|
|
932
934
|
workingColorSpaceConfig: { unpackColorSpace: w },
|
|
933
935
|
outputColorSpaceConfig: { drawingBufferColorSpace: w }
|
|
@@ -936,29 +938,29 @@ function fe() {
|
|
|
936
938
|
primaries: t,
|
|
937
939
|
whitePoint: r,
|
|
938
940
|
transfer: D,
|
|
939
|
-
toXYZ:
|
|
940
|
-
fromXYZ:
|
|
941
|
+
toXYZ: de,
|
|
942
|
+
fromXYZ: fe,
|
|
941
943
|
luminanceCoefficients: n,
|
|
942
944
|
outputColorSpaceConfig: { drawingBufferColorSpace: w }
|
|
943
945
|
}
|
|
944
946
|
}), e;
|
|
945
947
|
}
|
|
946
|
-
var
|
|
947
|
-
function
|
|
948
|
+
var R = /*@__PURE__*/ pe();
|
|
949
|
+
function z(e) {
|
|
948
950
|
return e < .04045 ? e * .0773993808 : (e * .9478672986 + .0521327014) ** 2.4;
|
|
949
951
|
}
|
|
950
|
-
function
|
|
952
|
+
function B(e) {
|
|
951
953
|
return e < .0031308 ? e * 12.92 : 1.055 * e ** .41666 - .055;
|
|
952
954
|
}
|
|
953
|
-
var
|
|
955
|
+
var V, me = class {
|
|
954
956
|
static getDataURL(e, t = "image/png") {
|
|
955
957
|
if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src;
|
|
956
958
|
let n;
|
|
957
959
|
if (e instanceof HTMLCanvasElement) n = e;
|
|
958
960
|
else {
|
|
959
|
-
|
|
960
|
-
let t =
|
|
961
|
-
e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height), n =
|
|
961
|
+
V === void 0 && (V = A("canvas")), V.width = e.width, V.height = e.height;
|
|
962
|
+
let t = V.getContext("2d");
|
|
963
|
+
e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height), n = V;
|
|
962
964
|
}
|
|
963
965
|
return n.toDataURL(t);
|
|
964
966
|
}
|
|
@@ -969,12 +971,12 @@ var H, pe = class {
|
|
|
969
971
|
let n = t.getContext("2d");
|
|
970
972
|
n.drawImage(e, 0, 0, e.width, e.height);
|
|
971
973
|
let r = n.getImageData(0, 0, e.width, e.height), i = r.data;
|
|
972
|
-
for (let e = 0; e < i.length; e++) i[e] =
|
|
974
|
+
for (let e = 0; e < i.length; e++) i[e] = z(i[e] / 255) * 255;
|
|
973
975
|
return n.putImageData(r, 0, 0), t;
|
|
974
976
|
}
|
|
975
977
|
if (e.data) {
|
|
976
978
|
let t = e.data.slice(0);
|
|
977
|
-
for (let e = 0; e < t.length; e++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[e] = Math.floor(
|
|
979
|
+
for (let e = 0; e < t.length; e++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[e] = Math.floor(z(t[e] / 255) * 255) : t[e] = z(t[e]);
|
|
978
980
|
return {
|
|
979
981
|
data: t,
|
|
980
982
|
width: e.width,
|
|
@@ -983,9 +985,9 @@ var H, pe = class {
|
|
|
983
985
|
}
|
|
984
986
|
return j("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
|
|
985
987
|
}
|
|
986
|
-
},
|
|
988
|
+
}, he = 0, ge = class {
|
|
987
989
|
constructor(e = null) {
|
|
988
|
-
this.
|
|
990
|
+
this.isTextureSource = !0, Object.defineProperty(this, "id", { value: he++ }), this.uuid = ne(), this.data = e, this.dataReady = !0, this.version = 0;
|
|
989
991
|
}
|
|
990
992
|
getSize(e) {
|
|
991
993
|
let t = this.data;
|
|
@@ -1005,33 +1007,33 @@ var H, pe = class {
|
|
|
1005
1007
|
let e;
|
|
1006
1008
|
if (Array.isArray(r)) {
|
|
1007
1009
|
e = [];
|
|
1008
|
-
for (let t = 0, n = r.length; t < n; t++) r[t].isDataTexture ? e.push(
|
|
1009
|
-
} else e =
|
|
1010
|
+
for (let t = 0, n = r.length; t < n; t++) r[t].isDataTexture ? e.push(_e(r[t].image)) : e.push(_e(r[t]));
|
|
1011
|
+
} else e = _e(r);
|
|
1010
1012
|
n.url = e;
|
|
1011
1013
|
}
|
|
1012
1014
|
return t || (e.images[this.uuid] = n), n;
|
|
1013
1015
|
}
|
|
1014
1016
|
};
|
|
1015
|
-
function
|
|
1016
|
-
return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap ?
|
|
1017
|
+
function _e(e) {
|
|
1018
|
+
return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap ? me.getDataURL(e) : e.data ? {
|
|
1017
1019
|
data: Array.from(e.data),
|
|
1018
1020
|
width: e.width,
|
|
1019
1021
|
height: e.height,
|
|
1020
1022
|
type: e.data.constructor.name
|
|
1021
1023
|
} : (j("Texture: Unable to serialize Texture."), {});
|
|
1022
1024
|
}
|
|
1023
|
-
var
|
|
1025
|
+
var ve = 0, ye = /*@__PURE__*/ new L(), be = class e extends P {
|
|
1024
1026
|
constructor(t = e.DEFAULT_IMAGE, n = e.DEFAULT_MAPPING, r = l, i = l, a = f, o = p, s = h, c = m, u = e.DEFAULT_ANISOTROPY, d = "") {
|
|
1025
|
-
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value:
|
|
1027
|
+
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: ve++ }), this.uuid = ne(), this.name = "", this.source = new ge(t), this.mipmaps = [], this.mapping = n, this.channel = 0, this.wrapS = r, this.wrapT = i, this.magFilter = a, this.minFilter = o, this.anisotropy = u, this.format = s, this.internalFormat = null, this.type = c, this.offset = new ae(0, 0), this.repeat = new ae(1, 1), this.center = new ae(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new le(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = d, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(t && t.depth && t.depth > 1), this.pmremVersion = 0, this.normalized = !1;
|
|
1026
1028
|
}
|
|
1027
1029
|
get width() {
|
|
1028
|
-
return this.source.getSize(
|
|
1030
|
+
return this.source.getSize(ye).x;
|
|
1029
1031
|
}
|
|
1030
1032
|
get height() {
|
|
1031
|
-
return this.source.getSize(
|
|
1033
|
+
return this.source.getSize(ye).y;
|
|
1032
1034
|
}
|
|
1033
1035
|
get depth() {
|
|
1034
|
-
return this.source.getSize(
|
|
1036
|
+
return this.source.getSize(ye).z;
|
|
1035
1037
|
}
|
|
1036
1038
|
get image() {
|
|
1037
1039
|
return this.source.data;
|
|
@@ -1065,11 +1067,7 @@ var _e = 0, ve = /*@__PURE__*/ new R(), ye = class e extends P {
|
|
|
1065
1067
|
continue;
|
|
1066
1068
|
}
|
|
1067
1069
|
let r = this[t];
|
|
1068
|
-
|
|
1069
|
-
j(`Texture.setValues(): property '${t}' does not exist.`);
|
|
1070
|
-
continue;
|
|
1071
|
-
}
|
|
1072
|
-
r && n && r.isVector2 && n.isVector2 || r && n && r.isVector3 && n.isVector3 || r && n && r.isMatrix3 && n.isMatrix3 ? r.copy(n) : this[t] = n;
|
|
1070
|
+
r === void 0 ? j(`Texture.setValues(): property '${t}' does not exist.`) : r && n && r.isVector2 && n.isVector2 || r && n && r.isVector3 && n.isVector3 || r && n && r.isMatrix3 && n.isMatrix3 ? r.copy(n) : this[t] = n;
|
|
1073
1071
|
}
|
|
1074
1072
|
}
|
|
1075
1073
|
toJSON(e) {
|
|
@@ -1138,7 +1136,7 @@ var _e = 0, ve = /*@__PURE__*/ new R(), ye = class e extends P {
|
|
|
1138
1136
|
e === !0 && this.pmremVersion++;
|
|
1139
1137
|
}
|
|
1140
1138
|
};
|
|
1141
|
-
|
|
1139
|
+
be.DEFAULT_IMAGE = null, be.DEFAULT_MAPPING = 300, be.DEFAULT_ANISOTROPY = 1, class e {
|
|
1142
1140
|
static {
|
|
1143
1141
|
e.prototype.isVector4 = !0;
|
|
1144
1142
|
}
|
|
@@ -1339,7 +1337,7 @@ ye.DEFAULT_IMAGE = null, ye.DEFAULT_MAPPING = 300, ye.DEFAULT_ANISOTROPY = 1, cl
|
|
|
1339
1337
|
yield this.x, yield this.y, yield this.z, yield this.w;
|
|
1340
1338
|
}
|
|
1341
1339
|
};
|
|
1342
|
-
var
|
|
1340
|
+
var H = class e {
|
|
1343
1341
|
static {
|
|
1344
1342
|
e.prototype.isMatrix4 = !0;
|
|
1345
1343
|
}
|
|
@@ -1393,7 +1391,7 @@ var U = class e {
|
|
|
1393
1391
|
}
|
|
1394
1392
|
extractRotation(e) {
|
|
1395
1393
|
if (e.determinantAffine() === 0) return this.identity();
|
|
1396
|
-
let t = this.elements, n = e.elements, r = 1 /
|
|
1394
|
+
let t = this.elements, n = e.elements, r = 1 / U.setFromMatrixColumn(e, 0).length(), i = 1 / U.setFromMatrixColumn(e, 1).length(), a = 1 / U.setFromMatrixColumn(e, 2).length();
|
|
1397
1395
|
return t[0] = n[0] * r, t[1] = n[1] * r, t[2] = n[2] * r, t[3] = 0, t[4] = n[4] * i, t[5] = n[5] * i, t[6] = n[6] * i, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
|
|
1398
1396
|
}
|
|
1399
1397
|
makeRotationFromEuler(e) {
|
|
@@ -1420,11 +1418,11 @@ var U = class e {
|
|
|
1420
1418
|
return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
|
|
1421
1419
|
}
|
|
1422
1420
|
makeRotationFromQuaternion(e) {
|
|
1423
|
-
return this.compose(
|
|
1421
|
+
return this.compose(xe, e, Se);
|
|
1424
1422
|
}
|
|
1425
1423
|
lookAt(e, t, n) {
|
|
1426
1424
|
let r = this.elements;
|
|
1427
|
-
return
|
|
1425
|
+
return K.subVectors(e, t), K.lengthSq() === 0 && (K.z = 1), K.normalize(), G.crossVectors(n, K), G.lengthSq() === 0 && (Math.abs(n.z) === 1 ? K.x += 1e-4 : K.z += 1e-4, K.normalize(), G.crossVectors(n, K)), G.normalize(), Ce.crossVectors(K, G), r[0] = G.x, r[4] = Ce.x, r[8] = K.x, r[1] = G.y, r[5] = Ce.y, r[9] = K.y, r[2] = G.z, r[6] = Ce.z, r[10] = K.z, this;
|
|
1428
1426
|
}
|
|
1429
1427
|
multiply(e) {
|
|
1430
1428
|
return this.multiplyMatrices(this, e);
|
|
@@ -1504,10 +1502,10 @@ var U = class e {
|
|
|
1504
1502
|
e.x = r[12], e.y = r[13], e.z = r[14];
|
|
1505
1503
|
let i = this.determinantAffine();
|
|
1506
1504
|
if (i === 0) return n.set(1, 1, 1), t.identity(), this;
|
|
1507
|
-
let a =
|
|
1508
|
-
i < 0 && (a = -a),
|
|
1505
|
+
let a = U.set(r[0], r[1], r[2]).length(), o = U.set(r[4], r[5], r[6]).length(), s = U.set(r[8], r[9], r[10]).length();
|
|
1506
|
+
i < 0 && (a = -a), W.copy(this);
|
|
1509
1507
|
let c = 1 / a, l = 1 / o, u = 1 / s;
|
|
1510
|
-
return
|
|
1508
|
+
return W.elements[0] *= c, W.elements[1] *= c, W.elements[2] *= c, W.elements[4] *= l, W.elements[5] *= l, W.elements[6] *= l, W.elements[8] *= u, W.elements[9] *= u, W.elements[10] *= u, t.setFromRotationMatrix(W), n.x = a, n.y = o, n.z = s, this;
|
|
1511
1509
|
}
|
|
1512
1510
|
makePerspective(e, t, n, r, i, a, o = O, s = !1) {
|
|
1513
1511
|
let c = this.elements, l = 2 * i / (t - e), u = 2 * i / (n - r), d = (t + e) / (t - e), f = (n + r) / (n - r), p, m;
|
|
@@ -1538,7 +1536,7 @@ var U = class e {
|
|
|
1538
1536
|
let n = this.elements;
|
|
1539
1537
|
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;
|
|
1540
1538
|
}
|
|
1541
|
-
},
|
|
1539
|
+
}, U = /*@__PURE__*/ new L(), W = /*@__PURE__*/ new H(), xe = /*@__PURE__*/ new L(0, 0, 0), Se = /*@__PURE__*/ new L(1, 1, 1), G = /*@__PURE__*/ new L(), Ce = /*@__PURE__*/ new L(), K = /*@__PURE__*/ new L(), we = /*@__PURE__*/ new H(), Te = /*@__PURE__*/ new oe(), Ee = class e {
|
|
1542
1540
|
constructor(t = 0, n = 0, r = 0, i = e.DEFAULT_ORDER) {
|
|
1543
1541
|
this.isEuler = !0, this._x = t, this._y = n, this._z = r, this._order = i;
|
|
1544
1542
|
}
|
|
@@ -1601,13 +1599,13 @@ var U = class e {
|
|
|
1601
1599
|
return this._order = t, n === !0 && this._onChangeCallback(), this;
|
|
1602
1600
|
}
|
|
1603
1601
|
setFromQuaternion(e, t, n) {
|
|
1604
|
-
return
|
|
1602
|
+
return we.makeRotationFromQuaternion(e), this.setFromRotationMatrix(we, t, n);
|
|
1605
1603
|
}
|
|
1606
1604
|
setFromVector3(e, t = this._order) {
|
|
1607
1605
|
return this.set(e.x, e.y, e.z, t);
|
|
1608
1606
|
}
|
|
1609
1607
|
reorder(e) {
|
|
1610
|
-
return
|
|
1608
|
+
return Te.setFromEuler(this), this.setFromQuaternion(Te, e);
|
|
1611
1609
|
}
|
|
1612
1610
|
equals(e) {
|
|
1613
1611
|
return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order;
|
|
@@ -1626,25 +1624,25 @@ var U = class e {
|
|
|
1626
1624
|
yield this._x, yield this._y, yield this._z, yield this._order;
|
|
1627
1625
|
}
|
|
1628
1626
|
};
|
|
1629
|
-
|
|
1630
|
-
var
|
|
1627
|
+
Ee.DEFAULT_ORDER = "XYZ";
|
|
1628
|
+
var De = class {
|
|
1631
1629
|
constructor() {
|
|
1632
1630
|
this.mask = 1;
|
|
1633
1631
|
}
|
|
1634
1632
|
set(e) {
|
|
1635
|
-
this.mask =
|
|
1633
|
+
this.mask = 1 << e >>> 0;
|
|
1636
1634
|
}
|
|
1637
1635
|
enable(e) {
|
|
1638
|
-
this.mask |= 1 << e
|
|
1636
|
+
this.mask |= 1 << e;
|
|
1639
1637
|
}
|
|
1640
1638
|
enableAll() {
|
|
1641
1639
|
this.mask = -1;
|
|
1642
1640
|
}
|
|
1643
1641
|
toggle(e) {
|
|
1644
|
-
this.mask ^= 1 << e
|
|
1642
|
+
this.mask ^= 1 << e;
|
|
1645
1643
|
}
|
|
1646
1644
|
disable(e) {
|
|
1647
|
-
this.mask &= ~(1 << e
|
|
1645
|
+
this.mask &= ~(1 << e);
|
|
1648
1646
|
}
|
|
1649
1647
|
disableAll() {
|
|
1650
1648
|
this.mask = 0;
|
|
@@ -1653,9 +1651,9 @@ var Ee = class {
|
|
|
1653
1651
|
return (this.mask & e.mask) !== 0;
|
|
1654
1652
|
}
|
|
1655
1653
|
isEnabled(e) {
|
|
1656
|
-
return !!(this.mask &
|
|
1654
|
+
return !!(this.mask & 1 << e);
|
|
1657
1655
|
}
|
|
1658
|
-
},
|
|
1656
|
+
}, Oe = 0, ke = /*@__PURE__*/ new L(), q = /*@__PURE__*/ new oe(), J = /*@__PURE__*/ new H(), Ae = /*@__PURE__*/ new L(), je = /*@__PURE__*/ new L(), Me = /*@__PURE__*/ new L(), Ne = /*@__PURE__*/ new oe(), Pe = /*@__PURE__*/ new L(1, 0, 0), Fe = /*@__PURE__*/ new L(0, 1, 0), Ie = /*@__PURE__*/ new L(0, 0, 1), Le = { type: "added" }, Re = { type: "removed" }, ze = {
|
|
1659
1657
|
type: "childadded",
|
|
1660
1658
|
child: null
|
|
1661
1659
|
}, Be = {
|
|
@@ -1663,8 +1661,8 @@ var Ee = class {
|
|
|
1663
1661
|
child: null
|
|
1664
1662
|
}, Ve = class e extends P {
|
|
1665
1663
|
constructor() {
|
|
1666
|
-
super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value:
|
|
1667
|
-
let t = new
|
|
1664
|
+
super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: Oe++ }), this.uuid = ne(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = e.DEFAULT_UP.clone();
|
|
1665
|
+
let t = new L(), n = new Ee(), r = new oe(), i = new L(1, 1, 1);
|
|
1668
1666
|
function a() {
|
|
1669
1667
|
r.setFromEuler(n, !1);
|
|
1670
1668
|
}
|
|
@@ -1692,9 +1690,9 @@ var Ee = class {
|
|
|
1692
1690
|
enumerable: !0,
|
|
1693
1691
|
value: i
|
|
1694
1692
|
},
|
|
1695
|
-
modelViewMatrix: { value: new
|
|
1696
|
-
normalMatrix: { value: new
|
|
1697
|
-
}), this.matrix = new
|
|
1693
|
+
modelViewMatrix: { value: new H() },
|
|
1694
|
+
normalMatrix: { value: new le() }
|
|
1695
|
+
}), this.matrix = new H(), this.matrixWorld = new H(), this.matrixAutoUpdate = e.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new De(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.static = !1, this.userData = {}, this.pivot = null;
|
|
1698
1696
|
}
|
|
1699
1697
|
onBeforeShadow() {}
|
|
1700
1698
|
onAfterShadow() {}
|
|
@@ -1719,10 +1717,10 @@ var Ee = class {
|
|
|
1719
1717
|
this.quaternion.copy(e);
|
|
1720
1718
|
}
|
|
1721
1719
|
rotateOnAxis(e, t) {
|
|
1722
|
-
return
|
|
1720
|
+
return q.setFromAxisAngle(e, t), this.quaternion.multiply(q), this;
|
|
1723
1721
|
}
|
|
1724
1722
|
rotateOnWorldAxis(e, t) {
|
|
1725
|
-
return
|
|
1723
|
+
return q.setFromAxisAngle(e, t), this.quaternion.premultiply(q), this;
|
|
1726
1724
|
}
|
|
1727
1725
|
rotateX(e) {
|
|
1728
1726
|
return this.rotateOnAxis(Pe, e);
|
|
@@ -1734,7 +1732,7 @@ var Ee = class {
|
|
|
1734
1732
|
return this.rotateOnAxis(Ie, e);
|
|
1735
1733
|
}
|
|
1736
1734
|
translateOnAxis(e, t) {
|
|
1737
|
-
return
|
|
1735
|
+
return ke.copy(e).applyQuaternion(this.quaternion), this.position.add(ke.multiplyScalar(t)), this;
|
|
1738
1736
|
}
|
|
1739
1737
|
translateX(e) {
|
|
1740
1738
|
return this.translateOnAxis(Pe, e);
|
|
@@ -1754,7 +1752,7 @@ var Ee = class {
|
|
|
1754
1752
|
lookAt(e, t, n) {
|
|
1755
1753
|
e.isVector3 ? Ae.copy(e) : Ae.set(e, t, n);
|
|
1756
1754
|
let r = this.parent;
|
|
1757
|
-
this.updateWorldMatrix(!0, !1), je.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? J.lookAt(je, Ae, this.up) : J.lookAt(Ae, je, this.up), this.quaternion.setFromRotationMatrix(J), r && (J.extractRotation(r.matrixWorld),
|
|
1755
|
+
this.updateWorldMatrix(!0, !1), je.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? J.lookAt(je, Ae, this.up) : J.lookAt(Ae, je, this.up), this.quaternion.setFromRotationMatrix(J), r && (J.extractRotation(r.matrixWorld), q.setFromRotationMatrix(J), this.quaternion.premultiply(q.invert()));
|
|
1758
1756
|
}
|
|
1759
1757
|
add(e) {
|
|
1760
1758
|
if (arguments.length > 1) {
|
|
@@ -1815,6 +1813,7 @@ var Ee = class {
|
|
|
1815
1813
|
return e.set(t[8], t[9], t[10]).normalize();
|
|
1816
1814
|
}
|
|
1817
1815
|
raycast() {}
|
|
1816
|
+
intersectsFrustum() {}
|
|
1818
1817
|
traverse(e) {
|
|
1819
1818
|
e(this);
|
|
1820
1819
|
let t = this.children;
|
|
@@ -1868,7 +1867,7 @@ var Ee = class {
|
|
|
1868
1867
|
generator: "Object3D.toJSON"
|
|
1869
1868
|
});
|
|
1870
1869
|
let r = {};
|
|
1871
|
-
r.uuid = this.uuid, r.type = this.type,
|
|
1870
|
+
r.uuid = this.uuid, r.type = this.type, r.name = this.name, r.castShadow = this.castShadow, r.receiveShadow = this.receiveShadow, r.visible = this.visible, r.frustumCulled = this.frustumCulled, r.renderOrder = this.renderOrder, r.static = this.static, r.matrixAutoUpdate = this.matrixAutoUpdate, Object.keys(this.userData).length > 0 && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), r.up = this.up.toArray(), this.pivot !== null && (r.pivot = this.pivot.toArray()), this.morphTargetDictionary !== void 0 && (r.morphTargetDictionary = Object.assign({}, this.morphTargetDictionary)), this.morphTargetInfluences !== void 0 && (r.morphTargetInfluences = this.morphTargetInfluences.slice()), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (r.type = "BatchedMesh", r.perObjectFrustumCulled = this.perObjectFrustumCulled, r.sortObjects = this.sortObjects, r.drawRanges = this._drawRanges, r.reservedRanges = this._reservedRanges, r.geometryInfo = this._geometryInfo.map((e) => ({
|
|
1872
1871
|
...e,
|
|
1873
1872
|
boundingBox: e.boundingBox ? e.boundingBox.toJSON() : void 0,
|
|
1874
1873
|
boundingSphere: e.boundingSphere ? e.boundingSphere.toJSON() : void 0
|
|
@@ -1931,8 +1930,11 @@ var Ee = class {
|
|
|
1931
1930
|
}
|
|
1932
1931
|
return this;
|
|
1933
1932
|
}
|
|
1933
|
+
dispose() {
|
|
1934
|
+
this.dispatchEvent({ type: "dispose" });
|
|
1935
|
+
}
|
|
1934
1936
|
};
|
|
1935
|
-
Ve.DEFAULT_UP = /*@__PURE__*/ new
|
|
1937
|
+
Ve.DEFAULT_UP = /*@__PURE__*/ new L(0, 1, 0), Ve.DEFAULT_MATRIX_AUTO_UPDATE = !0, Ve.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
|
|
1936
1938
|
var He = {
|
|
1937
1939
|
aliceblue: 15792383,
|
|
1938
1940
|
antiquewhite: 16444375,
|
|
@@ -2109,18 +2111,18 @@ var Ge = class {
|
|
|
2109
2111
|
return this.r = e, this.g = e, this.b = e, this;
|
|
2110
2112
|
}
|
|
2111
2113
|
setHex(e, t = w) {
|
|
2112
|
-
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255,
|
|
2114
|
+
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, R.colorSpaceToWorking(this, t), this;
|
|
2113
2115
|
}
|
|
2114
|
-
setRGB(e, t, n, r =
|
|
2115
|
-
return this.r = e, this.g = t, this.b = n,
|
|
2116
|
+
setRGB(e, t, n, r = R.workingColorSpace) {
|
|
2117
|
+
return this.r = e, this.g = t, this.b = n, R.colorSpaceToWorking(this, r), this;
|
|
2116
2118
|
}
|
|
2117
|
-
setHSL(e, t, n, r =
|
|
2119
|
+
setHSL(e, t, n, r = R.workingColorSpace) {
|
|
2118
2120
|
if (e = re(e, 1), t = I(t, 0, 1), n = I(n, 0, 1), t === 0) this.r = this.g = this.b = n;
|
|
2119
2121
|
else {
|
|
2120
2122
|
let r = n <= .5 ? n * (1 + t) : n + t - n * t, i = 2 * n - r;
|
|
2121
2123
|
this.r = We(i, r, e + 1 / 3), this.g = We(i, r, e), this.b = We(i, r, e - 1 / 3);
|
|
2122
2124
|
}
|
|
2123
|
-
return
|
|
2125
|
+
return R.colorSpaceToWorking(this, r), this;
|
|
2124
2126
|
}
|
|
2125
2127
|
setStyle(e, t = w) {
|
|
2126
2128
|
function n(t) {
|
|
@@ -2160,10 +2162,10 @@ var Ge = class {
|
|
|
2160
2162
|
return this.r = e.r, this.g = e.g, this.b = e.b, this;
|
|
2161
2163
|
}
|
|
2162
2164
|
copySRGBToLinear(e) {
|
|
2163
|
-
return this.r =
|
|
2165
|
+
return this.r = z(e.r), this.g = z(e.g), this.b = z(e.b), this;
|
|
2164
2166
|
}
|
|
2165
2167
|
copyLinearToSRGB(e) {
|
|
2166
|
-
return this.r =
|
|
2168
|
+
return this.r = B(e.r), this.g = B(e.g), this.b = B(e.b), this;
|
|
2167
2169
|
}
|
|
2168
2170
|
convertSRGBToLinear() {
|
|
2169
2171
|
return this.copySRGBToLinear(this), this;
|
|
@@ -2172,13 +2174,13 @@ var Ge = class {
|
|
|
2172
2174
|
return this.copyLinearToSRGB(this), this;
|
|
2173
2175
|
}
|
|
2174
2176
|
getHex(e = w) {
|
|
2175
|
-
return
|
|
2177
|
+
return R.workingToColorSpace(X.copy(this), e), Math.round(I(X.r * 255, 0, 255)) * 65536 + Math.round(I(X.g * 255, 0, 255)) * 256 + Math.round(I(X.b * 255, 0, 255));
|
|
2176
2178
|
}
|
|
2177
2179
|
getHexString(e = w) {
|
|
2178
2180
|
return ("000000" + this.getHex(e).toString(16)).slice(-6);
|
|
2179
2181
|
}
|
|
2180
|
-
getHSL(e, t =
|
|
2181
|
-
|
|
2182
|
+
getHSL(e, t = R.workingColorSpace) {
|
|
2183
|
+
R.workingToColorSpace(X.copy(this), t);
|
|
2182
2184
|
let n = X.r, r = X.g, i = X.b, a = Math.max(n, r, i), o = Math.min(n, r, i), s, c, l = (o + a) / 2;
|
|
2183
2185
|
if (o === a) s = 0, c = 0;
|
|
2184
2186
|
else {
|
|
@@ -2196,11 +2198,11 @@ var Ge = class {
|
|
|
2196
2198
|
}
|
|
2197
2199
|
return e.h = s, e.s = c, e.l = l, e;
|
|
2198
2200
|
}
|
|
2199
|
-
getRGB(e, t =
|
|
2200
|
-
return
|
|
2201
|
+
getRGB(e, t = R.workingColorSpace) {
|
|
2202
|
+
return R.workingToColorSpace(X.copy(this), t), e.r = X.r, e.g = X.g, e.b = X.b, e;
|
|
2201
2203
|
}
|
|
2202
2204
|
getStyle(e = w) {
|
|
2203
|
-
|
|
2205
|
+
R.workingToColorSpace(X.copy(this), e);
|
|
2204
2206
|
let t = X.r, n = X.g, r = X.b;
|
|
2205
2207
|
return e === "srgb" ? `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(r * 255)})` : `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`;
|
|
2206
2208
|
}
|
|
@@ -2263,7 +2265,7 @@ var Ge = class {
|
|
|
2263
2265
|
}
|
|
2264
2266
|
}, X = /*@__PURE__*/ new Ge();
|
|
2265
2267
|
Ge.NAMES = He;
|
|
2266
|
-
var Ke = class extends
|
|
2268
|
+
var Ke = class extends be {
|
|
2267
2269
|
constructor(e = null, t = 1, n = 1, r, i, a, o, s, c = d, l = d, u, f) {
|
|
2268
2270
|
super(null, a, o, s, c, l, r, i, u, f), this.isDataTexture = !0, this.image = {
|
|
2269
2271
|
data: e,
|
|
@@ -2275,7 +2277,10 @@ var Ke = class extends ye {
|
|
|
2275
2277
|
function qe(e, t) {
|
|
2276
2278
|
return !e || e.constructor === t ? e : typeof t.BYTES_PER_ELEMENT == "number" ? new t(e) : Array.prototype.slice.call(e);
|
|
2277
2279
|
}
|
|
2278
|
-
|
|
2280
|
+
function Je(e) {
|
|
2281
|
+
return e !== void 0 && e.inTangents !== void 0 && e.outTangents !== void 0;
|
|
2282
|
+
}
|
|
2283
|
+
var Ye = class {
|
|
2279
2284
|
constructor(e, t, n, r) {
|
|
2280
2285
|
this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r === void 0 ? new t.constructor(n) : r, this.sampleValues = t, this.valueSize = n, this.settings = null, this.DefaultSettings_ = {};
|
|
2281
2286
|
}
|
|
@@ -2333,7 +2338,7 @@ var Je = class {
|
|
|
2333
2338
|
throw Error("THREE.Interpolant: Call to abstract method.");
|
|
2334
2339
|
}
|
|
2335
2340
|
intervalChanged_() {}
|
|
2336
|
-
},
|
|
2341
|
+
}, Xe = class extends Ye {
|
|
2337
2342
|
constructor(e, t, n, r) {
|
|
2338
2343
|
super(e, t, n, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
|
|
2339
2344
|
endingStart: x,
|
|
@@ -2368,7 +2373,7 @@ var Je = class {
|
|
|
2368
2373
|
for (let e = 0; e !== o; ++e) i[e] = g * a[l + e] + _ * a[c + e] + v * a[s + e] + y * a[u + e];
|
|
2369
2374
|
return i;
|
|
2370
2375
|
}
|
|
2371
|
-
},
|
|
2376
|
+
}, Ze = class extends Ye {
|
|
2372
2377
|
constructor(e, t, n, r) {
|
|
2373
2378
|
super(e, t, n, r);
|
|
2374
2379
|
}
|
|
@@ -2377,14 +2382,14 @@ var Je = class {
|
|
|
2377
2382
|
for (let e = 0; e !== o; ++e) i[e] = a[c + e] * u + a[s + e] * l;
|
|
2378
2383
|
return i;
|
|
2379
2384
|
}
|
|
2380
|
-
},
|
|
2385
|
+
}, Qe = class extends Ye {
|
|
2381
2386
|
constructor(e, t, n, r) {
|
|
2382
2387
|
super(e, t, n, r);
|
|
2383
2388
|
}
|
|
2384
2389
|
interpolate_(e) {
|
|
2385
2390
|
return this.copySampleValue_(e - 1);
|
|
2386
2391
|
}
|
|
2387
|
-
},
|
|
2392
|
+
}, $e = class extends Ye {
|
|
2388
2393
|
interpolate_(e, t, n, r) {
|
|
2389
2394
|
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = this.inTangents, u = this.outTangents;
|
|
2390
2395
|
if (!l || !u) {
|
|
@@ -2394,20 +2399,32 @@ var Je = class {
|
|
|
2394
2399
|
}
|
|
2395
2400
|
let d = o * 2, f = e - 1;
|
|
2396
2401
|
for (let p = 0; p !== o; ++p) {
|
|
2397
|
-
let o = a[c + p], m = a[s + p], h = f * d + p * 2, g = u[h], _ = u[h + 1], v = e * d + p * 2, y = l[v], b = l[v + 1], x = (n
|
|
2398
|
-
|
|
2399
|
-
S = x * x, C = S * x, w = 1 - x, T = w * w, E = T * w;
|
|
2400
|
-
let e = E * t + 3 * T * x * g + 3 * w * S * y + C * r - n;
|
|
2401
|
-
if (Math.abs(e) < 1e-10) break;
|
|
2402
|
-
let i = 3 * T * (g - t) + 6 * w * x * (y - g) + 3 * S * (r - y);
|
|
2403
|
-
if (Math.abs(i) < 1e-10) break;
|
|
2404
|
-
x -= e / i, x = Math.max(0, Math.min(1, x));
|
|
2405
|
-
}
|
|
2406
|
-
i[p] = E * o + 3 * T * x * _ + 3 * w * S * b + C * m;
|
|
2402
|
+
let o = a[c + p], m = a[s + p], h = f * d + p * 2, g = u[h], _ = u[h + 1], v = e * d + p * 2, y = l[v], b = l[v + 1], x = nt(n, t, g, y, r);
|
|
2403
|
+
i[p] = et(x, o, _, b, m);
|
|
2407
2404
|
}
|
|
2408
2405
|
return i;
|
|
2409
2406
|
}
|
|
2410
|
-
}
|
|
2407
|
+
};
|
|
2408
|
+
function et(e, t, n, r, i) {
|
|
2409
|
+
let a = 1 - e;
|
|
2410
|
+
return a * a * a * t + 3 * a * a * e * n + 3 * a * e * e * r + e * e * e * i;
|
|
2411
|
+
}
|
|
2412
|
+
function tt(e, t, n, r, i) {
|
|
2413
|
+
let a = 1 - e;
|
|
2414
|
+
return 3 * a * a * (n - t) + 6 * a * e * (r - n) + 3 * e * e * (i - r);
|
|
2415
|
+
}
|
|
2416
|
+
function nt(e, t, n, r, i) {
|
|
2417
|
+
let a = (e - t) / (i - t);
|
|
2418
|
+
for (let o = 0; o < 8; o++) {
|
|
2419
|
+
let o = et(a, t, n, r, i) - e;
|
|
2420
|
+
if (Math.abs(o) < 1e-10) break;
|
|
2421
|
+
let s = tt(a, t, n, r, i);
|
|
2422
|
+
if (Math.abs(s) < 1e-10) break;
|
|
2423
|
+
a = Math.max(0, Math.min(1, a - o / s));
|
|
2424
|
+
}
|
|
2425
|
+
return a;
|
|
2426
|
+
}
|
|
2427
|
+
var Z = class {
|
|
2411
2428
|
constructor(e, t, n, r) {
|
|
2412
2429
|
if (e === void 0) throw Error("THREE.KeyframeTrack: track name is undefined");
|
|
2413
2430
|
if (t === void 0 || t.length === 0) throw Error("THREE.KeyframeTrack: no keyframes in track named " + e);
|
|
@@ -2423,21 +2440,24 @@ var Je = class {
|
|
|
2423
2440
|
values: qe(e.values, Array)
|
|
2424
2441
|
};
|
|
2425
2442
|
let t = e.getInterpolation();
|
|
2426
|
-
t !== e.DefaultInterpolation && (n.interpolation = t)
|
|
2443
|
+
t !== e.DefaultInterpolation && (n.interpolation = t), Je(e.settings) && (n.settings = {
|
|
2444
|
+
inTangents: qe(e.settings.inTangents, Array),
|
|
2445
|
+
outTangents: qe(e.settings.outTangents, Array)
|
|
2446
|
+
});
|
|
2427
2447
|
}
|
|
2428
2448
|
return n.type = e.ValueTypeName, n;
|
|
2429
2449
|
}
|
|
2430
2450
|
InterpolantFactoryMethodDiscrete(e) {
|
|
2431
|
-
return new
|
|
2451
|
+
return new Qe(this.times, this.values, this.getValueSize(), e);
|
|
2432
2452
|
}
|
|
2433
2453
|
InterpolantFactoryMethodLinear(e) {
|
|
2434
|
-
return new
|
|
2454
|
+
return new Ze(this.times, this.values, this.getValueSize(), e);
|
|
2435
2455
|
}
|
|
2436
2456
|
InterpolantFactoryMethodSmooth(e) {
|
|
2437
|
-
return new
|
|
2457
|
+
return new Xe(this.times, this.values, this.getValueSize(), e);
|
|
2438
2458
|
}
|
|
2439
2459
|
InterpolantFactoryMethodBezier(e) {
|
|
2440
|
-
let t = new
|
|
2460
|
+
let t = new $e(this.times, this.values, this.getValueSize(), e);
|
|
2441
2461
|
return this.settings && (t.inTangents = this.settings.inTangents, t.outTangents = this.settings.outTangents), t;
|
|
2442
2462
|
}
|
|
2443
2463
|
setInterpolation(e) {
|
|
@@ -2486,6 +2506,7 @@ var Je = class {
|
|
|
2486
2506
|
if (e !== 1) {
|
|
2487
2507
|
let t = this.times;
|
|
2488
2508
|
for (let n = 0, r = t.length; n !== r; ++n) t[n] *= e;
|
|
2509
|
+
Je(this.settings) && (rt(this.settings.inTangents, e), rt(this.settings.outTangents, e));
|
|
2489
2510
|
}
|
|
2490
2511
|
return this;
|
|
2491
2512
|
}
|
|
@@ -2562,64 +2583,70 @@ var Je = class {
|
|
|
2562
2583
|
}
|
|
2563
2584
|
clone() {
|
|
2564
2585
|
let e = this.times.slice(), t = this.values.slice(), n = this.constructor, r = new n(this.name, e, t);
|
|
2565
|
-
return r.createInterpolant = this.createInterpolant, r
|
|
2586
|
+
return r.createInterpolant = this.createInterpolant, Je(this.settings) && (r.settings = {
|
|
2587
|
+
inTangents: this.settings.inTangents.slice(),
|
|
2588
|
+
outTangents: this.settings.outTangents.slice()
|
|
2589
|
+
}), r;
|
|
2566
2590
|
}
|
|
2567
2591
|
};
|
|
2592
|
+
function rt(e, t) {
|
|
2593
|
+
for (let n = 0, r = e.length; n !== r; n += 2) e[n] *= t;
|
|
2594
|
+
}
|
|
2568
2595
|
Z.prototype.ValueTypeName = "", Z.prototype.TimeBufferType = Float32Array, Z.prototype.ValueBufferType = Float32Array, Z.prototype.DefaultInterpolation = v;
|
|
2569
|
-
var
|
|
2596
|
+
var it = class extends Z {
|
|
2570
2597
|
constructor(e, t, n) {
|
|
2571
2598
|
super(e, t, n);
|
|
2572
2599
|
}
|
|
2573
2600
|
};
|
|
2574
|
-
|
|
2575
|
-
var
|
|
2601
|
+
it.prototype.ValueTypeName = "bool", it.prototype.ValueBufferType = Array, it.prototype.DefaultInterpolation = _, it.prototype.InterpolantFactoryMethodLinear = void 0, it.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2602
|
+
var at = class extends Z {
|
|
2576
2603
|
constructor(e, t, n, r) {
|
|
2577
2604
|
super(e, t, n, r);
|
|
2578
2605
|
}
|
|
2579
2606
|
};
|
|
2580
|
-
|
|
2581
|
-
var
|
|
2607
|
+
at.prototype.ValueTypeName = "color";
|
|
2608
|
+
var ot = class extends Z {
|
|
2582
2609
|
constructor(e, t, n, r) {
|
|
2583
2610
|
super(e, t, n, r);
|
|
2584
2611
|
}
|
|
2585
2612
|
};
|
|
2586
|
-
|
|
2587
|
-
var
|
|
2613
|
+
ot.prototype.ValueTypeName = "number";
|
|
2614
|
+
var st = class extends Ye {
|
|
2588
2615
|
constructor(e, t, n, r) {
|
|
2589
2616
|
super(e, t, n, r);
|
|
2590
2617
|
}
|
|
2591
2618
|
interpolate_(e, t, n, r) {
|
|
2592
2619
|
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = (n - t) / (r - t), c = e * o;
|
|
2593
|
-
for (let e = c + o; c !== e; c += 4)
|
|
2620
|
+
for (let e = c + o; c !== e; c += 4) oe.slerpFlat(i, 0, a, c - o, a, c, s);
|
|
2594
2621
|
return i;
|
|
2595
2622
|
}
|
|
2596
|
-
},
|
|
2623
|
+
}, ct = class extends Z {
|
|
2597
2624
|
constructor(e, t, n, r) {
|
|
2598
2625
|
super(e, t, n, r);
|
|
2599
2626
|
}
|
|
2600
2627
|
InterpolantFactoryMethodLinear(e) {
|
|
2601
|
-
return new
|
|
2628
|
+
return new st(this.times, this.values, this.getValueSize(), e);
|
|
2602
2629
|
}
|
|
2603
2630
|
};
|
|
2604
|
-
|
|
2605
|
-
var
|
|
2631
|
+
ct.prototype.ValueTypeName = "quaternion", ct.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2632
|
+
var lt = class extends Z {
|
|
2606
2633
|
constructor(e, t, n) {
|
|
2607
2634
|
super(e, t, n);
|
|
2608
2635
|
}
|
|
2609
2636
|
};
|
|
2610
|
-
|
|
2611
|
-
var
|
|
2637
|
+
lt.prototype.ValueTypeName = "string", lt.prototype.ValueBufferType = Array, lt.prototype.DefaultInterpolation = _, lt.prototype.InterpolantFactoryMethodLinear = void 0, lt.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2638
|
+
var ut = class extends Z {
|
|
2612
2639
|
constructor(e, t, n, r) {
|
|
2613
2640
|
super(e, t, n, r);
|
|
2614
2641
|
}
|
|
2615
2642
|
};
|
|
2616
|
-
|
|
2617
|
-
var
|
|
2643
|
+
ut.prototype.ValueTypeName = "vector";
|
|
2644
|
+
var dt = "\\[\\]\\.:\\/", ft = /* @__PURE__ */ RegExp("[\\[\\]\\.:\\/]", "g"), pt = "[^\\[\\]\\.:\\/]", mt = "[^" + dt.replace("\\.", "") + "]", ht = /*@__PURE__*/ "((?:WC+[\\/:])*)".replace("WC", pt), gt = /*@__PURE__*/ "(WCOD+)?".replace("WCOD", mt), _t = /*@__PURE__*/ "(?:\\.(WC+)(?:\\[(.+)\\])?)?".replace("WC", pt), vt = /*@__PURE__*/ "\\.(WC+)(?:\\[(.+)\\])?".replace("WC", pt), yt = RegExp("^" + ht + gt + _t + vt + "$"), bt = [
|
|
2618
2645
|
"material",
|
|
2619
2646
|
"materials",
|
|
2620
2647
|
"bones",
|
|
2621
2648
|
"map"
|
|
2622
|
-
],
|
|
2649
|
+
], xt = class {
|
|
2623
2650
|
constructor(e, t, n) {
|
|
2624
2651
|
let r = n || Q.parseTrackName(t);
|
|
2625
2652
|
this._targetGroup = e, this._bindings = e.subscribe_(t, r);
|
|
@@ -2649,10 +2676,10 @@ var ot = "\\[\\]\\.:\\/", st = /* @__PURE__ */ RegExp("[\\[\\]\\.:\\/]", "g"), c
|
|
|
2649
2676
|
return t && t.isAnimationObjectGroup ? new e.Composite(t, n, r) : new e(t, n, r);
|
|
2650
2677
|
}
|
|
2651
2678
|
static sanitizeNodeName(e) {
|
|
2652
|
-
return e.replace(/\s/g, "_").replace(
|
|
2679
|
+
return e.replace(/\s/g, "_").replace(ft, "");
|
|
2653
2680
|
}
|
|
2654
2681
|
static parseTrackName(e) {
|
|
2655
|
-
let t =
|
|
2682
|
+
let t = yt.exec(e);
|
|
2656
2683
|
if (t === null) throw Error("THREE.PropertyBinding: Cannot parse trackName: " + e);
|
|
2657
2684
|
let n = {
|
|
2658
2685
|
nodeName: t[2],
|
|
@@ -2663,7 +2690,7 @@ var ot = "\\[\\]\\.:\\/", st = /* @__PURE__ */ RegExp("[\\[\\]\\.:\\/]", "g"), c
|
|
|
2663
2690
|
}, r = n.nodeName && n.nodeName.lastIndexOf(".");
|
|
2664
2691
|
if (r !== void 0 && r !== -1) {
|
|
2665
2692
|
let e = n.nodeName.substring(r + 1);
|
|
2666
|
-
|
|
2693
|
+
bt.indexOf(e) !== -1 && (n.nodeName = n.nodeName.substring(0, r), n.objectName = e);
|
|
2667
2694
|
}
|
|
2668
2695
|
if (n.propertyName === null || n.propertyName.length === 0) throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: " + e);
|
|
2669
2696
|
return n;
|
|
@@ -2840,7 +2867,7 @@ var ot = "\\[\\]\\.:\\/", st = /* @__PURE__ */ RegExp("[\\[\\]\\.:\\/]", "g"), c
|
|
|
2840
2867
|
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
|
|
2841
2868
|
}
|
|
2842
2869
|
};
|
|
2843
|
-
Q.Composite =
|
|
2870
|
+
Q.Composite = xt, Q.prototype.BindingType = {
|
|
2844
2871
|
Direct: 0,
|
|
2845
2872
|
EntireArray: 1,
|
|
2846
2873
|
ArrayElement: 2,
|
|
@@ -2898,33 +2925,35 @@ Q.Composite = gt, Q.prototype.BindingType = {
|
|
|
2898
2925
|
let i = this.elements;
|
|
2899
2926
|
return i[0] = e, i[2] = t, i[1] = n, i[3] = r, this;
|
|
2900
2927
|
}
|
|
2901
|
-
}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: "
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
var _t = class {
|
|
2928
|
+
}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: "186" } })), typeof window < "u" && (window.__THREE__ ? j("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "186");
|
|
2929
|
+
// src/FontWorkerClient.ts
|
|
2930
|
+
var St = 100, Ct = class {
|
|
2905
2931
|
_worker;
|
|
2906
|
-
_concurrencyManager;
|
|
2907
2932
|
_nextId = 0;
|
|
2908
2933
|
_pending = /* @__PURE__ */ new Map();
|
|
2909
2934
|
_ready;
|
|
2910
|
-
|
|
2911
|
-
|
|
2935
|
+
_heavyRequests = 0;
|
|
2936
|
+
_releaseCore;
|
|
2937
|
+
_releaseCoreTimer;
|
|
2938
|
+
_reserveWorkerCore;
|
|
2939
|
+
constructor(e, t) {
|
|
2940
|
+
this._reserveWorkerCore = t?.reserveWorkerCore, this._worker = new Worker(e, { type: void 0 }), this._worker.onmessage = (e) => {
|
|
2912
2941
|
let { id: t, type: n, payload: r } = e.data, i = this._pending.get(t);
|
|
2913
2942
|
i && (this._pending.delete(t), n === "error" ? i.reject(Error(r.message)) : i.resolve(r));
|
|
2914
2943
|
}, this._worker.onerror = (e) => {
|
|
2915
2944
|
console.error("FontWorkerClient: worker error", e), this.dispose();
|
|
2916
|
-
}, this._ready = this._send("init", { fontBudgetBytes:
|
|
2945
|
+
}, this._ready = this._holdCore(this._send("init", { fontBudgetBytes: t?.fontBudgetBytes })).then(() => void 0);
|
|
2917
2946
|
}
|
|
2918
2947
|
async ready() {
|
|
2919
2948
|
return this._ready;
|
|
2920
2949
|
}
|
|
2921
2950
|
async loadFont(e, t, n, r) {
|
|
2922
|
-
return this._send("loadFont", {
|
|
2951
|
+
return this._holdCore(this._send("loadFont", {
|
|
2923
2952
|
url: e,
|
|
2924
2953
|
data: t,
|
|
2925
2954
|
atlasKey: n,
|
|
2926
2955
|
highQuality: r
|
|
2927
|
-
}, [t]);
|
|
2956
|
+
}, [t]));
|
|
2928
2957
|
}
|
|
2929
2958
|
async unloadFont(e) {
|
|
2930
2959
|
return this._send("unloadFont", { url: e });
|
|
@@ -2942,10 +2971,10 @@ var _t = class {
|
|
|
2942
2971
|
}, [t.buffer]);
|
|
2943
2972
|
}
|
|
2944
2973
|
async prepareTextBatch(e, t) {
|
|
2945
|
-
let n = await this._send("prepareTextBatch", {
|
|
2974
|
+
let n = await this._holdCore(this._send("prepareTextBatch", {
|
|
2946
2975
|
fontUrl: e,
|
|
2947
2976
|
texts: t
|
|
2948
|
-
}), r = (e) => e ? {
|
|
2977
|
+
})), r = (e) => e ? {
|
|
2949
2978
|
data: new Uint8Array(e.data),
|
|
2950
2979
|
width: e.width,
|
|
2951
2980
|
height: e.height,
|
|
@@ -2963,9 +2992,18 @@ var _t = class {
|
|
|
2963
2992
|
return this._send("getMemoryStats", void 0);
|
|
2964
2993
|
}
|
|
2965
2994
|
dispose() {
|
|
2966
|
-
this._worker.terminate();
|
|
2995
|
+
this._releaseCoreTimer !== void 0 && (clearTimeout(this._releaseCoreTimer), this._releaseCoreTimer = void 0), this._releaseCore?.(), this._releaseCore = void 0, this._worker.terminate();
|
|
2967
2996
|
for (let e of this._pending.values()) e.reject(/* @__PURE__ */ Error("FontWorkerClient disposed"));
|
|
2968
|
-
this._pending.clear()
|
|
2997
|
+
this._pending.clear();
|
|
2998
|
+
}
|
|
2999
|
+
_holdCore(e) {
|
|
3000
|
+
this._releaseCoreTimer !== void 0 && (clearTimeout(this._releaseCoreTimer), this._releaseCoreTimer = void 0), this._releaseCore ??= this._reserveWorkerCore?.(), this._heavyRequests++;
|
|
3001
|
+
let t = () => {
|
|
3002
|
+
this._heavyRequests--, !(this._heavyRequests > 0 || !this._releaseCore) && (this._releaseCoreTimer = setTimeout(() => {
|
|
3003
|
+
this._releaseCoreTimer = void 0, this._releaseCore?.(), this._releaseCore = void 0;
|
|
3004
|
+
}, St));
|
|
3005
|
+
};
|
|
3006
|
+
return e.then(t, t), e;
|
|
2969
3007
|
}
|
|
2970
3008
|
_send(e, t, n) {
|
|
2971
3009
|
let r = this._nextId++;
|
|
@@ -2980,7 +3018,7 @@ var _t = class {
|
|
|
2980
3018
|
}, n ?? []);
|
|
2981
3019
|
});
|
|
2982
3020
|
}
|
|
2983
|
-
},
|
|
3021
|
+
}, wt = class {
|
|
2984
3022
|
_map = /* @__PURE__ */ new Map();
|
|
2985
3023
|
_maxSize;
|
|
2986
3024
|
constructor(e) {
|
|
@@ -3009,29 +3047,29 @@ var _t = class {
|
|
|
3009
3047
|
this._map.clear();
|
|
3010
3048
|
}
|
|
3011
3049
|
}, $ = (e, t) => `${e}#q=${t}`;
|
|
3012
|
-
function
|
|
3013
|
-
return
|
|
3050
|
+
function Tt(e, t, n, r) {
|
|
3051
|
+
return Dt(e, t, n, r === 4 ? h : g, "");
|
|
3014
3052
|
}
|
|
3015
|
-
function
|
|
3016
|
-
return
|
|
3053
|
+
function Et(e, t, n) {
|
|
3054
|
+
return Dt(e, t, n, h, w);
|
|
3017
3055
|
}
|
|
3018
|
-
function
|
|
3056
|
+
function Dt(e, t, n, r, i) {
|
|
3019
3057
|
let a = new Ke(e, t, n, r, m);
|
|
3020
3058
|
return a.minFilter = f, a.magFilter = f, a.generateMipmaps = !1, a.colorSpace = i, a.needsUpdate = !0, a;
|
|
3021
3059
|
}
|
|
3022
|
-
var
|
|
3060
|
+
var Ot = 1e4, kt = (e) => {
|
|
3023
3061
|
let t = [];
|
|
3024
3062
|
for (let n = 0; n + 1 < e.length; n += 2) t.push({
|
|
3025
3063
|
from: e[n],
|
|
3026
3064
|
to: e[n + 1]
|
|
3027
3065
|
});
|
|
3028
3066
|
return t;
|
|
3029
|
-
},
|
|
3067
|
+
}, At = class {
|
|
3030
3068
|
_workerUrl;
|
|
3031
3069
|
_client;
|
|
3032
3070
|
_clientPromise;
|
|
3033
|
-
_concurrencyManager;
|
|
3034
3071
|
_fontBudgetBytes;
|
|
3072
|
+
_reserveWorkerCore;
|
|
3035
3073
|
_pending = /* @__PURE__ */ new Map();
|
|
3036
3074
|
_loaded = /* @__PURE__ */ new Set();
|
|
3037
3075
|
_shapeCache = /* @__PURE__ */ new Map();
|
|
@@ -3058,9 +3096,6 @@ var St = 1e4, Ct = (e) => {
|
|
|
3058
3096
|
constructor(e) {
|
|
3059
3097
|
this._workerUrl = e;
|
|
3060
3098
|
}
|
|
3061
|
-
setConcurrencyManager(e) {
|
|
3062
|
-
this._concurrencyManager = e;
|
|
3063
|
-
}
|
|
3064
3099
|
registerFontFamily(e) {
|
|
3065
3100
|
this._families.set(e.family, {
|
|
3066
3101
|
family: e.family,
|
|
@@ -3104,20 +3139,22 @@ var St = 1e4, Ct = (e) => {
|
|
|
3104
3139
|
if (t) for (let n of this._families.values()) for (let r of n.faces) r.url === e && (r.unicodeRanges = t);
|
|
3105
3140
|
}
|
|
3106
3141
|
_ensureClient() {
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
return await t.ready(), this._client = t, t;
|
|
3142
|
+
return this._client ? Promise.resolve(this._client) : (this._clientPromise || (this._clientPromise = (async () => {
|
|
3143
|
+
let e = new Ct(this._workerUrl, {
|
|
3144
|
+
fontBudgetBytes: this._fontBudgetBytes,
|
|
3145
|
+
reserveWorkerCore: this._reserveWorkerCore
|
|
3146
|
+
});
|
|
3147
|
+
return await e.ready(), this._client = e, e;
|
|
3114
3148
|
})(), this._clientPromise.catch(() => {
|
|
3115
3149
|
this._clientPromise = void 0;
|
|
3116
|
-
}), this._clientPromise;
|
|
3150
|
+
})), this._clientPromise);
|
|
3117
3151
|
}
|
|
3118
3152
|
setMemoryBudget(e) {
|
|
3119
3153
|
this._fontBudgetBytes = e;
|
|
3120
3154
|
}
|
|
3155
|
+
setWorkerCoreReservation(e) {
|
|
3156
|
+
this._reserveWorkerCore = e;
|
|
3157
|
+
}
|
|
3121
3158
|
async memoryStats() {
|
|
3122
3159
|
return this._client?.getMemoryStats();
|
|
3123
3160
|
}
|
|
@@ -3129,7 +3166,7 @@ var St = 1e4, Ct = (e) => {
|
|
|
3129
3166
|
}
|
|
3130
3167
|
if (this._pending.has(r)) return this._refCount.set(r, (this._refCount.get(r) ?? 0) + 1), this._pending.get(r);
|
|
3131
3168
|
let i = n ? $(n, t) : void 0, a = this._fetchAndLoad(e, r, i, t);
|
|
3132
|
-
this._refCount.set(r, 1), this._pending.set(r, a), this._shapeCache.set(r, new
|
|
3169
|
+
this._refCount.set(r, 1), this._pending.set(r, a), this._shapeCache.set(r, new wt(Ot));
|
|
3133
3170
|
try {
|
|
3134
3171
|
await a, this._loaded.add(r), this._atlasKeys.set(r, i ?? r);
|
|
3135
3172
|
} catch (e) {
|
|
@@ -3199,7 +3236,7 @@ var St = 1e4, Ct = (e) => {
|
|
|
3199
3236
|
let e = this._segmentTextByFace(t.faces, n);
|
|
3200
3237
|
await Promise.all(e.map((e) => this._prepareSingleFontText(e.url, e.text, r)));
|
|
3201
3238
|
let a = this._stitchSegments(e, r), o = this._shapeCache.get(i);
|
|
3202
|
-
o || (o = new
|
|
3239
|
+
o || (o = new wt(Ot), this._shapeCache.set(i, o)), a._generation = this._currentGen(i), o.set(n, a);
|
|
3203
3240
|
})();
|
|
3204
3241
|
this._preparePending.set(a, o);
|
|
3205
3242
|
try {
|
|
@@ -3209,18 +3246,19 @@ var St = 1e4, Ct = (e) => {
|
|
|
3209
3246
|
}
|
|
3210
3247
|
}
|
|
3211
3248
|
_stitchSegments(e, t) {
|
|
3212
|
-
let n = [], r = /* @__PURE__ */ new Map(), i = 0, a = 0, o = 0, s = 0;
|
|
3213
|
-
for (let
|
|
3214
|
-
let e = this._shapeCache.get($(
|
|
3249
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = 0, a = 0, o = 0, s = 0, c = !0;
|
|
3250
|
+
for (let l of e) {
|
|
3251
|
+
let e = this._shapeCache.get($(l.url, t))?.get(l.text);
|
|
3215
3252
|
if (!e) continue;
|
|
3216
3253
|
i === 0 && (i = e.unitsPerEm, a = e.ascender, o = e.descender, s = e.lineGap);
|
|
3217
|
-
let
|
|
3218
|
-
|
|
3254
|
+
let u = i / e.unitsPerEm;
|
|
3255
|
+
c &&= e.allowsLetterSpacing;
|
|
3256
|
+
for (let t of e.glyphs) n.push(u === 1 ? t : {
|
|
3219
3257
|
...t,
|
|
3220
|
-
xAdvance: t.xAdvance *
|
|
3221
|
-
yAdvance: t.yAdvance *
|
|
3222
|
-
xOffset: t.xOffset *
|
|
3223
|
-
yOffset: t.yOffset *
|
|
3258
|
+
xAdvance: t.xAdvance * u,
|
|
3259
|
+
yAdvance: t.yAdvance * u,
|
|
3260
|
+
xOffset: t.xOffset * u,
|
|
3261
|
+
yOffset: t.yOffset * u
|
|
3224
3262
|
});
|
|
3225
3263
|
for (let t of e.metrics) {
|
|
3226
3264
|
let e = `${t.fontIndex}:${t.glyphId}`;
|
|
@@ -3233,14 +3271,16 @@ var St = 1e4, Ct = (e) => {
|
|
|
3233
3271
|
unitsPerEm: 1e3,
|
|
3234
3272
|
ascender: 800,
|
|
3235
3273
|
descender: -200,
|
|
3236
|
-
lineGap: 0
|
|
3274
|
+
lineGap: 0,
|
|
3275
|
+
allowsLetterSpacing: c
|
|
3237
3276
|
} : {
|
|
3238
3277
|
glyphs: n,
|
|
3239
3278
|
metrics: [...r.values()],
|
|
3240
3279
|
unitsPerEm: i,
|
|
3241
3280
|
ascender: a,
|
|
3242
3281
|
descender: o,
|
|
3243
|
-
lineGap: s
|
|
3282
|
+
lineGap: s,
|
|
3283
|
+
allowsLetterSpacing: c
|
|
3244
3284
|
};
|
|
3245
3285
|
}
|
|
3246
3286
|
getAtlas(e, t) {
|
|
@@ -3248,14 +3288,14 @@ var St = 1e4, Ct = (e) => {
|
|
|
3248
3288
|
return this._atlasCache.get(n);
|
|
3249
3289
|
}
|
|
3250
3290
|
getAtlasTexture(e, t) {
|
|
3251
|
-
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._atlasCache, this._atlasDirty, this._textureCache, (e) =>
|
|
3291
|
+
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._atlasCache, this._atlasDirty, this._textureCache, (e) => Tt(e.data, e.width, e.height, e.channels));
|
|
3252
3292
|
}
|
|
3253
3293
|
getColorAtlas(e, t) {
|
|
3254
3294
|
let n = this._resolveAtlasKey(e, t);
|
|
3255
3295
|
return this._colorAtlasCache.get(n);
|
|
3256
3296
|
}
|
|
3257
3297
|
getColorAtlasTexture(e, t) {
|
|
3258
|
-
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._colorAtlasCache, this._colorAtlasDirty, this._colorTextureCache, (e) =>
|
|
3298
|
+
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._colorAtlasCache, this._colorAtlasDirty, this._colorTextureCache, (e) => Et(e.data, e.width, e.height));
|
|
3259
3299
|
}
|
|
3260
3300
|
_getOrUpdateTexture(e, t, n, r, i) {
|
|
3261
3301
|
if (!n.has(e)) {
|
|
@@ -3342,7 +3382,7 @@ var St = 1e4, Ct = (e) => {
|
|
|
3342
3382
|
if (!a.ok) throw Error(`FontManager: failed to fetch font from ${e}: ${a.status}`);
|
|
3343
3383
|
let o = await a.arrayBuffer(), s = await i.loadFont(t, o, n, r);
|
|
3344
3384
|
if (!s.ok) throw Error(`FontManager: WASM failed to load font from ${e}`);
|
|
3345
|
-
s.cmapRanges?.length && !this._cmapRanges.has(e) && (this._cmapRanges.set(e,
|
|
3385
|
+
s.cmapRanges?.length && !this._cmapRanges.has(e) && (this._cmapRanges.set(e, kt(s.cmapRanges)), this._applyCmapRanges(e));
|
|
3346
3386
|
}
|
|
3347
3387
|
async _flushBatch() {
|
|
3348
3388
|
this._batchScheduled = !1;
|
|
@@ -3370,11 +3410,14 @@ var St = 1e4, Ct = (e) => {
|
|
|
3370
3410
|
};
|
|
3371
3411
|
await Promise.all([...e].map(([e, t]) => n(e, t)));
|
|
3372
3412
|
}
|
|
3373
|
-
},
|
|
3413
|
+
}, jt = 64, Mt = 64, Nt = (e) => e ? 16 : 35, Pt = (e) => e ? 8 : 12, Ft = {
|
|
3374
3414
|
Normal: 0,
|
|
3375
3415
|
Whitespace: 1,
|
|
3376
3416
|
Newline: 2,
|
|
3377
3417
|
Ideographic: 3
|
|
3418
|
+
}, It = {
|
|
3419
|
+
Neutral: 0,
|
|
3420
|
+
Ltr: 1,
|
|
3421
|
+
Rtl: 2
|
|
3378
3422
|
};
|
|
3379
|
-
|
|
3380
|
-
export { Tt as COLOR_GLYPH_PX_SIZE, wt as FontManager, _t as FontWorkerClient, Ot as GlyphCharClass, vt as LRUMap, Et as SDF_PX_SIZE, Dt as atlasRangePx, bt as createColorAtlasTexture, yt as createSdfAtlasTexture, s as fetchFontFamilyFromCss, a as parseCssUnicodeRange, o as parseFontFamilyFromCss };
|
|
3423
|
+
export { jt as COLOR_GLYPH_PX_SIZE, At as FontManager, Ct as FontWorkerClient, Ft as GlyphCharClass, It as GlyphDirection, wt as LRUMap, Mt as SDF_PX_SIZE, Pt as atlasPaddingPx, Nt as atlasRangePx, Et as createColorAtlasTexture, Tt as createSdfAtlasTexture, s as fetchFontFamilyFromCss, a as parseCssUnicodeRange, o as parseFontFamilyFromCss };
|