babylonjs-serializers 9.26.2 → 9.27.1
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/babylon.glTF2Serializer.js +1 -1
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylonjs.serializers.d.ts +133 -3
- package/babylonjs.serializers.es5.js +1374 -1268
- package/babylonjs.serializers.js +1 -1
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/babylonjs.serializers.module.d.ts +281 -7
- package/package.json +3 -3
|
@@ -720,8 +720,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
720
720
|
case "VEC2": return 2;
|
|
721
721
|
case "VEC3": return 3;
|
|
722
722
|
} }
|
|
723
|
-
function
|
|
724
|
-
function
|
|
723
|
+
function F(e) { return e.some(function (e) { return e >= 256; }); }
|
|
724
|
+
function V(e) { switch (e) {
|
|
725
725
|
case t.VertexBuffer.PositionKind:
|
|
726
726
|
case t.VertexBuffer.NormalKind:
|
|
727
727
|
case t.VertexBuffer.TangentKind:
|
|
@@ -970,63 +970,63 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
-
G._CreateNodeAndMorphAnimationFromAnimationGroups = function (e, n, s, r, i, o, a, l, u) {
|
|
973
|
+
G._CreateNodeAndMorphAnimationFromAnimationGroups = function (e, n, s, r, i, o, a, l, u, c) {
|
|
974
974
|
var e_31, _a;
|
|
975
|
-
var c;
|
|
976
975
|
var h;
|
|
976
|
+
var d;
|
|
977
977
|
if (e.animationGroups) {
|
|
978
|
-
var
|
|
979
|
-
var _loop_1 = function (
|
|
980
|
-
var
|
|
981
|
-
|
|
978
|
+
var f_5 = e.animationGroups;
|
|
979
|
+
var _loop_1 = function (p_4) {
|
|
980
|
+
var f_6 = new Map, m_4 = new Map, g_4 = new Set, x_4 = p_4.to - p_4.from;
|
|
981
|
+
d = { name: p_4.name, channels: [], samplers: [] };
|
|
982
982
|
var _loop_2 = function (n_18) {
|
|
983
|
-
var
|
|
983
|
+
var c_4 = p_4.targetedAnimations[n_18], x_5 = c_4.target, _4 = c_4.animation;
|
|
984
984
|
if (u && !u(_4))
|
|
985
985
|
return "continue";
|
|
986
|
-
var T_3 = l.has(
|
|
987
|
-
if (this_1._IsTransformable(
|
|
988
|
-
var e_32 = G._DeduceAnimationInfo(
|
|
986
|
+
var T_3 = l.has(x_5);
|
|
987
|
+
if (this_1._IsTransformable(x_5) || 1 === x_5.length && this_1._IsTransformable(x_5[0])) {
|
|
988
|
+
var e_32 = G._DeduceAnimationInfo(c_4.animation);
|
|
989
989
|
if (e_32) {
|
|
990
|
-
var t_16 = this_1._IsTransformable(
|
|
991
|
-
t_16 && G._AddAnimation("".concat(_4.name),
|
|
990
|
+
var t_16 = this_1._IsTransformable(x_5) ? x_5 : this_1._IsTransformable(x_5[0]) ? x_5[0] : null;
|
|
991
|
+
t_16 && G._AddAnimation("".concat(_4.name), d, t_16, _4, e_32.dataAccessorType, e_32.animationChannelTargetPath, s, r, i, o, e_32.useQuaternion, a, T_3);
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
else if ((
|
|
995
|
-
var n_19 =
|
|
994
|
+
else if ((x_5 instanceof t.MorphTarget || 1 === x_5.length && x_5[0] instanceof t.MorphTarget) && G._DeduceAnimationInfo(c_4.animation)) {
|
|
995
|
+
var n_19 = x_5 instanceof t.MorphTarget ? x_5 : x_5[0];
|
|
996
996
|
if (n_19) {
|
|
997
997
|
var t_17 = e.morphTargetManagers.find(function (e) { for (var t_18 = 0; t_18 < e.numTargets; ++t_18)
|
|
998
998
|
if (e.getTarget(t_18) === n_19)
|
|
999
999
|
return !0; return !1; });
|
|
1000
1000
|
if (t_17) {
|
|
1001
1001
|
var s_14 = e.meshes.find(function (e) { return e.morphTargetManager === t_17; });
|
|
1002
|
-
s_14 && (
|
|
1002
|
+
s_14 && (f_6.has(s_14) || f_6.set(s_14, new Map), null === (h = f_6.get(s_14)) || void 0 === h || h.set(n_19, _4), g_4.add(s_14), m_4.set(s_14, _4));
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
};
|
|
1007
|
-
for (var n_18 = 0; n_18 <
|
|
1007
|
+
for (var n_18 = 0; n_18 < p_4.targetedAnimations.length; ++n_18) {
|
|
1008
1008
|
_loop_2(n_18);
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1010
|
+
g_4.forEach(function (e) { var n = e.morphTargetManager; var l = null; var u = [], c = m_4.get(e).getKeys(), h = c.length; for (var s_15 = 0; s_15 < h; ++s_15)
|
|
1011
1011
|
for (var r_10 = 0; r_10 < n.numTargets; ++r_10) {
|
|
1012
|
-
var i_7 = n.getTarget(r_10), o_6 =
|
|
1012
|
+
var i_7 = n.getTarget(r_10), o_6 = f_6.get(e);
|
|
1013
1013
|
if (o_6) {
|
|
1014
1014
|
var n_20 = o_6.get(i_7);
|
|
1015
|
-
n_20 ? (l || (l = new t.Animation("".concat(
|
|
1015
|
+
n_20 ? (l || (l = new t.Animation("".concat(p_4.name, "_").concat(e.name, "_MorphWeightAnimation"), "influence", n_20.framePerSecond, t.Animation.ANIMATIONTYPE_FLOAT, n_20.loopMode, n_20.enableBlending)), u.push(n_20.getKeys()[s_15])) : u.push({ frame: p_4.from + x_4 / h * s_15, value: i_7.influence, inTangent: c[0].inTangent ? 0 : void 0, outTangent: c[0].outTangent ? 0 : void 0 });
|
|
1016
1016
|
}
|
|
1017
|
-
} l.setKeys(u, !0); var
|
|
1017
|
+
} l.setKeys(u, !0); var g = G._DeduceAnimationInfo(l); g && G._AddAnimation("".concat(p_4.name, "_").concat(e.name, "_MorphWeightAnimation"), d, e, l, g.dataAccessorType, g.animationChannelTargetPath, s, r, i, o, g.useQuaternion, a, !1, null == n ? void 0 : n.numTargets); }), d.channels.length && d.samplers.length && (null == c || c.set(p_4, n.length), n.push(d));
|
|
1018
1018
|
};
|
|
1019
1019
|
var this_1 = this;
|
|
1020
1020
|
try {
|
|
1021
|
-
for (var
|
|
1022
|
-
var
|
|
1023
|
-
_loop_1(
|
|
1021
|
+
for (var f_4 = __values(f_5), f_4_1 = f_4.next(); !f_4_1.done; f_4_1 = f_4.next()) {
|
|
1022
|
+
var p_4 = f_4_1.value;
|
|
1023
|
+
_loop_1(p_4);
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
1027
1027
|
finally {
|
|
1028
1028
|
try {
|
|
1029
|
-
if (
|
|
1029
|
+
if (f_4_1 && !f_4_1.done && (_a = f_4.return)) _a.call(f_4);
|
|
1030
1030
|
}
|
|
1031
1031
|
finally { if (e_31) throw e_31.error; }
|
|
1032
1032
|
}
|
|
@@ -1042,16 +1042,16 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
var e_34 = a.get(s), r_11 = new Float32Array(m.inputs);
|
|
1044
1044
|
g = l.createBufferView(r_11), x = l.createAccessor(g, "SCALAR", 5126, m.inputs.length, void 0, { min: [m.inputsMin], max: [m.inputsMax] }), c.push(x), _ = c.length - 1;
|
|
1045
|
-
var u_4 = new t.Quaternion, h_4 = new t.Vector3,
|
|
1045
|
+
var u_4 = new t.Quaternion, h_4 = new t.Vector3, d_4 = new t.Vector3, v_3 = s instanceof t.Camera, M_2 = S(i), w_2 = new Float32Array(m.outputs.length * M_2);
|
|
1046
1046
|
m.outputs.forEach(function (e, n) { var s = e; switch (o) {
|
|
1047
1047
|
case "translation":
|
|
1048
|
-
f && (t.Vector3.FromArrayToRef(e, 0,
|
|
1048
|
+
f && (t.Vector3.FromArrayToRef(e, 0, d_4), B(d_4), d_4.toArray(s));
|
|
1049
1049
|
break;
|
|
1050
1050
|
case "rotation": 4 === e.length ? t.Quaternion.FromArrayToRef(e, 0, u_4) : (s = new Array(4), t.Vector3.FromArrayToRef(e, 0, h_4), t.Quaternion.FromEulerVectorToRef(h_4, u_4)), f && (P(u_4), v_3 && U(u_4)), u_4.toArray(s);
|
|
1051
1051
|
} w_2.set(s, n * M_2); }), g = l.createBufferView(w_2), x = l.createAccessor(g, i, 5126, m.outputs.length), c.push(x), T = c.length - 1, y = { interpolation: m.samplerInterpolation, input: _, output: T }, n.samplers.push(y), b = { sampler: n.samplers.length - 1, target: { node: e_34, path: o } }, n.channels.push(b);
|
|
1052
1052
|
} };
|
|
1053
|
-
G._CreateBakedAnimation = function (e, n, s, r, i, o, a, l, u, c, h) { var d; var f = t.Quaternion.Identity(); var p, m, g, x, _, T = null, y = null; c.min = t.Tools.FloatRound(r / o); var b = n.getKeys(); for (var r_12 = 0,
|
|
1054
|
-
if (m = b[r_12], r_12 + 1 <
|
|
1053
|
+
G._CreateBakedAnimation = function (e, n, s, r, i, o, a, l, u, c, h) { var d; var f = t.Quaternion.Identity(); var p, m, g, x, _, T = null, y = null; c.min = t.Tools.FloatRound(r / o); var b = n.getKeys(); for (var r_12 = 0, c_5 = b.length; r_12 < c_5; ++r_12) {
|
|
1054
|
+
if (m = b[r_12], r_12 + 1 < c_5)
|
|
1055
1055
|
if (g = b[r_12 + 1], m.value.equals && m.value.equals(g.value) || m.value === g.value) {
|
|
1056
1056
|
if (0 !== r_12)
|
|
1057
1057
|
continue;
|
|
@@ -1187,7 +1187,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1187
1187
|
var i_9 = t.Vector3.FromArray(o_8, 3 * s_16);
|
|
1188
1188
|
t.Vector3.FromArray(r_14, 3 * s_16).subtractToRef(i_9, c), c.x *= u, n_28[0] = Math.min(n_28[0], c.x), l_6[0] = Math.max(l_6[0], c.x), n_28[1] = Math.min(n_28[1], c.y), l_6[1] = Math.max(l_6[1], c.y), n_28[2] = Math.min(n_28[2], c.z), l_6[2] = Math.max(l_6[2], c.z), e_39[3 * s_16] = c.x, e_39[3 * s_16 + 1] = c.y, e_39[3 * s_16 + 2] = c.z;
|
|
1189
1189
|
}
|
|
1190
|
-
var
|
|
1190
|
+
var f_7 = s.createBufferView(e_39, 12), p_5 = s.createAccessor(f_7, "VEC3", 5126, r_14.length / 3, 0, { min: n_28, max: l_6 });
|
|
1191
1191
|
i.push(p_5), a.attributes.POSITION = i.length - 1;
|
|
1192
1192
|
}
|
|
1193
1193
|
else
|
|
@@ -1241,8 +1241,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
else
|
|
1243
1243
|
t.Tools.Warn("Unsupported number of components for color attribute: ".concat(e_42));
|
|
1244
|
-
var l_9 = s.createBufferView(n_33, 4 * e_42),
|
|
1245
|
-
i.push(
|
|
1244
|
+
var l_9 = s.createBufferView(n_33, 4 * e_42), f_8 = s.createAccessor(l_9, 3 === e_42 ? "VEC3" : "VEC4", 5126, d, 0);
|
|
1245
|
+
i.push(f_8), a.attributes.COLOR_0 = i.length - 1;
|
|
1246
1246
|
}
|
|
1247
1247
|
else
|
|
1248
1248
|
t.Tools.Warn("Morph target colors for mesh ".concat(n.name, " were not exported. Mesh does not have colors vertex data"));
|
|
@@ -1272,9 +1272,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1272
1272
|
var Z = /** @class */ (function () {
|
|
1273
1273
|
function Z(e, n) {
|
|
1274
1274
|
if (e === void 0) { e = t.EngineStore.LastCreatedScene; }
|
|
1275
|
-
if (this._glTF = { asset: { generator: "Babylon.js v".concat(t.Engine.Version), version: "2.0" } }, this._animations = [], this._accessors = [], this._bufferViews = [], this._cameras = [], this._images = [], this._materials = [], this._meshes = [], this._nodes = [], this._samplers = [], this._scenes = [], this._skins = [], this._textures = [], this._imageData = {}, this._shouldUseGlb = !1, this._materialExporter = new v(this), this._extensions = {}, this._bufferManager = new j, this._shouldExportNodeMap = new Map, this._nodeMap = new Map, this._materialMap = new Map, this._camerasMap = new Map, this._nodesCameraMap = new Map, this._skinMap = new Map, this._nodesSkinMap = new Map, this._materialNeedsUVsSet = new Set, !e)
|
|
1275
|
+
if (this._glTF = { asset: { generator: "Babylon.js v".concat(t.Engine.Version), version: "2.0" } }, this._animations = [], this._accessors = [], this._bufferViews = [], this._cameras = [], this._images = [], this._materials = [], this._meshes = [], this._nodes = [], this._samplers = [], this._scenes = [], this._skins = [], this._textures = [], this._imageData = {}, this._shouldUseGlb = !1, this._materialExporter = new v(this), this._extensions = {}, this._bufferManager = new j, this._shouldExportNodeMap = new Map, this._nodeMap = new Map, this._animationGroupMap = new Map, this._materialMap = new Map, this._camerasMap = new Map, this._nodesCameraMap = new Map, this._skinMap = new Map, this._nodesSkinMap = new Map, this._materialNeedsUVsSet = new Set, !e)
|
|
1276
1276
|
throw new Error("No scene available to export");
|
|
1277
|
-
this._babylonScene = e, this._options = Object.assign({ shouldExportNode: function () { return !0; }, shouldExportAnimation: function () { return !0; }, metadataSelector: function (e) { var t; return null === (t = null == e ? void 0 : e.gltf) || void 0 === t ? void 0 : t.extras; }, animationSampleRate: 1 / 60, exportWithoutWaitingForScene: !1, exportUnusedUVs: !1, removeNoopRootNodes: !0, includeCoordinateSystemConversionNodes: !1, meshCompressionMethod: "None" }, n), this._loadExtensions();
|
|
1277
|
+
this._babylonScene = e, this._options = Object.assign({ shouldExportNode: function () { return !0; }, shouldExportAnimation: function () { return !0; }, metadataSelector: function (e) { var t; return null === (t = null == e ? void 0 : e.gltf) || void 0 === t ? void 0 : t.extras; }, animationSampleRate: 1 / 60, exportWithoutWaitingForScene: !1, exportUnusedUVs: !1, removeNoopRootNodes: !0, includeCoordinateSystemConversionNodes: !1, meshCompressionMethod: "None", khrInteractivity: void 0 }, n), this._loadExtensions();
|
|
1278
1278
|
}
|
|
1279
1279
|
Z.prototype._ApplyExtension = function (e, t, n, s) {
|
|
1280
1280
|
var _this = this;
|
|
@@ -1683,7 +1683,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
};
|
|
1685
1685
|
Z.prototype._exportSceneAsync = function () { return c(this, void 0, void 0, function () {
|
|
1686
|
-
var e, t_33, n, s, r, i, _a, _b, e_76, _c, _g, n_39, e_77, _h, _j, e_78, t_34,
|
|
1686
|
+
var e, t_33, n, s, r, i, o, _a, _b, e_76, _c, _g, n_39, e_77, _h, _j, e_78, t_34, a_9, a, _k, _l, _p, _q, l, _r, _u, _v, _x, u, _y, _z, _0, _5;
|
|
1687
1687
|
var e_73, _6, e_74, _7, e_75, _8, _9, _10, _11;
|
|
1688
1688
|
return __generator(this, function (_12) {
|
|
1689
1689
|
switch (_12.label) {
|
|
@@ -1693,8 +1693,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1693
1693
|
t_33 = this._options.metadataSelector(this._babylonScene.metadata);
|
|
1694
1694
|
t_33 && (e.extras = t_33);
|
|
1695
1695
|
}
|
|
1696
|
-
n = new Array, s = new Array, r = new Array;
|
|
1697
|
-
if (
|
|
1696
|
+
n = new Array, s = new Array, r = new Array, i = this._options.removeNoopRootNodes && !this._options.khrInteractivity;
|
|
1697
|
+
if (i && !this._options.includeCoordinateSystemConversionNodes)
|
|
1698
1698
|
try {
|
|
1699
1699
|
for (_a = __values(this._babylonScene.animationGroups), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
1700
1700
|
e_76 = _b.value;
|
|
@@ -1702,7 +1702,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1702
1702
|
for (_c = (e_74 = void 0, __values(e_76.targetedAnimations)), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
1703
1703
|
n_39 = _g.value;
|
|
1704
1704
|
e_77 = n_39.target;
|
|
1705
|
-
e_77 instanceof t.TransformNode && !e_77.parent && (null !=
|
|
1705
|
+
e_77 instanceof t.TransformNode && !e_77.parent && (null != o ? o : o = new Set).add(e_77);
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
catch (e_74_1) { e_74 = { error: e_74_1 }; }
|
|
@@ -1724,8 +1724,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1724
1724
|
try {
|
|
1725
1725
|
for (_h = __values(this._babylonScene.rootNodes), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
1726
1726
|
e_78 = _j.value;
|
|
1727
|
-
t_34 = e_78.animations,
|
|
1728
|
-
|
|
1727
|
+
t_34 = e_78.animations, a_9 = !!t_34 && t_34.length > 0 || (null == o ? void 0 : o.has(e_78));
|
|
1728
|
+
i && !this._options.includeCoordinateSystemConversionNodes && w(e_78, this._babylonScene.useRightHandedSystem) && !a_9 ? r.push.apply(r, __spreadArray([], __read(e_78.getChildren()), false)) : this._babylonScene.useRightHandedSystem ? n.push(e_78) : s.push(e_78);
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
1731
|
catch (e_75_1) { e_75 = { error: e_75_1 }; }
|
|
@@ -1736,35 +1736,88 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1736
1736
|
finally { if (e_75) throw e_75.error; }
|
|
1737
1737
|
}
|
|
1738
1738
|
this._listAvailableCameras(), this._listAvailableSkeletons();
|
|
1739
|
-
|
|
1739
|
+
a = new Q(!0, !1);
|
|
1740
1740
|
_l = (_k = (_9 = e.nodes).push).apply;
|
|
1741
1741
|
_p = [_9];
|
|
1742
1742
|
_q = [[]];
|
|
1743
|
-
return [4 /*yield*/, this._exportNodesAsync(s,
|
|
1743
|
+
return [4 /*yield*/, this._exportNodesAsync(s, a)];
|
|
1744
1744
|
case 1:
|
|
1745
1745
|
_l.apply(_k, _p.concat([__spreadArray.apply(void 0, _q.concat([__read.apply(void 0, [_12.sent()]), false]))]));
|
|
1746
|
-
|
|
1746
|
+
l = new Q(!1, !1);
|
|
1747
1747
|
_u = (_r = (_10 = e.nodes).push).apply;
|
|
1748
1748
|
_v = [_10];
|
|
1749
1749
|
_x = [[]];
|
|
1750
|
-
return [4 /*yield*/, this._exportNodesAsync(n,
|
|
1750
|
+
return [4 /*yield*/, this._exportNodesAsync(n, l)];
|
|
1751
1751
|
case 2:
|
|
1752
1752
|
_u.apply(_r, _v.concat([__spreadArray.apply(void 0, _x.concat([__read.apply(void 0, [_12.sent()]), false]))]));
|
|
1753
|
-
|
|
1753
|
+
u = new Q(!1, !0);
|
|
1754
1754
|
_z = (_y = (_11 = e.nodes).push).apply;
|
|
1755
1755
|
_0 = [_11];
|
|
1756
1756
|
_5 = [[]];
|
|
1757
|
-
return [4 /*yield*/, this._exportNodesAsync(r,
|
|
1757
|
+
return [4 /*yield*/, this._exportNodesAsync(r, u)];
|
|
1758
1758
|
case 3:
|
|
1759
|
-
_z.apply(_y, _0.concat([__spreadArray.apply(void 0, _5.concat([__read.apply(void 0, [_12.sent()]), false]))])), e.nodes.length && this._scenes.push(e), this._exportAndAssignCameras(), this._exportAndAssignSkeletons(
|
|
1759
|
+
_z.apply(_y, _0.concat([__spreadArray.apply(void 0, _5.concat([__read.apply(void 0, [_12.sent()]), false]))])), e.nodes.length && this._scenes.push(e), this._exportAndAssignCameras(), this._exportAndAssignSkeletons(a.getNodesSet()), this._babylonScene.animationGroups.length && G._CreateNodeAndMorphAnimationFromAnimationGroups(this._babylonScene, this._animations, this._nodeMap, this._bufferManager, this._bufferViews, this._accessors, this._animationSampleRate, a.getNodesSet(), this._options.shouldExportAnimation, this._animationGroupMap);
|
|
1760
1760
|
return [2 /*return*/];
|
|
1761
1761
|
}
|
|
1762
1762
|
});
|
|
1763
1763
|
}); };
|
|
1764
|
+
Z.prototype._getNodeIndex = function (e) { return this._nodeMap.get(e); };
|
|
1765
|
+
Z.prototype._getAnimationIndex = function (e) { return this._animationGroupMap.get(e); };
|
|
1766
|
+
Z.prototype._getCameraIndex = function (e) { var t = this._camerasMap.get(e); if (!t)
|
|
1767
|
+
return; var n = this._cameras.indexOf(t); return n >= 0 ? n : void 0; };
|
|
1768
|
+
Z.prototype._getMaterialIndex = function (e) { return this._materialMap.get(e); };
|
|
1769
|
+
Z.prototype._getRootIndex = function (e, t) {
|
|
1770
|
+
var e_79, _a;
|
|
1771
|
+
var n, s, r, i, o, a, l;
|
|
1772
|
+
switch (e) {
|
|
1773
|
+
case "nodes": return this._getNodeIndex(t);
|
|
1774
|
+
case "animations": return this._getAnimationIndex(t);
|
|
1775
|
+
case "cameras": return this._getCameraIndex(t);
|
|
1776
|
+
case "materials": return this._getMaterialIndex(t);
|
|
1777
|
+
case "meshes": {
|
|
1778
|
+
var e_80 = this._getNodeIndex(t);
|
|
1779
|
+
return void 0 === e_80 || null === (n = this._nodes[e_80]) || void 0 === n ? void 0 : n.mesh;
|
|
1780
|
+
}
|
|
1781
|
+
case "textures": return null === (s = this._materialExporter.getTextureInfo(t)) || void 0 === s ? void 0 : s.index;
|
|
1782
|
+
case "images": {
|
|
1783
|
+
var e_81 = null === (r = this._materialExporter.getTextureInfo(t)) || void 0 === r ? void 0 : r.index;
|
|
1784
|
+
if (void 0 === e_81)
|
|
1785
|
+
return;
|
|
1786
|
+
var n_40 = this._textures[e_81];
|
|
1787
|
+
try {
|
|
1788
|
+
for (var _b = __values(["KHR_texture_basisu", "EXT_texture_webp", "EXT_texture_avif"]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1789
|
+
var e_82 = _c.value;
|
|
1790
|
+
var t_35 = null === (o = null === (i = null == n_40 ? void 0 : n_40.extensions) || void 0 === i ? void 0 : i[e_82]) || void 0 === o ? void 0 : o.source;
|
|
1791
|
+
if ("number" == typeof t_35)
|
|
1792
|
+
return t_35;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
catch (e_79_1) { e_79 = { error: e_79_1 }; }
|
|
1796
|
+
finally {
|
|
1797
|
+
try {
|
|
1798
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1799
|
+
}
|
|
1800
|
+
finally { if (e_79) throw e_79.error; }
|
|
1801
|
+
}
|
|
1802
|
+
return null == n_40 ? void 0 : n_40.source;
|
|
1803
|
+
}
|
|
1804
|
+
case "samplers": {
|
|
1805
|
+
var e_83 = null === (a = this._materialExporter.getTextureInfo(t)) || void 0 === a ? void 0 : a.index;
|
|
1806
|
+
return void 0 === e_83 || null === (l = this._textures[e_83]) || void 0 === l ? void 0 : l.sampler;
|
|
1807
|
+
}
|
|
1808
|
+
case "skins": {
|
|
1809
|
+
var e_84 = this._skinMap.get(t), n_41 = e_84 ? this._skins.indexOf(e_84) : -1;
|
|
1810
|
+
return n_41 >= 0 ? n_41 : void 0;
|
|
1811
|
+
}
|
|
1812
|
+
case "scenes": return t === this._babylonScene && this._scenes.length > 0 ? 0 : void 0;
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
Z.prototype._setNodeExtension = function (e, t, n) { var s = this._nodes[e]; if (!s)
|
|
1816
|
+
throw new Error("Cannot write ".concat(t, ": glTF node ").concat(e, " does not exist.")); s.extensions || (s.extensions = {}), s.extensions[t] = n; };
|
|
1764
1817
|
Z.prototype._shouldExportNode = function (e) { var t = this._shouldExportNodeMap.get(e); return void 0 === t && (t = this._options.shouldExportNode(e), this._shouldExportNodeMap.set(e, t)), t; };
|
|
1765
1818
|
Z.prototype._exportNodesAsync = function (e, t) { return c(this, void 0, void 0, function () {
|
|
1766
|
-
var n,
|
|
1767
|
-
var
|
|
1819
|
+
var n, e_85, e_85_1, s_25, e_86_1;
|
|
1820
|
+
var e_86, _a;
|
|
1768
1821
|
return __generator(this, function (_b) {
|
|
1769
1822
|
switch (_b.label) {
|
|
1770
1823
|
case 0:
|
|
@@ -1773,250 +1826,250 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1773
1826
|
_b.label = 1;
|
|
1774
1827
|
case 1:
|
|
1775
1828
|
_b.trys.push([1, 6, 7, 8]);
|
|
1776
|
-
|
|
1829
|
+
e_85 = __values(e), e_85_1 = e_85.next();
|
|
1777
1830
|
_b.label = 2;
|
|
1778
1831
|
case 2:
|
|
1779
|
-
if (!!
|
|
1780
|
-
s_25 =
|
|
1832
|
+
if (!!e_85_1.done) return [3 /*break*/, 5];
|
|
1833
|
+
s_25 = e_85_1.value;
|
|
1781
1834
|
return [4 /*yield*/, this._exportNodeAsync(s_25, n, t)];
|
|
1782
1835
|
case 3:
|
|
1783
1836
|
_b.sent();
|
|
1784
1837
|
_b.label = 4;
|
|
1785
1838
|
case 4:
|
|
1786
|
-
|
|
1839
|
+
e_85_1 = e_85.next();
|
|
1787
1840
|
return [3 /*break*/, 2];
|
|
1788
1841
|
case 5: return [3 /*break*/, 8];
|
|
1789
1842
|
case 6:
|
|
1790
|
-
|
|
1791
|
-
|
|
1843
|
+
e_86_1 = _b.sent();
|
|
1844
|
+
e_86 = { error: e_86_1 };
|
|
1792
1845
|
return [3 /*break*/, 8];
|
|
1793
1846
|
case 7:
|
|
1794
1847
|
try {
|
|
1795
|
-
if (
|
|
1848
|
+
if (e_85_1 && !e_85_1.done && (_a = e_85.return)) _a.call(e_85);
|
|
1796
1849
|
}
|
|
1797
|
-
finally { if (
|
|
1850
|
+
finally { if (e_86) throw e_86.error; }
|
|
1798
1851
|
return [7 /*endfinally*/];
|
|
1799
1852
|
case 8: return [2 /*return*/, n];
|
|
1800
1853
|
}
|
|
1801
1854
|
});
|
|
1802
1855
|
}); };
|
|
1803
1856
|
Z.prototype._collectBuffers = function (e, n, s, r, i) {
|
|
1804
|
-
var
|
|
1857
|
+
var e_87, _a;
|
|
1805
1858
|
if (this._shouldExportNode(e) && e instanceof t.AbstractMesh && e.geometry) {
|
|
1806
|
-
var
|
|
1807
|
-
if (
|
|
1808
|
-
for (var r_23 in
|
|
1809
|
-
if (!
|
|
1859
|
+
var t_36 = e.geometry.getVertexBuffers();
|
|
1860
|
+
if (t_36)
|
|
1861
|
+
for (var r_23 in t_36) {
|
|
1862
|
+
if (!V(r_23))
|
|
1810
1863
|
continue;
|
|
1811
|
-
var
|
|
1812
|
-
i.setHasVertexColorAlpha(
|
|
1813
|
-
var
|
|
1814
|
-
n.set(
|
|
1815
|
-
var u_7 = s.get(
|
|
1816
|
-
s.set(
|
|
1864
|
+
var o_14 = t_36[r_23];
|
|
1865
|
+
i.setHasVertexColorAlpha(o_14, e.hasVertexAlpha);
|
|
1866
|
+
var a_10 = o_14._buffer, l_13 = n.get(a_10) || [];
|
|
1867
|
+
n.set(a_10, l_13), -1 === l_13.indexOf(o_14) && l_13.push(o_14);
|
|
1868
|
+
var u_7 = s.get(o_14) || [];
|
|
1869
|
+
s.set(o_14, u_7), -1 === u_7.indexOf(e) && u_7.push(e);
|
|
1817
1870
|
}
|
|
1818
|
-
var
|
|
1819
|
-
if (
|
|
1820
|
-
for (var
|
|
1821
|
-
var
|
|
1822
|
-
r.set(
|
|
1871
|
+
var o_15 = e.morphTargetManager;
|
|
1872
|
+
if (o_15)
|
|
1873
|
+
for (var t_37 = 0; t_37 < o_15.numTargets; t_37++) {
|
|
1874
|
+
var n_42 = o_15.getTarget(t_37), s_26 = r.get(n_42) || [];
|
|
1875
|
+
r.set(n_42, s_26), -1 === s_26.indexOf(e) && s_26.push(e);
|
|
1823
1876
|
}
|
|
1824
1877
|
}
|
|
1825
1878
|
try {
|
|
1826
1879
|
for (var _b = __values(e.getChildren()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1827
|
-
var
|
|
1828
|
-
this._collectBuffers(
|
|
1880
|
+
var t_38 = _c.value;
|
|
1881
|
+
this._collectBuffers(t_38, n, s, r, i);
|
|
1829
1882
|
}
|
|
1830
1883
|
}
|
|
1831
|
-
catch (
|
|
1884
|
+
catch (e_87_1) { e_87 = { error: e_87_1 }; }
|
|
1832
1885
|
finally {
|
|
1833
1886
|
try {
|
|
1834
1887
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1835
1888
|
}
|
|
1836
|
-
finally { if (
|
|
1889
|
+
finally { if (e_87) throw e_87.error; }
|
|
1837
1890
|
}
|
|
1838
1891
|
};
|
|
1839
1892
|
Z.prototype._exportBuffers = function (e, n) {
|
|
1840
|
-
var
|
|
1893
|
+
var e_88, _a, e_89, _b, e_90, _c, e_91, _g;
|
|
1841
1894
|
var s = new Map, r = new Map, i = new Map;
|
|
1842
1895
|
try {
|
|
1843
|
-
for (var
|
|
1844
|
-
var
|
|
1845
|
-
this._collectBuffers(
|
|
1896
|
+
for (var e_92 = __values(e), e_92_1 = e_92.next(); !e_92_1.done; e_92_1 = e_92.next()) {
|
|
1897
|
+
var t_40 = e_92_1.value;
|
|
1898
|
+
this._collectBuffers(t_40, s, r, i, n);
|
|
1846
1899
|
}
|
|
1847
1900
|
}
|
|
1848
|
-
catch (
|
|
1901
|
+
catch (e_88_1) { e_88 = { error: e_88_1 }; }
|
|
1849
1902
|
finally {
|
|
1850
1903
|
try {
|
|
1851
|
-
if (
|
|
1904
|
+
if (e_92_1 && !e_92_1.done && (_a = e_92.return)) _a.call(e_92);
|
|
1852
1905
|
}
|
|
1853
|
-
finally { if (
|
|
1906
|
+
finally { if (e_88) throw e_88.error; }
|
|
1854
1907
|
}
|
|
1855
1908
|
var o = Array.from(s.keys());
|
|
1856
|
-
var _loop_4 = function (
|
|
1857
|
-
var
|
|
1858
|
-
var i_14 =
|
|
1909
|
+
var _loop_4 = function (e_93) {
|
|
1910
|
+
var e_94, _h, e_95, _j, e_96, _k, e_97, _l;
|
|
1911
|
+
var i_14 = e_93.getData();
|
|
1859
1912
|
if (!i_14)
|
|
1860
1913
|
throw new Error("Buffer data is not available");
|
|
1861
|
-
var
|
|
1862
|
-
if (!
|
|
1914
|
+
var o_20 = s.get(e_93);
|
|
1915
|
+
if (!o_20)
|
|
1863
1916
|
return "continue";
|
|
1864
|
-
var
|
|
1865
|
-
if (
|
|
1917
|
+
var a_12 = o_20[0].byteStride;
|
|
1918
|
+
if (o_20.some(function (e) { return e.byteStride !== a_12; }))
|
|
1866
1919
|
throw new Error("Vertex buffers pointing to the same buffer must have the same byte stride");
|
|
1867
1920
|
var l_14 = $(i_14).slice();
|
|
1868
|
-
var _loop_5 = function (
|
|
1869
|
-
var
|
|
1921
|
+
var _loop_5 = function (e_98) {
|
|
1922
|
+
var n_43 = r.get(e_98), _r = I(e_98, n_43), s_27 = _r.byteOffset, i_15 = _r.byteStride, o_21 = _r.componentCount, a_13 = _r.type, u_8 = _r.count, c_6 = _r.normalized, h_6 = _r.kind;
|
|
1870
1923
|
switch (h_6) {
|
|
1871
1924
|
case t.VertexBuffer.NormalKind:
|
|
1872
1925
|
case t.VertexBuffer.TangentKind:
|
|
1873
|
-
t.EnumerateFloatValues(l_14, s_27, i_15,
|
|
1874
|
-
var
|
|
1875
|
-
e[0] *=
|
|
1926
|
+
t.EnumerateFloatValues(l_14, s_27, i_15, o_21, a_13, u_8, c_6, function (e) { var t = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]); if (t > 0) {
|
|
1927
|
+
var n_44 = 1 / t;
|
|
1928
|
+
e[0] *= n_44, e[1] *= n_44, e[2] *= n_44;
|
|
1876
1929
|
} });
|
|
1877
1930
|
break;
|
|
1878
1931
|
case t.VertexBuffer.ColorKind: {
|
|
1879
|
-
var
|
|
1880
|
-
if (0 ==
|
|
1932
|
+
var e_99 = n_43.filter(function (e) { return e.material instanceof t.StandardMaterial || null == e.material; }).length;
|
|
1933
|
+
if (0 == e_99)
|
|
1881
1934
|
break;
|
|
1882
|
-
if (
|
|
1935
|
+
if (e_99 != n_43.length) {
|
|
1883
1936
|
t.Logger.Warn("Not converting vertex color space, as buffer is shared by StandardMaterials and other material types. Results may look incorrect.");
|
|
1884
1937
|
break;
|
|
1885
1938
|
}
|
|
1886
|
-
|
|
1887
|
-
var r_24 = new t.Color3, h_7 = new t.Color4,
|
|
1888
|
-
t.EnumerateFloatValues(l_14, s_27, i_15,
|
|
1939
|
+
a_13 == t.VertexBuffer.UNSIGNED_BYTE && t.Logger.Warn("Converting uint8 vertex colors to linear space. Results may look incorrect.");
|
|
1940
|
+
var r_24 = new t.Color3, h_7 = new t.Color4, d_5 = this_3._babylonScene.getEngine().useExactSrgbConversions;
|
|
1941
|
+
t.EnumerateFloatValues(l_14, s_27, i_15, o_21, a_13, u_8, c_6, function (e) { 3 === e.length ? (r_24.fromArray(e, 0), r_24.toLinearSpaceToRef(r_24, d_5), r_24.toArray(e, 0)) : (h_7.fromArray(e, 0), h_7.toLinearSpaceToRef(h_7, d_5), h_7.toArray(e, 0)); });
|
|
1889
1942
|
}
|
|
1890
1943
|
}
|
|
1891
1944
|
};
|
|
1892
1945
|
try {
|
|
1893
|
-
for (var
|
|
1894
|
-
var
|
|
1895
|
-
_loop_5(
|
|
1946
|
+
for (var o_17 = (e_94 = void 0, __values(o_20)), o_17_1 = o_17.next(); !o_17_1.done; o_17_1 = o_17.next()) {
|
|
1947
|
+
var e_98 = o_17_1.value;
|
|
1948
|
+
_loop_5(e_98);
|
|
1896
1949
|
}
|
|
1897
1950
|
}
|
|
1898
|
-
catch (
|
|
1951
|
+
catch (e_94_1) { e_94 = { error: e_94_1 }; }
|
|
1899
1952
|
finally {
|
|
1900
1953
|
try {
|
|
1901
|
-
if (
|
|
1954
|
+
if (o_17_1 && !o_17_1.done && (_h = o_17.return)) _h.call(o_17);
|
|
1902
1955
|
}
|
|
1903
|
-
finally { if (
|
|
1956
|
+
finally { if (e_94) throw e_94.error; }
|
|
1904
1957
|
}
|
|
1905
1958
|
if (n.convertToRightHanded) {
|
|
1906
1959
|
try {
|
|
1907
|
-
for (var
|
|
1908
|
-
var
|
|
1909
|
-
var
|
|
1960
|
+
for (var o_18 = (e_95 = void 0, __values(o_20)), o_18_1 = o_18.next(); !o_18_1.done; o_18_1 = o_18.next()) {
|
|
1961
|
+
var e_100 = o_18_1.value;
|
|
1962
|
+
var n_45 = r.get(e_100), _p = I(e_100, n_45), s_28 = _p.byteOffset, i_16 = _p.byteStride, o_22 = _p.componentCount, a_14 = _p.type, u_9 = _p.count, c_7 = _p.normalized, h_8 = _p.kind;
|
|
1910
1963
|
switch (h_8) {
|
|
1911
1964
|
case t.VertexBuffer.PositionKind:
|
|
1912
1965
|
case t.VertexBuffer.NormalKind:
|
|
1913
|
-
case t.VertexBuffer.TangentKind: t.EnumerateFloatValues(l_14, s_28, i_16,
|
|
1966
|
+
case t.VertexBuffer.TangentKind: t.EnumerateFloatValues(l_14, s_28, i_16, o_22, a_14, u_9, c_7, function (e) { e[0] = -e[0]; });
|
|
1914
1967
|
}
|
|
1915
1968
|
}
|
|
1916
1969
|
}
|
|
1917
|
-
catch (
|
|
1970
|
+
catch (e_95_1) { e_95 = { error: e_95_1 }; }
|
|
1918
1971
|
finally {
|
|
1919
1972
|
try {
|
|
1920
|
-
if (
|
|
1973
|
+
if (o_18_1 && !o_18_1.done && (_j = o_18.return)) _j.call(o_18);
|
|
1921
1974
|
}
|
|
1922
|
-
finally { if (
|
|
1975
|
+
finally { if (e_95) throw e_95.error; }
|
|
1923
1976
|
}
|
|
1924
|
-
n.convertedToRightHandedBuffers.set(
|
|
1977
|
+
n.convertedToRightHandedBuffers.set(e_93, l_14);
|
|
1925
1978
|
}
|
|
1926
|
-
var u_10 = this_3._bufferManager.createBufferView(l_14,
|
|
1927
|
-
n.setVertexBufferView(
|
|
1928
|
-
var
|
|
1979
|
+
var u_10 = this_3._bufferManager.createBufferView(l_14, a_12);
|
|
1980
|
+
n.setVertexBufferView(e_93, u_10);
|
|
1981
|
+
var c_8 = new Map;
|
|
1929
1982
|
try {
|
|
1930
|
-
for (var
|
|
1931
|
-
var
|
|
1932
|
-
var
|
|
1983
|
+
for (var o_19 = (e_96 = void 0, __values(o_20)), o_19_1 = o_19.next(); !o_19_1.done; o_19_1 = o_19.next()) {
|
|
1984
|
+
var e_101 = o_19_1.value;
|
|
1985
|
+
var n_46 = r.get(e_101), _q = I(e_101, n_46), s_29 = _q.kind, i_17 = _q.totalVertices;
|
|
1933
1986
|
switch (s_29) {
|
|
1934
1987
|
case t.VertexBuffer.MatricesIndicesKind:
|
|
1935
|
-
case t.VertexBuffer.MatricesIndicesExtraKind: if (
|
|
1936
|
-
var
|
|
1937
|
-
null !==
|
|
1988
|
+
case t.VertexBuffer.MatricesIndicesExtraKind: if (e_101.type == t.VertexBuffer.FLOAT) {
|
|
1989
|
+
var t_41 = e_101.getFloatData(i_17);
|
|
1990
|
+
null !== t_41 && c_8.set(e_101, t_41);
|
|
1938
1991
|
}
|
|
1939
1992
|
}
|
|
1940
1993
|
}
|
|
1941
1994
|
}
|
|
1942
|
-
catch (
|
|
1995
|
+
catch (e_96_1) { e_96 = { error: e_96_1 }; }
|
|
1943
1996
|
finally {
|
|
1944
1997
|
try {
|
|
1945
|
-
if (
|
|
1998
|
+
if (o_19_1 && !o_19_1.done && (_k = o_19.return)) _k.call(o_19);
|
|
1946
1999
|
}
|
|
1947
|
-
finally { if (
|
|
2000
|
+
finally { if (e_96) throw e_96.error; }
|
|
1948
2001
|
}
|
|
1949
|
-
0 !==
|
|
1950
|
-
var h_9 = Array.from(
|
|
2002
|
+
0 !== c_8.size && t.Logger.Warn("Joint indices conversion needed: some joint indices are stored as floats in Babylon but GLTF requires UNSIGNED BYTES. We will perform the conversion but this might lead to unused data in the buffer.");
|
|
2003
|
+
var h_9 = Array.from(c_8.keys());
|
|
1951
2004
|
try {
|
|
1952
|
-
for (var h_5 = (
|
|
1953
|
-
var
|
|
1954
|
-
var s_30 =
|
|
2005
|
+
for (var h_5 = (e_97 = void 0, __values(h_9)), h_5_1 = h_5.next(); !h_5_1.done; h_5_1 = h_5.next()) {
|
|
2006
|
+
var t_42 = h_5_1.value;
|
|
2007
|
+
var s_30 = c_8.get(t_42);
|
|
1955
2008
|
if (!s_30)
|
|
1956
2009
|
continue;
|
|
1957
|
-
var r_25 =
|
|
1958
|
-
for (var
|
|
1959
|
-
i_18[
|
|
1960
|
-
var
|
|
1961
|
-
n.setRemappedBufferView(
|
|
2010
|
+
var r_25 = F(s_30), i_18 = new (r_25 ? Uint16Array : Uint8Array)(s_30.length);
|
|
2011
|
+
for (var e_102 = 0; e_102 < s_30.length; e_102++)
|
|
2012
|
+
i_18[e_102] = s_30[e_102];
|
|
2013
|
+
var o_23 = this_3._bufferManager.createBufferView(i_18, 4 * (r_25 ? 2 : 1));
|
|
2014
|
+
n.setRemappedBufferView(e_93, t_42, o_23);
|
|
1962
2015
|
}
|
|
1963
2016
|
}
|
|
1964
|
-
catch (
|
|
2017
|
+
catch (e_97_1) { e_97 = { error: e_97_1 }; }
|
|
1965
2018
|
finally {
|
|
1966
2019
|
try {
|
|
1967
2020
|
if (h_5_1 && !h_5_1.done && (_l = h_5.return)) _l.call(h_5);
|
|
1968
2021
|
}
|
|
1969
|
-
finally { if (
|
|
2022
|
+
finally { if (e_97) throw e_97.error; }
|
|
1970
2023
|
}
|
|
1971
2024
|
};
|
|
1972
2025
|
var this_3 = this;
|
|
1973
2026
|
try {
|
|
1974
|
-
for (var
|
|
1975
|
-
var
|
|
1976
|
-
_loop_4(
|
|
2027
|
+
for (var o_16 = __values(o), o_16_1 = o_16.next(); !o_16_1.done; o_16_1 = o_16.next()) {
|
|
2028
|
+
var e_93 = o_16_1.value;
|
|
2029
|
+
_loop_4(e_93);
|
|
1977
2030
|
}
|
|
1978
2031
|
}
|
|
1979
|
-
catch (
|
|
2032
|
+
catch (e_89_1) { e_89 = { error: e_89_1 }; }
|
|
1980
2033
|
finally {
|
|
1981
2034
|
try {
|
|
1982
|
-
if (
|
|
2035
|
+
if (o_16_1 && !o_16_1.done && (_b = o_16.return)) _b.call(o_16);
|
|
1983
2036
|
}
|
|
1984
|
-
finally { if (
|
|
2037
|
+
finally { if (e_89) throw e_89.error; }
|
|
1985
2038
|
}
|
|
1986
2039
|
var a = Array.from(i.keys());
|
|
1987
2040
|
try {
|
|
1988
|
-
for (var
|
|
1989
|
-
var
|
|
1990
|
-
var
|
|
1991
|
-
if (!
|
|
2041
|
+
for (var a_11 = __values(a), a_11_1 = a_11.next(); !a_11_1.done; a_11_1 = a_11.next()) {
|
|
2042
|
+
var e_103 = a_11_1.value;
|
|
2043
|
+
var t_43 = i.get(e_103);
|
|
2044
|
+
if (!t_43)
|
|
1992
2045
|
continue;
|
|
1993
|
-
var s_31 = X(
|
|
2046
|
+
var s_31 = X(e_103, t_43[0], this._bufferManager, this._bufferViews, this._accessors, n.convertToRightHanded);
|
|
1994
2047
|
try {
|
|
1995
|
-
for (var
|
|
1996
|
-
var
|
|
1997
|
-
n.bindMorphDataToMesh(
|
|
2048
|
+
for (var t_39 = (e_91 = void 0, __values(t_43)), t_39_1 = t_39.next(); !t_39_1.done; t_39_1 = t_39.next()) {
|
|
2049
|
+
var e_104 = t_39_1.value;
|
|
2050
|
+
n.bindMorphDataToMesh(e_104, s_31);
|
|
1998
2051
|
}
|
|
1999
2052
|
}
|
|
2000
|
-
catch (
|
|
2053
|
+
catch (e_91_1) { e_91 = { error: e_91_1 }; }
|
|
2001
2054
|
finally {
|
|
2002
2055
|
try {
|
|
2003
|
-
if (
|
|
2056
|
+
if (t_39_1 && !t_39_1.done && (_g = t_39.return)) _g.call(t_39);
|
|
2004
2057
|
}
|
|
2005
|
-
finally { if (
|
|
2058
|
+
finally { if (e_91) throw e_91.error; }
|
|
2006
2059
|
}
|
|
2007
2060
|
}
|
|
2008
2061
|
}
|
|
2009
|
-
catch (
|
|
2062
|
+
catch (e_90_1) { e_90 = { error: e_90_1 }; }
|
|
2010
2063
|
finally {
|
|
2011
2064
|
try {
|
|
2012
|
-
if (
|
|
2065
|
+
if (a_11_1 && !a_11_1.done && (_c = a_11.return)) _c.call(a_11);
|
|
2013
2066
|
}
|
|
2014
|
-
finally { if (
|
|
2067
|
+
finally { if (e_90) throw e_90.error; }
|
|
2015
2068
|
}
|
|
2016
2069
|
};
|
|
2017
2070
|
Z.prototype._exportNodeAsync = function (e, t, n) { return c(this, void 0, void 0, function () {
|
|
2018
|
-
var s, r, i_19,
|
|
2019
|
-
var
|
|
2071
|
+
var s, r, i_19, o_24, i, _a, _b, t_44, e_105_1;
|
|
2072
|
+
var e_105, _c;
|
|
2020
2073
|
var _this = this;
|
|
2021
2074
|
return __generator(this, function (_g) {
|
|
2022
2075
|
switch (_g.label) {
|
|
@@ -2029,8 +2082,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2029
2082
|
r = _g.sent();
|
|
2030
2083
|
if (r) {
|
|
2031
2084
|
s = this._nodes.length, this._nodes.push(r), this._nodeMap.set(e, s), n.pushExportedNode(e), t.push(s);
|
|
2032
|
-
i_19 = { name: "runtime animations", channels: [], samplers: [] },
|
|
2033
|
-
this._babylonScene.animationGroups.length || (G._CreateMorphTargetAnimationFromMorphTargetAnimations(e, i_19,
|
|
2085
|
+
i_19 = { name: "runtime animations", channels: [], samplers: [] }, o_24 = [];
|
|
2086
|
+
this._babylonScene.animationGroups.length || (G._CreateMorphTargetAnimationFromMorphTargetAnimations(e, i_19, o_24, this._nodeMap, this._nodes, this._bufferManager, this._bufferViews, this._accessors, this._animationSampleRate, n.convertToRightHanded, this._options.shouldExportAnimation), e.animations.length && G._CreateNodeAnimationFromNodeAnimations(e, i_19, o_24, this._nodeMap, this._nodes, this._bufferManager, this._bufferViews, this._accessors, this._animationSampleRate, n.convertToRightHanded, this._options.shouldExportAnimation)), i_19.channels.length && i_19.samplers.length && this._animations.push(i_19), o_24.forEach(function (e) { e.channels.length && e.samplers.length && _this._animations.push(e); });
|
|
2034
2087
|
}
|
|
2035
2088
|
i = r ? [] : t;
|
|
2036
2089
|
_g.label = 2;
|
|
@@ -2040,8 +2093,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2040
2093
|
_g.label = 3;
|
|
2041
2094
|
case 3:
|
|
2042
2095
|
if (!!_b.done) return [3 /*break*/, 6];
|
|
2043
|
-
|
|
2044
|
-
return [4 /*yield*/, this._exportNodeAsync(
|
|
2096
|
+
t_44 = _b.value;
|
|
2097
|
+
return [4 /*yield*/, this._exportNodeAsync(t_44, i, n)];
|
|
2045
2098
|
case 4:
|
|
2046
2099
|
_g.sent();
|
|
2047
2100
|
_g.label = 5;
|
|
@@ -2050,14 +2103,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2050
2103
|
return [3 /*break*/, 3];
|
|
2051
2104
|
case 6: return [3 /*break*/, 9];
|
|
2052
2105
|
case 7:
|
|
2053
|
-
|
|
2054
|
-
|
|
2106
|
+
e_105_1 = _g.sent();
|
|
2107
|
+
e_105 = { error: e_105_1 };
|
|
2055
2108
|
return [3 /*break*/, 9];
|
|
2056
2109
|
case 8:
|
|
2057
2110
|
try {
|
|
2058
2111
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
2059
2112
|
}
|
|
2060
|
-
finally { if (
|
|
2113
|
+
finally { if (e_105) throw e_105.error; }
|
|
2061
2114
|
return [7 /*endfinally*/];
|
|
2062
2115
|
case 9:
|
|
2063
2116
|
r && i.length && (r.children = i);
|
|
@@ -2065,15 +2118,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2065
2118
|
}
|
|
2066
2119
|
});
|
|
2067
2120
|
}); };
|
|
2068
|
-
Z.prototype._createNodeAsync = function (e, n) { return c(this, void 0, void 0, function () { var s, r, i, o,
|
|
2121
|
+
Z.prototype._createNodeAsync = function (e, n) { return c(this, void 0, void 0, function () { var s, r, i, o, t_45, r_26, _a, _b, t_46, t_47, s_32, e_106, n_47; return __generator(this, function (_c) {
|
|
2069
2122
|
switch (_c.label) {
|
|
2070
2123
|
case 0:
|
|
2071
2124
|
if (!this._shouldExportNode(e))
|
|
2072
2125
|
return [2 /*return*/, null];
|
|
2073
2126
|
o = {};
|
|
2074
2127
|
if (e.name && (o.name = e.name), e.metadata) {
|
|
2075
|
-
|
|
2076
|
-
|
|
2128
|
+
t_45 = this._options.metadataSelector(e.metadata);
|
|
2129
|
+
t_45 && (o.extras = t_45);
|
|
2077
2130
|
}
|
|
2078
2131
|
if (!(e instanceof t.TransformNode && (this._setNodeTransformation(o, e, n.convertToRightHanded), e instanceof t.AbstractMesh))) return [3 /*break*/, 3];
|
|
2079
2132
|
r_26 = e instanceof t.InstancedMesh ? e.sourceMesh : e;
|
|
@@ -2086,24 +2139,24 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2086
2139
|
_c.label = 2;
|
|
2087
2140
|
case 2:
|
|
2088
2141
|
if (_a, e.skeleton) {
|
|
2089
|
-
|
|
2090
|
-
void 0 !==
|
|
2142
|
+
t_46 = this._skinMap.get(e.skeleton);
|
|
2143
|
+
void 0 !== t_46 && (void 0 === this._nodesSkinMap.get(t_46) && this._nodesSkinMap.set(t_46, []), null === (s = this._nodesSkinMap.get(t_46)) || void 0 === s || s.push(o));
|
|
2091
2144
|
}
|
|
2092
2145
|
_c.label = 3;
|
|
2093
2146
|
case 3:
|
|
2094
2147
|
if (e instanceof t.TargetCamera) {
|
|
2095
|
-
|
|
2096
|
-
if (
|
|
2097
|
-
void 0 === this._nodesCameraMap.get(
|
|
2148
|
+
t_47 = this._camerasMap.get(e);
|
|
2149
|
+
if (t_47) {
|
|
2150
|
+
void 0 === this._nodesCameraMap.get(t_47) && this._nodesCameraMap.set(t_47, []), this._setCameraTransformation(o, e, n.convertToRightHanded);
|
|
2098
2151
|
s_32 = e.parent;
|
|
2099
2152
|
if (null !== s_32 && K(e, s_32)) {
|
|
2100
|
-
|
|
2101
|
-
if (void 0 !==
|
|
2102
|
-
|
|
2103
|
-
return [2 /*return*/, (k(o,
|
|
2153
|
+
e_106 = this._nodeMap.get(s_32);
|
|
2154
|
+
if (void 0 !== e_106) {
|
|
2155
|
+
n_47 = this._nodes[e_106];
|
|
2156
|
+
return [2 /*return*/, (k(o, n_47), null === (r = this._nodesCameraMap.get(t_47)) || void 0 === r || r.push(n_47), null)];
|
|
2104
2157
|
}
|
|
2105
2158
|
}
|
|
2106
|
-
null === (i = this._nodesCameraMap.get(
|
|
2159
|
+
null === (i = this._nodesCameraMap.get(t_47)) || void 0 === i || i.push(o);
|
|
2107
2160
|
}
|
|
2108
2161
|
}
|
|
2109
2162
|
return [4 /*yield*/, this._extensionsPostExportNodeAsync("exportNodeAsync", o, e, this._nodeMap, n.convertToRightHanded)];
|
|
@@ -2126,36 +2179,36 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2126
2179
|
} return !1; }(o); if (h) {
|
|
2127
2180
|
if (o === t.Material.TriangleStripDrawMode || o === t.Material.TriangleFanDrawMode)
|
|
2128
2181
|
throw new Error("Triangle strip/fan fill mode is not implemented");
|
|
2129
|
-
var
|
|
2182
|
+
var a_15 = n ? new Uint32Array(r) : new Uint16Array(r);
|
|
2130
2183
|
if (e)
|
|
2131
|
-
for (var
|
|
2132
|
-
|
|
2184
|
+
for (var t_48 = 0; t_48 + 2 < r; t_48 += 3)
|
|
2185
|
+
a_15[t_48] = e[s + t_48] + i, a_15[t_48 + 1] = e[s + t_48 + 2] + i, a_15[t_48 + 2] = e[s + t_48 + 1] + i;
|
|
2133
2186
|
else
|
|
2134
|
-
for (var
|
|
2135
|
-
|
|
2136
|
-
c =
|
|
2187
|
+
for (var e_107 = 0; e_107 + 2 < r; e_107 += 3)
|
|
2188
|
+
a_15[e_107] = e_107, a_15[e_107 + 1] = e_107 + 2, a_15[e_107 + 2] = e_107 + 1;
|
|
2189
|
+
c = a_15;
|
|
2137
2190
|
}
|
|
2138
2191
|
else if (e && 0 !== i) {
|
|
2139
|
-
var
|
|
2140
|
-
for (var
|
|
2141
|
-
|
|
2142
|
-
c =
|
|
2192
|
+
var t_49 = n ? new Uint32Array(r) : new Uint16Array(r);
|
|
2193
|
+
for (var n_48 = 0; n_48 < r; n_48++)
|
|
2194
|
+
t_49[n_48] = e[s + n_48] + i;
|
|
2195
|
+
c = t_49;
|
|
2143
2196
|
}
|
|
2144
2197
|
else
|
|
2145
2198
|
e && (c = function (e, t, n, s) { var r = e; return 0 === t && n === e.length || (r = Array.isArray(e) ? e.slice(t, t + n) : e.subarray(t, t + n)), r instanceof Int32Array ? new Uint32Array(r.buffer, r.byteOffset, r.length) : Array.isArray(r) ? s ? new Uint32Array(r) : new Uint16Array(r) : r; }(e, s, r, n)); if (c) {
|
|
2146
|
-
var
|
|
2147
|
-
if (void 0 ===
|
|
2148
|
-
var
|
|
2149
|
-
this._accessors.push(this._bufferManager.createAccessor(
|
|
2199
|
+
var t_50 = l.getIndicesAccessor(e, s, r, i, h);
|
|
2200
|
+
if (void 0 === t_50) {
|
|
2201
|
+
var o_25 = this._bufferManager.createBufferView(c), a_16 = n ? 5125 : 5123;
|
|
2202
|
+
this._accessors.push(this._bufferManager.createAccessor(o_25, "SCALAR", a_16, r, 0)), t_50 = this._accessors.length - 1, l.setIndicesAccessor(e, s, r, i, h, t_50);
|
|
2150
2203
|
}
|
|
2151
|
-
u.indices =
|
|
2204
|
+
u.indices = t_50;
|
|
2152
2205
|
} };
|
|
2153
|
-
Z.prototype._exportVertexBuffer = function (e, n, s, r, i, o) { var a = e.getKind(); if (!
|
|
2206
|
+
Z.prototype._exportVertexBuffer = function (e, n, s, r, i, o) { var a = e.getKind(); if (!V(a))
|
|
2154
2207
|
return; if (a.startsWith("uv") && !this._options.exportUnusedUVs && (!n || !this._materialNeedsUVsSet.has(n)))
|
|
2155
2208
|
return; var l = i.getVertexAccessor(e, s, r); if (void 0 === l) {
|
|
2156
|
-
var
|
|
2157
|
-
c[
|
|
2158
|
-
this._accessors.push(this._bufferManager.createAccessor(
|
|
2209
|
+
var n_49 = i.convertedToRightHandedBuffers.get(e._buffer) || e._buffer.getData(), o_26 = a === t.VertexBuffer.PositionKind ? function (e, n, s, r) { var i = n.byteOffset, o = n.byteStride, a = n.type, l = n.normalized, u = n.getSize(), c = new Array(u).fill(1 / 0), h = new Array(u).fill(-1 / 0); return t.EnumerateFloatValues(e, i + s * o, o, u, a, r * u, l, function (e) { for (var t_51 = 0; t_51 < u; t_51++)
|
|
2210
|
+
c[t_51] = Math.min(c[t_51], e[t_51]), h[t_51] = Math.max(h[t_51], e[t_51]); }), { min: c, max: h }; }(n_49, e, s, r) : void 0, u_11 = (a === t.VertexBuffer.MatricesIndicesKind || a === t.VertexBuffer.MatricesIndicesExtraKind) && e.type === t.VertexBuffer.FLOAT, c_9 = u_11 ? t.VertexBuffer.UNSIGNED_BYTE : e.type, h_10 = u_11 ? void 0 : e.normalized, d_6 = u_11 ? i.getRemappedBufferView(e._buffer, e) : i.getVertexBufferView(e._buffer), f_9 = e.byteOffset + s * e.byteStride;
|
|
2211
|
+
this._accessors.push(this._bufferManager.createAccessor(d_6, function (e, n) { if (e == t.VertexBuffer.ColorKind)
|
|
2159
2212
|
return n ? "VEC4" : "VEC3"; switch (e) {
|
|
2160
2213
|
case t.VertexBuffer.PositionKind:
|
|
2161
2214
|
case t.VertexBuffer.NormalKind: return "VEC3";
|
|
@@ -2170,7 +2223,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2170
2223
|
case t.VertexBuffer.UV4Kind:
|
|
2171
2224
|
case t.VertexBuffer.UV5Kind:
|
|
2172
2225
|
case t.VertexBuffer.UV6Kind: return "VEC2";
|
|
2173
|
-
} throw new Error("Unknown kind ".concat(e)); }(a, i.hasVertexColorAlpha(e)),
|
|
2226
|
+
} throw new Error("Unknown kind ".concat(e)); }(a, i.hasVertexColorAlpha(e)), c_9, r, f_9, o_26, h_10)), l = this._accessors.length - 1, i.setVertexAccessor(e, s, r, l);
|
|
2174
2227
|
} o.attributes[function (e) { switch (e) {
|
|
2175
2228
|
case t.VertexBuffer.PositionKind: return "POSITION";
|
|
2176
2229
|
case t.VertexBuffer.NormalKind: return "NORMAL";
|
|
@@ -2220,8 +2273,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2220
2273
|
}
|
|
2221
2274
|
}); }); };
|
|
2222
2275
|
Z.prototype._exportMeshAsync = function (e, n) { return c(this, void 0, void 0, function () {
|
|
2223
|
-
var s, r, i, o, a, l, u, c, h, d, f, p, m, g,
|
|
2224
|
-
var
|
|
2276
|
+
var s, r, i, o, a, l, u, c, h, d, f, p, m, g, g_5, g_5_1, s_33, u_12, g_6, n_50, s_34, l_15, c_10, h_11, n_51, s_35, x_6, _5, _a, _b, e_112, f_10, f_10_1, e_113, e_108_1, f_11, f_11_1, e_114;
|
|
2277
|
+
var e_108, _c, e_109, _g, e_110, _h, e_111, _j;
|
|
2225
2278
|
return __generator(this, function (_k) {
|
|
2226
2279
|
switch (_k.label) {
|
|
2227
2280
|
case 0:
|
|
@@ -2235,89 +2288,89 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2235
2288
|
_k.label = 1;
|
|
2236
2289
|
case 1:
|
|
2237
2290
|
_k.trys.push([1, 9, 10, 11]);
|
|
2238
|
-
|
|
2291
|
+
g_5 = __values(g), g_5_1 = g_5.next();
|
|
2239
2292
|
_k.label = 2;
|
|
2240
2293
|
case 2:
|
|
2241
|
-
if (!!
|
|
2242
|
-
s_33 =
|
|
2243
|
-
u_12 = { attributes: {} },
|
|
2294
|
+
if (!!g_5_1.done) return [3 /*break*/, 8];
|
|
2295
|
+
s_33 = g_5_1.value;
|
|
2296
|
+
u_12 = { attributes: {} }, g_6 = s_33.getMaterial() || this._babylonScene.defaultMaterial;
|
|
2244
2297
|
if (!m) return [3 /*break*/, 3];
|
|
2245
|
-
|
|
2246
|
-
(!h_11.equalsWithEpsilon(l_15, t.Epsilon) ||
|
|
2298
|
+
n_50 = { name: g_6.name }, s_34 = e, l_15 = t.Color3.White(), c_10 = null !== (i = null === (r = s_34.material) || void 0 === r ? void 0 : r.alpha) && void 0 !== i ? i : 1, h_11 = null !== (a = null === (o = s_34.greasedLineMaterial) || void 0 === o ? void 0 : o.color) && void 0 !== a ? a : l_15;
|
|
2299
|
+
(!h_11.equalsWithEpsilon(l_15, t.Epsilon) || c_10 < 1) && (n_50.pbrMetallicRoughness = { baseColorFactor: __spreadArray(__spreadArray([], __read(h_11.asArray()), false), [c_10], false) }), this._materials.push(n_50), u_12.material = this._materials.length - 1;
|
|
2247
2300
|
return [3 /*break*/, 6];
|
|
2248
2301
|
case 3:
|
|
2249
2302
|
if (!p) return [3 /*break*/, 4];
|
|
2250
|
-
|
|
2251
|
-
(!s_35.color.equalsWithEpsilon(t.Color3.White(), t.Epsilon) || s_35.alpha < 1) && (
|
|
2303
|
+
n_51 = { name: g_6.name }, s_35 = e;
|
|
2304
|
+
(!s_35.color.equalsWithEpsilon(t.Color3.White(), t.Epsilon) || s_35.alpha < 1) && (n_51.pbrMetallicRoughness = { baseColorFactor: __spreadArray(__spreadArray([], __read(s_35.color.asArray()), false), [s_35.alpha], false) }), this._materials.push(n_51), u_12.material = this._materials.length - 1;
|
|
2252
2305
|
return [3 /*break*/, 6];
|
|
2253
|
-
case 4: return [4 /*yield*/, this._exportMaterialAsync(
|
|
2306
|
+
case 4: return [4 /*yield*/, this._exportMaterialAsync(g_6, d, s_33, u_12)];
|
|
2254
2307
|
case 5:
|
|
2255
2308
|
_k.sent();
|
|
2256
2309
|
_k.label = 6;
|
|
2257
2310
|
case 6:
|
|
2258
|
-
|
|
2259
|
-
_5 =
|
|
2260
|
-
n.wasAddedByNoopNode && !e.getScene().useRightHandedSystem && (_5 = _5 === t.Material.ClockWiseSideOrientation ? t.Material.CounterClockWiseSideOrientation : t.Material.ClockWiseSideOrientation), this._exportIndices(h, h ? t.AreIndices32Bits(h, s_33.indexCount, s_33.indexStart, s_33.verticesStart) : s_33.verticesCount > 65535, h ? s_33.indexStart : s_33.verticesStart, h ? s_33.indexCount : s_33.verticesCount, -s_33.verticesStart,
|
|
2311
|
+
x_6 = p || m ? t.Material.LineListDrawMode : null !== (l = e.overrideRenderingFillMode) && void 0 !== l ? l : g_6.fillMode;
|
|
2312
|
+
_5 = g_6._getEffectiveOrientation(e);
|
|
2313
|
+
n.wasAddedByNoopNode && !e.getScene().useRightHandedSystem && (_5 = _5 === t.Material.ClockWiseSideOrientation ? t.Material.CounterClockWiseSideOrientation : t.Material.ClockWiseSideOrientation), this._exportIndices(h, h ? t.AreIndices32Bits(h, s_33.indexCount, s_33.indexStart, s_33.verticesStart) : s_33.verticesCount > 65535, h ? s_33.indexStart : s_33.verticesStart, h ? s_33.indexCount : s_33.verticesCount, -s_33.verticesStart, x_6, _5, n, u_12);
|
|
2261
2314
|
try {
|
|
2262
|
-
for (_a = (
|
|
2263
|
-
|
|
2264
|
-
this._exportVertexBuffer(
|
|
2315
|
+
for (_a = (e_109 = void 0, __values(Object.values(d))), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
2316
|
+
e_112 = _b.value;
|
|
2317
|
+
this._exportVertexBuffer(e_112, g_6, s_33.verticesStart, s_33.verticesCount, n, u_12);
|
|
2265
2318
|
}
|
|
2266
2319
|
}
|
|
2267
|
-
catch (
|
|
2320
|
+
catch (e_109_1) { e_109 = { error: e_109_1 }; }
|
|
2268
2321
|
finally {
|
|
2269
2322
|
try {
|
|
2270
2323
|
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
2271
2324
|
}
|
|
2272
|
-
finally { if (
|
|
2325
|
+
finally { if (e_109) throw e_109.error; }
|
|
2273
2326
|
}
|
|
2274
2327
|
if (f) {
|
|
2275
2328
|
u_12.targets = [];
|
|
2276
2329
|
try {
|
|
2277
|
-
for (
|
|
2278
|
-
|
|
2279
|
-
u_12.targets.push(
|
|
2330
|
+
for (f_10 = (e_110 = void 0, __values(f)), f_10_1 = f_10.next(); !f_10_1.done; f_10_1 = f_10.next()) {
|
|
2331
|
+
e_113 = f_10_1.value;
|
|
2332
|
+
u_12.targets.push(e_113.attributes);
|
|
2280
2333
|
}
|
|
2281
2334
|
}
|
|
2282
|
-
catch (
|
|
2335
|
+
catch (e_110_1) { e_110 = { error: e_110_1 }; }
|
|
2283
2336
|
finally {
|
|
2284
2337
|
try {
|
|
2285
|
-
if (
|
|
2338
|
+
if (f_10_1 && !f_10_1.done && (_h = f_10.return)) _h.call(f_10);
|
|
2286
2339
|
}
|
|
2287
|
-
finally { if (
|
|
2340
|
+
finally { if (e_110) throw e_110.error; }
|
|
2288
2341
|
}
|
|
2289
2342
|
}
|
|
2290
2343
|
c.primitives.push(u_12), this._extensionsPostExportMeshPrimitive(u_12);
|
|
2291
2344
|
_k.label = 7;
|
|
2292
2345
|
case 7:
|
|
2293
|
-
|
|
2346
|
+
g_5_1 = g_5.next();
|
|
2294
2347
|
return [3 /*break*/, 2];
|
|
2295
2348
|
case 8: return [3 /*break*/, 11];
|
|
2296
2349
|
case 9:
|
|
2297
|
-
|
|
2298
|
-
|
|
2350
|
+
e_108_1 = _k.sent();
|
|
2351
|
+
e_108 = { error: e_108_1 };
|
|
2299
2352
|
return [3 /*break*/, 11];
|
|
2300
2353
|
case 10:
|
|
2301
2354
|
try {
|
|
2302
|
-
if (
|
|
2355
|
+
if (g_5_1 && !g_5_1.done && (_c = g_5.return)) _c.call(g_5);
|
|
2303
2356
|
}
|
|
2304
|
-
finally { if (
|
|
2357
|
+
finally { if (e_108) throw e_108.error; }
|
|
2305
2358
|
return [7 /*endfinally*/];
|
|
2306
2359
|
case 11:
|
|
2307
2360
|
if (f) {
|
|
2308
2361
|
c.weights = [], c.extras || (c.extras = {}), c.extras.targetNames = [];
|
|
2309
2362
|
try {
|
|
2310
|
-
for (
|
|
2311
|
-
|
|
2312
|
-
c.weights.push(
|
|
2363
|
+
for (f_11 = __values(f), f_11_1 = f_11.next(); !f_11_1.done; f_11_1 = f_11.next()) {
|
|
2364
|
+
e_114 = f_11_1.value;
|
|
2365
|
+
c.weights.push(e_114.influence), c.extras.targetNames.push(e_114.name);
|
|
2313
2366
|
}
|
|
2314
2367
|
}
|
|
2315
|
-
catch (
|
|
2368
|
+
catch (e_111_1) { e_111 = { error: e_111_1 }; }
|
|
2316
2369
|
finally {
|
|
2317
2370
|
try {
|
|
2318
|
-
if (
|
|
2371
|
+
if (f_11_1 && !f_11_1.done && (_j = f_11.return)) _j.call(f_11);
|
|
2319
2372
|
}
|
|
2320
|
-
finally { if (
|
|
2373
|
+
finally { if (e_111) throw e_111.error; }
|
|
2321
2374
|
}
|
|
2322
2375
|
}
|
|
2323
2376
|
return [2 /*return*/, u];
|
|
@@ -2387,33 +2440,33 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2387
2440
|
return __generator(this, function (_a) {
|
|
2388
2441
|
switch (_a.label) {
|
|
2389
2442
|
case 0: return [4 /*yield*/, new Promise(function (e) {
|
|
2390
|
-
var
|
|
2443
|
+
var e_115, _a;
|
|
2391
2444
|
var r, a;
|
|
2392
2445
|
if (n && s instanceof t.Mesh && s.hasThinInstances && _this._exporter) {
|
|
2393
2446
|
_this._wasUsed = !0;
|
|
2394
|
-
var
|
|
2395
|
-
var p_6 = !1, m_5 = !1,
|
|
2396
|
-
var
|
|
2447
|
+
var e_116 = t.Vector3.Zero(), l_16 = t.Quaternion.Identity(), u_13 = t.Vector3.One(), c_12 = s.thinInstanceGetWorldMatrices(), h_12 = t.TmpVectors.Vector3[2], d_7 = t.TmpVectors.Quaternion[1], f_12 = t.TmpVectors.Vector3[3];
|
|
2448
|
+
var p_6 = !1, m_5 = !1, g_7 = !1;
|
|
2449
|
+
var x_7 = new Float32Array(3 * s.thinInstanceCount), _6 = new Float32Array(4 * s.thinInstanceCount), T_4 = new Float32Array(3 * s.thinInstanceCount);
|
|
2397
2450
|
var y_3 = 0;
|
|
2398
2451
|
try {
|
|
2399
|
-
for (var
|
|
2400
|
-
var
|
|
2401
|
-
|
|
2452
|
+
for (var c_11 = __values(c_12), c_11_1 = c_11.next(); !c_11_1.done; c_11_1 = c_11.next()) {
|
|
2453
|
+
var t_52 = c_11_1.value;
|
|
2454
|
+
t_52.decompose(f_12, d_7, h_12), i && (B(h_12), P(d_7)), x_7.set(h_12.asArray(), 3 * y_3), _6.set(d_7.normalize().asArray(), 4 * y_3), T_4.set(f_12.asArray(), 3 * y_3), p_6 = p_6 || !h_12.equalsWithEpsilon(e_116), m_5 = m_5 || !d_7.equalsWithEpsilon(l_16), g_7 = g_7 || !f_12.equalsWithEpsilon(u_13), y_3++;
|
|
2402
2455
|
}
|
|
2403
2456
|
}
|
|
2404
|
-
catch (
|
|
2457
|
+
catch (e_115_1) { e_115 = { error: e_115_1 }; }
|
|
2405
2458
|
finally {
|
|
2406
2459
|
try {
|
|
2407
|
-
if (
|
|
2460
|
+
if (c_11_1 && !c_11_1.done && (_a = c_11.return)) _a.call(c_11);
|
|
2408
2461
|
}
|
|
2409
|
-
finally { if (
|
|
2462
|
+
finally { if (e_115) throw e_115.error; }
|
|
2410
2463
|
}
|
|
2411
2464
|
var b_2 = { attributes: {} };
|
|
2412
|
-
p_6 && (b_2.attributes.TRANSLATION = _this._buildAccessor(
|
|
2465
|
+
p_6 && (b_2.attributes.TRANSLATION = _this._buildAccessor(x_7, "VEC3", s.thinInstanceCount, o)), m_5 && (b_2.attributes.ROTATION = _this._buildAccessor(_6, "VEC4", s.thinInstanceCount, o)), g_7 && (b_2.attributes.SCALE = _this._buildAccessor(T_4, "VEC3", s.thinInstanceCount, o));
|
|
2413
2466
|
var v_4 = null === (a = null === (r = s._userThinInstanceBuffersStorage) || void 0 === r ? void 0 : r.data) || void 0 === a ? void 0 : a.instanceColor;
|
|
2414
2467
|
if (v_4) {
|
|
2415
|
-
var
|
|
2416
|
-
s.hasVertexAlpha && v_4.length === 4 *
|
|
2468
|
+
var e_117 = s.thinInstanceCount, n_52 = "VEC3";
|
|
2469
|
+
s.hasVertexAlpha && v_4.length === 4 * e_117 ? (_this._instanceColorWarned || (t.Logger.Warn("EXT_mesh_gpu_instancing: Exporting instance colors as RGB, alpha channel of instance color is not exported"), _this._instanceColorWarned = !0), v_4 = te(v_4, e_117)) : v_4.length === 4 * e_117 && (v_4 = te(v_4, e_117)), v_4.length === 3 * e_117 && (b_2.attributes._COLOR_0 = _this._buildAccessor(v_4, n_52, e_117, o));
|
|
2417
2470
|
}
|
|
2418
2471
|
n.extensions = n.extensions || {}, n.extensions[ee] = b_2;
|
|
2419
2472
|
}
|
|
@@ -2442,7 +2495,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2442
2495
|
});
|
|
2443
2496
|
ae.prototype.dispose = function () { };
|
|
2444
2497
|
ae.prototype.postExportMeshPrimitive = function (e, n, s) {
|
|
2445
|
-
var
|
|
2498
|
+
var e_118, _a;
|
|
2446
2499
|
var _this = this;
|
|
2447
2500
|
if (!this.enabled)
|
|
2448
2501
|
return;
|
|
@@ -2451,53 +2504,53 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2451
2504
|
var r = [], i = [];
|
|
2452
2505
|
var o = null;
|
|
2453
2506
|
if (void 0 !== e.indices) {
|
|
2454
|
-
var
|
|
2455
|
-
o = n.getData(
|
|
2507
|
+
var t_53 = s[e.indices], a_17 = n.getBufferView(t_53);
|
|
2508
|
+
o = n.getData(a_17).slice(), r.push(a_17), i.push(t_53);
|
|
2456
2509
|
}
|
|
2457
2510
|
var a = [];
|
|
2458
2511
|
try {
|
|
2459
2512
|
for (var _b = __values(Object.entries(e.attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2460
|
-
var _g = __read(_c.value, 2),
|
|
2461
|
-
var
|
|
2462
|
-
a.push({ kind:
|
|
2513
|
+
var _g = __read(_c.value, 2), o_27 = _g[0], l_17 = _g[1];
|
|
2514
|
+
var e_119 = s[l_17], u_14 = n.getBufferView(e_119), c_13 = S(e_119.type), h_13 = t.GetTypedArrayData(n.getData(u_14), c_13, e_119.componentType, e_119.byteOffset || 0, u_14.byteStride || t.GetTypeByteLength(e_119.componentType) * c_13, e_119.count, !0);
|
|
2515
|
+
a.push({ kind: o_27, dracoName: oe(o_27), size: S(e_119.type), data: h_13 }), r.push(u_14), i.push(e_119);
|
|
2463
2516
|
}
|
|
2464
2517
|
}
|
|
2465
|
-
catch (
|
|
2518
|
+
catch (e_118_1) { e_118 = { error: e_118_1 }; }
|
|
2466
2519
|
finally {
|
|
2467
2520
|
try {
|
|
2468
2521
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2469
2522
|
}
|
|
2470
|
-
finally { if (
|
|
2523
|
+
finally { if (e_118) throw e_118.error; }
|
|
2471
2524
|
}
|
|
2472
2525
|
var l = { method: e.targets ? "MESH_SEQUENTIAL_ENCODING" : "MESH_EDGEBREAKER_ENCODING" }, u = t.DracoEncoder.Default._encodeAsync(a, o, l).then(function (t) {
|
|
2473
|
-
var
|
|
2526
|
+
var e_120, _a, e_121, _b;
|
|
2474
2527
|
var s = { bufferView: -1, attributes: t.attributeIds }, o = n.createBufferView(t.data);
|
|
2475
2528
|
n.setBufferView(s, o);
|
|
2476
2529
|
try {
|
|
2477
2530
|
for (var r_28 = __values(r), r_28_1 = r_28.next(); !r_28_1.done; r_28_1 = r_28.next()) {
|
|
2478
|
-
var
|
|
2479
|
-
_this._bufferViewsUsed.add(
|
|
2531
|
+
var e_122 = r_28_1.value;
|
|
2532
|
+
_this._bufferViewsUsed.add(e_122);
|
|
2480
2533
|
}
|
|
2481
2534
|
}
|
|
2482
|
-
catch (
|
|
2535
|
+
catch (e_120_1) { e_120 = { error: e_120_1 }; }
|
|
2483
2536
|
finally {
|
|
2484
2537
|
try {
|
|
2485
2538
|
if (r_28_1 && !r_28_1.done && (_a = r_28.return)) _a.call(r_28);
|
|
2486
2539
|
}
|
|
2487
|
-
finally { if (
|
|
2540
|
+
finally { if (e_120) throw e_120.error; }
|
|
2488
2541
|
}
|
|
2489
2542
|
try {
|
|
2490
2543
|
for (var i_20 = __values(i), i_20_1 = i_20.next(); !i_20_1.done; i_20_1 = i_20.next()) {
|
|
2491
|
-
var
|
|
2492
|
-
_this._accessorsUsed.add(
|
|
2544
|
+
var e_123 = i_20_1.value;
|
|
2545
|
+
_this._accessorsUsed.add(e_123);
|
|
2493
2546
|
}
|
|
2494
2547
|
}
|
|
2495
|
-
catch (
|
|
2548
|
+
catch (e_121_1) { e_121 = { error: e_121_1 }; }
|
|
2496
2549
|
finally {
|
|
2497
2550
|
try {
|
|
2498
2551
|
if (i_20_1 && !i_20_1.done && (_b = i_20.return)) _b.call(i_20);
|
|
2499
2552
|
}
|
|
2500
|
-
finally { if (
|
|
2553
|
+
finally { if (e_121) throw e_121.error; }
|
|
2501
2554
|
}
|
|
2502
2555
|
e.extensions || (e.extensions = {}), e.extensions[ie] = s;
|
|
2503
2556
|
}).catch(function (e) { t.Logger.Error("KHR_draco_mesh_compression: Failed to export Draco-encoded primitive. Resulting glTF may be invalid. " + e.message); });
|
|
@@ -2545,21 +2598,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2545
2598
|
case 0: return [4 /*yield*/, new Promise(function (o) { if (!(s instanceof t.Light))
|
|
2546
2599
|
return void o(n); var a = s.getTypeID() == t.Light.LIGHTTYPEID_POINTLIGHT ? "point" : s.getTypeID() == t.Light.LIGHTTYPEID_DIRECTIONALLIGHT ? "directional" : s.getTypeID() == t.Light.LIGHTTYPEID_SPOTLIGHT ? "spot" : null; if (!(a && s instanceof t.ShadowLight))
|
|
2547
2600
|
return t.Logger.Warn("".concat(e, ": Light ").concat(s.name, " is not supported in ").concat(ce)), void o(n); if (s.falloffType !== t.Light.FALLOFF_GLTF && t.Logger.Warn("".concat(e, ": Light falloff for ").concat(s.name, " does not match the ").concat(ce, " specification!")), !s.position.equalsToFloats(0, 0, 0)) {
|
|
2548
|
-
var
|
|
2549
|
-
i && B(
|
|
2601
|
+
var e_124 = t.TmpVectors.Vector3[0].copyFrom(s.position);
|
|
2602
|
+
i && B(e_124), n.translation = e_124.asArray();
|
|
2550
2603
|
} if ("point" !== a) {
|
|
2551
|
-
var
|
|
2552
|
-
i && B(
|
|
2553
|
-
var r_29 = t.Quaternion.FromUnitVectorsToRef(fe,
|
|
2604
|
+
var e_125 = s.direction.normalizeToRef(t.TmpVectors.Vector3[0]);
|
|
2605
|
+
i && B(e_125);
|
|
2606
|
+
var r_29 = t.Quaternion.FromUnitVectorsToRef(fe, e_125, t.TmpVectors.Quaternion[0]);
|
|
2554
2607
|
t.Quaternion.IsIdentity(r_29) || (n.rotation = r_29.asArray());
|
|
2555
2608
|
} var l = { type: a, name: s.name, color: s.diffuse.asArray(), intensity: s.intensity, range: s.range }; if (z(l, he), "spot" === a) {
|
|
2556
|
-
var
|
|
2557
|
-
l.spot = { innerConeAngle:
|
|
2609
|
+
var e_126 = s;
|
|
2610
|
+
l.spot = { innerConeAngle: e_126.innerAngle / 2, outerConeAngle: e_126.angle / 2 }, z(l.spot, de);
|
|
2558
2611
|
} _this._lights || (_this._lights = { lights: [] }), _this._lights.lights.push(l); var u = { light: _this._lights.lights.length - 1 }, c = s.parent; if (c && K(s, c)) {
|
|
2559
|
-
var
|
|
2560
|
-
if (
|
|
2561
|
-
var
|
|
2562
|
-
return k(n,
|
|
2612
|
+
var e_127 = r.get(c);
|
|
2613
|
+
if (e_127) {
|
|
2614
|
+
var t_54 = _this._exporter._nodes[e_127];
|
|
2615
|
+
return k(n, t_54), t_54.extensions || (t_54.extensions = {}), t_54.extensions[ce] = u, void o(null);
|
|
2563
2616
|
}
|
|
2564
2617
|
} n.extensions || (n.extensions = {}), n.extensions[ce] = u, o(n); })];
|
|
2565
2618
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -2571,55 +2624,108 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2571
2624
|
var me = !1;
|
|
2572
2625
|
function ge() { me || (me = !0, Z.RegisterExtension(ce, function (e) { return new pe(e); })); }
|
|
2573
2626
|
ge();
|
|
2574
|
-
var xe = "
|
|
2575
|
-
var
|
|
2576
|
-
function
|
|
2577
|
-
|
|
2627
|
+
var xe = "KHR_interactivity";
|
|
2628
|
+
var _e = /** @class */ (function () {
|
|
2629
|
+
function _e(e) {
|
|
2630
|
+
var t, n;
|
|
2631
|
+
this._exporter = e, this.name = xe, this.enabled = !!e.options.khrInteractivity, this.required = null !== (n = null === (t = e.options.khrInteractivity) || void 0 === t ? void 0 : t.required) && void 0 !== n && n;
|
|
2632
|
+
}
|
|
2633
|
+
_e.prototype.dispose = function () { this._exporter = null; };
|
|
2634
|
+
Object.defineProperty(_e.prototype, "wasUsed", {
|
|
2635
|
+
get: function () { return this.enabled; },
|
|
2636
|
+
enumerable: false,
|
|
2637
|
+
configurable: true
|
|
2638
|
+
});
|
|
2639
|
+
_e.prototype.onExporting = function () {
|
|
2640
|
+
var e_128, _a, e_129, _b;
|
|
2641
|
+
var _this = this;
|
|
2642
|
+
var e, t, n;
|
|
2643
|
+
var s = this._exporter.options.khrInteractivity;
|
|
2644
|
+
if (!s)
|
|
2645
|
+
return;
|
|
2646
|
+
var r = s.build({ getNodeCount: function () { return _this._exporter._nodes.length; }, getNodeIndex: function (e) { return _this._exporter._getNodeIndex(e); }, getAnimationIndex: function (e) { return _this._exporter._getAnimationIndex(e); }, getCameraIndex: function (e) { return _this._exporter._getCameraIndex(e); }, getMaterialIndex: function (e) { return _this._exporter._getMaterialIndex(e); }, getRootIndex: function (e, t) { return _this._exporter._getRootIndex(e, t); }, setNodeExtension: function (e, t, n) { return _this._exporter._setNodeExtension(e, t, n); } });
|
|
2647
|
+
this._exporter._glTF.extensions[xe] = r;
|
|
2648
|
+
try {
|
|
2649
|
+
for (var _c = __values(s.additionalExtensionsUsed), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
2650
|
+
var t_55 = _g.value;
|
|
2651
|
+
(e = this._exporter._glTF).extensionsUsed || (e.extensionsUsed = []), -1 === this._exporter._glTF.extensionsUsed.indexOf(t_55) && this._exporter._glTF.extensionsUsed.push(t_55);
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
catch (e_128_1) { e_128 = { error: e_128_1 }; }
|
|
2655
|
+
finally {
|
|
2656
|
+
try {
|
|
2657
|
+
if (_g && !_g.done && (_a = _c.return)) _a.call(_c);
|
|
2658
|
+
}
|
|
2659
|
+
finally { if (e_128) throw e_128.error; }
|
|
2660
|
+
}
|
|
2661
|
+
try {
|
|
2662
|
+
for (var _h = __values(s.additionalExtensionsRequired), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
2663
|
+
var e_130 = _j.value;
|
|
2664
|
+
(t = this._exporter._glTF).extensionsUsed || (t.extensionsUsed = []), -1 === this._exporter._glTF.extensionsUsed.indexOf(e_130) && this._exporter._glTF.extensionsUsed.push(e_130), (n = this._exporter._glTF).extensionsRequired || (n.extensionsRequired = []), -1 === this._exporter._glTF.extensionsRequired.indexOf(e_130) && this._exporter._glTF.extensionsRequired.push(e_130);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
catch (e_129_1) { e_129 = { error: e_129_1 }; }
|
|
2668
|
+
finally {
|
|
2669
|
+
try {
|
|
2670
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
2671
|
+
}
|
|
2672
|
+
finally { if (e_129) throw e_129.error; }
|
|
2673
|
+
}
|
|
2674
|
+
};
|
|
2675
|
+
return _e;
|
|
2676
|
+
}());
|
|
2677
|
+
var Te = !1;
|
|
2678
|
+
function ye() { Te || (Te = !0, Z.RegisterExtension(xe, function (e) { return new _e(e); }, 200)); }
|
|
2679
|
+
ye();
|
|
2680
|
+
var be = "EXT_lights_area", ve = { name: "", color: [1, 1, 1], intensity: 1, size: 1 }, Me = { aspect: 1 }, we = t.Vector3.Backward();
|
|
2681
|
+
var Re = /** @class */ (function () {
|
|
2682
|
+
function Re(e) {
|
|
2683
|
+
this.name = be, this.enabled = !0, this.required = !1, this._exporter = e;
|
|
2578
2684
|
}
|
|
2579
|
-
|
|
2580
|
-
Object.defineProperty(
|
|
2685
|
+
Re.prototype.dispose = function () { this._lights = null; };
|
|
2686
|
+
Object.defineProperty(Re.prototype, "wasUsed", {
|
|
2581
2687
|
get: function () { return !!this._lights; },
|
|
2582
2688
|
enumerable: false,
|
|
2583
2689
|
configurable: true
|
|
2584
2690
|
});
|
|
2585
|
-
|
|
2586
|
-
|
|
2691
|
+
Re.prototype.onExporting = function () { this._exporter._glTF.extensions[be] = this._lights; };
|
|
2692
|
+
Re.prototype.postExportNodeAsync = function (e, n, s, r, i) { return c(this, void 0, void 0, function () {
|
|
2587
2693
|
var _this = this;
|
|
2588
2694
|
return __generator(this, function (_a) {
|
|
2589
2695
|
switch (_a.label) {
|
|
2590
2696
|
case 0: return [4 /*yield*/, new Promise(function (o) { if (!(s instanceof t.Light))
|
|
2591
2697
|
return void o(n); var a = s.getTypeID() == t.Light.LIGHTTYPEID_RECT_AREALIGHT ? "rect" : null; if (!a)
|
|
2592
|
-
return t.Logger.Warn("".concat(e, ": Light ").concat(s.name, " is not supported in ").concat(
|
|
2593
|
-
var
|
|
2594
|
-
i && B(
|
|
2595
|
-
} var u = t.Vector3.Forward(); i && B(u); var c = t.Quaternion.FromUnitVectorsToRef(
|
|
2596
|
-
var
|
|
2597
|
-
if (
|
|
2598
|
-
var
|
|
2599
|
-
return k(n,
|
|
2698
|
+
return t.Logger.Warn("".concat(e, ": Light ").concat(s.name, " is not supported in ").concat(be)), void o(n); var l = s; if (l.falloffType !== t.Light.FALLOFF_GLTF && t.Logger.Warn("".concat(e, ": Light falloff for ").concat(s.name, " does not match the ").concat(be, " specification!")), !l.position.equalsToFloats(0, 0, 0)) {
|
|
2699
|
+
var e_131 = t.TmpVectors.Vector3[0].copyFrom(l.position);
|
|
2700
|
+
i && B(e_131), n.translation = e_131.asArray();
|
|
2701
|
+
} var u = t.Vector3.Forward(); i && B(u); var c = t.Quaternion.FromUnitVectorsToRef(we, u, t.TmpVectors.Quaternion[0]); t.Quaternion.IsIdentity(c) || (n.rotation = c.asArray()); var h = { type: a, name: l.name, color: l.diffuse.asArray(), intensity: l.intensity, size: l.height, rect: { aspect: l.width / l.height } }; z(h, ve), h.rect && z(h.rect, Me), _this._lights || (_this._lights = { lights: [] }), _this._lights.lights.push(h); var d = { light: _this._lights.lights.length - 1 }, f = s.parent; if (f && K(l, f)) {
|
|
2702
|
+
var e_132 = r.get(f);
|
|
2703
|
+
if (e_132) {
|
|
2704
|
+
var t_56 = _this._exporter._nodes[e_132];
|
|
2705
|
+
return k(n, t_56), t_56.extensions || (t_56.extensions = {}), t_56.extensions[be] = d, void o(null);
|
|
2600
2706
|
}
|
|
2601
|
-
} n.extensions || (n.extensions = {}), n.extensions[
|
|
2707
|
+
} n.extensions || (n.extensions = {}), n.extensions[be] = d, o(n); })];
|
|
2602
2708
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2603
2709
|
}
|
|
2604
2710
|
});
|
|
2605
2711
|
}); };
|
|
2606
|
-
return
|
|
2712
|
+
return Re;
|
|
2607
2713
|
}());
|
|
2608
|
-
var
|
|
2609
|
-
function
|
|
2610
|
-
|
|
2611
|
-
var
|
|
2612
|
-
var
|
|
2613
|
-
function
|
|
2614
|
-
this.name =
|
|
2714
|
+
var Ae = !1;
|
|
2715
|
+
function Ce() { Ae || (Ae = !0, Z.RegisterExtension(be, function (e) { return new Re(e); })); }
|
|
2716
|
+
Ce();
|
|
2717
|
+
var Ee = "KHR_materials_anisotropy";
|
|
2718
|
+
var Ie = /** @class */ (function () {
|
|
2719
|
+
function Ie(e) {
|
|
2720
|
+
this.name = Ee, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._anisoTexturesMap = {}, this._exporter = e;
|
|
2615
2721
|
}
|
|
2616
|
-
|
|
2617
|
-
Object.defineProperty(
|
|
2722
|
+
Ie.prototype.dispose = function () { };
|
|
2723
|
+
Object.defineProperty(Ie.prototype, "wasUsed", {
|
|
2618
2724
|
get: function () { return this._wasUsed; },
|
|
2619
2725
|
enumerable: false,
|
|
2620
2726
|
configurable: true
|
|
2621
2727
|
});
|
|
2622
|
-
|
|
2728
|
+
Ie.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e, n_53, r_30; return __generator(this, function (_a) {
|
|
2623
2729
|
switch (_a.label) {
|
|
2624
2730
|
case 0:
|
|
2625
2731
|
e = [];
|
|
@@ -2629,9 +2735,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2629
2735
|
return [3 /*break*/, 5];
|
|
2630
2736
|
case 1:
|
|
2631
2737
|
if (!(s instanceof t.OpenPBRMaterial && s.specularRoughnessAnisotropy > 0)) return [3 /*break*/, 5];
|
|
2632
|
-
|
|
2633
|
-
if (!this._anisoTexturesMap[
|
|
2634
|
-
e.push(this._anisoTexturesMap[
|
|
2738
|
+
n_53 = function (e) { var t = e.specularRoughnessAnisotropyTexture, n = e.geometryTangentTexture; return "".concat(t && t.getInternalTexture() ? t.getInternalTexture().uniqueId : "NoStrength", "_").concat(n && n.getInternalTexture() ? n.getInternalTexture().uniqueId : "NoTangent"); }(s);
|
|
2739
|
+
if (!this._anisoTexturesMap[n_53]) return [3 /*break*/, 2];
|
|
2740
|
+
e.push(this._anisoTexturesMap[n_53]);
|
|
2635
2741
|
return [3 /*break*/, 4];
|
|
2636
2742
|
case 2: return [4 /*yield*/, function (e) { return c(this, void 0, void 0, function () { var n, s, r, _a; return __generator(this, function (_b) {
|
|
2637
2743
|
switch (_b.label) {
|
|
@@ -2650,88 +2756,88 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2650
2756
|
}); }); }(s)];
|
|
2651
2757
|
case 3:
|
|
2652
2758
|
r_30 = _a.sent();
|
|
2653
|
-
r_30 && (e.push(r_30), this._anisoTexturesMap[
|
|
2759
|
+
r_30 && (e.push(r_30), this._anisoTexturesMap[n_53] = r_30);
|
|
2654
2760
|
_a.label = 4;
|
|
2655
2761
|
case 4: return [2 /*return*/, e];
|
|
2656
2762
|
case 5: return [2 /*return*/, []];
|
|
2657
2763
|
}
|
|
2658
2764
|
}); }); };
|
|
2659
|
-
|
|
2765
|
+
Ie.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
2660
2766
|
var _this = this;
|
|
2661
2767
|
return new Promise(function (e) { var r; if (s instanceof t.PBRBaseMaterial) {
|
|
2662
2768
|
if (!s.anisotropy.isEnabled || s.anisotropy.legacy)
|
|
2663
2769
|
return void e(n);
|
|
2664
2770
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
2665
|
-
var
|
|
2666
|
-
null !== r_31.anisotropyTexture && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
2771
|
+
var t_57 = _this._exporter._materialExporter.getTextureInfo(s.anisotropy.texture), r_31 = { anisotropyStrength: s.anisotropy.intensity, anisotropyRotation: s.anisotropy.angle, anisotropyTexture: null != t_57 ? t_57 : void 0 };
|
|
2772
|
+
null !== r_31.anisotropyTexture && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ee] = r_31;
|
|
2667
2773
|
}
|
|
2668
2774
|
else if (s instanceof t.OpenPBRMaterial && s.specularRoughnessAnisotropy > 0) {
|
|
2669
2775
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
2670
|
-
var
|
|
2671
|
-
s._useRoughnessFromMetallicTextureGreen && (
|
|
2776
|
+
var t_58 = s.specularRoughnessTexture;
|
|
2777
|
+
s._useRoughnessFromMetallicTextureGreen && (t_58 = s.baseMetalnessTexture);
|
|
2672
2778
|
var i_21 = _this._anisoTexturesMap[s.id];
|
|
2673
|
-
if (!
|
|
2674
|
-
var
|
|
2779
|
+
if (!t_58 && !i_21) {
|
|
2780
|
+
var t_59 = s.specularRoughness, r_32 = s.specularRoughnessAnisotropy;
|
|
2675
2781
|
if (!s._useGltfStyleAnisotropy) {
|
|
2676
|
-
var
|
|
2677
|
-
|
|
2782
|
+
var e_133 = function (e, t) { var n = e * e, s = n * Math.sqrt(2 / (1 + (1 - t) * (1 - t))), r = (1 - t) * s; return { newBaseRoughness: Math.sqrt(r), newAnisotropyStrength: Math.min(Math.sqrt((s - n) / Math.max(1 - n, 1e-4)), 1) }; }(s.specularRoughness, s.specularRoughnessAnisotropy);
|
|
2783
|
+
t_59 = e_133.newBaseRoughness, r_32 = e_133.newAnisotropyStrength;
|
|
2678
2784
|
}
|
|
2679
|
-
n.pbrMetallicRoughness && (n.pbrMetallicRoughness.roughnessFactor =
|
|
2785
|
+
n.pbrMetallicRoughness && (n.pbrMetallicRoughness.roughnessFactor = t_59);
|
|
2680
2786
|
var i_22 = { anisotropyStrength: r_32, anisotropyRotation: s.geometryTangentAngle + .5 * Math.PI, anisotropyTexture: void 0 };
|
|
2681
|
-
return n.extensions[
|
|
2787
|
+
return n.extensions[Ee] = i_22, e(n);
|
|
2682
2788
|
}
|
|
2683
|
-
var
|
|
2684
|
-
s._useGltfStyleAnisotropy || (n.extensions.KHR_materials_openpbr = {}, (r = _this._exporter._glTF).extensionsUsed || (r.extensionsUsed = []), -1 === _this._exporter._glTF.extensionsUsed.indexOf("KHR_materials_openpbr") && _this._exporter._glTF.extensionsUsed.push("KHR_materials_openpbr")), _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
2789
|
+
var o_28 = i_21 ? _this._exporter._materialExporter.getTextureInfo(i_21) : null, a_18 = { anisotropyStrength: s.specularRoughnessAnisotropy, anisotropyRotation: s.geometryTangentAngle, anisotropyTexture: o_28 || void 0, extensions: {} };
|
|
2790
|
+
s._useGltfStyleAnisotropy || (n.extensions.KHR_materials_openpbr = {}, (r = _this._exporter._glTF).extensionsUsed || (r.extensionsUsed = []), -1 === _this._exporter._glTF.extensionsUsed.indexOf("KHR_materials_openpbr") && _this._exporter._glTF.extensionsUsed.push("KHR_materials_openpbr")), _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ee] = a_18;
|
|
2685
2791
|
} e(n); });
|
|
2686
2792
|
};
|
|
2687
|
-
return
|
|
2793
|
+
return Ie;
|
|
2688
2794
|
}());
|
|
2689
|
-
var
|
|
2690
|
-
function
|
|
2691
|
-
|
|
2692
|
-
var
|
|
2693
|
-
function
|
|
2694
|
-
var
|
|
2695
|
-
function
|
|
2696
|
-
this.name =
|
|
2795
|
+
var Se = !1;
|
|
2796
|
+
function Fe() { Se || (Se = !0, Z.RegisterExtension(Ee, function (e) { return new Ie(e); })); }
|
|
2797
|
+
Fe();
|
|
2798
|
+
var Ve = "KHR_materials_clearcoat";
|
|
2799
|
+
function Oe(e, n) { var s = new t.Texture(n.name, n.getScene()); return s._texture = e, s.coordinatesIndex = n.coordinatesIndex, n instanceof t.Texture && (s.uOffset = n.uOffset, s.vOffset = n.vOffset, s.uScale = n.uScale, s.vScale = n.vScale, s.wAng = n.wAng), s.wrapU = n.wrapU, s.wrapV = n.wrapV, s; }
|
|
2800
|
+
var Be = /** @class */ (function () {
|
|
2801
|
+
function Be(e) {
|
|
2802
|
+
this.name = Ve, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._mergedTexturesMap = {}, this._cachedInternalTexturesMap = {}, this._exporter = e;
|
|
2697
2803
|
}
|
|
2698
|
-
|
|
2699
|
-
var
|
|
2804
|
+
Be.prototype.dispose = function () {
|
|
2805
|
+
var e_134, _a, e_135, _b;
|
|
2700
2806
|
try {
|
|
2701
2807
|
for (var _c = __values(Object.keys(this._mergedTexturesMap)), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
2702
|
-
var
|
|
2703
|
-
this._mergedTexturesMap[
|
|
2808
|
+
var e_136 = _g.value;
|
|
2809
|
+
this._mergedTexturesMap[e_136].dispose();
|
|
2704
2810
|
}
|
|
2705
2811
|
}
|
|
2706
|
-
catch (
|
|
2812
|
+
catch (e_134_1) { e_134 = { error: e_134_1 }; }
|
|
2707
2813
|
finally {
|
|
2708
2814
|
try {
|
|
2709
2815
|
if (_g && !_g.done && (_a = _c.return)) _a.call(_c);
|
|
2710
2816
|
}
|
|
2711
|
-
finally { if (
|
|
2817
|
+
finally { if (e_134) throw e_134.error; }
|
|
2712
2818
|
}
|
|
2713
2819
|
this._mergedTexturesMap = {};
|
|
2714
2820
|
try {
|
|
2715
2821
|
for (var _h = __values(Object.keys(this._cachedInternalTexturesMap)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
2716
|
-
var
|
|
2717
|
-
this._cachedInternalTexturesMap[
|
|
2822
|
+
var e_137 = _j.value;
|
|
2823
|
+
this._cachedInternalTexturesMap[e_137].dispose();
|
|
2718
2824
|
}
|
|
2719
2825
|
}
|
|
2720
|
-
catch (
|
|
2826
|
+
catch (e_135_1) { e_135 = { error: e_135_1 }; }
|
|
2721
2827
|
finally {
|
|
2722
2828
|
try {
|
|
2723
2829
|
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
2724
2830
|
}
|
|
2725
|
-
finally { if (
|
|
2831
|
+
finally { if (e_135) throw e_135.error; }
|
|
2726
2832
|
}
|
|
2727
2833
|
this._cachedInternalTexturesMap = {};
|
|
2728
2834
|
};
|
|
2729
|
-
Object.defineProperty(
|
|
2835
|
+
Object.defineProperty(Be.prototype, "wasUsed", {
|
|
2730
2836
|
get: function () { return this._wasUsed; },
|
|
2731
2837
|
enumerable: false,
|
|
2732
2838
|
configurable: true
|
|
2733
2839
|
});
|
|
2734
|
-
|
|
2840
|
+
Be.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e, n_54, n_55, e_138; return __generator(this, function (_a) {
|
|
2735
2841
|
switch (_a.label) {
|
|
2736
2842
|
case 0:
|
|
2737
2843
|
e = [];
|
|
@@ -2741,10 +2847,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2741
2847
|
return [3 /*break*/, 5];
|
|
2742
2848
|
case 1:
|
|
2743
2849
|
if (!(s instanceof t.OpenPBRMaterial && s.coatWeight > 0)) return [3 /*break*/, 5];
|
|
2744
|
-
|
|
2745
|
-
if (!(s.coatWeightTexture ? s.coatRoughnessTexture ? s._useCoatRoughnessFromGreenChannel && s.coatWeightTexture.getInternalTexture() === s.coatRoughnessTexture.getInternalTexture() ? (e.push(s.coatWeightTexture), e.push(s.coatRoughnessTexture)) :
|
|
2746
|
-
|
|
2747
|
-
if (!!this._cachedInternalTexturesMap[
|
|
2850
|
+
n_54 = !1;
|
|
2851
|
+
if (!(s.coatWeightTexture ? s.coatRoughnessTexture ? s._useCoatRoughnessFromGreenChannel && s.coatWeightTexture.getInternalTexture() === s.coatRoughnessTexture.getInternalTexture() ? (e.push(s.coatWeightTexture), e.push(s.coatRoughnessTexture)) : n_54 = !0 : e.push(s.coatWeightTexture) : s.coatRoughnessTexture && (s._useCoatRoughnessFromGreenChannel ? e.push(s.coatRoughnessTexture) : n_54 = !0), n_54)) return [3 /*break*/, 4];
|
|
2852
|
+
n_55 = function (e) { var t = e.coatWeightTexture, n = t && t.getInternalTexture() ? t.getInternalTexture().uniqueId : "NoCoat", s = e.coatRoughnessTexture; return "".concat(n, "_").concat(s && s.getInternalTexture() ? s.getInternalTexture().uniqueId : "NoRoughness"); }(s);
|
|
2853
|
+
if (!!this._cachedInternalTexturesMap[n_55]) return [3 /*break*/, 3];
|
|
2748
2854
|
return [4 /*yield*/, function (e) { return c(this, void 0, void 0, function () { var n, s, r, _a; return __generator(this, function (_b) {
|
|
2749
2855
|
switch (_b.label) {
|
|
2750
2856
|
case 0:
|
|
@@ -2761,17 +2867,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2761
2867
|
}
|
|
2762
2868
|
}); }); }(s)];
|
|
2763
2869
|
case 2:
|
|
2764
|
-
|
|
2765
|
-
|
|
2870
|
+
e_138 = _a.sent();
|
|
2871
|
+
e_138 && (this._cachedInternalTexturesMap[n_55] = e_138);
|
|
2766
2872
|
_a.label = 3;
|
|
2767
2873
|
case 3:
|
|
2768
|
-
this._cachedInternalTexturesMap[
|
|
2874
|
+
this._cachedInternalTexturesMap[n_55] && (s.coatWeightTexture && (this._mergedTexturesMap[s.coatWeightTexture.uniqueId] = Oe(this._cachedInternalTexturesMap[n_55], s.coatWeightTexture), e.push(this._mergedTexturesMap[s.coatWeightTexture.uniqueId])), s.coatRoughnessTexture && (this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId] = Oe(this._cachedInternalTexturesMap[n_55], s.coatRoughnessTexture), e.push(this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId])));
|
|
2769
2875
|
_a.label = 4;
|
|
2770
2876
|
case 4: return [2 /*return*/, (s.geometryCoatNormalTexture && e.push(s.geometryCoatNormalTexture), e)];
|
|
2771
2877
|
case 5: return [2 /*return*/, []];
|
|
2772
2878
|
}
|
|
2773
2879
|
}); }); };
|
|
2774
|
-
|
|
2880
|
+
Be.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
2775
2881
|
var _this = this;
|
|
2776
2882
|
return new Promise(function (e) { if (s instanceof t.PBRBaseMaterial) {
|
|
2777
2883
|
if (!s.clearCoat.isEnabled)
|
|
@@ -2780,67 +2886,67 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2780
2886
|
var r_33 = _this._exporter._materialExporter.getTextureInfo(s.clearCoat.texture);
|
|
2781
2887
|
var i_23;
|
|
2782
2888
|
i_23 = s.clearCoat.useRoughnessFromMainTexture ? _this._exporter._materialExporter.getTextureInfo(s.clearCoat.texture) : _this._exporter._materialExporter.getTextureInfo(s.clearCoat.textureRoughness), s.clearCoat.isTintEnabled && t.Tools.Warn("Clear Color tint is not supported for glTF export. Ignoring for: ".concat(s.name)), s.clearCoat.remapF0OnInterfaceChange && t.Tools.Warn("Clear Color F0 remapping is not supported for glTF export. Ignoring for: ".concat(s.name));
|
|
2783
|
-
var
|
|
2784
|
-
null ===
|
|
2889
|
+
var o_29 = _this._exporter._materialExporter.getTextureInfo(s.clearCoat.bumpTexture), a_19 = { clearcoatFactor: s.clearCoat.intensity, clearcoatTexture: null != r_33 ? r_33 : void 0, clearcoatRoughnessFactor: s.clearCoat.roughness, clearcoatRoughnessTexture: null != i_23 ? i_23 : void 0, clearcoatNormalTexture: null != o_29 ? o_29 : void 0 };
|
|
2890
|
+
null === a_19.clearcoatTexture && null === a_19.clearcoatRoughnessTexture && null === a_19.clearcoatRoughnessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ve] = a_19;
|
|
2785
2891
|
}
|
|
2786
2892
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
2787
2893
|
if (0 == s.coatWeight)
|
|
2788
2894
|
return void e(n);
|
|
2789
|
-
var r_34, i_24,
|
|
2790
|
-
_this._wasUsed = !0, n.extensions = n.extensions || {}, s.coatWeightTexture && (r_34 = _this._mergedTexturesMap[s.coatWeightTexture.uniqueId], i_24 = _this._exporter._materialExporter.getTextureInfo(r_34)), s.coatRoughnessTexture && (
|
|
2791
|
-
var l_18 = _this._exporter._materialExporter.getTextureInfo(s.geometryCoatNormalTexture), u_15 = { clearcoatFactor: s.coatWeight, clearcoatTexture: null != i_24 ? i_24 : void 0, clearcoatRoughnessFactor: s.coatRoughness, clearcoatRoughnessTexture: null !=
|
|
2792
|
-
null === u_15.clearcoatTexture && null === u_15.clearcoatRoughnessTexture && null === u_15.clearcoatRoughnessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
2895
|
+
var r_34, i_24, o_30, a_20;
|
|
2896
|
+
_this._wasUsed = !0, n.extensions = n.extensions || {}, s.coatWeightTexture && (r_34 = _this._mergedTexturesMap[s.coatWeightTexture.uniqueId], i_24 = _this._exporter._materialExporter.getTextureInfo(r_34)), s.coatRoughnessTexture && (o_30 = _this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId], a_20 = _this._exporter._materialExporter.getTextureInfo(o_30)), s.coatColorTexture && t.Tools.Warn("Clear Color tint is not supported for glTF export. Ignoring for: ".concat(s.name));
|
|
2897
|
+
var l_18 = _this._exporter._materialExporter.getTextureInfo(s.geometryCoatNormalTexture), u_15 = { clearcoatFactor: s.coatWeight, clearcoatTexture: null != i_24 ? i_24 : void 0, clearcoatRoughnessFactor: s.coatRoughness, clearcoatRoughnessTexture: null != a_20 ? a_20 : void 0, clearcoatNormalTexture: null != l_18 ? l_18 : void 0 };
|
|
2898
|
+
null === u_15.clearcoatTexture && null === u_15.clearcoatRoughnessTexture && null === u_15.clearcoatRoughnessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ve] = u_15;
|
|
2793
2899
|
} e(n); });
|
|
2794
2900
|
};
|
|
2795
|
-
return
|
|
2901
|
+
return Be;
|
|
2796
2902
|
}());
|
|
2797
|
-
var
|
|
2798
|
-
function
|
|
2799
|
-
|
|
2800
|
-
var
|
|
2801
|
-
function
|
|
2802
|
-
function
|
|
2803
|
-
var
|
|
2804
|
-
function
|
|
2805
|
-
this.name =
|
|
2903
|
+
var Ne = !1;
|
|
2904
|
+
function Pe() { Ne || (Ne = !0, Z.RegisterExtension(Ve, function (e) { return new Be(e); })); }
|
|
2905
|
+
Pe();
|
|
2906
|
+
var Ue = "KHR_materials_coat";
|
|
2907
|
+
function ke(e) { var t = e.coatRoughnessAnisotropyTexture, n = e.geometryCoatTangentTexture; return "".concat(t && t.getInternalTexture() ? t.getInternalTexture().uniqueId : "NoStrength", "_").concat(n && n.getInternalTexture() ? n.getInternalTexture().uniqueId : "NoTangent"); }
|
|
2908
|
+
function Ke(e, n) { var s = new t.Texture(n.name, n.getScene()); return s._texture = e, s.coordinatesIndex = n.coordinatesIndex, n instanceof t.Texture && (s.uOffset = n.uOffset, s.vOffset = n.vOffset, s.uScale = n.uScale, s.vScale = n.vScale, s.wAng = n.wAng), s.wrapU = n.wrapU, s.wrapV = n.wrapV, s; }
|
|
2909
|
+
var $e = /** @class */ (function () {
|
|
2910
|
+
function $e(e) {
|
|
2911
|
+
this.name = Ue, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._mergedTexturesMap = {}, this._cachedInternalTexturesMap = {}, this._exporter = e;
|
|
2806
2912
|
}
|
|
2807
|
-
|
|
2808
|
-
var
|
|
2913
|
+
$e.prototype.dispose = function () {
|
|
2914
|
+
var e_139, _a, e_140, _b;
|
|
2809
2915
|
try {
|
|
2810
2916
|
for (var _c = __values(Object.keys(this._mergedTexturesMap)), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
2811
|
-
var
|
|
2812
|
-
this._mergedTexturesMap[
|
|
2917
|
+
var e_141 = _g.value;
|
|
2918
|
+
this._mergedTexturesMap[e_141].dispose();
|
|
2813
2919
|
}
|
|
2814
2920
|
}
|
|
2815
|
-
catch (
|
|
2921
|
+
catch (e_139_1) { e_139 = { error: e_139_1 }; }
|
|
2816
2922
|
finally {
|
|
2817
2923
|
try {
|
|
2818
2924
|
if (_g && !_g.done && (_a = _c.return)) _a.call(_c);
|
|
2819
2925
|
}
|
|
2820
|
-
finally { if (
|
|
2926
|
+
finally { if (e_139) throw e_139.error; }
|
|
2821
2927
|
}
|
|
2822
2928
|
this._mergedTexturesMap = {};
|
|
2823
2929
|
try {
|
|
2824
2930
|
for (var _h = __values(Object.keys(this._cachedInternalTexturesMap)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
2825
|
-
var
|
|
2826
|
-
this._cachedInternalTexturesMap[
|
|
2931
|
+
var e_142 = _j.value;
|
|
2932
|
+
this._cachedInternalTexturesMap[e_142].dispose();
|
|
2827
2933
|
}
|
|
2828
2934
|
}
|
|
2829
|
-
catch (
|
|
2935
|
+
catch (e_140_1) { e_140 = { error: e_140_1 }; }
|
|
2830
2936
|
finally {
|
|
2831
2937
|
try {
|
|
2832
2938
|
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
2833
2939
|
}
|
|
2834
|
-
finally { if (
|
|
2940
|
+
finally { if (e_140) throw e_140.error; }
|
|
2835
2941
|
}
|
|
2836
2942
|
this._cachedInternalTexturesMap = {};
|
|
2837
2943
|
};
|
|
2838
|
-
Object.defineProperty(
|
|
2944
|
+
Object.defineProperty($e.prototype, "wasUsed", {
|
|
2839
2945
|
get: function () { return this._wasUsed; },
|
|
2840
2946
|
enumerable: false,
|
|
2841
2947
|
configurable: true
|
|
2842
2948
|
});
|
|
2843
|
-
|
|
2949
|
+
$e.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e, n_56, n_57, e_143, n_58, r_35; return __generator(this, function (_a) {
|
|
2844
2950
|
switch (_a.label) {
|
|
2845
2951
|
case 0:
|
|
2846
2952
|
e = [];
|
|
@@ -2850,10 +2956,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2850
2956
|
return [3 /*break*/, 9];
|
|
2851
2957
|
case 1:
|
|
2852
2958
|
if (!(s instanceof t.OpenPBRMaterial && s.coatWeight > 0)) return [3 /*break*/, 9];
|
|
2853
|
-
|
|
2854
|
-
if (!(s.coatWeightTexture ? s.coatRoughnessTexture ? s._useCoatRoughnessFromGreenChannel && s.coatWeightTexture.getInternalTexture() === s.coatRoughnessTexture.getInternalTexture() ? (e.push(s.coatWeightTexture), e.push(s.coatRoughnessTexture)) :
|
|
2855
|
-
|
|
2856
|
-
if (!!this._cachedInternalTexturesMap[
|
|
2959
|
+
n_56 = !1;
|
|
2960
|
+
if (!(s.coatWeightTexture ? s.coatRoughnessTexture ? s._useCoatRoughnessFromGreenChannel && s.coatWeightTexture.getInternalTexture() === s.coatRoughnessTexture.getInternalTexture() ? (e.push(s.coatWeightTexture), e.push(s.coatRoughnessTexture)) : n_56 = !0 : e.push(s.coatWeightTexture) : s.coatRoughnessTexture && (s._useCoatRoughnessFromGreenChannel ? e.push(s.coatRoughnessTexture) : n_56 = !0), n_56)) return [3 /*break*/, 4];
|
|
2961
|
+
n_57 = function (e) { var t = e.coatWeightTexture, n = t && t.getInternalTexture() ? t.getInternalTexture().uniqueId : "NoCoat", s = e.coatRoughnessTexture; return "".concat(n, "_").concat(s && s.getInternalTexture() ? s.getInternalTexture().uniqueId : "NoRoughness"); }(s);
|
|
2962
|
+
if (!!this._cachedInternalTexturesMap[n_57]) return [3 /*break*/, 3];
|
|
2857
2963
|
return [4 /*yield*/, function (e) { return c(this, void 0, void 0, function () { var n, s, r, _a; return __generator(this, function (_b) {
|
|
2858
2964
|
switch (_b.label) {
|
|
2859
2965
|
case 0:
|
|
@@ -2870,17 +2976,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2870
2976
|
}
|
|
2871
2977
|
}); }); }(s)];
|
|
2872
2978
|
case 2:
|
|
2873
|
-
|
|
2874
|
-
|
|
2979
|
+
e_143 = _a.sent();
|
|
2980
|
+
e_143 && (this._cachedInternalTexturesMap[n_57] = e_143);
|
|
2875
2981
|
_a.label = 3;
|
|
2876
2982
|
case 3:
|
|
2877
|
-
this._cachedInternalTexturesMap[
|
|
2983
|
+
this._cachedInternalTexturesMap[n_57] && (s.coatWeightTexture && (this._mergedTexturesMap[s.coatWeightTexture.uniqueId] = Ke(this._cachedInternalTexturesMap[n_57], s.coatWeightTexture), e.push(this._mergedTexturesMap[s.coatWeightTexture.uniqueId])), s.coatRoughnessTexture && (this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId] = Ke(this._cachedInternalTexturesMap[n_57], s.coatRoughnessTexture), e.push(this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId])));
|
|
2878
2984
|
_a.label = 4;
|
|
2879
2985
|
case 4:
|
|
2880
2986
|
if (!(s.geometryCoatNormalTexture && e.push(s.geometryCoatNormalTexture), s.coatColorTexture && e.push(s.coatColorTexture), s.coatRoughnessAnisotropy > 0)) return [3 /*break*/, 8];
|
|
2881
|
-
|
|
2882
|
-
if (!this._mergedTexturesMap[
|
|
2883
|
-
e.push(this._mergedTexturesMap[
|
|
2987
|
+
n_58 = ke(s);
|
|
2988
|
+
if (!this._mergedTexturesMap[n_58]) return [3 /*break*/, 5];
|
|
2989
|
+
e.push(this._mergedTexturesMap[n_58]);
|
|
2884
2990
|
return [3 /*break*/, 7];
|
|
2885
2991
|
case 5: return [4 /*yield*/, function (e) { return c(this, void 0, void 0, function () { var n, s, r, _a; return __generator(this, function (_b) {
|
|
2886
2992
|
switch (_b.label) {
|
|
@@ -2899,137 +3005,137 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2899
3005
|
}); }); }(s)];
|
|
2900
3006
|
case 6:
|
|
2901
3007
|
r_35 = _a.sent();
|
|
2902
|
-
r_35 && (e.push(r_35), this._mergedTexturesMap[
|
|
3008
|
+
r_35 && (e.push(r_35), this._mergedTexturesMap[n_58] = r_35);
|
|
2903
3009
|
_a.label = 7;
|
|
2904
3010
|
case 7: return [2 /*return*/, e];
|
|
2905
3011
|
case 8: return [2 /*return*/, e];
|
|
2906
3012
|
case 9: return [2 /*return*/, []];
|
|
2907
3013
|
}
|
|
2908
3014
|
}); }); };
|
|
2909
|
-
|
|
3015
|
+
$e.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
2910
3016
|
var _this = this;
|
|
2911
3017
|
return new Promise(function (e) { var r; if (s instanceof t.PBRBaseMaterial) {
|
|
2912
3018
|
if (!s.clearCoat.isEnabled)
|
|
2913
3019
|
return void e(n);
|
|
2914
3020
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
2915
|
-
var
|
|
3021
|
+
var t_60 = _this._exporter._materialExporter.getTextureInfo(s.clearCoat.texture);
|
|
2916
3022
|
var r_36, i_25;
|
|
2917
3023
|
r_36 = s.clearCoat.useRoughnessFromMainTexture ? _this._exporter._materialExporter.getTextureInfo(s.clearCoat.texture) : _this._exporter._materialExporter.getTextureInfo(s.clearCoat.textureRoughness), s.clearCoat.isTintEnabled && (i_25 = _this._exporter._materialExporter.getTextureInfo(s.clearCoat.tintTexture));
|
|
2918
|
-
var
|
|
2919
|
-
null === l_19.coatTexture && null === l_19.coatRoughnessTexture && null === l_19.coatRoughnessTexture && null === l_19.coatColorTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
3024
|
+
var o_31 = _this._exporter._materialExporter.getTextureInfo(s.clearCoat.bumpTexture), a_21 = s.clearCoat.indexOfRefraction, l_19 = { coatFactor: s.clearCoat.intensity, coatTexture: null != t_60 ? t_60 : void 0, coatRoughnessFactor: s.clearCoat.roughness, coatRoughnessTexture: null != r_36 ? r_36 : void 0, coatNormalTexture: null != o_31 ? o_31 : void 0, coatColorFactor: s.clearCoat.tintColor.asArray(), coatColorTexture: null != i_25 ? i_25 : void 0, coatIor: 1.5 !== a_21 ? a_21 : void 0 };
|
|
3025
|
+
null === l_19.coatTexture && null === l_19.coatRoughnessTexture && null === l_19.coatRoughnessTexture && null === l_19.coatColorTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ue] = l_19;
|
|
2920
3026
|
}
|
|
2921
3027
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
2922
3028
|
if (0 == s.coatWeight)
|
|
2923
3029
|
return void e(n);
|
|
2924
|
-
var
|
|
2925
|
-
_this._wasUsed = !0, n.extensions = n.extensions || {}, s.coatWeightTexture && (
|
|
2926
|
-
var l_20 = _this._exporter._materialExporter.getTextureInfo(s.geometryCoatNormalTexture), u_16 = _this._exporter._materialExporter.getTextureInfo(s.coatColorTexture),
|
|
2927
|
-
var m_6,
|
|
3030
|
+
var t_61, i_26, o_32, a_22;
|
|
3031
|
+
_this._wasUsed = !0, n.extensions = n.extensions || {}, s.coatWeightTexture && (t_61 = _this._mergedTexturesMap[s.coatWeightTexture.uniqueId] ? _this._mergedTexturesMap[s.coatWeightTexture.uniqueId] : s.coatWeightTexture, i_26 = _this._exporter._materialExporter.getTextureInfo(t_61)), s.coatRoughnessTexture && (o_32 = _this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId] ? _this._mergedTexturesMap[s.coatRoughnessTexture.uniqueId] : s.coatRoughnessTexture, a_22 = _this._exporter._materialExporter.getTextureInfo(o_32));
|
|
3032
|
+
var l_20 = _this._exporter._materialExporter.getTextureInfo(s.geometryCoatNormalTexture), u_16 = _this._exporter._materialExporter.getTextureInfo(s.coatColorTexture), c_14 = s.coatIor, h_14 = s.coatDarkening, d_8 = s.coatRoughnessTexture, f_13 = ke(s), p_7 = _this._mergedTexturesMap[f_13];
|
|
3033
|
+
var m_6, g_8 = 0, x_8 = 0;
|
|
2928
3034
|
if (s.coatRoughnessAnisotropy > 0) {
|
|
2929
|
-
if (
|
|
2930
|
-
var
|
|
2931
|
-
|
|
3035
|
+
if (d_8 || p_7) {
|
|
3036
|
+
var e_144 = p_7 ? _this._exporter._materialExporter.getTextureInfo(p_7) : null;
|
|
3037
|
+
g_8 = s.coatRoughnessAnisotropy, x_8 = s.geometryCoatTangentAngle, m_6 = e_144 || void 0;
|
|
2932
3038
|
}
|
|
2933
3039
|
else {
|
|
2934
|
-
var
|
|
3040
|
+
var e_145 = s.coatRoughness, t_62 = s.coatRoughnessAnisotropy;
|
|
2935
3041
|
if (!s._useGltfStyleAnisotropy) {
|
|
2936
|
-
var
|
|
2937
|
-
|
|
3042
|
+
var n_59 = function (e, t) { var n = e * e, s = n * Math.sqrt(2 / (1 + (1 - t) * (1 - t))), r = (1 - t) * s; return { newBaseRoughness: Math.sqrt(r), newAnisotropyStrength: Math.min(Math.sqrt((s - n) / Math.max(1 - n, 1e-4)), 1) }; }(s.coatRoughness, s.coatRoughnessAnisotropy);
|
|
3043
|
+
e_145 = n_59.newBaseRoughness, t_62 = n_59.newAnisotropyStrength;
|
|
2938
3044
|
}
|
|
2939
|
-
n.pbrMetallicRoughness && (n.pbrMetallicRoughness.roughnessFactor =
|
|
3045
|
+
n.pbrMetallicRoughness && (n.pbrMetallicRoughness.roughnessFactor = e_145), g_8 = t_62, x_8 = s.geometryCoatTangentAngle + .5 * Math.PI, m_6 = void 0;
|
|
2940
3046
|
}
|
|
2941
3047
|
s._useGltfStyleAnisotropy || (n.extensions.KHR_materials_openpbr = {}, (r = _this._exporter._glTF).extensionsUsed || (r.extensionsUsed = []), -1 === _this._exporter._glTF.extensionsUsed.indexOf("KHR_materials_openpbr") && _this._exporter._glTF.extensionsUsed.push("KHR_materials_openpbr"));
|
|
2942
3048
|
}
|
|
2943
|
-
var _7 = { coatFactor: s.coatWeight, coatTexture: null != i_26 ? i_26 : void 0, coatRoughnessFactor: s.coatRoughness, coatRoughnessTexture: null !=
|
|
2944
|
-
null === _7.coatTexture && null === _7.coatRoughnessTexture && null === _7.coatRoughnessTexture && null === _7.coatAnisotropyTexture && null === _7.coatColorTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
3049
|
+
var _7 = { coatFactor: s.coatWeight, coatTexture: null != i_26 ? i_26 : void 0, coatRoughnessFactor: s.coatRoughness, coatRoughnessTexture: null != a_22 ? a_22 : void 0, coatNormalTexture: null != l_20 ? l_20 : void 0, coatColorFactor: s.coatColor.asArray(), coatColorTexture: null != u_16 ? u_16 : void 0, coatIor: 1.5 !== c_14 ? c_14 : void 0, coatDarkeningFactor: 1 !== h_14 ? h_14 : void 0, coatAnisotropyRotation: x_8, coatAnisotropyStrength: g_8, coatAnisotropyTexture: m_6 };
|
|
3050
|
+
null === _7.coatTexture && null === _7.coatRoughnessTexture && null === _7.coatRoughnessTexture && null === _7.coatAnisotropyTexture && null === _7.coatColorTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Ue] = _7;
|
|
2945
3051
|
} e(n); });
|
|
2946
3052
|
};
|
|
2947
|
-
return
|
|
3053
|
+
return $e;
|
|
2948
3054
|
}());
|
|
2949
|
-
var
|
|
2950
|
-
function
|
|
2951
|
-
|
|
2952
|
-
var
|
|
2953
|
-
function
|
|
2954
|
-
var
|
|
2955
|
-
function
|
|
2956
|
-
this.name =
|
|
3055
|
+
var ze = !1;
|
|
3056
|
+
function We() { ze || (ze = !0, Z.RegisterExtension(Ue, function (e) { return new $e(e); })); }
|
|
3057
|
+
We();
|
|
3058
|
+
var De = "KHR_materials_diffuse_transmission";
|
|
3059
|
+
function Le(e, n) { var s = n.subSurface; var r = null; return s.translucencyIntensityTexture ? r = s.translucencyIntensityTexture : s.thicknessTexture && s.useMaskFromThicknessTexture && (r = s.thicknessTexture), r && !s.useGltfStyleTextures ? (t.Logger.Warn("".concat(e, ": Translucency intensity texture is not supported when useGltfStyleTextures = false. Ignoring for: ").concat(n.name), 1), null) : r; }
|
|
3060
|
+
var He = /** @class */ (function () {
|
|
3061
|
+
function He(e) {
|
|
3062
|
+
this.name = De, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
2957
3063
|
}
|
|
2958
|
-
|
|
2959
|
-
Object.defineProperty(
|
|
3064
|
+
He.prototype.dispose = function () { };
|
|
3065
|
+
Object.defineProperty(He.prototype, "wasUsed", {
|
|
2960
3066
|
get: function () { return this._wasUsed; },
|
|
2961
3067
|
enumerable: false,
|
|
2962
3068
|
configurable: true
|
|
2963
3069
|
});
|
|
2964
|
-
|
|
3070
|
+
He.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var n, t_63; return __generator(this, function (_a) {
|
|
2965
3071
|
n = [];
|
|
2966
3072
|
if (s instanceof t.PBRMaterial && this._isExtensionEnabled(s)) {
|
|
2967
|
-
|
|
2968
|
-
return [2 /*return*/, (
|
|
3073
|
+
t_63 = Le(e, s);
|
|
3074
|
+
return [2 /*return*/, (t_63 && n.push(t_63), s.subSurface.translucencyColorTexture && n.push(s.subSurface.translucencyColorTexture), n)];
|
|
2969
3075
|
}
|
|
2970
3076
|
return [2 /*return*/, n];
|
|
2971
3077
|
}); }); };
|
|
2972
|
-
|
|
3078
|
+
He.prototype._isExtensionEnabled = function (e) { if (e.unlit)
|
|
2973
3079
|
return !1; var t = e.subSurface; return !!t.isTranslucencyEnabled && !e.unlit && !t.useAlbedoToTintTranslucency && t.useGltfStyleTextures && 1 === t.volumeIndexOfRefraction && 0 === t.minimumThickness && 0 === t.maximumThickness; };
|
|
2974
|
-
|
|
3080
|
+
He.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
2975
3081
|
var _this = this;
|
|
2976
3082
|
return new Promise(function (r) { var i, o; if (s instanceof t.PBRMaterial && _this._isExtensionEnabled(s)) {
|
|
2977
3083
|
_this._wasUsed = !0;
|
|
2978
|
-
var
|
|
2979
|
-
(l_21 ||
|
|
3084
|
+
var t_64 = s.subSurface, r_37 = Le(e, s), a_23 = 0 == t_64.translucencyIntensity ? void 0 : t_64.translucencyIntensity, l_21 = null !== (i = _this._exporter._materialExporter.getTextureInfo(r_37)) && void 0 !== i ? i : void 0, u_17 = !t_64.translucencyColor || t_64.translucencyColor.equalsFloats(1, 1, 1) ? void 0 : t_64.translucencyColor.asArray(), c_15 = null !== (o = _this._exporter._materialExporter.getTextureInfo(t_64.translucencyColorTexture)) && void 0 !== o ? o : void 0, h_15 = { diffuseTransmissionFactor: a_23, diffuseTransmissionTexture: l_21, diffuseTransmissionColorFactor: u_17, diffuseTransmissionColorTexture: c_15 };
|
|
3085
|
+
(l_21 || c_15) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions = n.extensions || {}, n.extensions[De] = h_15;
|
|
2980
3086
|
} r(n); });
|
|
2981
3087
|
};
|
|
2982
|
-
return
|
|
3088
|
+
return He;
|
|
2983
3089
|
}());
|
|
2984
|
-
var
|
|
2985
|
-
function
|
|
2986
|
-
|
|
2987
|
-
var
|
|
2988
|
-
var
|
|
2989
|
-
function
|
|
2990
|
-
this.name =
|
|
3090
|
+
var je = !1;
|
|
3091
|
+
function qe() { je || (je = !0, Z.RegisterExtension(De, function (e) { return new He(e); })); }
|
|
3092
|
+
qe();
|
|
3093
|
+
var Ge = "KHR_materials_dispersion";
|
|
3094
|
+
var Xe = /** @class */ (function () {
|
|
3095
|
+
function Xe() {
|
|
3096
|
+
this.name = Ge, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
2991
3097
|
}
|
|
2992
|
-
|
|
2993
|
-
Object.defineProperty(
|
|
3098
|
+
Xe.prototype.dispose = function () { };
|
|
3099
|
+
Object.defineProperty(Xe.prototype, "wasUsed", {
|
|
2994
3100
|
get: function () { return this._wasUsed; },
|
|
2995
3101
|
enumerable: false,
|
|
2996
3102
|
configurable: true
|
|
2997
3103
|
});
|
|
2998
|
-
|
|
3104
|
+
Xe.prototype._isExtensionEnabled = function (e) { if (e.unlit)
|
|
2999
3105
|
return !1; var t = e.subSurface; return !(!t.isRefractionEnabled && !t.isDispersionEnabled); };
|
|
3000
|
-
|
|
3106
|
+
Xe.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3001
3107
|
var _this = this;
|
|
3002
3108
|
return new Promise(function (e) { if (s instanceof t.PBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3003
3109
|
_this._wasUsed = !0;
|
|
3004
|
-
var
|
|
3005
|
-
n.extensions = n.extensions || {}, n.extensions[
|
|
3110
|
+
var e_146 = { dispersion: s.subSurface.dispersion };
|
|
3111
|
+
n.extensions = n.extensions || {}, n.extensions[Ge] = e_146;
|
|
3006
3112
|
} e(n); });
|
|
3007
3113
|
};
|
|
3008
|
-
return
|
|
3114
|
+
return Xe;
|
|
3009
3115
|
}());
|
|
3010
|
-
var
|
|
3011
|
-
function
|
|
3012
|
-
|
|
3013
|
-
var
|
|
3014
|
-
var
|
|
3015
|
-
function
|
|
3016
|
-
this.name =
|
|
3116
|
+
var Qe = !1;
|
|
3117
|
+
function Ze() { Qe || (Qe = !0, Z.RegisterExtension(Ge, function () { return new Xe; })); }
|
|
3118
|
+
Ze();
|
|
3119
|
+
var Ye = "KHR_materials_emissive_strength";
|
|
3120
|
+
var Je = /** @class */ (function () {
|
|
3121
|
+
function Je() {
|
|
3122
|
+
this.name = Ye, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
3017
3123
|
}
|
|
3018
|
-
|
|
3019
|
-
Object.defineProperty(
|
|
3124
|
+
Je.prototype.dispose = function () { };
|
|
3125
|
+
Object.defineProperty(Je.prototype, "wasUsed", {
|
|
3020
3126
|
get: function () { return this._wasUsed; },
|
|
3021
3127
|
enumerable: false,
|
|
3022
3128
|
configurable: true
|
|
3023
3129
|
});
|
|
3024
|
-
|
|
3130
|
+
Je.prototype.postExportMaterialAsync = function (e, n, s) { return c(this, void 0, void 0, function () {
|
|
3025
3131
|
var _this = this;
|
|
3026
3132
|
return __generator(this, function (_a) {
|
|
3027
3133
|
switch (_a.label) {
|
|
3028
3134
|
case 0: return [4 /*yield*/, new Promise(function (e) { if (!(s instanceof t.PBRMaterial))
|
|
3029
3135
|
return e(n); var r = s.emissiveColor.scale(s.emissiveIntensity), i = Math.max.apply(Math, __spreadArray([], __read(r.asArray()), false)); if (i > 1) {
|
|
3030
3136
|
n.emissiveFactor = r.scale(1 / i).asArray(), _this._wasUsed = !0;
|
|
3031
|
-
var
|
|
3032
|
-
n.extensions || (n.extensions = {}), n.extensions[
|
|
3137
|
+
var e_147 = { emissiveStrength: i };
|
|
3138
|
+
n.extensions || (n.extensions = {}), n.extensions[Ye] = e_147;
|
|
3033
3139
|
}
|
|
3034
3140
|
else
|
|
3035
3141
|
n.emissiveFactor = r.asArray(); return e(n); })];
|
|
@@ -3037,53 +3143,53 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3037
3143
|
}
|
|
3038
3144
|
});
|
|
3039
3145
|
}); };
|
|
3040
|
-
return
|
|
3146
|
+
return Je;
|
|
3041
3147
|
}());
|
|
3042
|
-
var
|
|
3043
|
-
function
|
|
3044
|
-
|
|
3045
|
-
var
|
|
3046
|
-
var
|
|
3047
|
-
function
|
|
3048
|
-
this.name =
|
|
3148
|
+
var et = !1;
|
|
3149
|
+
function tt() { et || (et = !0, Z.RegisterExtension(Ye, function () { return new Je; })); }
|
|
3150
|
+
tt();
|
|
3151
|
+
var nt = "KHR_materials_ior";
|
|
3152
|
+
var st = /** @class */ (function () {
|
|
3153
|
+
function st() {
|
|
3154
|
+
this.name = nt, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
3049
3155
|
}
|
|
3050
|
-
|
|
3051
|
-
Object.defineProperty(
|
|
3156
|
+
st.prototype.dispose = function () { };
|
|
3157
|
+
Object.defineProperty(st.prototype, "wasUsed", {
|
|
3052
3158
|
get: function () { return this._wasUsed; },
|
|
3053
3159
|
enumerable: false,
|
|
3054
3160
|
configurable: true
|
|
3055
3161
|
});
|
|
3056
|
-
|
|
3057
|
-
|
|
3162
|
+
st.prototype._isExtensionEnabled = function (e) { return !e.unlit && (e instanceof t.OpenPBRMaterial ? 1.5 != e.specularIor : e instanceof t.PBRMaterial && null != e.indexOfRefraction && 1.5 != e.indexOfRefraction); };
|
|
3163
|
+
st.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3058
3164
|
var _this = this;
|
|
3059
3165
|
return new Promise(function (e) { if (s instanceof t.PBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3060
3166
|
_this._wasUsed = !0;
|
|
3061
|
-
var
|
|
3062
|
-
n.extensions = n.extensions || {}, n.extensions[
|
|
3167
|
+
var e_148 = { ior: s.indexOfRefraction };
|
|
3168
|
+
n.extensions = n.extensions || {}, n.extensions[nt] = e_148;
|
|
3063
3169
|
}
|
|
3064
3170
|
else if (s instanceof t.OpenPBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3065
3171
|
_this._wasUsed = !0;
|
|
3066
|
-
var
|
|
3067
|
-
n.extensions = n.extensions || {}, n.extensions[
|
|
3172
|
+
var e_149 = { ior: s.specularIor };
|
|
3173
|
+
n.extensions = n.extensions || {}, n.extensions[nt] = e_149;
|
|
3068
3174
|
} e(n); });
|
|
3069
3175
|
};
|
|
3070
|
-
return
|
|
3176
|
+
return st;
|
|
3071
3177
|
}());
|
|
3072
|
-
var
|
|
3073
|
-
function
|
|
3074
|
-
|
|
3075
|
-
var
|
|
3076
|
-
var
|
|
3077
|
-
function
|
|
3078
|
-
this.name =
|
|
3178
|
+
var rt = !1;
|
|
3179
|
+
function it() { rt || (rt = !0, Z.RegisterExtension(nt, function () { return new st; })); }
|
|
3180
|
+
it();
|
|
3181
|
+
var ot = "KHR_materials_iridescence";
|
|
3182
|
+
var at = /** @class */ (function () {
|
|
3183
|
+
function at(e) {
|
|
3184
|
+
this.name = ot, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3079
3185
|
}
|
|
3080
|
-
|
|
3081
|
-
Object.defineProperty(
|
|
3186
|
+
at.prototype.dispose = function () { };
|
|
3187
|
+
Object.defineProperty(at.prototype, "wasUsed", {
|
|
3082
3188
|
get: function () { return this._wasUsed; },
|
|
3083
3189
|
enumerable: false,
|
|
3084
3190
|
configurable: true
|
|
3085
3191
|
});
|
|
3086
|
-
|
|
3192
|
+
at.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3087
3193
|
e = [];
|
|
3088
3194
|
if (s instanceof t.PBRBaseMaterial) {
|
|
3089
3195
|
if (s.iridescence.isEnabled)
|
|
@@ -3093,43 +3199,43 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3093
3199
|
return [2 /*return*/, (s.thinFilmWeightTexture && e.push(s.thinFilmWeightTexture), s.thinFilmThicknessTexture && s.thinFilmThicknessTexture !== s.thinFilmWeightTexture && e.push(s.thinFilmThicknessTexture), e)];
|
|
3094
3200
|
return [2 /*return*/, []];
|
|
3095
3201
|
}); }); };
|
|
3096
|
-
|
|
3202
|
+
at.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3097
3203
|
var _this = this;
|
|
3098
3204
|
return new Promise(function (e) { if (s instanceof t.PBRBaseMaterial) {
|
|
3099
3205
|
if (!s.iridescence.isEnabled)
|
|
3100
3206
|
return void e(n);
|
|
3101
3207
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
3102
|
-
var
|
|
3103
|
-
null === i_27.iridescenceTexture && null === i_27.iridescenceThicknessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
3208
|
+
var t_65 = _this._exporter._materialExporter.getTextureInfo(s.iridescence.texture), r_38 = _this._exporter._materialExporter.getTextureInfo(s.iridescence.thicknessTexture), i_27 = { iridescenceFactor: s.iridescence.intensity, iridescenceIor: s.iridescence.indexOfRefraction, iridescenceThicknessMinimum: s.iridescence.minimumThickness, iridescenceThicknessMaximum: s.iridescence.maximumThickness, iridescenceTexture: null != t_65 ? t_65 : void 0, iridescenceThicknessTexture: null != r_38 ? r_38 : void 0 };
|
|
3209
|
+
null === i_27.iridescenceTexture && null === i_27.iridescenceThicknessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[ot] = i_27;
|
|
3104
3210
|
}
|
|
3105
3211
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
3106
3212
|
if (s.thinFilmWeight <= 0)
|
|
3107
3213
|
return void e(n);
|
|
3108
3214
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
3109
|
-
var
|
|
3110
|
-
null === i_28.iridescenceTexture && null === i_28.iridescenceThicknessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
3215
|
+
var t_66 = _this._exporter._materialExporter.getTextureInfo(s.thinFilmWeightTexture), r_39 = _this._exporter._materialExporter.getTextureInfo(s.thinFilmThicknessTexture), i_28 = { iridescenceFactor: s.thinFilmWeight, iridescenceIor: s.thinFilmIor, iridescenceThicknessMinimum: 1e3 * s.thinFilmThicknessMin, iridescenceThicknessMaximum: 1e3 * s.thinFilmThickness, iridescenceTexture: null != t_66 ? t_66 : void 0, iridescenceThicknessTexture: null != r_39 ? r_39 : void 0 };
|
|
3216
|
+
null === i_28.iridescenceTexture && null === i_28.iridescenceThicknessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[ot] = i_28;
|
|
3111
3217
|
} e(n); });
|
|
3112
3218
|
};
|
|
3113
|
-
return
|
|
3219
|
+
return at;
|
|
3114
3220
|
}());
|
|
3115
|
-
var
|
|
3116
|
-
function
|
|
3117
|
-
|
|
3118
|
-
var
|
|
3119
|
-
var
|
|
3120
|
-
function
|
|
3121
|
-
this.name =
|
|
3221
|
+
var lt = !1;
|
|
3222
|
+
function ut() { lt || (lt = !0, Z.RegisterExtension(ot, function (e) { return new at(e); })); }
|
|
3223
|
+
ut();
|
|
3224
|
+
var ct = "KHR_materials_sheen";
|
|
3225
|
+
var ht = /** @class */ (function () {
|
|
3226
|
+
function ht(e) {
|
|
3227
|
+
this.name = ct, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3122
3228
|
}
|
|
3123
|
-
|
|
3124
|
-
Object.defineProperty(
|
|
3229
|
+
ht.prototype.dispose = function () { };
|
|
3230
|
+
Object.defineProperty(ht.prototype, "wasUsed", {
|
|
3125
3231
|
get: function () { return this._wasUsed; },
|
|
3126
3232
|
enumerable: false,
|
|
3127
3233
|
configurable: true
|
|
3128
3234
|
});
|
|
3129
|
-
|
|
3235
|
+
ht.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3130
3236
|
return [2 /*return*/, s instanceof t.PBRMaterial && s.sheen.isEnabled && s.sheen.texture ? [s.sheen.texture] : []];
|
|
3131
3237
|
}); }); };
|
|
3132
|
-
|
|
3238
|
+
ht.prototype.postExportMaterialAsync = function (e, n, s) { return c(this, void 0, void 0, function () {
|
|
3133
3239
|
var _this = this;
|
|
3134
3240
|
return __generator(this, function (_a) {
|
|
3135
3241
|
switch (_a.label) {
|
|
@@ -3137,71 +3243,71 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3137
3243
|
if (!s.sheen.isEnabled)
|
|
3138
3244
|
return void e(n);
|
|
3139
3245
|
_this._wasUsed = !0, null == n.extensions && (n.extensions = {});
|
|
3140
|
-
var
|
|
3141
|
-
null ===
|
|
3246
|
+
var t_67 = { sheenColorFactor: s.sheen.color.asArray(), sheenRoughnessFactor: null !== (r = s.sheen.roughness) && void 0 !== r ? r : 0 };
|
|
3247
|
+
null === t_67.sheenColorTexture && null === t_67.sheenRoughnessTexture || _this._exporter._materialNeedsUVsSet.add(s), s.sheen.texture && (t_67.sheenColorTexture = null !== (i = _this._exporter._materialExporter.getTextureInfo(s.sheen.texture)) && void 0 !== i ? i : void 0), s.sheen.textureRoughness && !s.sheen.useRoughnessFromMainTexture ? t_67.sheenRoughnessTexture = null !== (o = _this._exporter._materialExporter.getTextureInfo(s.sheen.textureRoughness)) && void 0 !== o ? o : void 0 : s.sheen.texture && s.sheen.useRoughnessFromMainTexture && (t_67.sheenRoughnessTexture = null !== (a = _this._exporter._materialExporter.getTextureInfo(s.sheen.texture)) && void 0 !== a ? a : void 0), n.extensions[ct] = t_67;
|
|
3142
3248
|
} e(n); })];
|
|
3143
3249
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3144
3250
|
}
|
|
3145
3251
|
});
|
|
3146
3252
|
}); };
|
|
3147
|
-
return
|
|
3253
|
+
return ht;
|
|
3148
3254
|
}());
|
|
3149
|
-
var
|
|
3150
|
-
function
|
|
3151
|
-
|
|
3152
|
-
var
|
|
3153
|
-
function
|
|
3154
|
-
var
|
|
3155
|
-
function
|
|
3156
|
-
this.name =
|
|
3255
|
+
var dt = !1;
|
|
3256
|
+
function ft() { dt || (dt = !0, Z.RegisterExtension(ct, function (e) { return new ht(e); })); }
|
|
3257
|
+
ft();
|
|
3258
|
+
var pt = "KHR_materials_fuzz";
|
|
3259
|
+
function mt(e, n) { var s = new t.Texture(n.name, n.getScene()); return s._texture = e, s.coordinatesIndex = n.coordinatesIndex, n instanceof t.Texture && (s.uOffset = n.uOffset, s.vOffset = n.vOffset, s.uScale = n.uScale, s.vScale = n.vScale, s.wAng = n.wAng), s.wrapU = n.wrapU, s.wrapV = n.wrapV, s; }
|
|
3260
|
+
var gt = /** @class */ (function () {
|
|
3261
|
+
function gt(e) {
|
|
3262
|
+
this.name = pt, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._mergedTexturesMap = {}, this._cachedInternalTexturesMap = {}, this._exporter = e;
|
|
3157
3263
|
}
|
|
3158
|
-
|
|
3159
|
-
var
|
|
3264
|
+
gt.prototype.dispose = function () {
|
|
3265
|
+
var e_150, _a, e_151, _b;
|
|
3160
3266
|
try {
|
|
3161
3267
|
for (var _c = __values(Object.keys(this._mergedTexturesMap)), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
3162
|
-
var
|
|
3163
|
-
this._mergedTexturesMap[
|
|
3268
|
+
var e_152 = _g.value;
|
|
3269
|
+
this._mergedTexturesMap[e_152].dispose();
|
|
3164
3270
|
}
|
|
3165
3271
|
}
|
|
3166
|
-
catch (
|
|
3272
|
+
catch (e_150_1) { e_150 = { error: e_150_1 }; }
|
|
3167
3273
|
finally {
|
|
3168
3274
|
try {
|
|
3169
3275
|
if (_g && !_g.done && (_a = _c.return)) _a.call(_c);
|
|
3170
3276
|
}
|
|
3171
|
-
finally { if (
|
|
3277
|
+
finally { if (e_150) throw e_150.error; }
|
|
3172
3278
|
}
|
|
3173
3279
|
this._mergedTexturesMap = {};
|
|
3174
3280
|
try {
|
|
3175
3281
|
for (var _h = __values(Object.keys(this._cachedInternalTexturesMap)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
3176
|
-
var
|
|
3177
|
-
this._cachedInternalTexturesMap[
|
|
3282
|
+
var e_153 = _j.value;
|
|
3283
|
+
this._cachedInternalTexturesMap[e_153].dispose();
|
|
3178
3284
|
}
|
|
3179
3285
|
}
|
|
3180
|
-
catch (
|
|
3286
|
+
catch (e_151_1) { e_151 = { error: e_151_1 }; }
|
|
3181
3287
|
finally {
|
|
3182
3288
|
try {
|
|
3183
3289
|
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
3184
3290
|
}
|
|
3185
|
-
finally { if (
|
|
3291
|
+
finally { if (e_151) throw e_151.error; }
|
|
3186
3292
|
}
|
|
3187
3293
|
this._cachedInternalTexturesMap = {};
|
|
3188
3294
|
};
|
|
3189
|
-
Object.defineProperty(
|
|
3295
|
+
Object.defineProperty(gt.prototype, "wasUsed", {
|
|
3190
3296
|
get: function () { return this._wasUsed; },
|
|
3191
3297
|
enumerable: false,
|
|
3192
3298
|
configurable: true
|
|
3193
3299
|
});
|
|
3194
|
-
|
|
3300
|
+
gt.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e_154, n_60, n_61, e_155; return __generator(this, function (_a) {
|
|
3195
3301
|
switch (_a.label) {
|
|
3196
3302
|
case 0:
|
|
3197
3303
|
if (!(s instanceof t.OpenPBRMaterial)) return [3 /*break*/, 4];
|
|
3198
|
-
|
|
3304
|
+
e_154 = [];
|
|
3199
3305
|
if (!(s.fuzzWeight > 0)) return [3 /*break*/, 3];
|
|
3200
|
-
s.fuzzWeightTexture &&
|
|
3201
|
-
|
|
3202
|
-
if (!(s.fuzzRoughnessTexture && (s._useFuzzRoughnessFromTextureAlpha ?
|
|
3203
|
-
|
|
3204
|
-
if (!!this._cachedInternalTexturesMap[
|
|
3306
|
+
s.fuzzWeightTexture && e_154.push(s.fuzzWeightTexture);
|
|
3307
|
+
n_60 = !1;
|
|
3308
|
+
if (!(s.fuzzRoughnessTexture && (s._useFuzzRoughnessFromTextureAlpha ? e_154.push(s.fuzzRoughnessTexture) : n_60 = !0), s.fuzzColorTexture && !n_60 && e_154.push(s.fuzzColorTexture), n_60)) return [3 /*break*/, 3];
|
|
3309
|
+
n_61 = function (e) { var t = e.fuzzColorTexture, n = t && t.getInternalTexture() ? t.getInternalTexture().uniqueId : "NoFuzzColor", s = e.fuzzRoughnessTexture; return "FuzzColor_".concat(n, "_FuzzRoughness_").concat(s && s.getInternalTexture() ? s.getInternalTexture().uniqueId : "NoFuzzRoughness"); }(s);
|
|
3310
|
+
if (!!this._cachedInternalTexturesMap[n_61]) return [3 /*break*/, 2];
|
|
3205
3311
|
return [4 /*yield*/, function (e) { return c(this, void 0, void 0, function () { var n, s, r, _a; return __generator(this, function (_b) {
|
|
3206
3312
|
switch (_b.label) {
|
|
3207
3313
|
case 0:
|
|
@@ -3218,17 +3324,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3218
3324
|
}
|
|
3219
3325
|
}); }); }(s)];
|
|
3220
3326
|
case 1:
|
|
3221
|
-
|
|
3222
|
-
|
|
3327
|
+
e_155 = _a.sent();
|
|
3328
|
+
e_155 && (this._cachedInternalTexturesMap[n_61] = e_155);
|
|
3223
3329
|
_a.label = 2;
|
|
3224
3330
|
case 2:
|
|
3225
|
-
this._cachedInternalTexturesMap[
|
|
3331
|
+
this._cachedInternalTexturesMap[n_61] && (s.fuzzColorTexture && (this._mergedTexturesMap[s.fuzzColorTexture.uniqueId] = mt(this._cachedInternalTexturesMap[n_61], s.fuzzColorTexture), e_154.push(this._mergedTexturesMap[s.fuzzColorTexture.uniqueId])), s.fuzzRoughnessTexture && (this._mergedTexturesMap[s.fuzzRoughnessTexture.uniqueId] = mt(this._cachedInternalTexturesMap[n_61], s.fuzzRoughnessTexture), e_154.push(this._mergedTexturesMap[s.fuzzRoughnessTexture.uniqueId])));
|
|
3226
3332
|
_a.label = 3;
|
|
3227
|
-
case 3: return [2 /*return*/,
|
|
3333
|
+
case 3: return [2 /*return*/, e_154];
|
|
3228
3334
|
case 4: return [2 /*return*/, []];
|
|
3229
3335
|
}
|
|
3230
3336
|
}); }); };
|
|
3231
|
-
|
|
3337
|
+
gt.prototype.postExportMaterialAsync = function (e, n, s) { return c(this, void 0, void 0, function () {
|
|
3232
3338
|
var _this = this;
|
|
3233
3339
|
return __generator(this, function (_a) {
|
|
3234
3340
|
switch (_a.label) {
|
|
@@ -3236,70 +3342,70 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3236
3342
|
if (0 == s.fuzzWeight)
|
|
3237
3343
|
return void e(n);
|
|
3238
3344
|
_this._wasUsed = !0, null == n.extensions && (n.extensions = {});
|
|
3239
|
-
var
|
|
3240
|
-
var
|
|
3241
|
-
s.fuzzWeightTexture && (
|
|
3345
|
+
var t_68 = { fuzzFactor: s.fuzzWeight, fuzzColorFactor: s.fuzzColor.asArray(), fuzzRoughnessFactor: s.fuzzRoughness };
|
|
3346
|
+
var a_24, l_22;
|
|
3347
|
+
s.fuzzWeightTexture && (t_68.fuzzTexture = null !== (r = _this._exporter._materialExporter.getTextureInfo(s.fuzzWeightTexture)) && void 0 !== r ? r : void 0), s.fuzzColorTexture && (a_24 = _this._mergedTexturesMap[s.fuzzColorTexture.uniqueId] ? _this._mergedTexturesMap[s.fuzzColorTexture.uniqueId] : s.fuzzColorTexture, t_68.fuzzColorTexture = null !== (i = _this._exporter._materialExporter.getTextureInfo(a_24)) && void 0 !== i ? i : void 0), s.fuzzRoughnessTexture && (l_22 = _this._mergedTexturesMap[s.fuzzRoughnessTexture.uniqueId] ? _this._mergedTexturesMap[s.fuzzRoughnessTexture.uniqueId] : s.fuzzRoughnessTexture, t_68.fuzzRoughnessTexture = null !== (o = _this._exporter._materialExporter.getTextureInfo(l_22)) && void 0 !== o ? o : void 0), null === t_68.fuzzColorTexture && null === t_68.fuzzRoughnessTexture || _this._exporter._materialNeedsUVsSet.add(s), n.extensions[pt] = t_68;
|
|
3242
3348
|
} e(n); })];
|
|
3243
3349
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3244
3350
|
}
|
|
3245
3351
|
});
|
|
3246
3352
|
}); };
|
|
3247
|
-
return
|
|
3353
|
+
return gt;
|
|
3248
3354
|
}());
|
|
3249
|
-
var
|
|
3250
|
-
function
|
|
3251
|
-
|
|
3252
|
-
var
|
|
3253
|
-
var
|
|
3254
|
-
function
|
|
3255
|
-
this.name =
|
|
3355
|
+
var xt = !1;
|
|
3356
|
+
function _t() { xt || (xt = !0, Z.RegisterExtension(pt, function (e) { return new gt(e); })); }
|
|
3357
|
+
_t();
|
|
3358
|
+
var Tt = "KHR_materials_specular";
|
|
3359
|
+
var yt = /** @class */ (function () {
|
|
3360
|
+
function yt(e) {
|
|
3361
|
+
this.name = Tt, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3256
3362
|
}
|
|
3257
|
-
|
|
3258
|
-
Object.defineProperty(
|
|
3363
|
+
yt.prototype.dispose = function () { };
|
|
3364
|
+
Object.defineProperty(yt.prototype, "wasUsed", {
|
|
3259
3365
|
get: function () { return this._wasUsed; },
|
|
3260
3366
|
enumerable: false,
|
|
3261
3367
|
configurable: true
|
|
3262
3368
|
});
|
|
3263
|
-
|
|
3369
|
+
yt.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3264
3370
|
e = [];
|
|
3265
3371
|
return [2 /*return*/, s instanceof t.PBRMaterial && this._isExtensionEnabled(s) ? (s.metallicReflectanceTexture && e.push(s.metallicReflectanceTexture), s.reflectanceTexture && e.push(s.reflectanceTexture), e) : e];
|
|
3266
3372
|
}); }); };
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3373
|
+
yt.prototype._isExtensionEnabled = function (e) { return !e.unlit && (null != e.metallicF0Factor && 1 != e.metallicF0Factor || null != e.metallicReflectanceColor && !e.metallicReflectanceColor.equalsFloats(1, 1, 1) || this._hasTexturesExtension(e)); };
|
|
3374
|
+
yt.prototype._hasTexturesExtension = function (e) { return null != e.metallicReflectanceTexture || null != e.reflectanceTexture; };
|
|
3375
|
+
yt.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3270
3376
|
var _this = this;
|
|
3271
3377
|
return new Promise(function (e) { var r, i, o, a, l; if (s instanceof t.PBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3272
3378
|
_this._wasUsed = !0, n.extensions = n.extensions || {};
|
|
3273
|
-
var
|
|
3274
|
-
_this._hasTexturesExtension(s) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[
|
|
3379
|
+
var e_156 = null !== (r = _this._exporter._materialExporter.getTextureInfo(s.metallicReflectanceTexture)) && void 0 !== r ? r : void 0, t_69 = null !== (i = _this._exporter._materialExporter.getTextureInfo(s.reflectanceTexture)) && void 0 !== i ? i : void 0, o_33 = { specularFactor: 1 == s.metallicF0Factor ? void 0 : s.metallicF0Factor, specularTexture: e_156, specularColorFactor: s.metallicReflectanceColor.equalsFloats(1, 1, 1) ? void 0 : s.metallicReflectanceColor.asArray(), specularColorTexture: t_69 };
|
|
3380
|
+
_this._hasTexturesExtension(s) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Tt] = o_33;
|
|
3275
3381
|
}
|
|
3276
3382
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
3277
3383
|
n.extensions = n.extensions || {};
|
|
3278
|
-
var
|
|
3279
|
-
if (!r_40 && !
|
|
3384
|
+
var t_70 = null !== (o = _this._exporter._materialExporter.getTextureInfo(s.specularWeightTexture)) && void 0 !== o ? o : void 0, r_40 = null !== (a = _this._exporter._materialExporter.getTextureInfo(s.specularColorTexture)) && void 0 !== a ? a : void 0, i_29 = 1 == s.specularWeight ? void 0 : s.specularWeight, u_18 = s.specularColor.equalsFloats(1, 1, 1) ? void 0 : s.specularColor.asArray();
|
|
3385
|
+
if (!r_40 && !t_70 && void 0 === i_29 && void 0 === u_18)
|
|
3280
3386
|
return e(n);
|
|
3281
3387
|
_this._wasUsed = !0;
|
|
3282
|
-
var
|
|
3283
|
-
h_16.extensions.EXT_materials_specular_edge_color =
|
|
3388
|
+
var c_16 = { specularEdgeColorEnabled: !0 }, h_16 = { specularFactor: i_29, specularTexture: t_70, specularColorFactor: u_18, specularColorTexture: r_40, extensions: {} };
|
|
3389
|
+
h_16.extensions.EXT_materials_specular_edge_color = c_16, (l = _this._exporter._glTF).extensionsUsed || (l.extensionsUsed = []), -1 === _this._exporter._glTF.extensionsUsed.indexOf("EXT_materials_specular_edge_color") && _this._exporter._glTF.extensionsUsed.push("EXT_materials_specular_edge_color"), (t_70 || r_40) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Tt] = h_16;
|
|
3284
3390
|
} e(n); });
|
|
3285
3391
|
};
|
|
3286
|
-
return
|
|
3392
|
+
return yt;
|
|
3287
3393
|
}());
|
|
3288
|
-
var
|
|
3289
|
-
function
|
|
3290
|
-
|
|
3291
|
-
var
|
|
3292
|
-
var
|
|
3293
|
-
function
|
|
3294
|
-
this.name =
|
|
3394
|
+
var bt = !1;
|
|
3395
|
+
function vt() { bt || (bt = !0, Z.RegisterExtension(Tt, function (e) { return new yt(e); })); }
|
|
3396
|
+
vt();
|
|
3397
|
+
var Mt = "KHR_materials_transmission";
|
|
3398
|
+
var wt = /** @class */ (function () {
|
|
3399
|
+
function wt(e) {
|
|
3400
|
+
this.name = Mt, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3295
3401
|
}
|
|
3296
|
-
|
|
3297
|
-
Object.defineProperty(
|
|
3402
|
+
wt.prototype.dispose = function () { };
|
|
3403
|
+
Object.defineProperty(wt.prototype, "wasUsed", {
|
|
3298
3404
|
get: function () { return this._wasUsed; },
|
|
3299
3405
|
enumerable: false,
|
|
3300
3406
|
configurable: true
|
|
3301
3407
|
});
|
|
3302
|
-
|
|
3408
|
+
wt.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3303
3409
|
e = [];
|
|
3304
3410
|
if (s instanceof t.PBRMaterial) {
|
|
3305
3411
|
if (this._isExtensionEnabled(s))
|
|
@@ -3309,12 +3415,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3309
3415
|
s instanceof t.OpenPBRMaterial && (s.transmissionWeight > 0 && s.transmissionWeightTexture && (e.push(s.transmissionWeightTexture), s.transmissionColorTexture && e.push(s.transmissionColorTexture)), s.subsurfaceWeight > 0 && s.subsurfaceWeightTexture && e.push(s.subsurfaceWeightTexture));
|
|
3310
3416
|
return [2 /*return*/, e];
|
|
3311
3417
|
}); }); };
|
|
3312
|
-
|
|
3418
|
+
wt.prototype._isExtensionEnabled = function (e) { if (e instanceof t.OpenPBRMaterial && !e.unlit)
|
|
3313
3419
|
return e.transmissionWeight > 0 || e.subsurfaceWeight > 0; if (e instanceof t.PBRMaterial && !e.unlit) {
|
|
3314
|
-
var
|
|
3315
|
-
return
|
|
3420
|
+
var t_71 = e.subSurface;
|
|
3421
|
+
return t_71.isRefractionEnabled && null != t_71.refractionIntensity && 0 != t_71.refractionIntensity || null != t_71.refractionIntensityTexture && t_71.useGltfStyleTextures;
|
|
3316
3422
|
} return !1; };
|
|
3317
|
-
|
|
3423
|
+
wt.prototype.postExportMaterialAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var r_41, i_30, e_157, e_158, t_72, t_73, e_159; return __generator(this, function (_a) {
|
|
3318
3424
|
if (!this._isExtensionEnabled(s))
|
|
3319
3425
|
return [2 /*return*/, n];
|
|
3320
3426
|
if (s instanceof t.PBRMaterial) {
|
|
@@ -3323,71 +3429,71 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3323
3429
|
if (r_41.refractionIntensityTexture)
|
|
3324
3430
|
if (r_41.useGltfStyleTextures) {
|
|
3325
3431
|
this._exporter._materialNeedsUVsSet.add(s);
|
|
3326
|
-
|
|
3327
|
-
|
|
3432
|
+
e_157 = this._exporter._materialExporter.getTextureInfo(r_41.refractionIntensityTexture);
|
|
3433
|
+
e_157 && (i_30.transmissionTexture = e_157);
|
|
3328
3434
|
}
|
|
3329
3435
|
else
|
|
3330
3436
|
t.Logger.Warn("".concat(e, ": Exporting a subsurface refraction intensity texture without `useGltfStyleTextures` is not supported"));
|
|
3331
|
-
n.extensions || (n.extensions = {}), n.extensions[
|
|
3437
|
+
n.extensions || (n.extensions = {}), n.extensions[Mt] = i_30;
|
|
3332
3438
|
}
|
|
3333
3439
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
3334
3440
|
this._wasUsed = !0;
|
|
3335
|
-
|
|
3441
|
+
e_158 = { transmissionFactor: (1 - s.transmissionWeight) * s.subsurfaceWeight + s.transmissionWeight };
|
|
3336
3442
|
if (s.transmissionWeightTexture) {
|
|
3337
3443
|
this._exporter._materialNeedsUVsSet.add(s);
|
|
3338
|
-
|
|
3339
|
-
|
|
3444
|
+
t_72 = this._exporter._materialExporter.getTextureInfo(s.transmissionWeightTexture);
|
|
3445
|
+
t_72 && (e_158.transmissionTexture = t_72);
|
|
3340
3446
|
}
|
|
3341
3447
|
else if (s.subsurfaceWeightTexture) {
|
|
3342
3448
|
this._exporter._materialNeedsUVsSet.add(s);
|
|
3343
|
-
|
|
3344
|
-
|
|
3449
|
+
t_73 = this._exporter._materialExporter.getTextureInfo(s.subsurfaceWeightTexture);
|
|
3450
|
+
t_73 && (e_158.transmissionTexture = t_73);
|
|
3345
3451
|
}
|
|
3346
3452
|
if (0 == s.transmissionDepth && (!s.transmissionColor.equals(t.Color3.White()) || s.transmissionColorTexture) && n.pbrMetallicRoughness && (n.pbrMetallicRoughness.baseColorFactor || (n.pbrMetallicRoughness.baseColorFactor = [1, 1, 1, 1]), n.pbrMetallicRoughness.baseColorFactor[0] *= s.transmissionColor.r, n.pbrMetallicRoughness.baseColorFactor[1] *= s.transmissionColor.g, n.pbrMetallicRoughness.baseColorFactor[2] *= s.transmissionColor.b, s.transmissionColorTexture && !n.pbrMetallicRoughness.baseColorTexture)) {
|
|
3347
|
-
|
|
3348
|
-
|
|
3453
|
+
e_159 = this._exporter._materialExporter.getTextureInfo(s.transmissionColorTexture);
|
|
3454
|
+
e_159 && (n.pbrMetallicRoughness.baseColorTexture = e_159, this._exporter._materialNeedsUVsSet.add(s));
|
|
3349
3455
|
}
|
|
3350
|
-
n.extensions || (n.extensions = {}), n.extensions[
|
|
3456
|
+
n.extensions || (n.extensions = {}), n.extensions[Mt] = e_158;
|
|
3351
3457
|
}
|
|
3352
3458
|
return [2 /*return*/, n];
|
|
3353
3459
|
}); }); };
|
|
3354
|
-
return
|
|
3460
|
+
return wt;
|
|
3355
3461
|
}());
|
|
3356
|
-
var
|
|
3357
|
-
function
|
|
3358
|
-
|
|
3359
|
-
var
|
|
3360
|
-
var
|
|
3361
|
-
function
|
|
3362
|
-
this.name =
|
|
3462
|
+
var Rt = !1;
|
|
3463
|
+
function At() { Rt || (Rt = !0, Z.RegisterExtension(Mt, function (e) { return new wt(e); })); }
|
|
3464
|
+
At();
|
|
3465
|
+
var Ct = "KHR_materials_unlit";
|
|
3466
|
+
var Et = /** @class */ (function () {
|
|
3467
|
+
function Et() {
|
|
3468
|
+
this.name = Ct, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
3363
3469
|
}
|
|
3364
|
-
Object.defineProperty(
|
|
3470
|
+
Object.defineProperty(Et.prototype, "wasUsed", {
|
|
3365
3471
|
get: function () { return this._wasUsed; },
|
|
3366
3472
|
enumerable: false,
|
|
3367
3473
|
configurable: true
|
|
3368
3474
|
});
|
|
3369
|
-
|
|
3370
|
-
|
|
3475
|
+
Et.prototype.dispose = function () { };
|
|
3476
|
+
Et.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3371
3477
|
var _this = this;
|
|
3372
|
-
return new Promise(function (e) { var r = !1; s instanceof t.PBRMaterial ? r = s.unlit : s instanceof t.StandardMaterial && (r = s.disableLighting), r && (_this._wasUsed = !0, null == n.extensions && (n.extensions = {}), n.extensions[
|
|
3478
|
+
return new Promise(function (e) { var r = !1; s instanceof t.PBRMaterial ? r = s.unlit : s instanceof t.StandardMaterial && (r = s.disableLighting), r && (_this._wasUsed = !0, null == n.extensions && (n.extensions = {}), n.extensions[Ct] = {}), e(n); });
|
|
3373
3479
|
};
|
|
3374
|
-
return
|
|
3480
|
+
return Et;
|
|
3375
3481
|
}());
|
|
3376
|
-
var
|
|
3377
|
-
function
|
|
3378
|
-
|
|
3379
|
-
var
|
|
3380
|
-
var
|
|
3381
|
-
function
|
|
3382
|
-
this.name =
|
|
3482
|
+
var It = !1;
|
|
3483
|
+
function St() { It || (It = !0, Z.RegisterExtension(Ct, function () { return new Et; })); }
|
|
3484
|
+
St();
|
|
3485
|
+
var Ft = "KHR_materials_volume";
|
|
3486
|
+
var Vt = /** @class */ (function () {
|
|
3487
|
+
function Vt(e) {
|
|
3488
|
+
this.name = Ft, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3383
3489
|
}
|
|
3384
|
-
|
|
3385
|
-
Object.defineProperty(
|
|
3490
|
+
Vt.prototype.dispose = function () { };
|
|
3491
|
+
Object.defineProperty(Vt.prototype, "wasUsed", {
|
|
3386
3492
|
get: function () { return this._wasUsed; },
|
|
3387
3493
|
enumerable: false,
|
|
3388
3494
|
configurable: true
|
|
3389
3495
|
});
|
|
3390
|
-
|
|
3496
|
+
Vt.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3391
3497
|
e = [];
|
|
3392
3498
|
if (s instanceof t.PBRMaterial) {
|
|
3393
3499
|
if (this._isExtensionEnabled(s))
|
|
@@ -3397,105 +3503,105 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3397
3503
|
s instanceof t.OpenPBRMaterial && (s.transmissionWeight > 0 || s.subsurfaceWeight > 0) && s.geometryThicknessTexture && e.push(s.geometryThicknessTexture);
|
|
3398
3504
|
return [2 /*return*/, e];
|
|
3399
3505
|
}); }); };
|
|
3400
|
-
|
|
3506
|
+
Vt.prototype._isExtensionEnabled = function (e) { if (e.unlit)
|
|
3401
3507
|
return !1; var n = e.subSurface; return !(!n.isRefractionEnabled && !n.isTranslucencyEnabled) && (null != n.maximumThickness && 0 != n.maximumThickness || null != n.tintColorAtDistance && n.tintColorAtDistance != Number.POSITIVE_INFINITY || null != n.tintColor && n.tintColor != t.Color3.White() || this._hasTexturesExtension(e)); };
|
|
3402
|
-
|
|
3403
|
-
|
|
3508
|
+
Vt.prototype._hasTexturesExtension = function (e) { return null != e.subSurface.thicknessTexture; };
|
|
3509
|
+
Vt.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3404
3510
|
var _this = this;
|
|
3405
3511
|
return new Promise(function (e) { var r, i; if (s instanceof t.PBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3406
3512
|
_this._wasUsed = !0;
|
|
3407
|
-
var
|
|
3408
|
-
_this._hasTexturesExtension(s) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions = n.extensions || {}, n.extensions[
|
|
3513
|
+
var e_160 = s.subSurface, t_74 = { thicknessFactor: 0 == e_160.maximumThickness ? void 0 : e_160.maximumThickness, thicknessTexture: null !== (r = _this._exporter._materialExporter.getTextureInfo(e_160.thicknessTexture)) && void 0 !== r ? r : void 0, attenuationDistance: e_160.tintColorAtDistance == Number.POSITIVE_INFINITY ? void 0 : e_160.tintColorAtDistance, attenuationColor: e_160.tintColor.equalsFloats(1, 1, 1) ? void 0 : e_160.tintColor.asArray() };
|
|
3514
|
+
_this._hasTexturesExtension(s) && _this._exporter._materialNeedsUVsSet.add(s), n.extensions = n.extensions || {}, n.extensions[Ft] = t_74;
|
|
3409
3515
|
}
|
|
3410
3516
|
else if (s instanceof t.OpenPBRMaterial) {
|
|
3411
|
-
var
|
|
3412
|
-
if (
|
|
3517
|
+
var e_161 = s.transmissionWeight > 0 && !s.geometryThinWalled, r_42 = s.subsurfaceWeight > 0 && !s.geometryThinWalled;
|
|
3518
|
+
if (e_161 || r_42) {
|
|
3413
3519
|
_this._wasUsed = !0;
|
|
3414
|
-
var
|
|
3520
|
+
var o_34 = s.geometryThickness, a_25 = null !== (i = _this._exporter._materialExporter.getTextureInfo(s.geometryThicknessTexture)) && void 0 !== i ? i : void 0;
|
|
3415
3521
|
var l_23;
|
|
3416
|
-
|
|
3522
|
+
a_25 && _this._exporter._materialNeedsUVsSet.add(s);
|
|
3417
3523
|
var u_19 = t.Color3.White().asArray();
|
|
3418
|
-
if (
|
|
3419
|
-
var
|
|
3420
|
-
var
|
|
3421
|
-
var r_43 = new t.Vector3(s.transmissionScatter.r *
|
|
3422
|
-
|
|
3524
|
+
if (e_161 && s.transmissionDepth > 0) {
|
|
3525
|
+
var e_162 = 1 / s.transmissionDepth;
|
|
3526
|
+
var n_62 = new t.Vector3(-Math.log(s.transmissionColor.r) * e_162, -Math.log(s.transmissionColor.g) * e_162, -Math.log(s.transmissionColor.b) * e_162);
|
|
3527
|
+
var r_43 = new t.Vector3(s.transmissionScatter.r * e_162, s.transmissionScatter.g * e_162, s.transmissionScatter.b * e_162), i_31 = n_62.subtract(r_43), o_35 = Math.min(i_31.x, i_31.y, i_31.z);
|
|
3528
|
+
o_35 < 0 && (i_31.x = i_31.x - o_35, i_31.y = i_31.y - o_35, i_31.z = i_31.z - o_35), n_62 = i_31.add(r_43), l_23 = 1 / Math.max(n_62.x, n_62.y, n_62.z), u_19[0] = Math.exp(-n_62.x * l_23), u_19[1] = Math.exp(-n_62.y * l_23), u_19[2] = Math.exp(-n_62.z * l_23);
|
|
3423
3529
|
}
|
|
3424
3530
|
else
|
|
3425
3531
|
l_23 = Number.MAX_VALUE, u_19[0] = 1, u_19[1] = 1, u_19[2] = 1;
|
|
3426
|
-
var
|
|
3532
|
+
var c_17 = 1;
|
|
3427
3533
|
var h_17 = t.Color3.White().asArray();
|
|
3428
3534
|
if (r_42) {
|
|
3429
|
-
var
|
|
3430
|
-
|
|
3535
|
+
var e_163 = s.subsurfaceRadius, n_63 = s.subsurfaceRadiusScale, r_44 = new t.Vector3(n_63.r, n_63.g, n_63.b).multiplyByFloats(e_163, e_163, e_163), i_32 = new t.Vector3(1 / Math.max(r_44.x, 1e-6), 1 / Math.max(r_44.y, 1e-6), 1 / Math.max(r_44.z, 1e-6));
|
|
3536
|
+
c_17 = 1 / Math.max(i_32.x, i_32.y, i_32.z), h_17[0] = Math.exp(-i_32.x * c_17), h_17[1] = Math.exp(-i_32.y * c_17), h_17[2] = Math.exp(-i_32.z * c_17);
|
|
3431
3537
|
}
|
|
3432
|
-
var
|
|
3433
|
-
n.extensions = n.extensions || {}, n.extensions[
|
|
3538
|
+
var d_9 = (1 - s.transmissionWeight) * s.subsurfaceWeight, f_14 = d_9 + s.transmissionWeight, p_8 = 1 / Math.max(f_14, 1e-6), m_7 = s.transmissionWeight * p_8, g_9 = d_9 * p_8, x_9 = u_19.map(function (e, t) { return e * m_7 + h_17[t] * g_9; }), _8 = { thicknessFactor: o_34, thicknessTexture: a_25, attenuationDistance: l_23 * m_7 + c_17 * g_9, attenuationColor: x_9 };
|
|
3539
|
+
n.extensions = n.extensions || {}, n.extensions[Ft] = _8;
|
|
3434
3540
|
}
|
|
3435
3541
|
} e(n); });
|
|
3436
3542
|
};
|
|
3437
|
-
return
|
|
3543
|
+
return Vt;
|
|
3438
3544
|
}());
|
|
3439
|
-
var
|
|
3440
|
-
function
|
|
3441
|
-
|
|
3442
|
-
var
|
|
3443
|
-
var
|
|
3444
|
-
function
|
|
3445
|
-
this.name =
|
|
3545
|
+
var Ot = !1;
|
|
3546
|
+
function Bt() { Ot || (Ot = !0, Z.RegisterExtension(Ft, function (e) { return new Vt(e); })); }
|
|
3547
|
+
Bt();
|
|
3548
|
+
var Nt = "KHR_materials_volume_scatter";
|
|
3549
|
+
var Pt = /** @class */ (function () {
|
|
3550
|
+
function Pt(e) {
|
|
3551
|
+
this.name = Nt, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3446
3552
|
}
|
|
3447
|
-
|
|
3448
|
-
Object.defineProperty(
|
|
3553
|
+
Pt.prototype.dispose = function () { };
|
|
3554
|
+
Object.defineProperty(Pt.prototype, "wasUsed", {
|
|
3449
3555
|
get: function () { return this._wasUsed; },
|
|
3450
3556
|
enumerable: false,
|
|
3451
3557
|
configurable: true
|
|
3452
3558
|
});
|
|
3453
|
-
|
|
3559
|
+
Pt.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3454
3560
|
e = [];
|
|
3455
3561
|
return [2 /*return*/, (s instanceof t.OpenPBRMaterial && (s.transmissionWeight > 0 && s.transmissionScatterTexture && e.push(s.transmissionScatterTexture), s.subsurfaceWeight > 0 && s.subsurfaceColorTexture && e.push(s.subsurfaceColorTexture)), e)];
|
|
3456
3562
|
}); }); };
|
|
3457
|
-
|
|
3563
|
+
Pt.prototype._isExtensionEnabled = function (e) { if (e.unlit)
|
|
3458
3564
|
return !1; var n = e.transmissionWeight > 0 && !e.geometryThinWalled && e.transmissionDepth > 0 && !e.transmissionScatter.equals(t.Color3.Black()), s = e.subsurfaceWeight > 0 && !e.geometryThinWalled; return !(!n && !s); };
|
|
3459
|
-
|
|
3565
|
+
Pt.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3460
3566
|
var _this = this;
|
|
3461
3567
|
return new Promise(function (e) { if (s instanceof t.OpenPBRMaterial && _this._isExtensionEnabled(s)) {
|
|
3462
3568
|
_this._wasUsed = !0;
|
|
3463
|
-
var
|
|
3464
|
-
s.transmissionWeight > 0 && (
|
|
3569
|
+
var e_164 = t.Vector3.Zero(), r_45 = 0;
|
|
3570
|
+
s.transmissionWeight > 0 && (e_164 = function (e) { var n = new t.Vector3(Math.sqrt(1 - e.x), Math.sqrt(1 - e.y), Math.sqrt(1 - e.z)), s = new t.Vector3(1, 1, 1), r = s.subtract(n), i = s.subtract(new t.Vector3(.139, .139, .139).multiplyInPlace(n)), o = s.add(new t.Vector3(1.17, 1.17, 1.17).multiplyInPlace(n)); return r.multiplyInPlace(i).divideInPlace(o); }(new t.Vector3(s.transmissionScatter.r, s.transmissionScatter.g, s.transmissionScatter.b)), r_45 = s.transmissionScatterAnisotropy);
|
|
3465
3571
|
var i_33 = t.Vector3.Zero();
|
|
3466
|
-
var
|
|
3467
|
-
s.subsurfaceWeight > 0 && (i_33.set(s.subsurfaceColor.r, s.subsurfaceColor.g, s.subsurfaceColor.b),
|
|
3468
|
-
var
|
|
3572
|
+
var o_36 = 0;
|
|
3573
|
+
s.subsurfaceWeight > 0 && (i_33.set(s.subsurfaceColor.r, s.subsurfaceColor.g, s.subsurfaceColor.b), o_36 = s.subsurfaceScatterAnisotropy);
|
|
3574
|
+
var a_26 = (1 - s.transmissionWeight) * s.subsurfaceWeight, l_24 = a_26 + s.transmissionWeight, u_20 = 1 / Math.max(l_24, 1e-6), c_18 = s.transmissionWeight * u_20, h_18 = a_26 * u_20, d_10 = { multiscatterColorFactor: e_164.multiplyByFloats(c_18, c_18, c_18).addInPlace(i_33.multiplyByFloats(h_18, h_18, h_18)).asArray(), scatterAnisotropy: r_45 * c_18 + o_36 * h_18 };
|
|
3469
3575
|
if (s.subsurfaceWeight > 0 && s.subsurfaceColorTexture) {
|
|
3470
3576
|
_this._exporter._materialNeedsUVsSet.add(s);
|
|
3471
|
-
var
|
|
3472
|
-
|
|
3577
|
+
var e_165 = _this._exporter._materialExporter.getTextureInfo(s.subsurfaceColorTexture);
|
|
3578
|
+
e_165 && (d_10.multiscatterColorTexture = e_165);
|
|
3473
3579
|
}
|
|
3474
3580
|
else if (s.transmissionWeight > 0 && s.transmissionScatterTexture) {
|
|
3475
3581
|
_this._exporter._materialNeedsUVsSet.add(s);
|
|
3476
|
-
var
|
|
3477
|
-
|
|
3582
|
+
var e_166 = _this._exporter._materialExporter.getTextureInfo(s.transmissionScatterTexture);
|
|
3583
|
+
e_166 && (d_10.multiscatterColorTexture = e_166);
|
|
3478
3584
|
}
|
|
3479
|
-
n.extensions = n.extensions || {}, n.extensions[
|
|
3585
|
+
n.extensions = n.extensions || {}, n.extensions[Nt] = d_10;
|
|
3480
3586
|
} e(n); });
|
|
3481
3587
|
};
|
|
3482
|
-
return
|
|
3588
|
+
return Pt;
|
|
3483
3589
|
}());
|
|
3484
|
-
var
|
|
3485
|
-
function
|
|
3486
|
-
|
|
3487
|
-
var
|
|
3488
|
-
var
|
|
3489
|
-
function
|
|
3490
|
-
this.name =
|
|
3590
|
+
var Ut = !1;
|
|
3591
|
+
function kt() { Ut || (Ut = !0, Z.RegisterExtension(Nt, function (e) { return new Pt(e); }, 101)); }
|
|
3592
|
+
kt();
|
|
3593
|
+
var Kt = "KHR_materials_diffuse_roughness";
|
|
3594
|
+
var $t = /** @class */ (function () {
|
|
3595
|
+
function $t(e) {
|
|
3596
|
+
this.name = Kt, this.enabled = !0, this.required = !1, this._wasUsed = !1, this._exporter = e;
|
|
3491
3597
|
}
|
|
3492
|
-
|
|
3493
|
-
Object.defineProperty(
|
|
3598
|
+
$t.prototype.dispose = function () { };
|
|
3599
|
+
Object.defineProperty($t.prototype, "wasUsed", {
|
|
3494
3600
|
get: function () { return this._wasUsed; },
|
|
3495
3601
|
enumerable: false,
|
|
3496
3602
|
configurable: true
|
|
3497
3603
|
});
|
|
3498
|
-
|
|
3604
|
+
$t.prototype.postExportMaterialAdditionalTexturesAsync = function (e, n, s) { return c(this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
|
|
3499
3605
|
e = [];
|
|
3500
3606
|
if (s instanceof t.PBRBaseMaterial) {
|
|
3501
3607
|
if (s._baseDiffuseRoughness)
|
|
@@ -3505,37 +3611,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3505
3611
|
return [2 /*return*/, (s.baseDiffuseRoughnessTexture && e.push(s.baseDiffuseRoughnessTexture), e)];
|
|
3506
3612
|
return [2 /*return*/, []];
|
|
3507
3613
|
}); }); };
|
|
3508
|
-
Pt.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3509
|
-
var _this = this;
|
|
3510
|
-
return new Promise(function (e) { var r = null, i = null; if (s instanceof t.PBRBaseMaterial ? (r = s._baseDiffuseRoughness, i = s._baseDiffuseRoughnessTexture) : s instanceof t.OpenPBRMaterial && (r = s.baseDiffuseRoughness, i = s.baseDiffuseRoughnessTexture), !r)
|
|
3511
|
-
return void e(n); _this._wasUsed = !0, n.extensions = n.extensions || {}; var o = _this._exporter._materialExporter.getTextureInfo(i), a = { diffuseRoughnessFactor: r, diffuseRoughnessTexture: null != o ? o : void 0 }; null !== a.diffuseRoughnessTexture && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Nt] = a, e(n); });
|
|
3512
|
-
};
|
|
3513
|
-
return Pt;
|
|
3514
|
-
}());
|
|
3515
|
-
var Ut = !1;
|
|
3516
|
-
function kt() { Ut || (Ut = !0, Z.RegisterExtension(Nt, function (e) { return new Pt(e); })); }
|
|
3517
|
-
kt();
|
|
3518
|
-
var Kt = "KHR_materials_openpbr";
|
|
3519
|
-
var $t = /** @class */ (function () {
|
|
3520
|
-
function $t() {
|
|
3521
|
-
this.name = Kt, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
3522
|
-
}
|
|
3523
|
-
$t.prototype.dispose = function () { };
|
|
3524
|
-
Object.defineProperty($t.prototype, "wasUsed", {
|
|
3525
|
-
get: function () { return this._wasUsed; },
|
|
3526
|
-
enumerable: false,
|
|
3527
|
-
configurable: true
|
|
3528
|
-
});
|
|
3529
3614
|
$t.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3530
3615
|
var _this = this;
|
|
3531
|
-
return new Promise(function (e) { s instanceof t.
|
|
3616
|
+
return new Promise(function (e) { var r = null, i = null; if (s instanceof t.PBRBaseMaterial ? (r = s._baseDiffuseRoughness, i = s._baseDiffuseRoughnessTexture) : s instanceof t.OpenPBRMaterial && (r = s.baseDiffuseRoughness, i = s.baseDiffuseRoughnessTexture), !r)
|
|
3617
|
+
return void e(n); _this._wasUsed = !0, n.extensions = n.extensions || {}; var o = _this._exporter._materialExporter.getTextureInfo(i), a = { diffuseRoughnessFactor: r, diffuseRoughnessTexture: null != o ? o : void 0 }; null !== a.diffuseRoughnessTexture && _this._exporter._materialNeedsUVsSet.add(s), n.extensions[Kt] = a, e(n); });
|
|
3532
3618
|
};
|
|
3533
3619
|
return $t;
|
|
3534
3620
|
}());
|
|
3535
3621
|
var zt = !1;
|
|
3536
|
-
function Wt() { zt || (zt = !0, Z.RegisterExtension(Kt, function () { return new $t; })); }
|
|
3622
|
+
function Wt() { zt || (zt = !0, Z.RegisterExtension(Kt, function (e) { return new $t(e); })); }
|
|
3537
3623
|
Wt();
|
|
3538
|
-
var Dt = "
|
|
3624
|
+
var Dt = "KHR_materials_openpbr";
|
|
3539
3625
|
var Lt = /** @class */ (function () {
|
|
3540
3626
|
function Lt() {
|
|
3541
3627
|
this.name = Dt, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
@@ -3546,39 +3632,41 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3546
3632
|
enumerable: false,
|
|
3547
3633
|
configurable: true
|
|
3548
3634
|
});
|
|
3549
|
-
Lt.prototype.
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
return void t.Tools.Warn("".concat(e, ": Texture ").concat(s.name, " with homogenousRotationInUVTransform, non-uniform scaling, and non-zero rotation cannot be exported with ").concat(Dt, "."));
|
|
3554
|
-
t.Tools.Warn("".concat(e, ": Texture ").concat(s.name, " with non-origin rotation center will be exported using an adjusted offset with ").concat(Dt, ".")), r.offset = function (e) { var t = e.uOffset, n = e.vOffset, s = e.uRotationCenter, r = e.vRotationCenter, i = e.uScale, o = e.vScale, a = e.wAng, l = Math.cos(a), u = Math.sin(a), c = s * i, h = r * o; return [t + (c * (1 - l) + h * u), n + (h * (1 - l) - c * u)]; }(s);
|
|
3555
|
-
}
|
|
3556
|
-
r.rotation = -s.wAng, i = !0;
|
|
3557
|
-
} 0 !== s.coordinatesIndex && (r.texCoord = s.coordinatesIndex, i = !0), i && (this._wasUsed = !0, n.extensions || (n.extensions = {}), n.extensions[Dt] = r); };
|
|
3635
|
+
Lt.prototype.postExportMaterialAsync = function (e, n, s) {
|
|
3636
|
+
var _this = this;
|
|
3637
|
+
return new Promise(function (e) { s instanceof t.OpenPBRMaterial && (_this._wasUsed = !0, n.extensions = n.extensions || {}, n.extensions[Dt] = {}), e(n); });
|
|
3638
|
+
};
|
|
3558
3639
|
return Lt;
|
|
3559
3640
|
}());
|
|
3560
3641
|
var Ht = !1;
|
|
3561
3642
|
function jt() { Ht || (Ht = !0, Z.RegisterExtension(Dt, function () { return new Lt; })); }
|
|
3562
3643
|
jt();
|
|
3563
|
-
var qt = "
|
|
3644
|
+
var qt = "KHR_texture_transform";
|
|
3564
3645
|
var Gt = /** @class */ (function () {
|
|
3565
|
-
function Gt(
|
|
3566
|
-
this.name = qt, this.enabled = !0, this.required = !
|
|
3646
|
+
function Gt() {
|
|
3647
|
+
this.name = qt, this.enabled = !0, this.required = !1, this._wasUsed = !1;
|
|
3567
3648
|
}
|
|
3649
|
+
Gt.prototype.dispose = function () { };
|
|
3568
3650
|
Object.defineProperty(Gt.prototype, "wasUsed", {
|
|
3569
3651
|
get: function () { return this._wasUsed; },
|
|
3570
3652
|
enumerable: false,
|
|
3571
3653
|
configurable: true
|
|
3572
3654
|
});
|
|
3573
|
-
Gt.prototype.
|
|
3574
|
-
|
|
3575
|
-
|
|
3655
|
+
Gt.prototype.postExportTexture = function (e, n, s) { if (s.getScene() || t.Tools.Warn("".concat(e, ": \"scene\" is not defined for Babylon texture ").concat(s.name, "!")), (0 !== s.uAng || 0 !== s.vAng) && (t.Tools.Warn("".concat(e, ": Texture ").concat(s.name, " with rotation in the u or v axis is not supported in glTF.")), 0 !== s.uRotationCenter || 0 !== s.vRotationCenter))
|
|
3656
|
+
return; var r = {}; var i = !1; if (0 === s.uOffset && 0 === s.vOffset || (r.offset = [s.uOffset, s.vOffset], i = !0), 1 === s.uScale && 1 === s.vScale || (r.scale = [s.uScale, s.vScale], i = !0), 0 !== s.wAng) {
|
|
3657
|
+
if (0 !== s.uRotationCenter || 0 !== s.vRotationCenter) {
|
|
3658
|
+
if (s.homogeneousRotationInUVTransform && s.uScale !== s.vScale)
|
|
3659
|
+
return void t.Tools.Warn("".concat(e, ": Texture ").concat(s.name, " with homogenousRotationInUVTransform, non-uniform scaling, and non-zero rotation cannot be exported with ").concat(qt, "."));
|
|
3660
|
+
t.Tools.Warn("".concat(e, ": Texture ").concat(s.name, " with non-origin rotation center will be exported using an adjusted offset with ").concat(qt, ".")), r.offset = function (e) { var t = e.uOffset, n = e.vOffset, s = e.uRotationCenter, r = e.vRotationCenter, i = e.uScale, o = e.vScale, a = e.wAng, l = Math.cos(a), u = Math.sin(a), c = s * i, h = r * o; return [t + (c * (1 - l) + h * u), n + (h * (1 - l) - c * u)]; }(s);
|
|
3661
|
+
}
|
|
3662
|
+
r.rotation = -s.wAng, i = !0;
|
|
3663
|
+
} 0 !== s.coordinatesIndex && (r.texCoord = s.coordinatesIndex, i = !0), i && (this._wasUsed = !0, n.extensions || (n.extensions = {}), n.extensions[qt] = r); };
|
|
3576
3664
|
return Gt;
|
|
3577
3665
|
}());
|
|
3578
3666
|
var Xt = !1;
|
|
3579
|
-
function Qt() { Xt || (Xt = !0, Z.RegisterExtension(qt, function (
|
|
3667
|
+
function Qt() { Xt || (Xt = !0, Z.RegisterExtension(qt, function () { return new Gt; })); }
|
|
3580
3668
|
Qt();
|
|
3581
|
-
var Zt = "
|
|
3669
|
+
var Zt = "KHR_texture_basisu";
|
|
3582
3670
|
var Yt = /** @class */ (function () {
|
|
3583
3671
|
function Yt(e) {
|
|
3584
3672
|
this.name = Zt, this.enabled = !0, this.required = !0, this._wasUsed = !1, this._exporter = e;
|
|
@@ -3590,13 +3678,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3590
3678
|
});
|
|
3591
3679
|
Yt.prototype.dispose = function () { };
|
|
3592
3680
|
Yt.prototype.postExportTexture = function (e, n) { var s = this._exporter._textures[n.index], r = s.source; if (void 0 === r)
|
|
3593
|
-
return; var i = this._exporter._images[r]; "image/
|
|
3681
|
+
return; var i = this._exporter._images[r]; "image/ktx2" === (i.mimeType || t.GetMimeType(i.uri)) && (s.source = void 0, s.extensions || (s.extensions = {}), s.extensions[Zt] = { source: r }, this._wasUsed = !0); };
|
|
3594
3682
|
return Yt;
|
|
3595
3683
|
}());
|
|
3596
3684
|
var Jt = !1;
|
|
3597
3685
|
function en() { Jt || (Jt = !0, Z.RegisterExtension(Zt, function (e) { return new Yt(e); })); }
|
|
3598
3686
|
en();
|
|
3599
|
-
var tn = "
|
|
3687
|
+
var tn = "EXT_texture_webp";
|
|
3600
3688
|
var nn = /** @class */ (function () {
|
|
3601
3689
|
function nn(e) {
|
|
3602
3690
|
this.name = tn, this.enabled = !0, this.required = !0, this._wasUsed = !1, this._exporter = e;
|
|
@@ -3608,17 +3696,35 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3608
3696
|
});
|
|
3609
3697
|
nn.prototype.dispose = function () { };
|
|
3610
3698
|
nn.prototype.postExportTexture = function (e, n) { var s = this._exporter._textures[n.index], r = s.source; if (void 0 === r)
|
|
3611
|
-
return; var i = this._exporter._images[r]; "image/
|
|
3699
|
+
return; var i = this._exporter._images[r]; "image/webp" === (i.mimeType || t.GetMimeType(i.uri)) && (s.source = void 0, s.extensions || (s.extensions = {}), s.extensions[tn] = { source: r }, this._wasUsed = !0); };
|
|
3612
3700
|
return nn;
|
|
3613
3701
|
}());
|
|
3614
3702
|
var sn = !1;
|
|
3615
3703
|
function rn() { sn || (sn = !0, Z.RegisterExtension(tn, function (e) { return new nn(e); })); }
|
|
3616
3704
|
rn();
|
|
3617
|
-
var on =
|
|
3618
|
-
var
|
|
3619
|
-
function
|
|
3705
|
+
var on = "EXT_texture_avif";
|
|
3706
|
+
var an = /** @class */ (function () {
|
|
3707
|
+
function an(e) {
|
|
3708
|
+
this.name = on, this.enabled = !0, this.required = !0, this._wasUsed = !1, this._exporter = e;
|
|
3709
|
+
}
|
|
3710
|
+
Object.defineProperty(an.prototype, "wasUsed", {
|
|
3711
|
+
get: function () { return this._wasUsed; },
|
|
3712
|
+
enumerable: false,
|
|
3713
|
+
configurable: true
|
|
3714
|
+
});
|
|
3715
|
+
an.prototype.dispose = function () { };
|
|
3716
|
+
an.prototype.postExportTexture = function (e, n) { var s = this._exporter._textures[n.index], r = s.source; if (void 0 === r)
|
|
3717
|
+
return; var i = this._exporter._images[r]; "image/avif" === (i.mimeType || t.GetMimeType(i.uri)) && (s.source = void 0, s.extensions || (s.extensions = {}), s.extensions[on] = { source: r }, this._wasUsed = !0); };
|
|
3718
|
+
return an;
|
|
3719
|
+
}());
|
|
3720
|
+
var ln = !1;
|
|
3721
|
+
function un() { ln || (ln = !0, Z.RegisterExtension(on, function (e) { return new an(e); })); }
|
|
3722
|
+
un();
|
|
3723
|
+
var cn = { __proto__: null, EXT_lights_area: Re, EXT_mesh_gpu_instancing: ne, EXT_texture_avif: an, EXT_texture_webp: nn, KHR_draco_mesh_compression: ae, KHR_interactivity: _e, KHR_lights_punctual: pe, KHR_materials_anisotropy: Ie, KHR_materials_clearcoat: Be, KHR_materials_coat: $e, KHR_materials_diffuse_roughness: $t, KHR_materials_diffuse_transmission: He, KHR_materials_dispersion: Xe, KHR_materials_emissive_strength: Je, KHR_materials_fuzz: gt, KHR_materials_ior: st, KHR_materials_iridescence: at, KHR_materials_openpbr: Lt, KHR_materials_sheen: ht, KHR_materials_specular: yt, KHR_materials_transmission: wt, KHR_materials_unlit: Et, KHR_materials_volume: Vt, KHR_materials_volume_scatter: Pt, KHR_texture_basisu: Yt, KHR_texture_transform: Gt, RegisterEXT_lights_area: Ce, RegisterEXT_mesh_gpu_instancing: re, RegisterEXT_texture_avif: un, RegisterEXT_texture_webp: rn, RegisterKHR_draco_mesh_compression: ue, RegisterKHR_interactivity: ye, RegisterKHR_lights_punctual: ge, RegisterKHR_materials_anisotropy: Fe, RegisterKHR_materials_clearcoat: Pe, RegisterKHR_materials_coat: We, RegisterKHR_materials_diffuse_roughness: Wt, RegisterKHR_materials_diffuse_transmission: qe, RegisterKHR_materials_dispersion: Ze, RegisterKHR_materials_emissive_strength: tt, RegisterKHR_materials_fuzz: _t, RegisterKHR_materials_ior: it, RegisterKHR_materials_iridescence: ut, RegisterKHR_materials_openpbr: jt, RegisterKHR_materials_sheen: ft, RegisterKHR_materials_specular: vt, RegisterKHR_materials_transmission: At, RegisterKHR_materials_unlit: St, RegisterKHR_materials_volume: Bt, RegisterKHR_materials_volume_scatter: kt, RegisterKHR_texture_basisu: en, RegisterKHR_texture_transform: Qt }, hn = { __proto__: null, EXT_lights_area: Re, EXT_mesh_gpu_instancing: ne, EXT_texture_avif: an, EXT_texture_webp: nn, GLTF2Export: Y, GLTFData: i, KHR_draco_mesh_compression: ae, KHR_interactivity: _e, KHR_lights_punctual: pe, KHR_materials_anisotropy: Ie, KHR_materials_clearcoat: Be, KHR_materials_coat: $e, KHR_materials_diffuse_roughness: $t, KHR_materials_diffuse_transmission: He, KHR_materials_dispersion: Xe, KHR_materials_emissive_strength: Je, KHR_materials_fuzz: gt, KHR_materials_ior: st, KHR_materials_iridescence: at, KHR_materials_openpbr: Lt, KHR_materials_sheen: ht, KHR_materials_specular: yt, KHR_materials_transmission: wt, KHR_materials_unlit: Et, KHR_materials_volume: Vt, KHR_materials_volume_scatter: Pt, KHR_texture_basisu: Yt, KHR_texture_transform: Gt, RegisterEXT_lights_area: Ce, RegisterEXT_mesh_gpu_instancing: re, RegisterEXT_texture_avif: un, RegisterEXT_texture_webp: rn, RegisterKHR_draco_mesh_compression: ue, RegisterKHR_interactivity: ye, RegisterKHR_lights_punctual: ge, RegisterKHR_materials_anisotropy: Fe, RegisterKHR_materials_clearcoat: Pe, RegisterKHR_materials_coat: We, RegisterKHR_materials_diffuse_roughness: Wt, RegisterKHR_materials_diffuse_transmission: qe, RegisterKHR_materials_dispersion: Ze, RegisterKHR_materials_emissive_strength: tt, RegisterKHR_materials_fuzz: _t, RegisterKHR_materials_ior: it, RegisterKHR_materials_iridescence: ut, RegisterKHR_materials_openpbr: jt, RegisterKHR_materials_sheen: ft, RegisterKHR_materials_specular: vt, RegisterKHR_materials_transmission: At, RegisterKHR_materials_unlit: St, RegisterKHR_materials_volume: Bt, RegisterKHR_materials_volume_scatter: kt, RegisterKHR_texture_basisu: en, RegisterKHR_texture_transform: Qt, _ConvertToGLTFPBRMetallicRoughness: _, _SolveMetallic: x };
|
|
3724
|
+
var dn = /** @class */ (function () {
|
|
3725
|
+
function dn() {
|
|
3620
3726
|
}
|
|
3621
|
-
|
|
3727
|
+
dn.CreateSTL = function (e, n, s, r, i, o, a, l) {
|
|
3622
3728
|
if (n === void 0) { n = !0; }
|
|
3623
3729
|
if (s === void 0) { s = "stlmesh"; }
|
|
3624
3730
|
if (r === void 0) { r = !1; }
|
|
@@ -3627,9 +3733,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3627
3733
|
if (a === void 0) { a = !1; }
|
|
3628
3734
|
if (l === void 0) { l = !1; }
|
|
3629
3735
|
var u = function (e, n, s) { var r = [3 * e[s], 3 * e[s + 1], 3 * e[s + 2]], i = [new t.Vector3(n[r[0]], n[r[0] + 2], n[r[0] + 1]), new t.Vector3(n[r[1]], n[r[1] + 2], n[r[1] + 1]), new t.Vector3(n[r[2]], n[r[2] + 2], n[r[2] + 1])], o = i[0].subtract(i[1]), a = i[2].subtract(i[1]); return { v: i, n: t.Vector3.Cross(a, o).normalize() }; }, c = function (e, t, n, s) { return t = h(e, t, n.x, s), t = h(e, t, n.y, s), h(e, t, n.z, s); }, h = function (e, t, n, s) { return e.setFloat32(t, n, s), t + 4; }, d = function (e) { if (a) {
|
|
3630
|
-
var
|
|
3631
|
-
e instanceof t.InstancedMesh && (
|
|
3632
|
-
var s_37 =
|
|
3736
|
+
var n_64 = e;
|
|
3737
|
+
e instanceof t.InstancedMesh && (n_64 = e.sourceMesh);
|
|
3738
|
+
var s_37 = n_64.getVerticesData(t.VertexBuffer.PositionKind, !0, !0);
|
|
3633
3739
|
if (!s_37)
|
|
3634
3740
|
return [];
|
|
3635
3741
|
var r_46 = t.Vector3.Zero();
|
|
@@ -3641,83 +3747,83 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3641
3747
|
a && (o = !0);
|
|
3642
3748
|
var f = "", p = 0, m = 0;
|
|
3643
3749
|
if (r) {
|
|
3644
|
-
for (var
|
|
3645
|
-
var
|
|
3646
|
-
p +=
|
|
3750
|
+
for (var t_75 = 0; t_75 < e.length; t_75++) {
|
|
3751
|
+
var n_65 = e[t_75].getIndices();
|
|
3752
|
+
p += n_65 ? n_65.length / 3 : 0;
|
|
3647
3753
|
}
|
|
3648
|
-
var
|
|
3649
|
-
f = new DataView(
|
|
3754
|
+
var t_76 = new ArrayBuffer(84 + 50 * p);
|
|
3755
|
+
f = new DataView(t_76), m += 80, f.setUint32(m, p, i), m += 4;
|
|
3650
3756
|
}
|
|
3651
3757
|
else
|
|
3652
3758
|
l || (f = "solid stlmesh\r\n");
|
|
3653
|
-
for (var
|
|
3654
|
-
var s_38 = e[
|
|
3759
|
+
for (var n_66 = 0; n_66 < e.length; n_66++) {
|
|
3760
|
+
var s_38 = e[n_66];
|
|
3655
3761
|
!r && l && (f += "solid " + s_38.name + "\r\n"), !o && s_38 instanceof t.Mesh && s_38.bakeCurrentTransformIntoVertices();
|
|
3656
|
-
var
|
|
3657
|
-
for (var
|
|
3658
|
-
var
|
|
3659
|
-
r ? (m = c(f, m,
|
|
3762
|
+
var a_27 = d(s_38), h_19 = s_38.getIndices() || [];
|
|
3763
|
+
for (var e_167 = 0; e_167 < h_19.length; e_167 += 3) {
|
|
3764
|
+
var t_77 = u(h_19, a_27, e_167);
|
|
3765
|
+
r ? (m = c(f, m, t_77.n, i), m = c(f, m, t_77.v[0], i), m = c(f, m, t_77.v[1], i), m = c(f, m, t_77.v[2], i), m += 2) : (f += "\tfacet normal " + t_77.n.x + " " + t_77.n.y + " " + t_77.n.z + "\r\n", f += "\t\touter loop\r\n", f += "\t\t\tvertex " + t_77.v[0].x + " " + t_77.v[0].y + " " + t_77.v[0].z + "\r\n", f += "\t\t\tvertex " + t_77.v[1].x + " " + t_77.v[1].y + " " + t_77.v[1].z + "\r\n", f += "\t\t\tvertex " + t_77.v[2].x + " " + t_77.v[2].y + " " + t_77.v[2].z + "\r\n", f += "\t\tendloop\r\n", f += "\tendfacet\r\n");
|
|
3660
3766
|
}
|
|
3661
3767
|
!r && l && (f += "endsolid " + name + "\r\n");
|
|
3662
3768
|
}
|
|
3663
3769
|
if (r || l || (f += "endsolid stlmesh"), n) {
|
|
3664
|
-
var
|
|
3665
|
-
|
|
3770
|
+
var e_168 = document.createElement("a"), t_78 = new Blob([f], { type: "application/octet-stream" });
|
|
3771
|
+
e_168.href = window.URL.createObjectURL(t_78), e_168.download = s + ".stl", e_168.click();
|
|
3666
3772
|
}
|
|
3667
3773
|
return f;
|
|
3668
3774
|
};
|
|
3669
|
-
return
|
|
3775
|
+
return dn;
|
|
3670
3776
|
}());
|
|
3671
|
-
var
|
|
3672
|
-
function
|
|
3777
|
+
var fn = { __proto__: null, STLExport: dn };
|
|
3778
|
+
function pn(e, t, n, s) {
|
|
3673
3779
|
if (n === void 0) { n = 3; }
|
|
3674
3780
|
if (s === void 0) { s = !1; }
|
|
3675
3781
|
var r = [];
|
|
3676
3782
|
for (var i_35 = 0; i_35 < e.length / n; i_35++) {
|
|
3677
|
-
var
|
|
3678
|
-
r.push("(".concat(
|
|
3783
|
+
var o_37 = e[i_35 * n] * (s ? -1 : 1), a_28 = e[i_35 * n + 1], l_25 = e[i_35 * n + 2];
|
|
3784
|
+
r.push("(".concat(o_37.toPrecision(t.precision), ", ").concat(a_28.toPrecision(t.precision), ", ").concat(l_25.toPrecision(t.precision), ")"));
|
|
3679
3785
|
}
|
|
3680
3786
|
return r.join(", ");
|
|
3681
3787
|
}
|
|
3682
|
-
function
|
|
3788
|
+
function mn(e, t) { var n = []; for (var s_39 = 0; s_39 < e.length / 2; s_39++) {
|
|
3683
3789
|
var r_47 = e[2 * s_39], i_36 = e[2 * s_39 + 1];
|
|
3684
3790
|
n.push("(".concat(r_47.toPrecision(t.precision), ", ").concat((1 - i_36).toPrecision(t.precision), ")"));
|
|
3685
3791
|
} return n.join(", "); }
|
|
3686
|
-
function
|
|
3792
|
+
function gn(e, n, s, r) { return "\n def \"Geometry\"\n {\n ".concat(function (e, n, s, r) { var i = e.getVerticesData(t.VertexBuffer.PositionKind), o = e.getVerticesData(t.VertexBuffer.NormalKind); if (i && o)
|
|
3687
3793
|
return "\n\tdef Mesh \"Geometry\"\n\t{\n uniform token orientation = \"".concat(s, "\"\n\t\tint[] faceVertexCounts = [").concat(function (e) { var t; var n = (null === (t = e.getIndices()) || void 0 === t ? void 0 : t.length) ? e.getTotalIndices() : e.getTotalVertices(); return Array(n / 3).fill(3).join(", "); }(e), "]\n\t\tint[] faceVertexIndices = [").concat(function (e) { var t; var n = e.getIndices(), s = null !== (t = null == n ? void 0 : n.length) && void 0 !== t ? t : e.getTotalVertices(), r = []; if (null !== n)
|
|
3688
|
-
for (var
|
|
3689
|
-
r.push(n[
|
|
3794
|
+
for (var e_169 = 0; e_169 < s; e_169++)
|
|
3795
|
+
r.push(n[e_169]);
|
|
3690
3796
|
else
|
|
3691
|
-
for (var
|
|
3692
|
-
r.push(
|
|
3693
|
-
var i_37 = r_48 > 0 ? r_48 : "",
|
|
3694
|
-
|
|
3695
|
-
} var r = e.getVerticesData(t.VertexBuffer.ColorKind); return r && (s += "\n\tcolor3f[] primvars:displayColor = [".concat(
|
|
3696
|
-
function
|
|
3697
|
-
function
|
|
3698
|
-
function
|
|
3699
|
-
function
|
|
3700
|
-
function
|
|
3797
|
+
for (var e_170 = 0; e_170 < s; e_170++)
|
|
3798
|
+
r.push(e_170); return r.join(", "); }(e), "]\n\t\tnormal3f[] normals = [").concat(pn(o, n, void 0, r), "] (\n\t\t\tinterpolation = \"vertex\"\n\t\t)\n\t\tpoint3f[] points = [").concat(pn(i, n, void 0, r), "]\n ").concat(function (e, n) { var s = ""; for (var r_48 = 0; r_48 < 4; r_48++) {
|
|
3799
|
+
var i_37 = r_48 > 0 ? r_48 : "", o_38 = e.getVerticesData(t.VertexBuffer.UVKind + (i_37 ? i_37 + 1 : ""));
|
|
3800
|
+
o_38 && (s += "\n\t\ttexCoord2f[] primvars:st".concat(i_37, " = [").concat(mn(o_38, n), "] (\n\t\t\tinterpolation = \"vertex\"\n\t\t)"));
|
|
3801
|
+
} var r = e.getVerticesData(t.VertexBuffer.ColorKind); return r && (s += "\n\tcolor3f[] primvars:displayColor = [".concat(pn(r, n, r.length / e.getTotalVertices()), "] (\n\t\tinterpolation = \"vertex\"\n\t\t)")), s; }(e, n), "\n\t\tuniform token subdivisionScheme = \"none\"\n\t}\n"); }(e, n, s, r), "\n }\n "); }
|
|
3802
|
+
function xn(e) { var t = '#usda 1.0\n (\n customLayerData = {\n string creator = "Babylon.js USDZExportAsync"\n }\n defaultPrim = "Root"\n metersPerUnit = 1\n upAxis = "Y"\n )'; return t += e, fflate.strToU8(t); }
|
|
3803
|
+
function _n(e) { var t = e.m; return "( ".concat(Tn(t, 0), ", ").concat(Tn(t, 4), ", ").concat(Tn(t, 8), ", ").concat(Tn(t, 12), " )"); }
|
|
3804
|
+
function Tn(e, t) { return "(".concat(e[t + 0], ", ").concat(e[t + 1], ", ").concat(e[t + 2], ", ").concat(e[t + 3], ")"); }
|
|
3805
|
+
function yn(e, t) { var n = "Object_" + e.uniqueId, s = _n(t); return "def Xform \"".concat(n, "\" (\n\tprepend references = @./geometries/Geometry_").concat(e.geometry.uniqueId, ".usda@</Geometry>\n\tprepend apiSchemas = [\"MaterialBindingAPI\"]\n)\n{\n\tmatrix4d xformOp:transform = ").concat(s, "\n\tuniform token[] xformOpOrder = [\"xformOp:transform\"]\t\n\n rel material:binding = </Root/Materials/Material_").concat(e.material.uniqueId, ">\n}\n\n"); }
|
|
3806
|
+
function bn(e) { switch (e) {
|
|
3701
3807
|
case t.Constants.TEXTURE_CLAMP_ADDRESSMODE: return "clamp";
|
|
3702
3808
|
case t.Constants.TEXTURE_MIRROR_ADDRESSMODE: return "mirror";
|
|
3703
3809
|
case t.Constants.TEXTURE_WRAP_ADDRESSMODE:
|
|
3704
3810
|
default: return "repeat";
|
|
3705
3811
|
} }
|
|
3706
|
-
function
|
|
3707
|
-
function
|
|
3708
|
-
function
|
|
3709
|
-
function
|
|
3710
|
-
function
|
|
3711
|
-
function
|
|
3812
|
+
function vn(e) { return "(".concat(e.x, ", ").concat(e.y, ")"); }
|
|
3813
|
+
function Mn(e) { return "(".concat(e.r, ", ").concat(e.g, ", ").concat(e.b, ")"); }
|
|
3814
|
+
function wn(e) { return "image/jpeg" === e || "image/png" === e; }
|
|
3815
|
+
function Rn(e, n, s, r, i, o) { var a, l; var u = e.getInternalTexture().uniqueId + "_" + e.invertY, c = e.mimeType || t.GetMimeType(null !== (l = null === (a = e.getInternalTexture()) || void 0 === a ? void 0 : a.url) && void 0 !== l ? l : ""), h = wn(c) ? c : "image/png", d = "image/jpeg" === h ? "jpg" : "png"; i[u] = { texture: e, mimeType: h, ext: d }; var f = e.coordinatesIndex > 0 ? "st" + e.coordinatesIndex : "st", p = new t.Vector2(e.uScale, e.vScale), m = new t.Vector2(e.uOffset, e.vOffset), g = e.wAng, x = Math.sin(g), _ = Math.cos(g); return m.y = 1 - m.y - p.y, m.x += x * p.x, m.y += (1 - _) * p.y, "\n def Shader \"PrimvarReader_".concat(s, "\"\n {\n uniform token info:id = \"UsdPrimvarReader_float2\"\n float2 inputs:fallback = (0.0, 0.0)\n token inputs:varname = \"").concat(f, "\"\n float2 outputs:result\n }\n\n def Shader \"Transform2d_").concat(s, "\"\n {\n uniform token info:id = \"UsdTransform2d\"\n token inputs:in.connect = </Root/Materials/Material_").concat(n.uniqueId, "/PrimvarReader_").concat(s, ".outputs:result>\n float inputs:rotation = ").concat((g * (180 / Math.PI)).toFixed(o.precision), "\n float2 inputs:scale = ").concat(vn(p), "\n float2 inputs:translation = ").concat(vn(m), "\n float2 outputs:result\n }\n\n def Shader \"Texture_").concat(e.uniqueId, "_").concat(s, "\"\n {\n uniform token info:id = \"UsdUVTexture\"\n asset inputs:file = @textures/Texture_").concat(u, ".").concat(d, "@\n float2 inputs:st.connect = </Root/Materials/Material_").concat(n.uniqueId, "/Transform2d_").concat(s, ".outputs:result>\n ").concat(r ? "float4 inputs:scale = " + function (e) { return "(".concat(e.r, ", ").concat(e.g, ", ").concat(e.b, ", 1.0)"); }(r) : "", "\n token inputs:sourceColorSpace = \"").concat(e.gammaSpace ? "sRGB" : "raw", "\"\n token inputs:wrapS = \"").concat(bn(e.wrapU), "\"\n token inputs:wrapT = \"").concat(bn(e.wrapV), "\"\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n ").concat(n.needAlphaBlending() || n.needAlphaTesting() ? "float outputs:a" : "", "\n }"); }
|
|
3816
|
+
function An(e, n, s) { var r = "\t\t\t", i = [], o = [], _a = function (e) { var n, s; var r = { diffuseMap: null, diffuse: null, alphaCutOff: 0, emissiveMap: null, emissive: null, normalMap: null, roughnessMap: null, roughnessChannel: "a", roughness: 0, metalnessMap: null, metalnessChannel: "r", metalness: 0, aoMap: null, aoMapChannel: "rgb", aoMapIntensity: 0, alphaMap: null, ior: 1, clearCoatEnabled: !1, clearCoat: 0, clearCoatMap: null, clearCoatRoughness: 0, clearCoatRoughnessMap: null }; return e instanceof t.StandardMaterial ? Object.assign(Object.assign({}, r), { diffuseMap: e.diffuseTexture, diffuse: e.diffuseColor, alphaCutOff: e.alphaCutOff, emissiveMap: e.emissiveTexture, emissive: e.emissiveColor, roughness: 1, alphaMap: e.opacityTexture }) : e instanceof t.PBRBaseMaterial ? Object.assign(Object.assign({}, r), { diffuseMap: e._albedoTexture, diffuse: e._albedoColor, alphaCutOff: e._alphaCutOff, emissiveMap: e._emissiveTexture, emissive: e._emissiveColor, normalMap: e._bumpTexture, roughnessMap: e._metallicTexture, roughnessChannel: e._useRoughnessFromMetallicTextureAlpha ? "a" : "g", roughness: null !== (n = e._roughness) && void 0 !== n ? n : 1, metalnessMap: e._metallicTexture, metalnessChannel: e._useMetallnessFromMetallicTextureBlue ? "b" : "r", metalness: null !== (s = e._metallic) && void 0 !== s ? s : 0, aoMap: e._ambientTexture, aoMapChannel: e._useAmbientInGrayScale ? "r" : "rgb", aoMapIntensity: e._ambientTextureStrength, alphaMap: e._opacityTexture, ior: e.subSurface.indexOfRefraction, clearCoatEnabled: e.clearCoat.isEnabled, clearCoat: e.clearCoat.intensity, clearCoatMap: e.clearCoat.texture, clearCoatRoughness: e.clearCoat.roughness, clearCoatRoughnessMap: e.clearCoat.useRoughnessFromMainTexture ? e.clearCoat.texture : e.clearCoat.textureRoughness }) : r; }(e), a = _a.diffuseMap, l = _a.diffuse, u = _a.alphaCutOff, c = _a.emissiveMap, h = _a.emissive, d = _a.normalMap, f = _a.roughnessMap, p = _a.roughnessChannel, m = _a.roughness, g = _a.metalnessMap, x = _a.metalnessChannel, _ = _a.metalness, T = _a.aoMap, y = _a.aoMapChannel, b = _a.aoMapIntensity, v = _a.alphaMap, M = _a.ior, w = _a.clearCoatEnabled, R = _a.clearCoat, A = _a.clearCoatMap, C = _a.clearCoatRoughness, E = _a.clearCoatRoughnessMap; return null !== a ? (i.push("".concat(r, "color3f inputs:diffuseColor.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(a.uniqueId, "_diffuse.outputs:rgb>")), e.needAlphaBlending() ? i.push("".concat(r, "float inputs:opacity.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(a.uniqueId, "_diffuse.outputs:a>")) : e.needAlphaTesting() && (i.push("".concat(r, "float inputs:opacity.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(a.uniqueId, "_diffuse.outputs:a>")), i.push("".concat(r, "float inputs:opacityThreshold = ").concat(u))), o.push(Rn(a, e, "diffuse", l, n, s))) : i.push("".concat(r, "color3f inputs:diffuseColor = ").concat(Mn(l || t.Color3.White()))), null !== c ? (i.push("".concat(r, "color3f inputs:emissiveColor.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(c.uniqueId, "_emissive.outputs:rgb>")), o.push(Rn(c, e, "emissive", h, n, s))) : h && h.toLuminance() > 0 && i.push("".concat(r, "color3f inputs:emissiveColor = ").concat(Mn(h))), null !== d && (i.push("".concat(r, "normal3f inputs:normal.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(d.uniqueId, "_normal.outputs:rgb>")), o.push(Rn(d, e, "normal", null, n, s))), null !== T && (i.push("".concat(r, "float inputs:occlusion.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(T.uniqueId, "_occlusion.outputs:").concat(y, ">")), o.push(Rn(T, e, "occlusion", new t.Color3(b, b, b), n, s))), null !== f ? (i.push("".concat(r, "float inputs:roughness.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(f.uniqueId, "_roughness.outputs:").concat(p, ">")), o.push(Rn(f, e, "roughness", new t.Color3(m, m, m), n, s))) : i.push("".concat(r, "float inputs:roughness = ").concat(m)), null !== g ? (i.push("".concat(r, "float inputs:metallic.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(g.uniqueId, "_metallic.outputs:").concat(x, ">")), o.push(Rn(g, e, "metallic", new t.Color3(_, _, _), n, s))) : i.push("".concat(r, "float inputs:metallic = ").concat(_)), null !== v ? (i.push("".concat(r, "float inputs:opacity.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(v.uniqueId, "_opacity.outputs:r>")), i.push("".concat(r, "float inputs:opacityThreshold = 0.0001")), o.push(Rn(v, e, "opacity", null, n, s))) : i.push("".concat(r, "float inputs:opacity = ").concat(e.alpha)), w && (null !== A ? (i.push("".concat(r, "float inputs:clearcoat.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(A.uniqueId, "_clearcoat.outputs:r>")), o.push(Rn(A, e, "clearcoat", new t.Color3(R, R, R), n, s))) : i.push("".concat(r, "float inputs:clearcoat = ").concat(R)), null !== E ? (i.push("".concat(r, "float inputs:clearcoatRoughness.connect = </Root/Materials/Material_").concat(e.uniqueId, "/Texture_").concat(E.uniqueId, "_clearcoatRoughness.outputs:g>")), o.push(Rn(E, e, "clearcoatRoughness", new t.Color3(C, C, C), n, s))) : i.push("".concat(r, "float inputs:clearcoatRoughness = ").concat(C))), i.push("".concat(r, "float inputs:ior = ").concat(M)), "\n\tdef Material \"Material_".concat(e.uniqueId, "\"\n\t{\n\t\tdef Shader \"PreviewSurface\"\n\t\t{\n\t\t\tuniform token info:id = \"UsdPreviewSurface\"\n").concat(i.join("\n"), "\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Root/Materials/Material_").concat(e.uniqueId, "/PreviewSurface.outputs:surface>\n\n").concat(o.join("\n"), "\n\n\t}\n"); }
|
|
3817
|
+
function Cn(e) { var n, s; e.computeWorldMatrix(!0); var r = e.getWorldMatrix().clone(), i = e.getScene().useRightHandedSystem; var o = null !== (s = null === (n = e.material) || void 0 === n ? void 0 : n._getEffectiveOrientation(e)) && void 0 !== s ? s : e.sideOrientation, a = !i, l = e.parent; for (; l;) {
|
|
3712
3818
|
if (w(l, i) && null === l.parent) {
|
|
3713
3819
|
i || (r.multiplyToRef(l.getWorldMatrix().invert(), r), o = o === t.Material.ClockWiseSideOrientation ? t.Material.CounterClockWiseSideOrientation : t.Material.ClockWiseSideOrientation), a = !1;
|
|
3714
3820
|
break;
|
|
3715
3821
|
}
|
|
3716
3822
|
l = l.parent;
|
|
3717
3823
|
} return r.determinant() < 0 && t.Tools.Warn("Mesh ".concat(e.name, " has a negative scale, which may look incorrect in destinations like QuickLook.")), { matrix: r, windingOrder: o === t.Material.ClockWiseSideOrientation ? "leftHanded" : "rightHanded", convertToRightHanded: a }; }
|
|
3718
|
-
function
|
|
3719
|
-
var r, _a, i, o, a, _b, _c,
|
|
3720
|
-
var
|
|
3824
|
+
function En(e, n, s) { return c(this, void 0, void 0, function () {
|
|
3825
|
+
var r, _a, i, o, a, _b, _c, n_67, e_172, l_26, u_21, t_79, _g, n_68, s_40, c_19, e_173, l, _h, _j, _k, _l, e_174, _p, n_69, s_41, r_49, o_39, o_40, a_29, l_27, u, e_175, t_80, n_70, s_42;
|
|
3826
|
+
var e_171, _q;
|
|
3721
3827
|
return __generator(this, function (_r) {
|
|
3722
3828
|
switch (_r.label) {
|
|
3723
3829
|
case 0:
|
|
@@ -3737,39 +3843,39 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3737
3843
|
a = {};
|
|
3738
3844
|
try {
|
|
3739
3845
|
for (_b = __values(e.meshes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3740
|
-
|
|
3741
|
-
if (0 ===
|
|
3846
|
+
n_67 = _c.value;
|
|
3847
|
+
if (0 === n_67.getTotalVertices())
|
|
3742
3848
|
continue;
|
|
3743
|
-
|
|
3744
|
-
if (u_21 && l_26 && (!s || s(
|
|
3849
|
+
e_172 = n_67, l_26 = e_172.geometry, u_21 = e_172.material;
|
|
3850
|
+
if (u_21 && l_26 && (!s || s(e_172)))
|
|
3745
3851
|
if (-1 !== ["StandardMaterial", "PBRMaterial", "PBRMetallicRoughnessMaterial"].indexOf(u_21.getClassName())) {
|
|
3746
|
-
|
|
3747
|
-
if (!(
|
|
3748
|
-
|
|
3749
|
-
i[
|
|
3852
|
+
t_79 = "geometries/Geometry_" + l_26.uniqueId + ".usda", _g = Cn(e_172), n_68 = _g.matrix, s_40 = _g.windingOrder, c_19 = _g.convertToRightHanded;
|
|
3853
|
+
if (!(t_79 in i)) {
|
|
3854
|
+
e_173 = gn(l_26, r, s_40, c_19);
|
|
3855
|
+
i[t_79] = xn(e_173);
|
|
3750
3856
|
}
|
|
3751
|
-
u_21.uniqueId in a || (a[u_21.uniqueId] = u_21), o +=
|
|
3857
|
+
u_21.uniqueId in a || (a[u_21.uniqueId] = u_21), o += yn(e_172, n_68);
|
|
3752
3858
|
}
|
|
3753
3859
|
else
|
|
3754
3860
|
t.Tools.Warn("USDZExportAsync does not support this material type: " + u_21.getClassName());
|
|
3755
3861
|
}
|
|
3756
3862
|
}
|
|
3757
|
-
catch (
|
|
3863
|
+
catch (e_171_1) { e_171 = { error: e_171_1 }; }
|
|
3758
3864
|
finally {
|
|
3759
3865
|
try {
|
|
3760
3866
|
if (_c && !_c.done && (_q = _b.return)) _q.call(_b);
|
|
3761
3867
|
}
|
|
3762
|
-
finally { if (
|
|
3868
|
+
finally { if (e_171) throw e_171.error; }
|
|
3763
3869
|
}
|
|
3764
|
-
e.activeCamera && r.exportCamera && (o += function (e, n) { var s = "Camera_" + e.uniqueId, r =
|
|
3870
|
+
e.activeCamera && r.exportCamera && (o += function (e, n) { var s = "Camera_" + e.uniqueId, r = _n(t.Matrix.RotationY(Math.PI).multiply(e.getWorldMatrix())); if (e.mode === t.Constants.ORTHOGRAPHIC_CAMERA)
|
|
3765
3871
|
return "def Camera \"".concat(s, "\"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ").concat(r, "\n\t\t\tuniform token[] xformOpOrder = [\"xformOp:transform\"]\n\n\t\t\tfloat2 clippingRange = (").concat(e.minZ.toPrecision(n.precision), ", ").concat(e.maxZ.toPrecision(n.precision), ")\n\t\t\tfloat horizontalAperture = ").concat((10 * (Math.abs(e.orthoLeft || 1) + Math.abs(e.orthoRight || 1))).toPrecision(n.precision), "\n\t\t\tfloat verticalAperture = ").concat((10 * (Math.abs(e.orthoTop || 1) + Math.abs(e.orthoBottom || 1))).toPrecision(n.precision), "\n\t\t\ttoken projection = \"orthographic\"\n\t\t}\n\t\n\t"); {
|
|
3766
|
-
var
|
|
3767
|
-
return "def Camera \"".concat(s, "\"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ").concat(r, "\n\t\t\tuniform token[] xformOpOrder = [\"xformOp:transform\"]\n\n\t\t\tfloat2 clippingRange = (").concat(e.minZ.toPrecision(n.precision), ", ").concat(e.maxZ.toPrecision(n.precision), ")\n\t\t\tfloat focalLength = ").concat((i_38 / (2 * Math.tan(.5 * e.fov))).toPrecision(n.precision), "\n token projection = \"perspective\"\n\t\t\tfloat horizontalAperture = ").concat((i_38 *
|
|
3872
|
+
var t_81 = e.getEngine().getAspectRatio(e), i_38 = n.cameraSensorWidth || 35;
|
|
3873
|
+
return "def Camera \"".concat(s, "\"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ").concat(r, "\n\t\t\tuniform token[] xformOpOrder = [\"xformOp:transform\"]\n\n\t\t\tfloat2 clippingRange = (").concat(e.minZ.toPrecision(n.precision), ", ").concat(e.maxZ.toPrecision(n.precision), ")\n\t\t\tfloat focalLength = ").concat((i_38 / (2 * Math.tan(.5 * e.fov))).toPrecision(n.precision), "\n token projection = \"perspective\"\n\t\t\tfloat horizontalAperture = ").concat((i_38 * t_81).toPrecision(n.precision), "\n\t\t\tfloat verticalAperture = ").concat((i_38 / t_81).toPrecision(n.precision), " \n\t\t}\n\t\n\t");
|
|
3768
3874
|
} }(e.activeCamera, r)), o += "\n }\n }";
|
|
3769
3875
|
l = {};
|
|
3770
3876
|
o += function (e, t, n) { var s = []; for (var r_50 in e) {
|
|
3771
3877
|
var i_39 = e[r_50];
|
|
3772
|
-
s.push(
|
|
3878
|
+
s.push(An(i_39, t, n));
|
|
3773
3879
|
} return "\n def \"Materials\"\n{\n".concat(s.join(""), "\n}\n\n"); }(a, l, r), o += "\n }", i[r.modelFileName] = fflate.strToU8(o);
|
|
3774
3880
|
_h = l;
|
|
3775
3881
|
_j = [];
|
|
@@ -3781,51 +3887,51 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3781
3887
|
if (!(_l < _j.length)) return [3 /*break*/, 9];
|
|
3782
3888
|
_k = _j[_l];
|
|
3783
3889
|
if (!(_k in _h)) return [3 /*break*/, 8];
|
|
3784
|
-
|
|
3785
|
-
_p = l[
|
|
3786
|
-
return [4 /*yield*/, h(
|
|
3890
|
+
e_174 = _k;
|
|
3891
|
+
_p = l[e_174], n_69 = _p.texture, s_41 = _p.ext, r_49 = _p.mimeType;
|
|
3892
|
+
return [4 /*yield*/, h(n_69)];
|
|
3787
3893
|
case 4:
|
|
3788
|
-
|
|
3789
|
-
if (!(
|
|
3790
|
-
i["textures/Texture_".concat(
|
|
3894
|
+
o_39 = _r.sent();
|
|
3895
|
+
if (!(o_39 && wn(o_39.mimeType) && o_39.mimeType === r_49)) return [3 /*break*/, 5];
|
|
3896
|
+
i["textures/Texture_".concat(e_174, ".").concat(s_41)] = new Uint8Array(o_39.data);
|
|
3791
3897
|
return [3 /*break*/, 8];
|
|
3792
3898
|
case 5:
|
|
3793
|
-
|
|
3794
|
-
return [4 /*yield*/, t.GetTextureDataAsync(
|
|
3899
|
+
o_40 = n_69.getSize();
|
|
3900
|
+
return [4 /*yield*/, t.GetTextureDataAsync(n_69)];
|
|
3795
3901
|
case 6:
|
|
3796
|
-
|
|
3797
|
-
return [4 /*yield*/, t.DumpTools.DumpDataAsync(
|
|
3902
|
+
a_29 = _r.sent();
|
|
3903
|
+
return [4 /*yield*/, t.DumpTools.DumpDataAsync(o_40.width, o_40.height, a_29, r_49, void 0, !1, !0)];
|
|
3798
3904
|
case 7:
|
|
3799
3905
|
l_27 = _r.sent();
|
|
3800
|
-
i["textures/Texture_".concat(
|
|
3906
|
+
i["textures/Texture_".concat(e_174, ".").concat(s_41)] = new Uint8Array(l_27).slice();
|
|
3801
3907
|
_r.label = 8;
|
|
3802
3908
|
case 8:
|
|
3803
3909
|
_l++;
|
|
3804
3910
|
return [3 /*break*/, 3];
|
|
3805
3911
|
case 9:
|
|
3806
3912
|
u = 0;
|
|
3807
|
-
for (
|
|
3808
|
-
|
|
3809
|
-
if (!
|
|
3913
|
+
for (e_175 in i) {
|
|
3914
|
+
t_80 = i[e_175];
|
|
3915
|
+
if (!t_80)
|
|
3810
3916
|
continue;
|
|
3811
|
-
u += 34 +
|
|
3812
|
-
|
|
3813
|
-
if (4 !==
|
|
3814
|
-
s_42 = new Uint8Array(64 -
|
|
3815
|
-
i[
|
|
3917
|
+
u += 34 + e_175.length;
|
|
3918
|
+
n_70 = 63 & u;
|
|
3919
|
+
if (4 !== n_70) {
|
|
3920
|
+
s_42 = new Uint8Array(64 - n_70);
|
|
3921
|
+
i[e_175] = [t_80, { extra: { 12345: s_42 } }];
|
|
3816
3922
|
}
|
|
3817
|
-
u =
|
|
3923
|
+
u = t_80.length;
|
|
3818
3924
|
}
|
|
3819
3925
|
return [2 /*return*/, fflate.zipSync(i, { level: 0 })];
|
|
3820
3926
|
}
|
|
3821
3927
|
});
|
|
3822
3928
|
}); }
|
|
3823
|
-
var
|
|
3824
|
-
var
|
|
3825
|
-
function
|
|
3929
|
+
var In = { __proto__: null, USDZExportAsync: En };
|
|
3930
|
+
var Sn = /** @class */ (function () {
|
|
3931
|
+
function Sn() {
|
|
3826
3932
|
}
|
|
3827
|
-
|
|
3828
|
-
var
|
|
3933
|
+
Sn.Export = function (e, n, s) {
|
|
3934
|
+
var e_176, _a, e_177, _b;
|
|
3829
3935
|
if (n === void 0) { n = []; }
|
|
3830
3936
|
var r;
|
|
3831
3937
|
if (!e || 0 === e.bones.length)
|
|
@@ -3835,17 +3941,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3835
3941
|
var o = null;
|
|
3836
3942
|
try {
|
|
3837
3943
|
for (var i_40 = __values(i), i_40_1 = i_40.next(); !i_40_1.done; i_40_1 = i_40.next()) {
|
|
3838
|
-
var
|
|
3839
|
-
var s_43 = e.getAnimationRange(
|
|
3944
|
+
var n_71 = i_40_1.value;
|
|
3945
|
+
var s_43 = e.getAnimationRange(n_71);
|
|
3840
3946
|
s_43 && (o = o ? new t.AnimationRange("animation-range", Math.min(o.from, s_43.from), Math.max(o.to, s_43.to)) : s_43);
|
|
3841
3947
|
}
|
|
3842
3948
|
}
|
|
3843
|
-
catch (
|
|
3949
|
+
catch (e_176_1) { e_176 = { error: e_176_1 }; }
|
|
3844
3950
|
finally {
|
|
3845
3951
|
try {
|
|
3846
3952
|
if (i_40_1 && !i_40_1.done && (_a = i_40.return)) _a.call(i_40);
|
|
3847
3953
|
}
|
|
3848
|
-
finally { if (
|
|
3954
|
+
finally { if (e_176) throw e_176.error; }
|
|
3849
3955
|
}
|
|
3850
3956
|
if (!o && (e.animations.length > 0 && (o = e.getAnimationRange(e.animations[0].name)), !o))
|
|
3851
3957
|
throw new Error("No animation range found in skeleton");
|
|
@@ -3853,280 +3959,280 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
3853
3959
|
var u = 0;
|
|
3854
3960
|
try {
|
|
3855
3961
|
for (var l_28 = __values(l), l_28_1 = l_28.next(); !l_28_1.done; l_28_1 = l_28.next()) {
|
|
3856
|
-
var
|
|
3857
|
-
|
|
3962
|
+
var e_178 = l_28_1.value;
|
|
3963
|
+
e_178.positionKeys.length > 0 && (u = Math.max(u, e_178.positionKeys.length)), e_178.rotationKeys.length > 0 && (u = Math.max(u, e_178.rotationKeys.length));
|
|
3858
3964
|
}
|
|
3859
3965
|
}
|
|
3860
|
-
catch (
|
|
3966
|
+
catch (e_177_1) { e_177 = { error: e_177_1 }; }
|
|
3861
3967
|
finally {
|
|
3862
3968
|
try {
|
|
3863
3969
|
if (l_28_1 && !l_28_1.done && (_b = l_28.return)) _b.call(l_28);
|
|
3864
3970
|
}
|
|
3865
|
-
finally { if (
|
|
3971
|
+
finally { if (e_177) throw e_177.error; }
|
|
3866
3972
|
}
|
|
3867
3973
|
0 === u && (u = Math.floor((o.to - o.from) / a) + 1);
|
|
3868
3974
|
var c = "";
|
|
3869
3975
|
return c += "HIERARCHY\n", c += this._ExportHierarchy(l, 0), c += "MOTION\n", c += "Frames: ".concat(u, "\n"), c += "Frame Time: ".concat(a.toFixed(6), "\n"), c += this._ExportMotionData(l, u, 0, i), c;
|
|
3870
3976
|
};
|
|
3871
|
-
|
|
3872
|
-
var
|
|
3977
|
+
Sn._BuildBoneHierarchy = function (e, t) {
|
|
3978
|
+
var e_179, _a, e_180, _b, e_181, _c, _g, _h;
|
|
3873
3979
|
var n = new Map, s = [];
|
|
3874
3980
|
try {
|
|
3875
3981
|
for (var _j = __values(e.bones), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
3876
|
-
var
|
|
3877
|
-
var
|
|
3878
|
-
n.set(
|
|
3982
|
+
var t_82 = _k.value;
|
|
3983
|
+
var e_182 = { bone: t_82, children: [], hasPositionChannels: !1, hasRotationChannels: !1, positionKeys: [], rotationKeys: [] };
|
|
3984
|
+
n.set(t_82, e_182);
|
|
3879
3985
|
}
|
|
3880
3986
|
}
|
|
3881
|
-
catch (
|
|
3987
|
+
catch (e_179_1) { e_179 = { error: e_179_1 }; }
|
|
3882
3988
|
finally {
|
|
3883
3989
|
try {
|
|
3884
3990
|
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
3885
3991
|
}
|
|
3886
|
-
finally { if (
|
|
3992
|
+
finally { if (e_179) throw e_179.error; }
|
|
3887
3993
|
}
|
|
3888
3994
|
try {
|
|
3889
3995
|
for (var _l = __values(e.bones), _p = _l.next(); !_p.done; _p = _l.next()) {
|
|
3890
3996
|
var r_51 = _p.value;
|
|
3891
|
-
var
|
|
3997
|
+
var e_183 = n.get(r_51);
|
|
3892
3998
|
if (r_51.animations.length > 0)
|
|
3893
3999
|
try {
|
|
3894
|
-
for (var _q = (
|
|
3895
|
-
var
|
|
3896
|
-
t.includes(
|
|
4000
|
+
for (var _q = (e_181 = void 0, __values(r_51.animations)), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
4001
|
+
var n_72 = _r.value;
|
|
4002
|
+
t.includes(n_72.name) && ("position" === n_72.targetProperty ? (e_183.hasPositionChannels = !0, (_g = e_183.positionKeys).push.apply(_g, __spreadArray([], __read(n_72.getKeys()), false))) : "rotationQuaternion" === n_72.targetProperty && (e_183.hasRotationChannels = !0, (_h = e_183.rotationKeys).push.apply(_h, __spreadArray([], __read(n_72.getKeys()), false))));
|
|
3897
4003
|
}
|
|
3898
4004
|
}
|
|
3899
|
-
catch (
|
|
4005
|
+
catch (e_181_1) { e_181 = { error: e_181_1 }; }
|
|
3900
4006
|
finally {
|
|
3901
4007
|
try {
|
|
3902
4008
|
if (_r && !_r.done && (_c = _q.return)) _c.call(_q);
|
|
3903
4009
|
}
|
|
3904
|
-
finally { if (
|
|
4010
|
+
finally { if (e_181) throw e_181.error; }
|
|
3905
4011
|
}
|
|
3906
4012
|
if (r_51.getParent()) {
|
|
3907
|
-
var
|
|
3908
|
-
|
|
4013
|
+
var t_83 = n.get(r_51.getParent());
|
|
4014
|
+
t_83 && t_83.children.push(e_183);
|
|
3909
4015
|
}
|
|
3910
4016
|
else
|
|
3911
|
-
s.push(
|
|
4017
|
+
s.push(e_183);
|
|
3912
4018
|
}
|
|
3913
4019
|
}
|
|
3914
|
-
catch (
|
|
4020
|
+
catch (e_180_1) { e_180 = { error: e_180_1 }; }
|
|
3915
4021
|
finally {
|
|
3916
4022
|
try {
|
|
3917
4023
|
if (_p && !_p.done && (_b = _l.return)) _b.call(_l);
|
|
3918
4024
|
}
|
|
3919
|
-
finally { if (
|
|
4025
|
+
finally { if (e_180) throw e_180.error; }
|
|
3920
4026
|
}
|
|
3921
4027
|
return s;
|
|
3922
4028
|
};
|
|
3923
|
-
|
|
3924
|
-
var
|
|
4029
|
+
Sn._ExportHierarchy = function (e, t) {
|
|
4030
|
+
var e_184, _a;
|
|
3925
4031
|
var n = "";
|
|
3926
4032
|
var s = " ".repeat(t);
|
|
3927
4033
|
try {
|
|
3928
|
-
for (var
|
|
3929
|
-
var r_52 =
|
|
3930
|
-
var
|
|
4034
|
+
for (var e_185 = __values(e), e_185_1 = e_185.next(); !e_185_1.done; e_185_1 = e_185.next()) {
|
|
4035
|
+
var r_52 = e_185_1.value;
|
|
4036
|
+
var e_186 = r_52.bone;
|
|
3931
4037
|
if (this._IsEndSite(r_52)) {
|
|
3932
4038
|
n += "".concat(s, "End Site\n"), n += "".concat(s, "{\n");
|
|
3933
|
-
var
|
|
3934
|
-
n += "".concat(s, " OFFSET ").concat(
|
|
4039
|
+
var t_84 = this._GetBoneOffset(e_186);
|
|
4040
|
+
n += "".concat(s, " OFFSET ").concat(t_84.x.toFixed(6), " ").concat(t_84.y.toFixed(6), " ").concat(t_84.z.toFixed(6), "\n"), n += "".concat(s, "}\n");
|
|
3935
4041
|
}
|
|
3936
4042
|
else {
|
|
3937
|
-
n += "".concat(0 === t ? "ROOT" : "".concat(s, "JOINT"), " ").concat(
|
|
3938
|
-
var i_41 = this._GetBoneOffset(
|
|
4043
|
+
n += "".concat(0 === t ? "ROOT" : "".concat(s, "JOINT"), " ").concat(e_186.name, "\n"), n += "".concat(s, "{\n");
|
|
4044
|
+
var i_41 = this._GetBoneOffset(e_186);
|
|
3939
4045
|
n += "".concat(s, " OFFSET ").concat(i_41.x.toFixed(6), " ").concat(i_41.y.toFixed(6), " ").concat(i_41.z.toFixed(6), "\n");
|
|
3940
|
-
var
|
|
3941
|
-
r_52.hasPositionChannels &&
|
|
4046
|
+
var o_41 = [];
|
|
4047
|
+
r_52.hasPositionChannels && o_41.push("Xposition", "Yposition", "Zposition"), r_52.hasRotationChannels && o_41.push("Zrotation", "Xrotation", "Yrotation"), o_41.length > 0 && (n += "".concat(s, " CHANNELS ").concat(o_41.length, " ").concat(o_41.join(" "), "\n")), r_52.children.length > 0 && (n += this._ExportHierarchy(r_52.children, t + 1)), n += "".concat(s, "}\n");
|
|
3942
4048
|
}
|
|
3943
4049
|
}
|
|
3944
4050
|
}
|
|
3945
|
-
catch (
|
|
4051
|
+
catch (e_184_1) { e_184 = { error: e_184_1 }; }
|
|
3946
4052
|
finally {
|
|
3947
4053
|
try {
|
|
3948
|
-
if (
|
|
4054
|
+
if (e_185_1 && !e_185_1.done && (_a = e_185.return)) _a.call(e_185);
|
|
3949
4055
|
}
|
|
3950
|
-
finally { if (
|
|
4056
|
+
finally { if (e_184) throw e_184.error; }
|
|
3951
4057
|
}
|
|
3952
4058
|
return n;
|
|
3953
4059
|
};
|
|
3954
|
-
|
|
3955
|
-
|
|
4060
|
+
Sn._IsEndSite = function (e) { return 0 === e.children.length; };
|
|
4061
|
+
Sn._GetBoneOffset = function (e) { try {
|
|
3956
4062
|
return e.getParent() ? e.getLocalMatrix().getTranslation() : e.getRestMatrix().getTranslation();
|
|
3957
4063
|
}
|
|
3958
4064
|
catch (e) {
|
|
3959
4065
|
return t.Vector3.Zero();
|
|
3960
4066
|
} };
|
|
3961
|
-
|
|
3962
|
-
var
|
|
3963
|
-
this._CollectFrameValues(e, i_42 + n,
|
|
4067
|
+
Sn._ExportMotionData = function (e, t, n, s) { var r = ""; for (var i_42 = 0; i_42 < t; i_42++) {
|
|
4068
|
+
var t_85 = [];
|
|
4069
|
+
this._CollectFrameValues(e, i_42 + n, t_85, s), r += t_85.map(function (e) { return e.toFixed(6); }).join(" ") + "\n";
|
|
3964
4070
|
} return r; };
|
|
3965
|
-
|
|
3966
|
-
var
|
|
4071
|
+
Sn._CollectFrameValues = function (e, t, n, s) {
|
|
4072
|
+
var e_187, _a;
|
|
3967
4073
|
try {
|
|
3968
|
-
for (var
|
|
3969
|
-
var r_53 =
|
|
4074
|
+
for (var e_188 = __values(e), e_188_1 = e_188.next(); !e_188_1.done; e_188_1 = e_188.next()) {
|
|
4075
|
+
var r_53 = e_188_1.value;
|
|
3970
4076
|
if (!this._IsEndSite(r_53)) {
|
|
3971
4077
|
if (r_53.hasPositionChannels) {
|
|
3972
|
-
var
|
|
3973
|
-
n.push(
|
|
4078
|
+
var e_189 = this._GetPositionAtFrameIndex(r_53.positionKeys, t);
|
|
4079
|
+
n.push(e_189.x, e_189.y, e_189.z);
|
|
3974
4080
|
}
|
|
3975
4081
|
if (r_53.hasRotationChannels) {
|
|
3976
|
-
var
|
|
4082
|
+
var e_190 = this._GetRotationAtFrameIndex(r_53.rotationKeys, t), s_44 = this._QuaternionToEuler(e_190);
|
|
3977
4083
|
n.push(s_44.z, s_44.x, s_44.y);
|
|
3978
4084
|
}
|
|
3979
4085
|
r_53.children.length > 0 && this._CollectFrameValues(r_53.children, t, n, s);
|
|
3980
4086
|
}
|
|
3981
4087
|
}
|
|
3982
4088
|
}
|
|
3983
|
-
catch (
|
|
4089
|
+
catch (e_187_1) { e_187 = { error: e_187_1 }; }
|
|
3984
4090
|
finally {
|
|
3985
4091
|
try {
|
|
3986
|
-
if (
|
|
4092
|
+
if (e_188_1 && !e_188_1.done && (_a = e_188.return)) _a.call(e_188);
|
|
3987
4093
|
}
|
|
3988
|
-
finally { if (
|
|
4094
|
+
finally { if (e_187) throw e_187.error; }
|
|
3989
4095
|
}
|
|
3990
4096
|
};
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
return
|
|
4097
|
+
Sn._GetPositionAtFrameIndex = function (e, n) { return 0 === e.length ? t.Vector3.Zero() : e[Math.max(0, Math.min(n, e.length - 1))].value.clone(); };
|
|
4098
|
+
Sn._GetRotationAtFrameIndex = function (e, n) { return 0 === e.length ? t.Quaternion.Identity() : e[Math.max(0, Math.min(n, e.length - 1))].value.clone(); };
|
|
4099
|
+
Sn._QuaternionToEuler = function (e) { var n = new t.Matrix; e.toRotationMatrix(n); var s = n.m; var r, i, o; var a = Math.sqrt(s[0] * s[0] + s[1] * s[1]); return a > t.Epsilon ? (r = Math.atan2(s[6], s[10]), i = Math.atan2(-s[2], a), o = Math.atan2(s[1], s[0])) : (r = Math.atan2(-s[9], s[5]), i = Math.atan2(-s[2], a), o = 0), new t.Vector3(t.Tools.ToDegrees(r), t.Tools.ToDegrees(i), t.Tools.ToDegrees(o)); };
|
|
4100
|
+
return Sn;
|
|
3995
4101
|
}());
|
|
3996
|
-
var
|
|
3997
|
-
function
|
|
3998
|
-
var
|
|
3999
|
-
function
|
|
4000
|
-
function
|
|
4001
|
-
function
|
|
4002
|
-
function
|
|
4003
|
-
function
|
|
4004
|
-
function
|
|
4102
|
+
var Fn = { __proto__: null, BVHExporter: Sn };
|
|
4103
|
+
function Vn(e) { return "string" == typeof (null == e ? void 0 : e.name); }
|
|
4104
|
+
var On = Symbol("__xml:meta$__"), Bn = Symbol("__xml:name$__");
|
|
4105
|
+
function Nn(e, t) { Object.prototype.hasOwnProperty.call(e.metadata, On) || (e.metadata[On] = []), e.metadata[On].push(t); }
|
|
4106
|
+
function Pn(e) { return function (t, n) { t[Bn] = e; }; }
|
|
4107
|
+
function Un() { return function (e, t) { return Nn(t, { kind: "none", prop: String(t.name), ignore: !0 }); }; }
|
|
4108
|
+
function kn(e) { return function (t, n) { return Nn(n, Object.assign({ kind: "attr", prop: String(n.name) }, e)); }; }
|
|
4109
|
+
function Kn(e) { return function (t, n) { return Nn(n, Object.assign({ kind: "elem", prop: String(n.name) }, e)); }; }
|
|
4110
|
+
function $n(e) { var t = "function" == typeof e ? e : null == e ? void 0 : e.constructor, n = null == t ? void 0 : t[Symbol.metadata]; if (!n)
|
|
4005
4111
|
return []; var s = []; var r = n; for (; r;)
|
|
4006
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
4007
|
-
function
|
|
4008
|
-
function
|
|
4009
|
-
function
|
|
4112
|
+
Object.prototype.hasOwnProperty.call(r, On) && s.push.apply(s, __spreadArray([], __read(r[On]), false)), r = Object.getPrototypeOf(r); return s; }
|
|
4113
|
+
function zn(e) { var t; return (null === (t = null == e ? void 0 : e.constructor) || void 0 === t ? void 0 : t[Bn]) || void 0; }
|
|
4114
|
+
function Wn(e) { return /^[A-Za-z_][A-Za-z0-9._-]*$/.test(e); }
|
|
4115
|
+
function Dn(e) { if (Vn(e))
|
|
4010
4116
|
return e; var t = (null != e ? e : "").trim(); if (!t)
|
|
4011
4117
|
return { name: "" }; var n = t.indexOf(":"); if (-1 === n)
|
|
4012
4118
|
return { name: t }; if (-1 !== t.indexOf(":", n + 1))
|
|
4013
|
-
return { name: t }; var s = t.slice(0, n), r = t.slice(n + 1); return
|
|
4014
|
-
function
|
|
4015
|
-
var
|
|
4016
|
-
function
|
|
4017
|
-
function
|
|
4018
|
-
var
|
|
4019
|
-
function
|
|
4119
|
+
return { name: t }; var s = t.slice(0, n), r = t.slice(n + 1); return Wn(s) && Wn(r) ? { ns: s, name: r } : { name: t }; }
|
|
4120
|
+
function Ln(e, t) { return t ? "".concat(t, ":").concat(e) : e; }
|
|
4121
|
+
var Hn = Object.freeze({ eps: 1e-6, maxDecimalsCap: 15, trimTrailingZeros: !0, allowScientific: !1, snapNearZero: !0 }), jn = Object.freeze({ number: Hn });
|
|
4122
|
+
function qn(e) { var t, n, s, r, i, o; var a = null !== (t = null == e ? void 0 : e.eps) && void 0 !== t ? t : Hn.eps; return { eps: a, maxDecimalsCap: null !== (n = null == e ? void 0 : e.maxDecimalsCap) && void 0 !== n ? n : Hn.maxDecimalsCap, trimTrailingZeros: null !== (s = null == e ? void 0 : e.trimTrailingZeros) && void 0 !== s ? s : Hn.trimTrailingZeros, fixedDecimals: null == e ? void 0 : e.fixedDecimals, allowScientific: null !== (r = null == e ? void 0 : e.allowScientific) && void 0 !== r ? r : Hn.allowScientific, snapNearZero: null !== (i = null == e ? void 0 : e.snapNearZero) && void 0 !== i ? i : Hn.snapNearZero, zeroThreshold: null !== (o = null == e ? void 0 : e.zeroThreshold) && void 0 !== o ? o : a, perAttributeEps: null == e ? void 0 : e.perAttributeEps }; }
|
|
4123
|
+
function Gn(e) { return { number: qn(null == e ? void 0 : e.number) }; }
|
|
4124
|
+
var Xn = /** @class */ (function () {
|
|
4125
|
+
function Xn(e) {
|
|
4020
4126
|
if (this.o = e, this._o = e.number, !Number.isFinite(this._o.eps) || this._o.eps <= 0)
|
|
4021
4127
|
throw new Error("opts.eps must be a finite, positive number");
|
|
4022
4128
|
}
|
|
4023
|
-
|
|
4129
|
+
Xn.prototype.toString = function (e) { var t, n, s, r; if (!Number.isFinite(e))
|
|
4024
4130
|
throw new Error("Cannot format non-finite number: ".concat(e)); var i = this._o, o = this._clampInt(null !== (t = i.maxDecimalsCap) && void 0 !== t ? t : 15, 0, 20), a = null === (n = i.trimTrailingZeros) || void 0 === n || n, l = null === (s = i.snapNearZero) || void 0 === s || s, u = null !== (r = i.zeroThreshold) && void 0 !== r ? r : i.eps, c = 1 / i.eps; var h, d = Math.round(e * c) / c; if (Object.is(d, -0) && (d = 0), l && Math.abs(d) <= u && (d = 0), h = void 0 !== i.fixedDecimals ? this._clampInt(i.fixedDecimals, 0, o) : this._clampInt(Math.ceil(-Math.log10(i.eps)), 0, o), i.allowScientific, 0 === h)
|
|
4025
4131
|
return String(Math.trunc(d)); var f = d.toFixed(h); if (a && void 0 === i.fixedDecimals && (f = f.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, "").replace(/\.$/, "")), /[eE]/.test(f))
|
|
4026
4132
|
throw new Error("Scientific notation not allowed in XML output: ".concat(f)); return f; };
|
|
4027
|
-
|
|
4028
|
-
return
|
|
4133
|
+
Xn.prototype._clampInt = function (e, t, n) { return Number.isFinite(e) ? (e = Math.trunc(e), Math.max(t, Math.min(n, e))) : t; };
|
|
4134
|
+
return Xn;
|
|
4029
4135
|
}());
|
|
4030
|
-
function
|
|
4031
|
-
function
|
|
4032
|
-
function
|
|
4033
|
-
function
|
|
4034
|
-
function
|
|
4035
|
-
var
|
|
4036
|
-
function
|
|
4037
|
-
this._ns = new Map, this._prefixCount = 0, this._builder = e, this._format =
|
|
4136
|
+
function Qn(e) { return e instanceof Date; }
|
|
4137
|
+
function Zn(e) { return "string" == typeof e; }
|
|
4138
|
+
function Yn(e) { return "number" == typeof e; }
|
|
4139
|
+
function Jn(e) { return "string" == typeof e || "number" == typeof e || "boolean" == typeof e || "bigint" == typeof e || Qn(e); }
|
|
4140
|
+
function es(e) { return "number" == typeof e || "boolean" == typeof e || "bigint" == typeof e || Qn(e); }
|
|
4141
|
+
var ts = /** @class */ (function () {
|
|
4142
|
+
function ts(e, t) {
|
|
4143
|
+
this._ns = new Map, this._prefixCount = 0, this._builder = e, this._format = Gn(t), this._nFmt = new Xn(this._format);
|
|
4038
4144
|
}
|
|
4039
|
-
|
|
4040
|
-
var
|
|
4145
|
+
ts.prototype.withNamespace = function () {
|
|
4146
|
+
var e_191, _a;
|
|
4041
4147
|
var e = [];
|
|
4042
4148
|
for (var _b = 0; _b < arguments.length; _b++) {
|
|
4043
4149
|
e[_b] = arguments[_b];
|
|
4044
4150
|
}
|
|
4045
4151
|
try {
|
|
4046
|
-
for (var
|
|
4047
|
-
var
|
|
4048
|
-
this._assignNamespace(
|
|
4152
|
+
for (var e_192 = __values(e), e_192_1 = e_192.next(); !e_192_1.done; e_192_1 = e_192.next()) {
|
|
4153
|
+
var t_86 = e_192_1.value;
|
|
4154
|
+
this._assignNamespace(t_86);
|
|
4049
4155
|
}
|
|
4050
4156
|
}
|
|
4051
|
-
catch (
|
|
4157
|
+
catch (e_191_1) { e_191 = { error: e_191_1 }; }
|
|
4052
4158
|
finally {
|
|
4053
4159
|
try {
|
|
4054
|
-
if (
|
|
4160
|
+
if (e_192_1 && !e_192_1.done && (_a = e_192.return)) _a.call(e_192);
|
|
4055
4161
|
}
|
|
4056
|
-
finally { if (
|
|
4162
|
+
finally { if (e_191) throw e_191.error; }
|
|
4057
4163
|
}
|
|
4058
4164
|
return this;
|
|
4059
4165
|
};
|
|
4060
|
-
|
|
4061
|
-
var
|
|
4062
|
-
if (!(t = null != t ? t :
|
|
4166
|
+
ts.prototype.serialize = function (e, t) {
|
|
4167
|
+
var e_193, _a;
|
|
4168
|
+
if (!(t = null != t ? t : zn(e)))
|
|
4063
4169
|
throw new Error("can not find name for given object");
|
|
4064
|
-
var n =
|
|
4170
|
+
var n = Dn(t);
|
|
4065
4171
|
n.ns && this._assignNamespace(n.ns, "xmlns"), this._gatherNamespaces(e, new WeakSet);
|
|
4066
4172
|
var s = this._builder.ele(null, n.name);
|
|
4067
4173
|
try {
|
|
4068
4174
|
for (var _b = __values(Array.from(this._ns.entries())), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4069
|
-
var _g = __read(_c.value, 2),
|
|
4070
|
-
s.att("xmlns",
|
|
4175
|
+
var _g = __read(_c.value, 2), e_194 = _g[0], t_87 = _g[1];
|
|
4176
|
+
s.att("xmlns", t_87, e_194);
|
|
4071
4177
|
}
|
|
4072
4178
|
}
|
|
4073
|
-
catch (
|
|
4179
|
+
catch (e_193_1) { e_193 = { error: e_193_1 }; }
|
|
4074
4180
|
finally {
|
|
4075
4181
|
try {
|
|
4076
4182
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4077
4183
|
}
|
|
4078
|
-
finally { if (
|
|
4184
|
+
finally { if (e_193) throw e_193.error; }
|
|
4079
4185
|
}
|
|
4080
4186
|
this._writeObjectContent(s, e, (new WeakSet).add(e)), this._builder.end();
|
|
4081
4187
|
};
|
|
4082
|
-
|
|
4083
|
-
var
|
|
4188
|
+
ts.prototype._writeObject = function (e, t, n) {
|
|
4189
|
+
var e_195, _a;
|
|
4084
4190
|
if (n.has(t))
|
|
4085
4191
|
return;
|
|
4086
4192
|
if (n.add(t), Array.isArray(t)) {
|
|
4087
4193
|
try {
|
|
4088
|
-
for (var
|
|
4089
|
-
var s_45 =
|
|
4090
|
-
|
|
4194
|
+
for (var t_88 = __values(t), t_88_1 = t_88.next(); !t_88_1.done; t_88_1 = t_88.next()) {
|
|
4195
|
+
var s_45 = t_88_1.value;
|
|
4196
|
+
es(s_45) || (Zn(s_45) ? this._builder.text(s_45) : this._writeObject(e, s_45, n));
|
|
4091
4197
|
}
|
|
4092
4198
|
}
|
|
4093
|
-
catch (
|
|
4199
|
+
catch (e_195_1) { e_195 = { error: e_195_1 }; }
|
|
4094
4200
|
finally {
|
|
4095
4201
|
try {
|
|
4096
|
-
if (
|
|
4202
|
+
if (t_88_1 && !t_88_1.done && (_a = t_88.return)) _a.call(t_88);
|
|
4097
4203
|
}
|
|
4098
|
-
finally { if (
|
|
4204
|
+
finally { if (e_195) throw e_195.error; }
|
|
4099
4205
|
}
|
|
4100
4206
|
return;
|
|
4101
4207
|
}
|
|
4102
|
-
var s =
|
|
4208
|
+
var s = zn(t);
|
|
4103
4209
|
if (!s)
|
|
4104
4210
|
return;
|
|
4105
|
-
var r =
|
|
4211
|
+
var r = Dn(s), i = this._getPrefix(r), o = Ln(r.name, i);
|
|
4106
4212
|
e.ele(null, o), this._writeObjectContent(e, t, n), this._builder.end();
|
|
4107
4213
|
};
|
|
4108
|
-
|
|
4109
|
-
var
|
|
4110
|
-
if ("xmlns" !==
|
|
4111
|
-
return
|
|
4214
|
+
ts.prototype._getPrefix = function (e) { if (e.ns) {
|
|
4215
|
+
var t_89 = this._ns.get(e.ns.toLowerCase());
|
|
4216
|
+
if ("xmlns" !== t_89)
|
|
4217
|
+
return t_89;
|
|
4112
4218
|
} };
|
|
4113
|
-
|
|
4114
|
-
var
|
|
4219
|
+
ts.prototype._writeObjectContent = function (e, t, n) {
|
|
4220
|
+
var e_196, _a, e_197, _b, e_198, _c;
|
|
4115
4221
|
var s, r, i;
|
|
4116
|
-
var o = null !== (s =
|
|
4222
|
+
var o = null !== (s = $n(t)) && void 0 !== s ? s : [], a = new Map;
|
|
4117
4223
|
try {
|
|
4118
|
-
for (var
|
|
4119
|
-
var
|
|
4120
|
-
var
|
|
4121
|
-
|
|
4224
|
+
for (var o_42 = __values(o), o_42_1 = o_42.next(); !o_42_1.done; o_42_1 = o_42.next()) {
|
|
4225
|
+
var e_199 = o_42_1.value;
|
|
4226
|
+
var t_90 = null !== (r = a.get(e_199.prop)) && void 0 !== r ? r : [];
|
|
4227
|
+
t_90.push(e_199), a.set(e_199.prop, t_90);
|
|
4122
4228
|
}
|
|
4123
4229
|
}
|
|
4124
|
-
catch (
|
|
4230
|
+
catch (e_196_1) { e_196 = { error: e_196_1 }; }
|
|
4125
4231
|
finally {
|
|
4126
4232
|
try {
|
|
4127
|
-
if (
|
|
4233
|
+
if (o_42_1 && !o_42_1.done && (_a = o_42.return)) _a.call(o_42);
|
|
4128
4234
|
}
|
|
4129
|
-
finally { if (
|
|
4235
|
+
finally { if (e_196) throw e_196.error; }
|
|
4130
4236
|
}
|
|
4131
4237
|
var l = Object.keys(t).sort(function (e, t) { var n, s; var r = (null !== (n = a.get(e)) && void 0 !== n ? n : []).some(function (e) { return "attr" === e.kind; }); return r === (null !== (s = a.get(t)) && void 0 !== s ? s : []).some(function (e) { return "attr" === e.kind; }) ? 0 : r ? -1 : 1; });
|
|
4132
4238
|
try {
|
|
@@ -4135,20 +4241,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4135
4241
|
var r_54 = t[s_46];
|
|
4136
4242
|
if (null == r_54)
|
|
4137
4243
|
continue;
|
|
4138
|
-
var
|
|
4139
|
-
if (
|
|
4140
|
-
if (
|
|
4244
|
+
var o_44 = a.get(s_46);
|
|
4245
|
+
if (o_44) {
|
|
4246
|
+
if (o_44.some(function (e) { return !0 === e.ignore || "none" === e.kind; }))
|
|
4141
4247
|
continue;
|
|
4142
4248
|
try {
|
|
4143
|
-
for (var
|
|
4144
|
-
var
|
|
4145
|
-
var
|
|
4146
|
-
if (
|
|
4147
|
-
switch (
|
|
4249
|
+
for (var o_43 = (e_198 = void 0, __values(o_44)), o_43_1 = o_43.next(); !o_43_1.done; o_43_1 = o_43.next()) {
|
|
4250
|
+
var t_91 = o_43_1.value;
|
|
4251
|
+
var n_73 = null !== (i = t_91.name) && void 0 !== i ? i : t_91.prop.toLowerCase();
|
|
4252
|
+
if (n_73)
|
|
4253
|
+
switch (t_91.kind) {
|
|
4148
4254
|
case "attr": {
|
|
4149
4255
|
var s_47 = null;
|
|
4150
|
-
if (
|
|
4151
|
-
var
|
|
4256
|
+
if (Yn(r_54) && this._nFmt && (s_47 = this._nFmt.toString(r_54)), t_91.formatter && (s_47 = new t_91.formatter(this._format).toString(r_54)), s_47 = null != s_47 ? s_47 : r_54.toString(), s_47) {
|
|
4257
|
+
var t_92 = Dn(n_73), r_55 = this._getPrefix(t_92), i_43 = Ln(t_92.name, r_55);
|
|
4152
4258
|
e.att(null, i_43, s_47);
|
|
4153
4259
|
}
|
|
4154
4260
|
break;
|
|
@@ -4156,219 +4262,219 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4156
4262
|
}
|
|
4157
4263
|
}
|
|
4158
4264
|
}
|
|
4159
|
-
catch (
|
|
4265
|
+
catch (e_198_1) { e_198 = { error: e_198_1 }; }
|
|
4160
4266
|
finally {
|
|
4161
4267
|
try {
|
|
4162
|
-
if (
|
|
4268
|
+
if (o_43_1 && !o_43_1.done && (_c = o_43.return)) _c.call(o_43);
|
|
4163
4269
|
}
|
|
4164
|
-
finally { if (
|
|
4270
|
+
finally { if (e_198) throw e_198.error; }
|
|
4165
4271
|
}
|
|
4166
4272
|
}
|
|
4167
4273
|
else
|
|
4168
|
-
|
|
4274
|
+
es(r_54) || (Zn(r_54) ? this._builder.text(r_54) : this._writeObject(e, r_54, n));
|
|
4169
4275
|
}
|
|
4170
4276
|
}
|
|
4171
|
-
catch (
|
|
4277
|
+
catch (e_197_1) { e_197 = { error: e_197_1 }; }
|
|
4172
4278
|
finally {
|
|
4173
4279
|
try {
|
|
4174
4280
|
if (l_29_1 && !l_29_1.done && (_b = l_29.return)) _b.call(l_29);
|
|
4175
4281
|
}
|
|
4176
|
-
finally { if (
|
|
4282
|
+
finally { if (e_197) throw e_197.error; }
|
|
4177
4283
|
}
|
|
4178
4284
|
};
|
|
4179
|
-
|
|
4180
|
-
var
|
|
4285
|
+
ts.prototype._gatherNamespaces = function (e, t) {
|
|
4286
|
+
var e_200, _a, e_201, _b, e_202, _c, e_203, _g, e_204, _h;
|
|
4181
4287
|
var n, s;
|
|
4182
4288
|
if (t.has(e))
|
|
4183
4289
|
return;
|
|
4184
4290
|
if (t.add(e), Array.isArray(e)) {
|
|
4185
4291
|
try {
|
|
4186
|
-
for (var
|
|
4187
|
-
var
|
|
4188
|
-
|
|
4292
|
+
for (var e_205 = __values(e), e_205_1 = e_205.next(); !e_205_1.done; e_205_1 = e_205.next()) {
|
|
4293
|
+
var n_74 = e_205_1.value;
|
|
4294
|
+
Jn(n_74) || this._gatherNamespaces(n_74, t);
|
|
4189
4295
|
}
|
|
4190
4296
|
}
|
|
4191
|
-
catch (
|
|
4297
|
+
catch (e_200_1) { e_200 = { error: e_200_1 }; }
|
|
4192
4298
|
finally {
|
|
4193
4299
|
try {
|
|
4194
|
-
if (
|
|
4300
|
+
if (e_205_1 && !e_205_1.done && (_a = e_205.return)) _a.call(e_205);
|
|
4195
4301
|
}
|
|
4196
|
-
finally { if (
|
|
4302
|
+
finally { if (e_200) throw e_200.error; }
|
|
4197
4303
|
}
|
|
4198
4304
|
return;
|
|
4199
4305
|
}
|
|
4200
|
-
var r =
|
|
4306
|
+
var r = zn(e);
|
|
4201
4307
|
r && this._assignNamespace(r);
|
|
4202
|
-
var i = null !== (n =
|
|
4308
|
+
var i = null !== (n = $n(e)) && void 0 !== n ? n : [], o = new Map;
|
|
4203
4309
|
try {
|
|
4204
4310
|
for (var i_44 = __values(i), i_44_1 = i_44.next(); !i_44_1.done; i_44_1 = i_44.next()) {
|
|
4205
|
-
var
|
|
4206
|
-
var
|
|
4207
|
-
|
|
4311
|
+
var e_206 = i_44_1.value;
|
|
4312
|
+
var t_93 = null !== (s = o.get(e_206.prop)) && void 0 !== s ? s : [];
|
|
4313
|
+
t_93.push(e_206), o.set(e_206.prop, t_93);
|
|
4208
4314
|
}
|
|
4209
4315
|
}
|
|
4210
|
-
catch (
|
|
4316
|
+
catch (e_201_1) { e_201 = { error: e_201_1 }; }
|
|
4211
4317
|
finally {
|
|
4212
4318
|
try {
|
|
4213
4319
|
if (i_44_1 && !i_44_1.done && (_b = i_44.return)) _b.call(i_44);
|
|
4214
4320
|
}
|
|
4215
|
-
finally { if (
|
|
4321
|
+
finally { if (e_201) throw e_201.error; }
|
|
4216
4322
|
}
|
|
4217
4323
|
var a = [];
|
|
4218
4324
|
try {
|
|
4219
4325
|
for (var _j = __values(Object.keys(e)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
4220
|
-
var
|
|
4221
|
-
var
|
|
4222
|
-
if (null ==
|
|
4326
|
+
var t_94 = _k.value;
|
|
4327
|
+
var n_75 = e[t_94];
|
|
4328
|
+
if (null == n_75)
|
|
4223
4329
|
continue;
|
|
4224
|
-
var s_49 = o.get(
|
|
4330
|
+
var s_49 = o.get(t_94);
|
|
4225
4331
|
if (s_49) {
|
|
4226
4332
|
if (s_49.some(function (e) { return !0 === e.ignore || "none" === e.kind; }))
|
|
4227
4333
|
continue;
|
|
4228
4334
|
try {
|
|
4229
|
-
for (var s_48 = (
|
|
4230
|
-
var
|
|
4231
|
-
|
|
4335
|
+
for (var s_48 = (e_203 = void 0, __values(s_49)), s_48_1 = s_48.next(); !s_48_1.done; s_48_1 = s_48.next()) {
|
|
4336
|
+
var e_207 = s_48_1.value;
|
|
4337
|
+
e_207.name && this._assignNamespace(e_207.name);
|
|
4232
4338
|
}
|
|
4233
4339
|
}
|
|
4234
|
-
catch (
|
|
4340
|
+
catch (e_203_1) { e_203 = { error: e_203_1 }; }
|
|
4235
4341
|
finally {
|
|
4236
4342
|
try {
|
|
4237
4343
|
if (s_48_1 && !s_48_1.done && (_g = s_48.return)) _g.call(s_48);
|
|
4238
4344
|
}
|
|
4239
|
-
finally { if (
|
|
4345
|
+
finally { if (e_203) throw e_203.error; }
|
|
4240
4346
|
}
|
|
4241
4347
|
}
|
|
4242
|
-
a.push(
|
|
4348
|
+
a.push(n_75);
|
|
4243
4349
|
}
|
|
4244
4350
|
}
|
|
4245
|
-
catch (
|
|
4351
|
+
catch (e_202_1) { e_202 = { error: e_202_1 }; }
|
|
4246
4352
|
finally {
|
|
4247
4353
|
try {
|
|
4248
4354
|
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
4249
4355
|
}
|
|
4250
|
-
finally { if (
|
|
4356
|
+
finally { if (e_202) throw e_202.error; }
|
|
4251
4357
|
}
|
|
4252
4358
|
try {
|
|
4253
|
-
for (var
|
|
4254
|
-
var
|
|
4255
|
-
|
|
4359
|
+
for (var a_30 = __values(a), a_30_1 = a_30.next(); !a_30_1.done; a_30_1 = a_30.next()) {
|
|
4360
|
+
var e_208 = a_30_1.value;
|
|
4361
|
+
Jn(e_208) || this._gatherNamespaces(e_208, t);
|
|
4256
4362
|
}
|
|
4257
4363
|
}
|
|
4258
|
-
catch (
|
|
4364
|
+
catch (e_204_1) { e_204 = { error: e_204_1 }; }
|
|
4259
4365
|
finally {
|
|
4260
4366
|
try {
|
|
4261
|
-
if (
|
|
4367
|
+
if (a_30_1 && !a_30_1.done && (_h = a_30.return)) _h.call(a_30);
|
|
4262
4368
|
}
|
|
4263
|
-
finally { if (
|
|
4369
|
+
finally { if (e_204) throw e_204.error; }
|
|
4264
4370
|
}
|
|
4265
4371
|
};
|
|
4266
|
-
|
|
4267
|
-
var
|
|
4268
|
-
return void (this._ns.get(
|
|
4372
|
+
ts.prototype._assignNamespace = function (e, t) { var n = Dn(e); if (null == n ? void 0 : n.ns) {
|
|
4373
|
+
var e_209 = n.ns.toLowerCase();
|
|
4374
|
+
return void (this._ns.get(e_209) || this._ns.set(e_209, null != t ? t : this._buildNsPrefix(e_209)));
|
|
4269
4375
|
} if ("xmlns" === t) {
|
|
4270
|
-
var
|
|
4271
|
-
this._ns.get(
|
|
4376
|
+
var e_210 = n.name.toLowerCase();
|
|
4377
|
+
this._ns.get(e_210) || this._ns.set(e_210, null != t ? t : this._buildNsPrefix(e_210));
|
|
4272
4378
|
} };
|
|
4273
|
-
|
|
4274
|
-
var
|
|
4379
|
+
ts.prototype._buildNsPrefix = function (e) {
|
|
4380
|
+
var e_211, _a;
|
|
4275
4381
|
var t, n = !1;
|
|
4276
4382
|
do {
|
|
4277
4383
|
t = "ns" + this._prefixCount++;
|
|
4278
4384
|
try {
|
|
4279
|
-
for (var _b = (
|
|
4280
|
-
var
|
|
4281
|
-
if (
|
|
4385
|
+
for (var _b = (e_211 = void 0, __values(Array.from(this._ns.values()))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4386
|
+
var e_212 = _c.value;
|
|
4387
|
+
if (e_212 === t) {
|
|
4282
4388
|
n = !0;
|
|
4283
4389
|
break;
|
|
4284
4390
|
}
|
|
4285
4391
|
}
|
|
4286
4392
|
}
|
|
4287
|
-
catch (
|
|
4393
|
+
catch (e_211_1) { e_211 = { error: e_211_1 }; }
|
|
4288
4394
|
finally {
|
|
4289
4395
|
try {
|
|
4290
4396
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4291
4397
|
}
|
|
4292
|
-
finally { if (
|
|
4398
|
+
finally { if (e_211) throw e_211.error; }
|
|
4293
4399
|
}
|
|
4294
4400
|
} while (n);
|
|
4295
4401
|
return t;
|
|
4296
4402
|
};
|
|
4297
|
-
return
|
|
4403
|
+
return ts;
|
|
4298
4404
|
}());
|
|
4299
|
-
var
|
|
4300
|
-
function
|
|
4405
|
+
var ns = /** @class */ (function () {
|
|
4406
|
+
function ns() {
|
|
4301
4407
|
}
|
|
4302
|
-
return
|
|
4408
|
+
return ns;
|
|
4303
4409
|
}());
|
|
4304
|
-
var
|
|
4305
|
-
|
|
4306
|
-
var
|
|
4307
|
-
function
|
|
4410
|
+
var ss;
|
|
4411
|
+
ns.OpenTag = "<", ns.CloseTag = ">", ns.Slash = "/", ns.Question = "?", ns.Quote = '"', ns.Equal = "=", ns.Space = " ", ns.Semicolon = ":", ns.Dec = "<?xml", ns.Xml = "xml", ns.Xmlns = "xmlns", ns.Xsi = "xsi", ns.VersionKeyword = "version", ns.EncodingKeyword = "encoding", ns.StandaloneKeyword = "standalone", e.TokenType = void 0, (ss = e.TokenType || (e.TokenType = {}))[ss.Declaration = 0] = "Declaration", ss[ss.Tag = 1] = "Tag", ss[ss.Attribute = 2] = "Attribute", ss[ss.Text = 3] = "Text";
|
|
4412
|
+
var rs = /** @class */ (function () {
|
|
4413
|
+
function rs(e) {
|
|
4308
4414
|
this._ctxStack = [], this._d = 0, this._w = e;
|
|
4309
4415
|
}
|
|
4310
|
-
|
|
4311
|
-
|
|
4416
|
+
rs.prototype.dec = function (e, t, n) { return this._w.write(ns.Dec), this._writeAttStr(ns.VersionKeyword, e), t && this._writeAttStr(ns.EncodingKeyword, t), void 0 !== n && this._writeAttStr(ns.StandaloneKeyword, n ? "yes" : "no"), this._w.write(ns.Question, ns.CloseTag), this; };
|
|
4417
|
+
rs.prototype.att = function (t, n, s) { var r = this._peekContext(); if (!r)
|
|
4312
4418
|
throw new Error("att() without open element"); if (r.closed)
|
|
4313
4419
|
throw new Error("att() after start tag closed for <".concat(r.name, ">")); if (this._isXmlnsDecl(t, n)) {
|
|
4314
|
-
if (n ===
|
|
4315
|
-
r.defaultNs = s, this._registerNamespace(r, "", s), this._writeAttStr(
|
|
4420
|
+
if (n === ns.Xmlns)
|
|
4421
|
+
r.defaultNs = s, this._registerNamespace(r, "", s), this._writeAttStr(ns.Xmlns, s);
|
|
4316
4422
|
else if (t)
|
|
4317
4423
|
this._registerNamespace(r, n, s), this._writeAttStr("".concat(t, ":").concat(n), s);
|
|
4318
4424
|
else {
|
|
4319
|
-
var
|
|
4320
|
-
this._registerNamespace(r,
|
|
4425
|
+
var e_213 = n.slice(6);
|
|
4426
|
+
this._registerNamespace(r, e_213, s), this._writeAttStr(n, s);
|
|
4321
4427
|
}
|
|
4322
4428
|
return r.lastToken = e.TokenType.Attribute, this;
|
|
4323
4429
|
} var i = n; return t && (i = "".concat(this._ensurePrefixDeclared(r, t), ":").concat(n)), r.lastToken = e.TokenType.Attribute, this._writeAttStr(i, s), this; };
|
|
4324
|
-
|
|
4325
|
-
|
|
4430
|
+
rs.prototype.ele = function (e, t) { var n; var s = this._peekContext(); s && this._closeOpenTagIfNeeded(s); var r = t; return e && (r = "".concat(null !== (n = this._lookupPrefix(e)) && void 0 !== n ? n : e, ":").concat(t)), this._pushContext(r, ++this._d), this._w.write(ns.OpenTag, r), this; };
|
|
4431
|
+
rs.prototype.text = function (t) { var n = this._peekContext(); if (!n)
|
|
4326
4432
|
throw new Error("text() without open element"); return this._closeOpenTagIfNeeded(n), n.lastToken = e.TokenType.Text, this._w.write(this._escText(t)), this; };
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
Object.defineProperty(
|
|
4433
|
+
rs.prototype.end = function () { var e = this._popContext(); return e && (this._d--, e.closed ? this._w.write(ns.OpenTag, ns.Slash, e.name, ns.CloseTag) : this._w.write(ns.Slash, ns.CloseTag)), this; };
|
|
4434
|
+
rs.prototype._pushContext = function (e, t) { var n = new rs.Context(e, t); return this._ctxStack.push(n), n; };
|
|
4435
|
+
rs.prototype._popContext = function () { return this._ctxStack.pop(); };
|
|
4436
|
+
rs.prototype._peekContext = function () { return this._ctxStack[this._ctxStack.length - 1]; };
|
|
4437
|
+
Object.defineProperty(rs.prototype, "_contextDepth", {
|
|
4332
4438
|
get: function () { return this._ctxStack.length; },
|
|
4333
4439
|
enumerable: false,
|
|
4334
4440
|
configurable: true
|
|
4335
4441
|
});
|
|
4336
|
-
|
|
4337
|
-
|
|
4442
|
+
rs.prototype._writeAttStr = function (e, t) { this._w.write(ns.Space, e, ns.Equal, ns.Quote, this._escAttr(t), ns.Quote); };
|
|
4443
|
+
rs.prototype._lookupPrefix = function (e) { var t; var n = this._ctxStack.length - 1; if (n >= 0)
|
|
4338
4444
|
do {
|
|
4339
4445
|
var s_50 = null === (t = this._ctxStack[n--].ns2prefix) || void 0 === t ? void 0 : t.get(e);
|
|
4340
4446
|
if (s_50)
|
|
4341
4447
|
return s_50;
|
|
4342
4448
|
} while (n >= 0); };
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
return e ===
|
|
4347
|
-
|
|
4449
|
+
rs.prototype._escText = function (e) { return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); };
|
|
4450
|
+
rs.prototype._escAttr = function (e) { return this._escText(e).replace(/"/g, """).replace(/'/g, "'"); };
|
|
4451
|
+
rs.prototype._isXmlnsDecl = function (e, t) { if (e)
|
|
4452
|
+
return e === ns.Xmlns; var n = t.length, s = ns.Xmlns.length; return n >= s && t.startsWith(ns.Xmlns) && (t.length == s || t[s] == ns.Semicolon); };
|
|
4453
|
+
rs.prototype._registerNamespace = function (e, t, n) { if (t === ns.Xml || t === ns.Xmlns)
|
|
4348
4454
|
throw new Error("reserved prefix '".concat(t, "'")); var s = e.prefix2ns.get(t); if (s && s !== n)
|
|
4349
4455
|
throw new Error("prefix '".concat(t, "' already bound to a different namespace")); e.ns2prefix.get(n) || e.ns2prefix.set(n, t), e.prefix2ns.set(t, n); };
|
|
4350
|
-
|
|
4351
|
-
var
|
|
4352
|
-
if (!e.prefix2ns.has(
|
|
4353
|
-
return
|
|
4456
|
+
rs.prototype._allocPrefix = function (e) { var t = 1; for (;;) {
|
|
4457
|
+
var n_76 = "ns" + t++;
|
|
4458
|
+
if (!e.prefix2ns.has(n_76))
|
|
4459
|
+
return n_76;
|
|
4354
4460
|
} };
|
|
4355
|
-
|
|
4461
|
+
rs.prototype._ensurePrefixDeclared = function (e, t) { var n = this._lookupPrefix(t); if (n)
|
|
4356
4462
|
return n; if (e.closed)
|
|
4357
|
-
throw new Error("can not declare namespace after start tag closed for <".concat(e.name, ">")); var s = this._allocPrefix(e); return this._writeAttStr("".concat(
|
|
4358
|
-
|
|
4359
|
-
return
|
|
4463
|
+
throw new Error("can not declare namespace after start tag closed for <".concat(e.name, ">")); var s = this._allocPrefix(e); return this._writeAttStr("".concat(ns.Xmlns, ":").concat(s), t), this._registerNamespace(e, s, t), s; };
|
|
4464
|
+
rs.prototype._closeOpenTagIfNeeded = function (e) { e.closed || (this._w.write(ns.CloseTag), e.closed = !0); };
|
|
4465
|
+
return rs;
|
|
4360
4466
|
}());
|
|
4361
|
-
|
|
4467
|
+
rs.Context = /** @class */ (function () {
|
|
4362
4468
|
function Context(e, t) {
|
|
4363
4469
|
this.name = "", this.closed = !1, this.lastToken = null, this.ns2prefix = new Map, this.prefix2ns = new Map, this.defaultNs = null, this.name = e, this.depth = t;
|
|
4364
4470
|
}
|
|
4365
4471
|
return Context;
|
|
4366
4472
|
}());
|
|
4367
|
-
var
|
|
4368
|
-
function
|
|
4473
|
+
var is = /** @class */ (function () {
|
|
4474
|
+
function is() {
|
|
4369
4475
|
this.count = 0, this._chunks = [];
|
|
4370
4476
|
}
|
|
4371
|
-
|
|
4477
|
+
is.prototype.write = function () {
|
|
4372
4478
|
var e = [];
|
|
4373
4479
|
for (var _a = 0; _a < arguments.length; _a++) {
|
|
4374
4480
|
e[_a] = arguments[_a];
|
|
@@ -4378,16 +4484,16 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4378
4484
|
var t = e.join("");
|
|
4379
4485
|
return this._chunks.push(t), this.count += t.length, this;
|
|
4380
4486
|
};
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
return
|
|
4487
|
+
is.prototype.toString = function () { return this._chunks.join(""); };
|
|
4488
|
+
is.prototype.clear = function () { this._chunks = [], this.count = 0; };
|
|
4489
|
+
return is;
|
|
4384
4490
|
}());
|
|
4385
|
-
var
|
|
4386
|
-
function
|
|
4491
|
+
var os = /** @class */ (function () {
|
|
4492
|
+
function os(e, t) {
|
|
4387
4493
|
if (t === void 0) { t = {}; }
|
|
4388
4494
|
this._sink = e, this._opts = t, this.count = 0, this._encoder = new TextEncoder, this._pending = "", this._pendingChars = 0;
|
|
4389
4495
|
}
|
|
4390
|
-
|
|
4496
|
+
os.prototype.write = function () {
|
|
4391
4497
|
var e = [];
|
|
4392
4498
|
for (var _a = 0; _a < arguments.length; _a++) {
|
|
4393
4499
|
e[_a] = arguments[_a];
|
|
@@ -4402,109 +4508,109 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4402
4508
|
var s = null !== (t = this._opts.flushChars) && void 0 !== t ? t : 65536;
|
|
4403
4509
|
return this._pendingChars >= s && this.flush(), this;
|
|
4404
4510
|
};
|
|
4405
|
-
|
|
4511
|
+
os.prototype.flush = function () { if (0 === this._pendingChars)
|
|
4406
4512
|
return this; var e = this._encoder.encode(this._pending); return this._sink.push(e), this.count += e.length, this._pending = "", this._pendingChars = 0, this; };
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
return
|
|
4513
|
+
os.prototype.finish = function () { this.flush(), this._sink.push(new Uint8Array(0), !0); };
|
|
4514
|
+
os.prototype.clear = function () { this._pending = "", this._pendingChars = 0, this.count = 0; };
|
|
4515
|
+
return os;
|
|
4410
4516
|
}());
|
|
4411
|
-
var
|
|
4412
|
-
var
|
|
4413
|
-
e.ST_Unit = void 0, (
|
|
4414
|
-
var
|
|
4415
|
-
var
|
|
4416
|
-
e.KnownI3mfContentType = void 0, (
|
|
4417
|
-
var
|
|
4418
|
-
var
|
|
4419
|
-
function
|
|
4517
|
+
var as = "http://schemas.microsoft.com/3dmanufacturing/core/2015/02", ls = "http://schemas.microsoft.com/3dmanufacturing/trianglesets/2021/07";
|
|
4518
|
+
var us, cs;
|
|
4519
|
+
e.ST_Unit = void 0, (us = e.ST_Unit || (e.ST_Unit = {})).micron = "micron", us.millimeter = "millimeter", us.centimeter = "centimeter", us.inch = "inch", us.foot = "foot", us.meter = "meter", e.ST_ObjectType = void 0, (cs = e.ST_ObjectType || (e.ST_ObjectType = {})).model = "model", cs.solidsupport = "solidsupport", cs.support = "support", cs.surface = "surface", cs.other = "other";
|
|
4520
|
+
var hs = "http://schemas.openxmlformats.org/package/2006/content-types", ds = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
4521
|
+
var fs;
|
|
4522
|
+
e.KnownI3mfContentType = void 0, (fs = e.KnownI3mfContentType || (e.KnownI3mfContentType = {})).Relationships = "application/vnd.openxmlformats-package.relationships+xml", fs.Model = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml", fs.Materials = "application/vnd.ms-package.3dmanufacturing-material+xml", fs.Colors = "application/vnd.ms-package.3dmanufacturing-colors+xml", fs.Texture = "application/vnd.ms-package.3dmanufacturing-texture+xml", fs.Texture2D = "application/vnd.ms-package.3dmanufacturing-texture2d+xml", fs.Production = "application/vnd.ms-package.3dmanufacturing-production+xml", fs.Slice = "application/vnd.ms-package.3dmanufacturing-slice+xml", fs.BeamLattice = "application/vnd.ms-package.3dmanufacturing-beamlattice+xml", fs.SecureContent = "application/vnd.ms-package.3dmanufacturing-securecontent+xml", fs.Png = "image/png", fs.Jpeg = "image/jpeg", fs.Tiff = "image/tiff", fs.Xml = "application/xml";
|
|
4523
|
+
var ps = "_rels/", ms = "3D/", gs = "3dmodel.model", xs = ".rels", _s = "[Content_Types].xml";
|
|
4524
|
+
var Ts = /** @class */ (function () {
|
|
4525
|
+
function Ts() {
|
|
4420
4526
|
}
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
return
|
|
4527
|
+
Ts.IsKnown = function (e) { return Ts.Known.has(e); };
|
|
4528
|
+
Ts.IsThreeDimModel = function (e) { return e === Ts.ThreeDimModel; };
|
|
4529
|
+
return Ts;
|
|
4424
4530
|
}());
|
|
4425
|
-
|
|
4426
|
-
var
|
|
4531
|
+
Ts.ThreeDimModel = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel", Ts.Thumbnail = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", Ts.PrintTicket = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket", Ts.MustPreserve = "http://schemas.openxmlformats.org/package/2006/relationships/mustpreserve", Ts.Known = new Set([Ts.ThreeDimModel, Ts.Thumbnail, Ts.PrintTicket, Ts.MustPreserve]);
|
|
4532
|
+
var ys = (function () { var e, t, n = [Pn({ ns: hs, name: "Types" })], s = []; return t = /** @class */ (function () {
|
|
4427
4533
|
function t() {
|
|
4428
4534
|
this.items = [];
|
|
4429
4535
|
}
|
|
4430
4536
|
return t;
|
|
4431
|
-
}()), u(t, "ThreeMfContentTypes"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4537
|
+
}()), u(t, "ThreeMfContentTypes"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), bs = (function () { var e, t, n, s, r = [Pn({ ns: hs, name: "Default" })], i = [], o = [], c = [], h = [], d = []; return t = /** @class */ (function () {
|
|
4432
4538
|
function t(e, t) {
|
|
4433
4539
|
this.ext = l(this, o, void 0), this.ct = (l(this, c), l(this, h, void 0)), l(this, d), this.ext = e, this.ct = t;
|
|
4434
4540
|
}
|
|
4435
4541
|
return t;
|
|
4436
|
-
}()), u(t, "ThreeMfContentType"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4542
|
+
}()), u(t, "ThreeMfContentType"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: { ns: hs, name: "Extension" } })], s = [kn({ name: { ns: hs, name: "ContentType" } })], a(null, null, n, { kind: "field", name: "ext", static: !1, private: !1, access: { has: function (e) { return "ext" in e; }, get: function (e) { return e.ext; }, set: function (e, t) { e.ext = t; } }, metadata: u }, o, c), a(null, null, s, { kind: "field", name: "ct", static: !1, private: !1, access: { has: function (e) { return "ct" in e; }, get: function (e) { return e.ct; }, set: function (e, t) { e.ct = t; } }, metadata: u }, h, d), a(null, e = { value: t }, r, { kind: "class", name: t.name, metadata: u }, null, i), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, i); })(), t; })(), vs = (function () { var e, t, n = [Pn({ ns: ds, name: "Relationships" })], s = []; return t = /** @class */ (function () {
|
|
4437
4543
|
function t() {
|
|
4438
4544
|
this.items = [];
|
|
4439
4545
|
}
|
|
4440
4546
|
return t;
|
|
4441
|
-
}()), u(t, "ThreeMfRelationships"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4547
|
+
}()), u(t, "ThreeMfRelationships"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Ms = (function () { var e, t, n, s, r, i = [Pn({ ns: ds, name: "Relationship" })], o = [], c = [], h = [], d = [], f = [], p = [], m = []; return t = /** @class */ (function () {
|
|
4442
4548
|
function t(e, t, n) {
|
|
4443
4549
|
this.id = l(this, c, void 0), this.type = (l(this, h), l(this, d, void 0)), this.target = (l(this, f), l(this, p, void 0)), l(this, m), this.id = e, this.type = t, this.target = n;
|
|
4444
4550
|
}
|
|
4445
4551
|
return t;
|
|
4446
|
-
}()), u(t, "ThreeMfRelationship"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4447
|
-
var
|
|
4448
|
-
function
|
|
4552
|
+
}()), u(t, "ThreeMfRelationship"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "Id" })], s = [kn({ name: "Type" })], r = [kn({ name: "Target" })], a(null, null, n, { kind: "field", name: "id", static: !1, private: !1, access: { has: function (e) { return "id" in e; }, get: function (e) { return e.id; }, set: function (e, t) { e.id = t; } }, metadata: u }, c, h), a(null, null, s, { kind: "field", name: "type", static: !1, private: !1, access: { has: function (e) { return "type" in e; }, get: function (e) { return e.type; }, set: function (e, t) { e.type = t; } }, metadata: u }, d, f), a(null, null, r, { kind: "field", name: "target", static: !1, private: !1, access: { has: function (e) { return "target" in e; }, get: function (e) { return e.target; }, set: function (e, t) { e.target = t; } }, metadata: u }, p, m), a(null, e = { value: t }, i, { kind: "class", name: t.name, metadata: u }, null, o), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, o); })(), t; })();
|
|
4553
|
+
var ws = /** @class */ (function () {
|
|
4554
|
+
function ws(e, t, n) {
|
|
4449
4555
|
this.contentTypes = e, this.relationships = t, this.model = n;
|
|
4450
4556
|
}
|
|
4451
|
-
return
|
|
4557
|
+
return ws;
|
|
4452
4558
|
}());
|
|
4453
|
-
var
|
|
4454
|
-
function
|
|
4559
|
+
var Rs = /** @class */ (function () {
|
|
4560
|
+
function Rs(e) {
|
|
4455
4561
|
this.values = e;
|
|
4456
4562
|
}
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
return
|
|
4563
|
+
Rs.Zero = function () { return new Rs([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); };
|
|
4564
|
+
Rs.prototype.toString = function () { return this.values.join(" "); };
|
|
4565
|
+
return Rs;
|
|
4460
4566
|
}());
|
|
4461
|
-
var
|
|
4462
|
-
function
|
|
4463
|
-
this.o = e, this._f = new
|
|
4567
|
+
var As = /** @class */ (function () {
|
|
4568
|
+
function As(e) {
|
|
4569
|
+
this.o = e, this._f = new Xn(e);
|
|
4464
4570
|
}
|
|
4465
|
-
|
|
4571
|
+
As.prototype.toString = function (e) {
|
|
4466
4572
|
var _this = this;
|
|
4467
4573
|
return e.values.map(function (e) { return _this._f.toString(e); }).join(" ");
|
|
4468
4574
|
};
|
|
4469
|
-
return
|
|
4575
|
+
return As;
|
|
4470
4576
|
}());
|
|
4471
|
-
var
|
|
4577
|
+
var Cs = (function () { var t, n, s, r, i, o = [Pn({ ns: as, name: "model" })], c = [], h = [], d = [], f = [], p = [], m = [], g = []; return n = /** @class */ (function () {
|
|
4472
4578
|
function n() {
|
|
4473
4579
|
this.unit = l(this, h, e.ST_Unit.millimeter), this.requiredextensions = (l(this, d), l(this, f, void 0)), this.recommendedextensions = (l(this, p), l(this, m, void 0)), this.metadata = l(this, g);
|
|
4474
4580
|
}
|
|
4475
4581
|
return n;
|
|
4476
|
-
}()), u(n, "ThreeMfModel"), (function () { var e = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; s = [
|
|
4582
|
+
}()), u(n, "ThreeMfModel"), (function () { var e = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; s = [kn({ name: "unit" })], r = [kn({ name: "requiredextensions" })], i = [kn({ name: "recommendedextensions" })], a(null, null, s, { kind: "field", name: "unit", static: !1, private: !1, access: { has: function (e) { return "unit" in e; }, get: function (e) { return e.unit; }, set: function (e, t) { e.unit = t; } }, metadata: e }, h, d), a(null, null, r, { kind: "field", name: "requiredextensions", static: !1, private: !1, access: { has: function (e) { return "requiredextensions" in e; }, get: function (e) { return e.requiredextensions; }, set: function (e, t) { e.requiredextensions = t; } }, metadata: e }, f, p), a(null, null, i, { kind: "field", name: "recommendedextensions", static: !1, private: !1, access: { has: function (e) { return "recommendedextensions" in e; }, get: function (e) { return e.recommendedextensions; }, set: function (e, t) { e.recommendedextensions = t; } }, metadata: e }, m, g), a(null, t = { value: n }, o, { kind: "class", name: n.name, metadata: e }, null, c), n = t.value, e && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e }); })(), n.KnownMeta = ["Title", "Designer", "Description", "Copyright", "LicenseTerms", "Rating", "CreationDate", "ModificationDate", "Application"], l(n, c), n; })(), Es = (function () { var e, t, n, s, r, i = [Pn({ ns: as, name: "meta" })], o = [], c = [], h = [], d = [], f = [], p = [], m = []; return t = /** @class */ (function () {
|
|
4477
4583
|
function t(e, t, n, s) {
|
|
4478
4584
|
this.name = l(this, c, void 0), this.preserve = (l(this, h), l(this, d, void 0)), this.type = (l(this, f), l(this, p, void 0)), this.value = l(this, m), this.name = e, this.value = t, this.preserve = n, this.type = s;
|
|
4479
4585
|
}
|
|
4480
4586
|
return t;
|
|
4481
|
-
}()), u(t, "ThreeMfMeta"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4587
|
+
}()), u(t, "ThreeMfMeta"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "name" })], s = [kn({ name: "preserve" })], r = [kn({ name: "type" })], a(null, null, n, { kind: "field", name: "name", static: !1, private: !1, access: { has: function (e) { return "name" in e; }, get: function (e) { return e.name; }, set: function (e, t) { e.name = t; } }, metadata: u }, c, h), a(null, null, s, { kind: "field", name: "preserve", static: !1, private: !1, access: { has: function (e) { return "preserve" in e; }, get: function (e) { return e.preserve; }, set: function (e, t) { e.preserve = t; } }, metadata: u }, d, f), a(null, null, r, { kind: "field", name: "type", static: !1, private: !1, access: { has: function (e) { return "type" in e; }, get: function (e) { return e.type; }, set: function (e, t) { e.type = t; } }, metadata: u }, p, m), a(null, e = { value: t }, i, { kind: "class", name: t.name, metadata: u }, null, o), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, o); })(), t; })(), Is = (function () { var e, t, n = [Pn({ ns: as, name: "metadatagroup" })], s = []; return t = /** @class */ (function () {
|
|
4482
4588
|
function t() {
|
|
4483
4589
|
this.metadata = [];
|
|
4484
4590
|
}
|
|
4485
4591
|
return t;
|
|
4486
|
-
}()), u(t, "ThreeMfMetadataGroup"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4592
|
+
}()), u(t, "ThreeMfMetadataGroup"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Ss = (function () { var e, t, n = [Pn({ ns: as, name: "resources" })], s = []; return t = /** @class */ (function () {
|
|
4487
4593
|
function t() {
|
|
4488
4594
|
this.object = [];
|
|
4489
4595
|
}
|
|
4490
4596
|
return t;
|
|
4491
|
-
}()), u(t, "ThreeMfResources"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4597
|
+
}()), u(t, "ThreeMfResources"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Fs = (function () { var t, n, s, r, i, o, c, h, d, f = [Pn({ ns: as, name: "object" })], p = [], m = [], g = [], x = [], _ = [], T = [], y = [], b = [], v = [], M = [], w = [], R = [], A = [], C = [], E = []; return n = /** @class */ (function () {
|
|
4492
4598
|
function n(t, n) {
|
|
4493
4599
|
if (n === void 0) { n = e.ST_ObjectType.model; }
|
|
4494
4600
|
this.id = l(this, m, void 0), this.type = (l(this, g), l(this, x, void 0)), this.thumbnail = (l(this, _), l(this, T, void 0)), this.partnumber = (l(this, y), l(this, b, void 0)), this.name = (l(this, v), l(this, M, void 0)), this.pid = (l(this, w), l(this, R, void 0)), this.pindex = (l(this, A), l(this, C, void 0)), this.metadatagroup = l(this, E), this.id = t, this.type = n;
|
|
4495
4601
|
}
|
|
4496
4602
|
return n;
|
|
4497
|
-
}()), u(n, "ThreeMfObject"), (function () { var e = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; s = [
|
|
4603
|
+
}()), u(n, "ThreeMfObject"), (function () { var e = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; s = [kn({ name: "id" })], r = [kn({ name: "type" })], i = [kn({ name: "thumbnail" })], o = [kn({ name: "partnumber" })], c = [kn({ name: "name" })], h = [kn({ name: "pid" })], d = [kn({ name: "pindex" })], a(null, null, s, { kind: "field", name: "id", static: !1, private: !1, access: { has: function (e) { return "id" in e; }, get: function (e) { return e.id; }, set: function (e, t) { e.id = t; } }, metadata: e }, m, g), a(null, null, r, { kind: "field", name: "type", static: !1, private: !1, access: { has: function (e) { return "type" in e; }, get: function (e) { return e.type; }, set: function (e, t) { e.type = t; } }, metadata: e }, x, _), a(null, null, i, { kind: "field", name: "thumbnail", static: !1, private: !1, access: { has: function (e) { return "thumbnail" in e; }, get: function (e) { return e.thumbnail; }, set: function (e, t) { e.thumbnail = t; } }, metadata: e }, T, y), a(null, null, o, { kind: "field", name: "partnumber", static: !1, private: !1, access: { has: function (e) { return "partnumber" in e; }, get: function (e) { return e.partnumber; }, set: function (e, t) { e.partnumber = t; } }, metadata: e }, b, v), a(null, null, c, { kind: "field", name: "name", static: !1, private: !1, access: { has: function (e) { return "name" in e; }, get: function (e) { return e.name; }, set: function (e, t) { e.name = t; } }, metadata: e }, M, w), a(null, null, h, { kind: "field", name: "pid", static: !1, private: !1, access: { has: function (e) { return "pid" in e; }, get: function (e) { return e.pid; }, set: function (e, t) { e.pid = t; } }, metadata: e }, R, A), a(null, null, d, { kind: "field", name: "pindex", static: !1, private: !1, access: { has: function (e) { return "pindex" in e; }, get: function (e) { return e.pindex; }, set: function (e, t) { e.pindex = t; } }, metadata: e }, C, E), a(null, t = { value: n }, f, { kind: "class", name: n.name, metadata: e }, null, p), n = t.value, e && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e }), l(n, p); })(), n; })(), Vs = (function () { var e, t, n = [Pn({ ns: as, name: "mesh" })], s = []; return t = /** @class */ (function () {
|
|
4498
4604
|
function t(e, t) {
|
|
4499
|
-
this.vertices = null != e ? e : new
|
|
4605
|
+
this.vertices = null != e ? e : new Os, this.triangles = null != t ? t : new Ns;
|
|
4500
4606
|
}
|
|
4501
4607
|
return t;
|
|
4502
|
-
}()), u(t, "ThreeMfMesh"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4608
|
+
}()), u(t, "ThreeMfMesh"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Os = (function () { var e, t, n = [Pn({ ns: as, name: "vertices" })], s = []; return t = /** @class */ (function () {
|
|
4503
4609
|
function t() {
|
|
4504
4610
|
this.vertex = [];
|
|
4505
4611
|
}
|
|
4506
4612
|
return t;
|
|
4507
|
-
}()), u(t, "ThreeMfVertices"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4613
|
+
}()), u(t, "ThreeMfVertices"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Bs = (function () { var e, t, n, s, r, i = [Pn({ ns: as, name: "vertex" })], o = [], c = [], h = [], d = [], f = [], p = [], m = []; return t = /** @class */ (function () {
|
|
4508
4614
|
function t(e, t, n) {
|
|
4509
4615
|
if (e === void 0) { e = 0; }
|
|
4510
4616
|
if (t === void 0) { t = 0; }
|
|
@@ -4512,144 +4618,144 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4512
4618
|
this.x = l(this, c, void 0), this.y = (l(this, h), l(this, d, void 0)), this.z = (l(this, f), l(this, p, void 0)), l(this, m), this.x = e, this.y = t, this.z = n;
|
|
4513
4619
|
}
|
|
4514
4620
|
return t;
|
|
4515
|
-
}()), u(t, "ThreeMfVertex"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4621
|
+
}()), u(t, "ThreeMfVertex"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "x" })], s = [kn({ name: "y" })], r = [kn({ name: "z" })], a(null, null, n, { kind: "field", name: "x", static: !1, private: !1, access: { has: function (e) { return "x" in e; }, get: function (e) { return e.x; }, set: function (e, t) { e.x = t; } }, metadata: u }, c, h), a(null, null, s, { kind: "field", name: "y", static: !1, private: !1, access: { has: function (e) { return "y" in e; }, get: function (e) { return e.y; }, set: function (e, t) { e.y = t; } }, metadata: u }, d, f), a(null, null, r, { kind: "field", name: "z", static: !1, private: !1, access: { has: function (e) { return "z" in e; }, get: function (e) { return e.z; }, set: function (e, t) { e.z = t; } }, metadata: u }, p, m), a(null, e = { value: t }, i, { kind: "class", name: t.name, metadata: u }, null, o), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, o); })(), t; })(), Ns = (function () { var e, t, n = [Pn({ ns: as, name: "triangles" })], s = []; return t = /** @class */ (function () {
|
|
4516
4622
|
function t() {
|
|
4517
4623
|
this.triangle = [];
|
|
4518
4624
|
}
|
|
4519
4625
|
return t;
|
|
4520
|
-
}()), u(t, "ThreeMfTriangles"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4626
|
+
}()), u(t, "ThreeMfTriangles"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Ps = (function () { var e, t, n, s, r, i, o, c, h, d = [Pn({ ns: as, name: "triangle" })], f = [], p = [], m = [], g = [], x = [], _ = [], T = [], y = [], b = [], v = [], M = [], w = [], R = [], A = [], C = []; return t = /** @class */ (function () {
|
|
4521
4627
|
function t(e, t, n) {
|
|
4522
4628
|
this.v1 = l(this, p, void 0), this.v2 = (l(this, m), l(this, g, void 0)), this.v3 = (l(this, x), l(this, _, void 0)), this.p1 = (l(this, T), l(this, y, void 0)), this.p2 = (l(this, b), l(this, v, void 0)), this.p3 = (l(this, M), l(this, w, void 0)), this.pid = (l(this, R), l(this, A, void 0)), l(this, C), this.v1 = e, this.v2 = t, this.v3 = n;
|
|
4523
4629
|
}
|
|
4524
4630
|
return t;
|
|
4525
|
-
}()), u(t, "ThreeMfTriangle"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4631
|
+
}()), u(t, "ThreeMfTriangle"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "v1" })], s = [kn({ name: "v2" })], r = [kn({ name: "v3" })], i = [kn({ name: "p1" })], o = [kn({ name: "p2" })], c = [kn({ name: "p3" })], h = [kn({ name: "pid" })], a(null, null, n, { kind: "field", name: "v1", static: !1, private: !1, access: { has: function (e) { return "v1" in e; }, get: function (e) { return e.v1; }, set: function (e, t) { e.v1 = t; } }, metadata: u }, p, m), a(null, null, s, { kind: "field", name: "v2", static: !1, private: !1, access: { has: function (e) { return "v2" in e; }, get: function (e) { return e.v2; }, set: function (e, t) { e.v2 = t; } }, metadata: u }, g, x), a(null, null, r, { kind: "field", name: "v3", static: !1, private: !1, access: { has: function (e) { return "v3" in e; }, get: function (e) { return e.v3; }, set: function (e, t) { e.v3 = t; } }, metadata: u }, _, T), a(null, null, i, { kind: "field", name: "p1", static: !1, private: !1, access: { has: function (e) { return "p1" in e; }, get: function (e) { return e.p1; }, set: function (e, t) { e.p1 = t; } }, metadata: u }, y, b), a(null, null, o, { kind: "field", name: "p2", static: !1, private: !1, access: { has: function (e) { return "p2" in e; }, get: function (e) { return e.p2; }, set: function (e, t) { e.p2 = t; } }, metadata: u }, v, M), a(null, null, c, { kind: "field", name: "p3", static: !1, private: !1, access: { has: function (e) { return "p3" in e; }, get: function (e) { return e.p3; }, set: function (e, t) { e.p3 = t; } }, metadata: u }, w, R), a(null, null, h, { kind: "field", name: "pid", static: !1, private: !1, access: { has: function (e) { return "pid" in e; }, get: function (e) { return e.pid; }, set: function (e, t) { e.pid = t; } }, metadata: u }, A, C), a(null, e = { value: t }, d, { kind: "class", name: t.name, metadata: u }, null, f), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, f); })(), t; })(), Us = (function () { var e, t, n = [Pn({ ns: as, name: "components" })], s = []; return t = /** @class */ (function () {
|
|
4526
4632
|
function t() {
|
|
4527
4633
|
this.component = [];
|
|
4528
4634
|
}
|
|
4529
4635
|
return t;
|
|
4530
|
-
}()), u(t, "ThreeMfComponents"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4636
|
+
}()), u(t, "ThreeMfComponents"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), ks = (function () { var e, t, n, s, r = [Pn({ ns: as, name: "component" })], i = [], o = [], c = [], h = [], d = []; return t = /** @class */ (function () {
|
|
4531
4637
|
function t(e, t) {
|
|
4532
4638
|
this.objectid = l(this, o, void 0), this.transform = (l(this, c), l(this, h, void 0)), l(this, d), this.objectid = e, this.transform = t;
|
|
4533
4639
|
}
|
|
4534
4640
|
return t;
|
|
4535
|
-
}()), u(t, "ThreeMfComponent"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4641
|
+
}()), u(t, "ThreeMfComponent"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "objectid" })], s = [kn({ name: "transform", formatter: As })], a(null, null, n, { kind: "field", name: "objectid", static: !1, private: !1, access: { has: function (e) { return "objectid" in e; }, get: function (e) { return e.objectid; }, set: function (e, t) { e.objectid = t; } }, metadata: u }, o, c), a(null, null, s, { kind: "field", name: "transform", static: !1, private: !1, access: { has: function (e) { return "transform" in e; }, get: function (e) { return e.transform; }, set: function (e, t) { e.transform = t; } }, metadata: u }, h, d), a(null, e = { value: t }, r, { kind: "class", name: t.name, metadata: u }, null, i), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, i); })(), t; })(), Ks = (function () { var e, t, n, s = [Pn({ ns: as, name: "basematerials" })], r = [], i = [], o = []; return t = /** @class */ (function () {
|
|
4536
4642
|
function t(e) {
|
|
4537
4643
|
this.id = l(this, i, void 0), this.base = (l(this, o), []), this.id = e;
|
|
4538
4644
|
}
|
|
4539
4645
|
return t;
|
|
4540
|
-
}()), u(t, "ThreeMfBaseMaterials"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4646
|
+
}()), u(t, "ThreeMfBaseMaterials"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "id" })], a(null, null, n, { kind: "field", name: "id", static: !1, private: !1, access: { has: function (e) { return "id" in e; }, get: function (e) { return e.id; }, set: function (e, t) { e.id = t; } }, metadata: u }, i, o), a(null, e = { value: t }, s, { kind: "class", name: t.name, metadata: u }, null, r), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, r); })(), t; })(), $s = (function () { var e, t, n, s, r = [Pn({ ns: as, name: "base" })], i = [], o = [], c = [], h = [], d = []; return t = /** @class */ (function () {
|
|
4541
4647
|
function t(e, t) {
|
|
4542
4648
|
this.name = l(this, o, void 0), this.displaycolor = (l(this, c), l(this, h, void 0)), l(this, d), this.name = e, this.displaycolor = t;
|
|
4543
4649
|
}
|
|
4544
4650
|
return t;
|
|
4545
|
-
}()), u(t, "ThreeMfBase"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4651
|
+
}()), u(t, "ThreeMfBase"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "name" })], s = [kn({ name: "displaycolor" })], a(null, null, n, { kind: "field", name: "name", static: !1, private: !1, access: { has: function (e) { return "name" in e; }, get: function (e) { return e.name; }, set: function (e, t) { e.name = t; } }, metadata: u }, o, c), a(null, null, s, { kind: "field", name: "displaycolor", static: !1, private: !1, access: { has: function (e) { return "displaycolor" in e; }, get: function (e) { return e.displaycolor; }, set: function (e, t) { e.displaycolor = t; } }, metadata: u }, h, d), a(null, e = { value: t }, r, { kind: "class", name: t.name, metadata: u }, null, i), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, i); })(), t; })(), zs = (function () { var e, t, n = [Pn({ ns: as, name: "build" })], s = []; return t = /** @class */ (function () {
|
|
4546
4652
|
function t() {
|
|
4547
4653
|
this.item = [];
|
|
4548
4654
|
}
|
|
4549
4655
|
return t;
|
|
4550
|
-
}()), u(t, "ThreeMfBuild"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(),
|
|
4656
|
+
}()), u(t, "ThreeMfBuild"), (function () { var r = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; a(null, e = { value: t }, n, { kind: "class", name: t.name, metadata: r }, null, s), t = e.value, r && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r }), l(t, s); })(), t; })(), Ws = (function () { var e, t, n, s, r, i = [Pn({ ns: as, name: "item" })], o = [], c = [], h = [], d = [], f = [], p = [], m = []; return t = /** @class */ (function () {
|
|
4551
4657
|
function t(e, t, n) {
|
|
4552
4658
|
this.objectid = l(this, c, void 0), this.transform = (l(this, h), l(this, d, void 0)), this.partnumber = (l(this, f), l(this, p, void 0)), this.metadatagroup = l(this, m), this.objectid = e, this.transform = t, this.partnumber = n;
|
|
4553
4659
|
}
|
|
4554
4660
|
return t;
|
|
4555
|
-
}()), u(t, "ThreeMfItem"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [
|
|
4556
|
-
var
|
|
4557
|
-
function
|
|
4558
|
-
this._object = new
|
|
4661
|
+
}()), u(t, "ThreeMfItem"), (function () { var u = "function" == typeof Symbol && Symbol.metadata ? Object.create(null) : void 0; n = [kn({ name: "objectid" })], s = [kn({ name: "transform", formatter: As })], r = [kn({ name: "partnumber" })], a(null, null, n, { kind: "field", name: "objectid", static: !1, private: !1, access: { has: function (e) { return "objectid" in e; }, get: function (e) { return e.objectid; }, set: function (e, t) { e.objectid = t; } }, metadata: u }, c, h), a(null, null, s, { kind: "field", name: "transform", static: !1, private: !1, access: { has: function (e) { return "transform" in e; }, get: function (e) { return e.transform; }, set: function (e, t) { e.transform = t; } }, metadata: u }, d, f), a(null, null, r, { kind: "field", name: "partnumber", static: !1, private: !1, access: { has: function (e) { return "partnumber" in e; }, get: function (e) { return e.partnumber; }, set: function (e, t) { e.partnumber = t; } }, metadata: u }, p, m), a(null, e = { value: t }, i, { kind: "class", name: t.name, metadata: u }, null, o), t = e.value, u && Object.defineProperty(t, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: u }), l(t, o); })(), t; })();
|
|
4662
|
+
var Ds = /** @class */ (function () {
|
|
4663
|
+
function Ds(e, t) {
|
|
4664
|
+
this._object = new Fs(e, t);
|
|
4559
4665
|
}
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4666
|
+
Ds.prototype.withName = function (e) { return this._object.name = e, this; };
|
|
4667
|
+
Ds.prototype.withThumbnail = function (e) { return this._object.thumbnail = e, this; };
|
|
4668
|
+
Ds.prototype.withProperty = function (e, t) {
|
|
4563
4669
|
if (t === void 0) { t = 0; }
|
|
4564
4670
|
return this._object.pid = e, this._object.id = t, this;
|
|
4565
4671
|
};
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
return
|
|
4672
|
+
Ds.prototype.build = function () { return this._object; };
|
|
4673
|
+
Ds.prototype.reset = function (e, t) { this._object = new Fs(e, t); };
|
|
4674
|
+
return Ds;
|
|
4569
4675
|
}());
|
|
4570
|
-
var
|
|
4571
|
-
__extends(
|
|
4572
|
-
function
|
|
4676
|
+
var Ls = /** @class */ (function (_super) {
|
|
4677
|
+
__extends(Ls, _super);
|
|
4678
|
+
function Ls(t, n) {
|
|
4573
4679
|
if (n === void 0) { n = e.ST_ObjectType.model; }
|
|
4574
4680
|
var _this = this;
|
|
4575
|
-
_this = _super.call(this, t, n) || this, _this._object.content = new
|
|
4681
|
+
_this = _super.call(this, t, n) || this, _this._object.content = new Us;
|
|
4576
4682
|
return _this;
|
|
4577
4683
|
}
|
|
4578
|
-
|
|
4579
|
-
return
|
|
4580
|
-
}(
|
|
4581
|
-
var
|
|
4582
|
-
__extends(
|
|
4583
|
-
function
|
|
4684
|
+
Ls.prototype.withComponent = function (e, t) { return this._object.content.component.push(new ks(e, t)), this; };
|
|
4685
|
+
return Ls;
|
|
4686
|
+
}(Ds));
|
|
4687
|
+
var Hs = /** @class */ (function (_super) {
|
|
4688
|
+
__extends(Hs, _super);
|
|
4689
|
+
function Hs(t) {
|
|
4584
4690
|
return _super.call(this, t, e.ST_ObjectType.model) || this;
|
|
4585
4691
|
}
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
for (var
|
|
4592
|
-
var s_51 = e[
|
|
4593
|
-
var
|
|
4594
|
-
this._vh && (
|
|
4692
|
+
Hs.prototype.withPostProcessHandlers = function (e, t) { return this._vh = e, this._th = t, this; };
|
|
4693
|
+
Hs.prototype.withData = function (e) { return this._object.content = this._buildMesh(e), this; };
|
|
4694
|
+
Hs.prototype.withMaterial = function (e, t) { return this._object.pid = e, this._object.pindex = t, this; };
|
|
4695
|
+
Hs.prototype._buildMesh = function (e) { var t = this._buildVertices(e.positions), n = this._buildTriangle(e.indices); return new Vs(t, n); };
|
|
4696
|
+
Hs.prototype._buildVertices = function (e) { var t = new Os; if (e)
|
|
4697
|
+
for (var n_77 = 0; n_77 < e.length;) {
|
|
4698
|
+
var s_51 = e[n_77++], r_56 = e[n_77++], i_45 = e[n_77++];
|
|
4699
|
+
var o_45 = new Bs(s_51, r_56, i_45);
|
|
4700
|
+
this._vh && (o_45 = this._vh(o_45)), t.vertex.push(o_45);
|
|
4595
4701
|
} return t; };
|
|
4596
|
-
|
|
4597
|
-
for (var
|
|
4598
|
-
var s_52 = e[
|
|
4599
|
-
var
|
|
4600
|
-
this._th && (
|
|
4702
|
+
Hs.prototype._buildTriangle = function (e) { var t = new Ns; if (e)
|
|
4703
|
+
for (var n_78 = 0; n_78 < e.length;) {
|
|
4704
|
+
var s_52 = e[n_78++], r_57 = e[n_78++], i_46 = e[n_78++];
|
|
4705
|
+
var o_46 = new Ps(s_52, r_57, i_46);
|
|
4706
|
+
this._th && (o_46 = this._th(o_46)), t.triangle.push(o_46);
|
|
4601
4707
|
} return t; };
|
|
4602
|
-
return
|
|
4603
|
-
}(
|
|
4604
|
-
var
|
|
4605
|
-
function
|
|
4606
|
-
this._m = new
|
|
4708
|
+
return Hs;
|
|
4709
|
+
}(Ds));
|
|
4710
|
+
var js = /** @class */ (function () {
|
|
4711
|
+
function js(e) {
|
|
4712
|
+
this._m = new Ks(e);
|
|
4607
4713
|
}
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
return
|
|
4714
|
+
js.prototype.withColor = function (e, t) { var n; this._m.base = null !== (n = this._m.base) && void 0 !== n ? n : []; var s = this._m.base.find(function (t) { return t.name.toLowerCase() === e.toLowerCase(); }); return s ? (s.displaycolor = this._rgbaToHex(t), this) : (s = new $s(e, this._rgbaToHex(t)), this._m.base.push(s), this); };
|
|
4715
|
+
js.prototype.build = function () { return this._m; };
|
|
4716
|
+
js.prototype._rgbaToHex = function (e) { var t = function (e) { return Math.round(Math.min(255, Math.max(0, 255 * Math.pow(e, 1 / 2.2)))); }, n = t(e.r).toString(16).padStart(2, "0").toUpperCase(), s = t(e.g).toString(16).padStart(2, "0").toUpperCase(), r = t(e.b).toString(16).padStart(2, "0").toUpperCase(); return "number" == typeof e.a ? "#".concat(n).concat(s).concat(r).concat(Math.round(Math.min(255, Math.max(0, 255 * e.a))).toString(16).padStart(2, "0").toUpperCase()) : "#".concat(n).concat(s).concat(r); };
|
|
4717
|
+
return js;
|
|
4612
4718
|
}());
|
|
4613
|
-
var
|
|
4614
|
-
function
|
|
4615
|
-
this._model = new
|
|
4719
|
+
var qs = /** @class */ (function () {
|
|
4720
|
+
function qs() {
|
|
4721
|
+
this._model = new Cs, this._objects = new Map;
|
|
4616
4722
|
}
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4723
|
+
qs.prototype.withMetaData = function (e, t, n, s) { return this._model.metadata || (this._model.metadata = new Array), this._model.metadata.push(new Es(e, t, n, s)), this; };
|
|
4724
|
+
qs.prototype.withMaterial = function (e) { var t, n; return e instanceof js && (e = e.build()), e && (this._model.resources = null !== (t = this._model.resources) && void 0 !== t ? t : new Ss, this._model.resources.basematerials = null !== (n = this._model.resources.basematerials) && void 0 !== n ? n : [], this._model.resources.basematerials.push(e)), this; };
|
|
4725
|
+
qs.prototype.withMesh = function (e) { var t; return e instanceof Hs && (e = e.build()), this._model.resources = null !== (t = this._model.resources) && void 0 !== t ? t : new Ss, this._model.resources.object.push(e), this; };
|
|
4726
|
+
qs.prototype.withComponents = function (e) { var t; return e instanceof Ls && (e = e.build()), this._model.resources = null !== (t = this._model.resources) && void 0 !== t ? t : new Ss, this._model.resources.object.push(e), this; };
|
|
4727
|
+
qs.prototype.withBuild = function (e, t, n) { var s, r; return this._model.build = null !== (s = this._model.build) && void 0 !== s ? s : new zs, null === (r = this._model.build.item) || void 0 === r || r.push(new Ws(e, t, n)), this; };
|
|
4728
|
+
qs.prototype.withUnit = function (e) { return this._model.unit = e, this; };
|
|
4729
|
+
qs.prototype.reset = function () { return this._model = new Cs, this._objects = new Map, this; };
|
|
4730
|
+
qs.prototype.build = function () { var e, t, n, s; if (!(null === (t = null === (e = this._model.resources) || void 0 === e ? void 0 : e.object) || void 0 === t ? void 0 : t.length))
|
|
4625
4731
|
throw new Error("Invalid state: resources MUST be defined "); if (!(null === (s = null === (n = this._model.build) || void 0 === n ? void 0 : n.item) || void 0 === s ? void 0 : s.length))
|
|
4626
4732
|
throw new Error("Invalid state: Build MUST be defined "); return this._model; };
|
|
4627
|
-
return
|
|
4733
|
+
return qs;
|
|
4628
4734
|
}());
|
|
4629
|
-
|
|
4630
|
-
var
|
|
4631
|
-
function
|
|
4735
|
+
qs.KnownMetaSet = new Set(Cs.KnownMeta.map(function (e) { return e.toLowerCase(); }));
|
|
4736
|
+
var Gs = /** @class */ (function () {
|
|
4737
|
+
function Gs() {
|
|
4632
4738
|
}
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
throw new Error("Invalid state: you Must provide at least a model."); var e = "".concat(
|
|
4638
|
-
var
|
|
4639
|
-
this.withRelationship(new
|
|
4640
|
-
} return new
|
|
4641
|
-
return
|
|
4739
|
+
Gs.prototype.withContentType = function (e) { this._cts || (this._cts = new ys); var t = this._cts.items; return t.some(function (t) { return t.ext === e.ext && t.ct === e.ct; }) || t.push(e), this; };
|
|
4740
|
+
Gs.prototype.withRelationship = function (t) { this._rs || (this._rs = new vs); var n = this._rs.items; return n.some(function (e) { return e.id === t.id; }) || n.push(t), this.withContentType(new bs("rels", e.KnownI3mfContentType.Relationships)), this; };
|
|
4741
|
+
Gs.prototype.withModel = function (t) { return t instanceof qs && (t = t.build()), this._m = t, this.withContentType(new bs("model", e.KnownI3mfContentType.Model)), this; };
|
|
4742
|
+
Gs.prototype.build = function () { if (!this._m)
|
|
4743
|
+
throw new Error("Invalid state: you Must provide at least a model."); var e = "".concat(ms).concat(gs); if (!this._rs) {
|
|
4744
|
+
var t_95 = "/".concat(e);
|
|
4745
|
+
this.withRelationship(new Ms("rel0", Ts.ThreeDimModel, t_95));
|
|
4746
|
+
} return new ws(this._cts, this._rs, this._m); };
|
|
4747
|
+
return Gs;
|
|
4642
4748
|
}());
|
|
4643
|
-
var
|
|
4644
|
-
function
|
|
4749
|
+
var Xs = /** @class */ (function () {
|
|
4750
|
+
function Xs(e) {
|
|
4645
4751
|
this._o = e;
|
|
4646
4752
|
}
|
|
4647
|
-
Object.defineProperty(
|
|
4753
|
+
Object.defineProperty(Xs.prototype, "options", {
|
|
4648
4754
|
get: function () { return this._o; },
|
|
4649
4755
|
enumerable: false,
|
|
4650
4756
|
configurable: true
|
|
4651
4757
|
});
|
|
4652
|
-
|
|
4758
|
+
Xs.prototype.serializeAsync = function (e) {
|
|
4653
4759
|
var t = [];
|
|
4654
4760
|
for (var _a = 1; _a < arguments.length; _a++) {
|
|
4655
4761
|
t[_a - 1] = arguments[_a];
|
|
@@ -4664,40 +4770,40 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4664
4770
|
s = n.Zip, r = n.ZipDeflate;
|
|
4665
4771
|
if (!s || !r)
|
|
4666
4772
|
throw new Error("fflate Zip / ZipDeflate not available");
|
|
4667
|
-
i = function (e, t, n) { var s = new r(t, { level: 6 }); e.add(s); var i = function (e) { return { push: function (t, n) { return e.push(t, n); } }; }(s), o = new
|
|
4773
|
+
i = function (e, t, n) { var s = new r(t, { level: 6 }); e.add(s); var i = function (e) { return { push: function (t, n) { return e.push(t, n); } }; }(s), o = new os(i), a = new rs(o).dec("1.0", "UTF-8"); new ts(a).serialize(n), o.finish(); }, o = this.toDocument.apply(this, __spreadArray([], __read(t), false));
|
|
4668
4774
|
if (!o)
|
|
4669
4775
|
return [2 /*return*/];
|
|
4670
4776
|
a = new s(e);
|
|
4671
|
-
i(a,
|
|
4777
|
+
i(a, _s, o.contentTypes), i(a, "".concat(ps).concat(xs), o.relationships), i(a, "".concat(ms).concat(gs), o.model), a.end();
|
|
4672
4778
|
return [2 /*return*/];
|
|
4673
4779
|
}
|
|
4674
4780
|
}); });
|
|
4675
4781
|
};
|
|
4676
|
-
|
|
4782
|
+
Xs.prototype.toDocument = function () {
|
|
4677
4783
|
var t = [];
|
|
4678
4784
|
for (var _a = 0; _a < arguments.length; _a++) {
|
|
4679
4785
|
t[_a] = arguments[_a];
|
|
4680
4786
|
}
|
|
4681
4787
|
var n, s;
|
|
4682
|
-
var r = (new
|
|
4788
|
+
var r = (new qs).withUnit(null !== (s = null === (n = this._o) || void 0 === n ? void 0 : n.unit) && void 0 !== s ? s : e.ST_Unit.millimeter);
|
|
4683
4789
|
if (this.options.metadata)
|
|
4684
|
-
for (var
|
|
4685
|
-
r.withMetaData(
|
|
4686
|
-
return (new
|
|
4790
|
+
for (var e_214 in this.options.metadata)
|
|
4791
|
+
r.withMetaData(e_214, this.options.metadata[e_214]);
|
|
4792
|
+
return (new Gs).withModel(this.toModel.apply(this, __spreadArray([r], __read(t), false))).build();
|
|
4687
4793
|
};
|
|
4688
|
-
return
|
|
4794
|
+
return Xs;
|
|
4689
4795
|
}());
|
|
4690
|
-
var
|
|
4691
|
-
function
|
|
4796
|
+
var Qs = /** @class */ (function () {
|
|
4797
|
+
function Qs() {
|
|
4692
4798
|
}
|
|
4693
|
-
|
|
4799
|
+
Qs.SerializeToMemoryAsync = function (e) {
|
|
4694
4800
|
var t = [];
|
|
4695
4801
|
for (var _a = 1; _a < arguments.length; _a++) {
|
|
4696
4802
|
t[_a - 1] = arguments[_a];
|
|
4697
4803
|
}
|
|
4698
4804
|
return c(this, void 0, void 0, function () {
|
|
4699
|
-
var n, s, r, i,
|
|
4700
|
-
var
|
|
4805
|
+
var n, s, r, i, n_79, n_79_1, e_216;
|
|
4806
|
+
var e_215, _a;
|
|
4701
4807
|
return __generator(this, function (_b) {
|
|
4702
4808
|
switch (_b.label) {
|
|
4703
4809
|
case 0:
|
|
@@ -4710,101 +4816,101 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4710
4816
|
r = new Uint8Array(s);
|
|
4711
4817
|
i = 0;
|
|
4712
4818
|
try {
|
|
4713
|
-
for (
|
|
4714
|
-
|
|
4715
|
-
r.set(
|
|
4819
|
+
for (n_79 = __values(n), n_79_1 = n_79.next(); !n_79_1.done; n_79_1 = n_79.next()) {
|
|
4820
|
+
e_216 = n_79_1.value;
|
|
4821
|
+
r.set(e_216, i), i += e_216.length;
|
|
4716
4822
|
}
|
|
4717
4823
|
}
|
|
4718
|
-
catch (
|
|
4824
|
+
catch (e_215_1) { e_215 = { error: e_215_1 }; }
|
|
4719
4825
|
finally {
|
|
4720
4826
|
try {
|
|
4721
|
-
if (
|
|
4827
|
+
if (n_79_1 && !n_79_1.done && (_a = n_79.return)) _a.call(n_79);
|
|
4722
4828
|
}
|
|
4723
|
-
finally { if (
|
|
4829
|
+
finally { if (e_215) throw e_215.error; }
|
|
4724
4830
|
}
|
|
4725
4831
|
return [2 /*return*/, r];
|
|
4726
4832
|
}
|
|
4727
4833
|
});
|
|
4728
4834
|
});
|
|
4729
4835
|
};
|
|
4730
|
-
return
|
|
4836
|
+
return Qs;
|
|
4731
4837
|
}());
|
|
4732
|
-
var
|
|
4733
|
-
function
|
|
4838
|
+
var Zs = /** @class */ (function () {
|
|
4839
|
+
function Zs() {
|
|
4734
4840
|
}
|
|
4735
|
-
return
|
|
4841
|
+
return Zs;
|
|
4736
4842
|
}());
|
|
4737
|
-
|
|
4738
|
-
var
|
|
4739
|
-
function
|
|
4843
|
+
Zs.FFLATEUrl = "https://unpkg.com/fflate@0.8.2";
|
|
4844
|
+
var Ys = /** @class */ (function () {
|
|
4845
|
+
function Ys(e, t, n) {
|
|
4740
4846
|
if (e === void 0) { e = 0; }
|
|
4741
4847
|
if (t === void 0) { t = Number.MIN_SAFE_INTEGER; }
|
|
4742
4848
|
if (n === void 0) { n = 1; }
|
|
4743
4849
|
this._from = e, this._to = t, this._step = n, this._i = e;
|
|
4744
4850
|
}
|
|
4745
|
-
|
|
4851
|
+
Ys.prototype.next = function () { if (this._i < this._to)
|
|
4746
4852
|
throw new Error("ST_ResourceID out of bound"); var e = this._i; return this._i += this._step, e; };
|
|
4747
|
-
|
|
4748
|
-
return
|
|
4853
|
+
Ys.prototype.reset = function () { return this._i = this._from, this; };
|
|
4854
|
+
return Ys;
|
|
4749
4855
|
}());
|
|
4750
|
-
var
|
|
4751
|
-
__extends(
|
|
4752
|
-
function
|
|
4856
|
+
var Js = /** @class */ (function (_super) {
|
|
4857
|
+
__extends(Js, _super);
|
|
4858
|
+
function Js(e) {
|
|
4753
4859
|
if (e === void 0) { e = {}; }
|
|
4754
|
-
return _super.call(this, Object.assign(Object.assign({},
|
|
4860
|
+
return _super.call(this, Object.assign(Object.assign({}, Js.DefaultOptions), e)) || this;
|
|
4755
4861
|
}
|
|
4756
|
-
|
|
4757
|
-
var
|
|
4862
|
+
Js.prototype.toModel = function (e) {
|
|
4863
|
+
var e_217, _a;
|
|
4758
4864
|
var n = [];
|
|
4759
4865
|
for (var _b = 1; _b < arguments.length; _b++) {
|
|
4760
4866
|
n[_b - 1] = arguments[_b];
|
|
4761
4867
|
}
|
|
4762
4868
|
n = n.filter(function (e) { return e instanceof t.Mesh || e instanceof t.InstancedMesh; });
|
|
4763
|
-
var s = new
|
|
4764
|
-
for (var
|
|
4765
|
-
var
|
|
4766
|
-
if (
|
|
4767
|
-
null == o || o.push(
|
|
4869
|
+
var s = new Ys, r = e, i = new Map, o = this.options.exportInstances ? [] : null;
|
|
4870
|
+
for (var e_218 = 0; e_218 < n.length; e_218++) {
|
|
4871
|
+
var a_31 = n[e_218];
|
|
4872
|
+
if (a_31 instanceof t.InstancedMesh) {
|
|
4873
|
+
null == o || o.push(a_31);
|
|
4768
4874
|
continue;
|
|
4769
4875
|
}
|
|
4770
|
-
var l_30 =
|
|
4876
|
+
var l_30 = a_31.name || "mesh".concat(e_218), u_22 = a_31.getWorldMatrix(), c_20 = this._handleBabylonTo3mfMatrixTransformToRef(u_22, Rs.Zero()), h_20 = a_31.subMeshes;
|
|
4771
4877
|
if (void 0 === h_20)
|
|
4772
4878
|
continue;
|
|
4773
|
-
var
|
|
4774
|
-
for (var
|
|
4775
|
-
var
|
|
4776
|
-
if (
|
|
4777
|
-
var
|
|
4778
|
-
r.withMesh(
|
|
4879
|
+
var d_11 = 1 == h_20.length;
|
|
4880
|
+
for (var e_219 = 0; e_219 < h_20.length; e_219++) {
|
|
4881
|
+
var t_96 = h_20[e_219], n_80 = this._extractSubMesh(a_31, t_96);
|
|
4882
|
+
if (n_80) {
|
|
4883
|
+
var o_47 = d_11 ? "".concat(l_30) : "".concat(l_30, "_").concat(e_219), a_32 = new Hs(s.next()).withData(n_80).withName(o_47).build();
|
|
4884
|
+
r.withMesh(a_32), r.withBuild(a_32.id, c_20), i.set(t_96, a_32);
|
|
4779
4885
|
}
|
|
4780
4886
|
}
|
|
4781
4887
|
}
|
|
4782
4888
|
if (o && o.length) {
|
|
4783
|
-
var
|
|
4889
|
+
var e_220 = this._groupBy(o, function (e) { return e.sourceMesh; });
|
|
4784
4890
|
try {
|
|
4785
|
-
for (var _c = __values(Array.from(
|
|
4786
|
-
var _h = __read(_g.value, 2),
|
|
4787
|
-
if (
|
|
4788
|
-
for (var
|
|
4789
|
-
var s_53 =
|
|
4790
|
-
for (var
|
|
4791
|
-
var
|
|
4792
|
-
|
|
4891
|
+
for (var _c = __values(Array.from(e_220.entries())), _g = _c.next(); !_g.done; _g = _c.next()) {
|
|
4892
|
+
var _h = __read(_g.value, 2), t_97 = _h[0], n_81 = _h[1];
|
|
4893
|
+
if (n_81 && n_81.length)
|
|
4894
|
+
for (var e_221 = 0; e_221 < n_81.length; e_221++) {
|
|
4895
|
+
var s_53 = n_81[e_221].getWorldMatrix(), o_48 = t_97.subMeshes;
|
|
4896
|
+
for (var e_222 = 0; e_222 < o_48.length; e_222++) {
|
|
4897
|
+
var t_98 = o_48[e_222], n_82 = i.get(t_98);
|
|
4898
|
+
n_82 && r.withBuild(n_82.id, this._handleBabylonTo3mfMatrixTransformToRef(s_53, Rs.Zero()));
|
|
4793
4899
|
}
|
|
4794
4900
|
}
|
|
4795
4901
|
}
|
|
4796
4902
|
}
|
|
4797
|
-
catch (
|
|
4903
|
+
catch (e_217_1) { e_217 = { error: e_217_1 }; }
|
|
4798
4904
|
finally {
|
|
4799
4905
|
try {
|
|
4800
4906
|
if (_g && !_g.done && (_a = _c.return)) _a.call(_c);
|
|
4801
4907
|
}
|
|
4802
|
-
finally { if (
|
|
4908
|
+
finally { if (e_217) throw e_217.error; }
|
|
4803
4909
|
}
|
|
4804
4910
|
}
|
|
4805
4911
|
return r.build();
|
|
4806
4912
|
};
|
|
4807
|
-
|
|
4913
|
+
Js.prototype.ensureZipLibReadyAsync = function () { return c(this, void 0, void 0, function () {
|
|
4808
4914
|
var _this = this;
|
|
4809
4915
|
return __generator(this, function (_a) {
|
|
4810
4916
|
switch (_a.label) {
|
|
@@ -4815,7 +4921,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4815
4921
|
e = globalThis;
|
|
4816
4922
|
_a = e.fflate;
|
|
4817
4923
|
if (_a) return [3 /*break*/, 2];
|
|
4818
|
-
return [4 /*yield*/, t.Tools.LoadScriptAsync(
|
|
4924
|
+
return [4 /*yield*/, t.Tools.LoadScriptAsync(Zs.FFLATEUrl)];
|
|
4819
4925
|
case 1:
|
|
4820
4926
|
_a = (_b.sent());
|
|
4821
4927
|
_b.label = 2;
|
|
@@ -4827,81 +4933,81 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
4827
4933
|
}
|
|
4828
4934
|
});
|
|
4829
4935
|
}); };
|
|
4830
|
-
|
|
4831
|
-
return; var s = e.getVerticesData(
|
|
4936
|
+
Js.prototype._extractSubMesh = function (e, t) { var n = e.getIndices(); if (!n)
|
|
4937
|
+
return; var s = e.getVerticesData(Js._PositionKind); if (!s)
|
|
4832
4938
|
return; if (0 == t.indexStart && t.indexCount == n.length)
|
|
4833
|
-
return { positions: s, indices: n }; var r = t.indexStart, i = new Map, o = [], a = new Uint32Array(t.indexCount); for (var
|
|
4834
|
-
var
|
|
4835
|
-
var l_31 = i.get(
|
|
4939
|
+
return { positions: s, indices: n }; var r = t.indexStart, i = new Map, o = [], a = new Uint32Array(t.indexCount); for (var e_223 = 0; e_223 < t.indexCount; e_223++) {
|
|
4940
|
+
var t_99 = n[r + e_223];
|
|
4941
|
+
var l_31 = i.get(t_99);
|
|
4836
4942
|
if (void 0 === l_31) {
|
|
4837
|
-
l_31 = i.size, i.set(
|
|
4838
|
-
var
|
|
4839
|
-
o.push(s[
|
|
4943
|
+
l_31 = i.size, i.set(t_99, l_31);
|
|
4944
|
+
var e_224 = 3 * t_99;
|
|
4945
|
+
o.push(s[e_224], s[e_224 + 1], s[e_224 + 2]);
|
|
4840
4946
|
}
|
|
4841
|
-
a[
|
|
4947
|
+
a[e_223] = l_31;
|
|
4842
4948
|
} return { positions: new Float32Array(o), indices: a }; };
|
|
4843
|
-
|
|
4844
|
-
var
|
|
4949
|
+
Js.prototype._groupBy = function (e, t) {
|
|
4950
|
+
var e_225, _a;
|
|
4845
4951
|
var n = new Map;
|
|
4846
4952
|
try {
|
|
4847
|
-
for (var
|
|
4848
|
-
var s_54 =
|
|
4849
|
-
var
|
|
4850
|
-
r_58 ? r_58.push(s_54) : n.set(
|
|
4953
|
+
for (var e_226 = __values(e), e_226_1 = e_226.next(); !e_226_1.done; e_226_1 = e_226.next()) {
|
|
4954
|
+
var s_54 = e_226_1.value;
|
|
4955
|
+
var e_227 = t(s_54), r_58 = n.get(e_227);
|
|
4956
|
+
r_58 ? r_58.push(s_54) : n.set(e_227, [s_54]);
|
|
4851
4957
|
}
|
|
4852
4958
|
}
|
|
4853
|
-
catch (
|
|
4959
|
+
catch (e_225_1) { e_225 = { error: e_225_1 }; }
|
|
4854
4960
|
finally {
|
|
4855
4961
|
try {
|
|
4856
|
-
if (
|
|
4962
|
+
if (e_226_1 && !e_226_1.done && (_a = e_226.return)) _a.call(e_226);
|
|
4857
4963
|
}
|
|
4858
|
-
finally { if (
|
|
4964
|
+
finally { if (e_225) throw e_225.error; }
|
|
4859
4965
|
}
|
|
4860
4966
|
return n;
|
|
4861
4967
|
};
|
|
4862
|
-
|
|
4863
|
-
return
|
|
4864
|
-
}(
|
|
4865
|
-
|
|
4866
|
-
var
|
|
4867
|
-
var Zs = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4868
|
-
if (void 0 !== Zs)
|
|
4869
|
-
for (var e_219 in Cn)
|
|
4870
|
-
Zs.BABYLON[e_219] = Cn[e_219];
|
|
4871
|
-
var Ys = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4872
|
-
if (void 0 !== Ys) {
|
|
4873
|
-
Ys.BABYLON = Ys.BABYLON || {};
|
|
4874
|
-
var e_220 = Ys.BABYLON;
|
|
4875
|
-
e_220.GLTF2 = e_220.GLTF2 || {}, e_220.GLTF2.Exporter = e_220.GLTF2.Exporter || {}, e_220.GLTF2.Exporter.Extensions = e_220.GLTF2.Exporter.Extensions || {};
|
|
4876
|
-
var t_98 = [];
|
|
4877
|
-
for (var n_81 in r)
|
|
4878
|
-
e_220[n_81] = r[n_81], t_98.push(n_81);
|
|
4879
|
-
for (var n_82 in o)
|
|
4880
|
-
e_220[n_82] = o[n_82], t_98.push(n_82);
|
|
4881
|
-
for (var n_83 in J)
|
|
4882
|
-
e_220[n_83] = J[n_83], t_98.push(n_83);
|
|
4883
|
-
for (var n_84 in on)
|
|
4884
|
-
e_220.GLTF2.Exporter.Extensions[n_84] = on[n_84], t_98.push(n_84);
|
|
4885
|
-
for (var n_85 in an)
|
|
4886
|
-
t_98.indexOf(n_85) > -1 || (e_220.GLTF2.Exporter[n_85] = an[n_85]);
|
|
4887
|
-
}
|
|
4888
|
-
var Js = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4889
|
-
if (void 0 !== Js)
|
|
4890
|
-
for (var e_221 in s)
|
|
4891
|
-
Js.BABYLON[e_221] = s[e_221];
|
|
4892
|
-
var er = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4893
|
-
if (void 0 !== er)
|
|
4894
|
-
for (var e_222 in un)
|
|
4895
|
-
er.BABYLON[e_222] = un[e_222];
|
|
4968
|
+
Js.prototype._handleBabylonTo3mfMatrixTransformToRef = function (e, n) { var s = e.multiplyToRef(Js._R_BJS_TO_3MF, t.Matrix.Zero()).m; return n.values = [s[0], s[1], s[2], s[4], s[5], s[6], s[8], s[9], s[10], s[12], s[13], s[14]], n; };
|
|
4969
|
+
return Js;
|
|
4970
|
+
}(Xs));
|
|
4971
|
+
Js.DefaultOptions = { unit: e.ST_Unit.meter, exportInstances: !1 }, Js._PositionKind = "position", Js._R_BJS_TO_3MF = t.Matrix.RotationX(Math.PI / 2).multiply(t.Matrix.Scaling(1, -1, 1));
|
|
4972
|
+
var er = { __proto__: null, AbstractThreeMfSerializer: Xs, ContentTypeFileName: _s, DefaultXmlSerializerFormatOptions: jn, DefaultXmlSerializerNumberOptions: Hn, GetXmlFieldMeta: $n, GetXmlName: zn, IsQualifiedName: Vn, Known3mfRelationshipTypes: Ts, get KnownI3mfContentType() { return e.KnownI3mfContentType; }, Matrix3d: Rs, MatrixFormatter: As, ModelFileName: gs, NumberFormatter: Xn, Object3dDirName: ms, OpenXmlContentTypesNamespace: hs, OpenXmlRelationshipsNamespace: ds, RelationshipDirName: ps, RelationshipFileName: xs, ResolveFormatOptions: Gn, ResolveNumberOptions: qn, get ST_ObjectType() { return e.ST_ObjectType; }, get ST_Unit() { return e.ST_Unit; }, StringXmlWriter: is, ThreeDimModelNamespace: as, ThreeMf: Qs, ThreeMfBase: $s, ThreeMfBaseMaterials: Ks, ThreeMfBuild: zs, ThreeMfComponent: ks, ThreeMfComponents: Us, ThreeMfComponentsBuilder: Ls, ThreeMfContentType: bs, ThreeMfContentTypes: ys, ThreeMfDocument: ws, ThreeMfDocumentBuilder: Gs, ThreeMfItem: Ws, ThreeMfMaterialBuilder: js, ThreeMfMesh: Vs, ThreeMfMeshBuilder: Hs, ThreeMfMeta: Es, ThreeMfMetadataGroup: Is, ThreeMfModel: Cs, ThreeMfModelBuilder: qs, ThreeMfObject: Fs, ThreeMfObjectBuilder: Ds, ThreeMfRelationship: Ms, ThreeMfRelationships: vs, ThreeMfResources: Ss, ThreeMfSerializer: Js, ThreeMfSerializerGlobalConfiguration: Zs, ThreeMfTriangle: Ps, ThreeMfTriangles: Ns, ThreeMfVertex: Bs, ThreeMfVertices: Os, ToQualifiedString: Ln, get TokenType() { return e.TokenType; }, TriangleSetsNamespace: ls, Utf8XmlWriterToBytes: os, XmlAttr: kn, XmlBuilder: rs, XmlElem: Kn, XmlIgnore: Un, XmlName: Pn, XmlNameToParts: Dn, XmlSerializer: ts };
|
|
4896
4973
|
var tr = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4897
4974
|
if (void 0 !== tr)
|
|
4898
|
-
for (var
|
|
4899
|
-
tr.BABYLON[
|
|
4975
|
+
for (var e_228 in Fn)
|
|
4976
|
+
tr.BABYLON[e_228] = Fn[e_228];
|
|
4900
4977
|
var nr = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4901
4978
|
if (void 0 !== nr) {
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4979
|
+
nr.BABYLON = nr.BABYLON || {};
|
|
4980
|
+
var e_229 = nr.BABYLON;
|
|
4981
|
+
e_229.GLTF2 = e_229.GLTF2 || {}, e_229.GLTF2.Exporter = e_229.GLTF2.Exporter || {}, e_229.GLTF2.Exporter.Extensions = e_229.GLTF2.Exporter.Extensions || {};
|
|
4982
|
+
var t_100 = [];
|
|
4983
|
+
for (var n_83 in r)
|
|
4984
|
+
e_229[n_83] = r[n_83], t_100.push(n_83);
|
|
4985
|
+
for (var n_84 in o)
|
|
4986
|
+
e_229[n_84] = o[n_84], t_100.push(n_84);
|
|
4987
|
+
for (var n_85 in J)
|
|
4988
|
+
e_229[n_85] = J[n_85], t_100.push(n_85);
|
|
4989
|
+
for (var n_86 in cn)
|
|
4990
|
+
e_229.GLTF2.Exporter.Extensions[n_86] = cn[n_86], t_100.push(n_86);
|
|
4991
|
+
for (var n_87 in hn)
|
|
4992
|
+
t_100.indexOf(n_87) > -1 || (e_229.GLTF2.Exporter[n_87] = hn[n_87]);
|
|
4993
|
+
}
|
|
4994
|
+
var sr = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4995
|
+
if (void 0 !== sr)
|
|
4996
|
+
for (var e_230 in s)
|
|
4997
|
+
sr.BABYLON[e_230] = s[e_230];
|
|
4998
|
+
var rr = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
4999
|
+
if (void 0 !== rr)
|
|
5000
|
+
for (var e_231 in fn)
|
|
5001
|
+
rr.BABYLON[e_231] = fn[e_231];
|
|
5002
|
+
var ir = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
5003
|
+
if (void 0 !== ir)
|
|
5004
|
+
for (var e_232 in In)
|
|
5005
|
+
ir.BABYLON[e_232] = In[e_232];
|
|
5006
|
+
var or = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
5007
|
+
if (void 0 !== or) {
|
|
5008
|
+
var e_233 = [];
|
|
5009
|
+
for (var t_101 in er)
|
|
5010
|
+
e_233.indexOf(t_101) > -1 || (or.BABYLON[t_101] = er[t_101], e_233.push(t_101));
|
|
4905
5011
|
}
|
|
4906
|
-
e.AbstractThreeMfSerializer =
|
|
5012
|
+
e.AbstractThreeMfSerializer = Xs, e.BVHExporter = Sn, e.ContentTypeFileName = _s, e.DefaultXmlSerializerFormatOptions = jn, e.DefaultXmlSerializerNumberOptions = Hn, e.EXT_lights_area = Re, e.EXT_mesh_gpu_instancing = ne, e.EXT_texture_avif = an, e.EXT_texture_webp = nn, e.GLTF2Export = Y, e.GLTFData = i, e.GetXmlFieldMeta = $n, e.GetXmlName = zn, e.IsQualifiedName = Vn, e.KHR_draco_mesh_compression = ae, e.KHR_interactivity = _e, e.KHR_lights_punctual = pe, e.KHR_materials_anisotropy = Ie, e.KHR_materials_clearcoat = Be, e.KHR_materials_coat = $e, e.KHR_materials_diffuse_roughness = $t, e.KHR_materials_diffuse_transmission = He, e.KHR_materials_dispersion = Xe, e.KHR_materials_emissive_strength = Je, e.KHR_materials_fuzz = gt, e.KHR_materials_ior = st, e.KHR_materials_iridescence = at, e.KHR_materials_openpbr = Lt, e.KHR_materials_sheen = ht, e.KHR_materials_specular = yt, e.KHR_materials_transmission = wt, e.KHR_materials_unlit = Et, e.KHR_materials_volume = Vt, e.KHR_materials_volume_scatter = Pt, e.KHR_texture_basisu = Yt, e.KHR_texture_transform = Gt, e.Known3mfRelationshipTypes = Ts, e.Matrix3d = Rs, e.MatrixFormatter = As, e.ModelFileName = gs, e.NumberFormatter = Xn, e.OBJExport = n, e.Object3dDirName = ms, e.OpenXmlContentTypesNamespace = hs, e.OpenXmlRelationshipsNamespace = ds, e.RegisterEXT_lights_area = Ce, e.RegisterEXT_mesh_gpu_instancing = re, e.RegisterEXT_texture_avif = un, e.RegisterEXT_texture_webp = rn, e.RegisterKHR_draco_mesh_compression = ue, e.RegisterKHR_interactivity = ye, e.RegisterKHR_lights_punctual = ge, e.RegisterKHR_materials_anisotropy = Fe, e.RegisterKHR_materials_clearcoat = Pe, e.RegisterKHR_materials_coat = We, e.RegisterKHR_materials_diffuse_roughness = Wt, e.RegisterKHR_materials_diffuse_transmission = qe, e.RegisterKHR_materials_dispersion = Ze, e.RegisterKHR_materials_emissive_strength = tt, e.RegisterKHR_materials_fuzz = _t, e.RegisterKHR_materials_ior = it, e.RegisterKHR_materials_iridescence = ut, e.RegisterKHR_materials_openpbr = jt, e.RegisterKHR_materials_sheen = ft, e.RegisterKHR_materials_specular = vt, e.RegisterKHR_materials_transmission = At, e.RegisterKHR_materials_unlit = St, e.RegisterKHR_materials_volume = Bt, e.RegisterKHR_materials_volume_scatter = kt, e.RegisterKHR_texture_basisu = en, e.RegisterKHR_texture_transform = Qt, e.RelationshipDirName = ps, e.RelationshipFileName = xs, e.ResolveFormatOptions = Gn, e.ResolveNumberOptions = qn, e.STLExport = dn, e.StringXmlWriter = is, e.ThreeDimModelNamespace = as, e.ThreeMf = Qs, e.ThreeMfBase = $s, e.ThreeMfBaseMaterials = Ks, e.ThreeMfBuild = zs, e.ThreeMfComponent = ks, e.ThreeMfComponents = Us, e.ThreeMfComponentsBuilder = Ls, e.ThreeMfContentType = bs, e.ThreeMfContentTypes = ys, e.ThreeMfDocument = ws, e.ThreeMfDocumentBuilder = Gs, e.ThreeMfItem = Ws, e.ThreeMfMaterialBuilder = js, e.ThreeMfMesh = Vs, e.ThreeMfMeshBuilder = Hs, e.ThreeMfMeta = Es, e.ThreeMfMetadataGroup = Is, e.ThreeMfModel = Cs, e.ThreeMfModelBuilder = qs, e.ThreeMfObject = Fs, e.ThreeMfObjectBuilder = Ds, e.ThreeMfRelationship = Ms, e.ThreeMfRelationships = vs, e.ThreeMfResources = Ss, e.ThreeMfSerializer = Js, e.ThreeMfSerializerGlobalConfiguration = Zs, e.ThreeMfTriangle = Ps, e.ThreeMfTriangles = Ns, e.ThreeMfVertex = Bs, e.ThreeMfVertices = Os, e.ToQualifiedString = Ln, e.TriangleSetsNamespace = ls, e.USDZExportAsync = En, e.Utf8XmlWriterToBytes = os, e.XmlAttr = kn, e.XmlBuilder = rs, e.XmlElem = Kn, e.XmlIgnore = Un, e.XmlName = Pn, e.XmlNameToParts = Dn, e.XmlSerializer = ts, e._ConvertToGLTFPBRMetallicRoughness = _, e._SolveMetallic = x, e.__IGLTFExporterExtension = 0;
|
|
4907
5013
|
});
|