ss-component-new 1.2.121 → 1.2.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MTLLoader-C0LsBewy.js +657 -0
- package/dist/MTLLoader-CoCCbd3x.cjs +6 -0
- package/dist/{OrbitControls-73QGXBgx.js → OrbitControls-33fCDmCo.js} +1 -1
- package/dist/{OrbitControls-nn1QAWCC.cjs → OrbitControls-BOsfMAtl.cjs} +1 -1
- package/dist/{animationData-DAR1Psji.js → animationData-DrOJvOmw.js} +1 -1
- package/dist/{animationData-Ij535Tj0.cjs → animationData-qyd-p-Ia.cjs} +1 -1
- package/dist/{iconfont-CJHykbIU.cjs → iconfont-CXfLYwJt.cjs} +1 -1
- package/dist/{iconfont-DfFi5cMT.js → iconfont-SQLdkUxD.js} +2 -2
- package/dist/{index-SK2R8Au3.js → index-27xIavMI.js} +3 -3
- package/dist/{index-BdICMliy.cjs → index-2gouIJwt.cjs} +2 -2
- package/dist/{index-ChDPZPsX.cjs → index-6m9_eoz2.cjs} +1 -1
- package/dist/{index-FmeTqV-z.cjs → index-925S4M1w.cjs} +1 -1
- package/dist/{index-B3XAh8gm.cjs → index-AK6NYu0u.cjs} +1 -1
- package/dist/{index-CnOxqbyO.cjs → index-B-xa8hpS.cjs} +1 -1
- package/dist/{index-BcRqxekC.cjs → index-B4nVDTEd.cjs} +1 -1
- package/dist/{index-C4trWxW0.cjs → index-BLUkgnsD.cjs} +1 -1
- package/dist/{index-L7Er1Xkn.js → index-BToHa_zG.js} +1 -1
- package/dist/{index-A57hDM9a.js → index-BYZj9xBC.js} +1 -1
- package/dist/{index-DsABDW9D.js → index-BYsAJ9zX.js} +3 -3
- package/dist/{index-hlssbOO3.js → index-BZv4Mmtr.js} +2 -2
- package/dist/{index-Ck4xHqWp.cjs → index-BaMUrnC-.cjs} +1 -1
- package/dist/{index-B8cT6gbr.cjs → index-BlILL9X2.cjs} +1 -1
- package/dist/{index-DXvlbTUX.cjs → index-BohZH-LY.cjs} +1 -1
- package/dist/{index-HEONGHaA.js → index-C11eE1Yh.js} +1 -1
- package/dist/{index-WXtrPIUb.cjs → index-C3RxziLy.cjs} +1 -1
- package/dist/{index-D3Iedo8k.js → index-C6atD1Q_.js} +6 -6
- package/dist/{index-Dn4ovLEw.cjs → index-CKrDUuTs.cjs} +1 -1
- package/dist/{index-CYrx4kMZ.cjs → index-CMNT44sP.cjs} +1 -1
- package/dist/{index-B4ax-cew.js → index-CRkUQszP.js} +131 -131
- package/dist/{index-B2sc_EIV.js → index-Cg0PixUa.js} +6 -6
- package/dist/{index-1sx5rdNK.cjs → index-ChPlrmkk.cjs} +1 -1
- package/dist/{index-DKtWCD8p.js → index-Cof7cnuP.js} +1 -1
- package/dist/{index-CwOWx2zX.cjs → index-D3s9H0iI.cjs} +1 -1
- package/dist/{index-CXVSplxS.js → index-DGGXADG1.js} +1 -1
- package/dist/{index-DdnkbwZU.cjs → index-DGygtXUq.cjs} +1 -1
- package/dist/{index-CGcDTU7m.js → index-DNwDV5C6.js} +3 -3
- package/dist/{index-Lmou0Dh-.cjs → index-DX_k3mya.cjs} +1 -1
- package/dist/{index-C3b3wO-F.js → index-DYXPwb6W.js} +9 -8
- package/dist/{index-CE4MFdkj.js → index-Daiy2LgO.js} +2 -2
- package/dist/{index-DeDBfYgx.js → index-Dc-Kfjz5.js} +1 -1
- package/dist/{index-BQIvl8vA.cjs → index-DjrCeYlk.cjs} +1 -1
- package/dist/{index-DTW2q40y.js → index-DoAUSaSw.js} +8 -8
- package/dist/{index-Bn0Dbcck.js → index-DoacqxV9.js} +2 -2
- package/dist/{index-BkhztLVb.js → index-DqCRd7Yb.js} +1 -1
- package/dist/{index-BzKqzHNY.cjs → index-I_sgP0JI.cjs} +1 -1
- package/dist/{index-BRuyTMcP.cjs → index-UFNl6xmT.cjs} +1 -1
- package/dist/{index-BQcWm9j-.cjs → index-bpgO5HEY.cjs} +1 -1
- package/dist/{index-Cvb_fmHO.js → index-mV5gESrD.js} +1 -1
- package/dist/{index-CG8drmPs.js → index-oMIzMm7Z.js} +13 -13
- package/dist/{index-DhZqGX5M.js → index-sSlmSdgl.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-CPSLiF_e.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BTP8TW2O.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-C4PvOEJj.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-OxPaUrzL.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-f4HnuW1V.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bd4plZAS.js} +8935 -8904
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BeChwhwq.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bo6DTOnK.cjs} +302 -302
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D4zYHB5Q.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-8-hEnIRz.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-CM-kfGD_.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-BtDOPz5u.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-BbGlPlCS.js → index.vue_vue_type_style_index_1_lang-BCCza-d5.js} +5 -6
- package/dist/{index.vue_vue_type_style_index_1_lang-CU4J66mB.cjs → index.vue_vue_type_style_index_1_lang-DWslriUG.cjs} +5 -5
- package/dist/{main-MrCi9qsL.cjs → main-BCaTwFJu.cjs} +1 -1
- package/dist/{main-BkfmaAvF.js → main-V0mDCPii.js} +2 -2
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +10 -10
- package/dist/{threeModel-CgvecinJ.js → threeModel-Ad5KT1yW.js} +4 -4
- package/dist/{threeModel-BjTvKKlz.cjs → threeModel-DfcHT3ZS.cjs} +1 -1
- package/dist/{threePreview-CpGJT5JF.js → threePreview-BrlTr4JW.js} +212 -212
- package/dist/threePreview-DBZPsXca.cjs +1 -0
- package/dist/threeSceneView-DP4C1cYr.cjs +5 -0
- package/dist/threeSceneView-DdT-UW1x.js +1347 -0
- package/dist/{threeSceneViewForCPMPIP-P5_VO8mK.js → threeSceneViewForCPMPIP-G-5xA6EZ.js} +263 -260
- package/dist/threeSceneViewForCPMPIP-ZZf6A2CS.cjs +5 -0
- package/dist/threeTrackPathView-BSjFCxv3.cjs +1 -0
- package/dist/threeTrackPathView-mh1DG86W.js +677 -0
- package/dist/{threeViewerHost-BrW-Q5yS.cjs → threeViewerHost-C0wrNEUU.cjs} +2 -2
- package/dist/{threeViewerHost-BnkccBX4.js → threeViewerHost-dLE8RsT_.js} +21 -20
- package/dist/{urdfTree-B5MFR-vI.js → urdfTree-DOatbQGU.js} +1 -1
- package/dist/{urdfTree-DcDCH-Mt.cjs → urdfTree-wEKL0XU1.cjs} +1 -1
- package/dist/workpieceTreePanel-B0beNKeI.cjs +1 -0
- package/dist/{workpieceTreePanel-CwWOx6nS.js → workpieceTreePanel-SfTsgYWM.js} +25 -26
- package/package.json +1 -1
- package/dist/MTLLoader-BU0Uj5jP.cjs +0 -2
- package/dist/MTLLoader-BoGYC8Ei.js +0 -304
- package/dist/OBJLoader-Cixm3SxG.cjs +0 -5
- package/dist/OBJLoader-qEN5sPHA.js +0 -356
- package/dist/loaderUtil-B592P_6Y.js +0 -5
- package/dist/loaderUtil-BdpTKBk4.cjs +0 -1
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/dist/threePreview-CZUHJyvq.cjs +0 -1
- package/dist/threeSceneView-BqpYM5f8.js +0 -1341
- package/dist/threeSceneView-C15fSMC0.cjs +0 -5
- package/dist/threeSceneViewForCPMPIP-BgO2g3cI.cjs +0 -5
- package/dist/threeTrackPathView-6Gz7GbWR.cjs +0 -1
- package/dist/threeTrackPathView-T-i6Ljm_.js +0 -664
- package/dist/workpieceTreePanel-CNXYaSy_.cjs +0 -1
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { O as Y, R as Z, w as D, C as P, f as S, a5 as H, V as O, aF as _, u as ie, ai as N, ah as Q, ag as R, o as ne, am as X, ao as W, k as K, Q as ae, aB as oe, ad as le, aA as q, Y as $, aV as ce, a3 as he } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bd4plZAS.js";
|
|
2
|
+
class xe extends Y {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new STL loader.
|
|
5
|
+
*
|
|
6
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
7
|
+
*/
|
|
8
|
+
constructor(t) {
|
|
9
|
+
super(t);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Starts loading from the given URL and passes the loaded STL asset
|
|
13
|
+
* to the `onLoad()` callback.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
16
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
|
|
17
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
18
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
19
|
+
*/
|
|
20
|
+
load(t, s, i, e) {
|
|
21
|
+
const r = this, c = new Z(this.manager);
|
|
22
|
+
c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(t, function(h) {
|
|
23
|
+
try {
|
|
24
|
+
s(r.parse(h));
|
|
25
|
+
} catch (l) {
|
|
26
|
+
e ? e(l) : console.error(l), r.manager.itemError(t);
|
|
27
|
+
}
|
|
28
|
+
}, i, e);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parses the given STL data and returns the resulting geometry.
|
|
32
|
+
*
|
|
33
|
+
* @param {ArrayBuffer} data - The raw STL data as an array buffer.
|
|
34
|
+
* @return {BufferGeometry} The parsed geometry.
|
|
35
|
+
*/
|
|
36
|
+
parse(t) {
|
|
37
|
+
function s(n) {
|
|
38
|
+
const a = new DataView(n), o = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8, u = a.getUint32(80, !0);
|
|
39
|
+
if (80 + 32 / 8 + u * o === a.byteLength)
|
|
40
|
+
return !0;
|
|
41
|
+
const m = [115, 111, 108, 105, 100];
|
|
42
|
+
for (let p = 0; p < 5; p++)
|
|
43
|
+
if (i(m, a, p)) return !1;
|
|
44
|
+
return !0;
|
|
45
|
+
}
|
|
46
|
+
function i(n, a, o) {
|
|
47
|
+
for (let u = 0, d = n.length; u < d; u++)
|
|
48
|
+
if (n[u] !== a.getUint8(o + u)) return !1;
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
function e(n) {
|
|
52
|
+
const a = new DataView(n), o = a.getUint32(80, !0);
|
|
53
|
+
let u, d, m, p = !1, g, b, x, C, v;
|
|
54
|
+
for (let y = 0; y < 70; y++)
|
|
55
|
+
a.getUint32(y, !1) == 1129270351 && a.getUint8(y + 4) == 82 && a.getUint8(y + 5) == 61 && (p = !0, g = new Float32Array(o * 3 * 3), b = a.getUint8(y + 6) / 255, x = a.getUint8(y + 7) / 255, C = a.getUint8(y + 8) / 255, v = a.getUint8(y + 9) / 255);
|
|
56
|
+
const j = 84, f = 12 * 4 + 2, w = new D(), A = new Float32Array(o * 3 * 3), M = new Float32Array(o * 3 * 3), k = new P();
|
|
57
|
+
for (let y = 0; y < o; y++) {
|
|
58
|
+
const U = j + y * f, E = a.getFloat32(U, !0), z = a.getFloat32(U + 4, !0), B = a.getFloat32(U + 8, !0);
|
|
59
|
+
if (p) {
|
|
60
|
+
const F = a.getUint16(U + 48, !0);
|
|
61
|
+
(F & 32768) === 0 ? (u = (F & 31) / 31, d = (F >> 5 & 31) / 31, m = (F >> 10 & 31) / 31) : (u = b, d = x, m = C);
|
|
62
|
+
}
|
|
63
|
+
for (let F = 1; F <= 3; F++) {
|
|
64
|
+
const G = U + F * 12, V = y * 3 * 3 + (F - 1) * 3;
|
|
65
|
+
A[V] = a.getFloat32(G, !0), A[V + 1] = a.getFloat32(G + 4, !0), A[V + 2] = a.getFloat32(G + 8, !0), M[V] = E, M[V + 1] = z, M[V + 2] = B, p && (k.setRGB(u, d, m, S), g[V] = k.r, g[V + 1] = k.g, g[V + 2] = k.b);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return w.setAttribute("position", new H(A, 3)), w.setAttribute("normal", new H(M, 3)), p && (w.setAttribute("color", new H(g, 3)), w.hasColors = !0, w.alpha = v), w;
|
|
69
|
+
}
|
|
70
|
+
function r(n) {
|
|
71
|
+
const a = new D(), o = /solid([\s\S]*?)endsolid/g, u = /facet([\s\S]*?)endfacet/g, d = /solid\s(.+)/;
|
|
72
|
+
let m = 0;
|
|
73
|
+
const p = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, g = new RegExp("vertex" + p + p + p, "g"), b = new RegExp("normal" + p + p + p, "g"), x = [], C = [], v = [], j = new O();
|
|
74
|
+
let f, w = 0, A = 0, M = 0;
|
|
75
|
+
for (; (f = o.exec(n)) !== null; ) {
|
|
76
|
+
A = M;
|
|
77
|
+
const k = f[0], y = (f = d.exec(k)) !== null ? f[1] : "";
|
|
78
|
+
for (v.push(y); (f = u.exec(k)) !== null; ) {
|
|
79
|
+
let z = 0, B = 0;
|
|
80
|
+
const F = f[0];
|
|
81
|
+
for (; (f = b.exec(F)) !== null; )
|
|
82
|
+
j.x = parseFloat(f[1]), j.y = parseFloat(f[2]), j.z = parseFloat(f[3]), B++;
|
|
83
|
+
for (; (f = g.exec(F)) !== null; )
|
|
84
|
+
x.push(parseFloat(f[1]), parseFloat(f[2]), parseFloat(f[3])), C.push(j.x, j.y, j.z), z++, M++;
|
|
85
|
+
B !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + m), z !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + m), m++;
|
|
86
|
+
}
|
|
87
|
+
const U = A, E = M - A;
|
|
88
|
+
a.userData.groupNames = v, a.addGroup(U, E, w), w++;
|
|
89
|
+
}
|
|
90
|
+
return a.setAttribute("position", new _(x, 3)), a.setAttribute("normal", new _(C, 3)), a;
|
|
91
|
+
}
|
|
92
|
+
function c(n) {
|
|
93
|
+
return typeof n != "string" ? new TextDecoder().decode(n) : n;
|
|
94
|
+
}
|
|
95
|
+
function h(n) {
|
|
96
|
+
if (typeof n == "string") {
|
|
97
|
+
const a = new Uint8Array(n.length);
|
|
98
|
+
for (let o = 0; o < n.length; o++)
|
|
99
|
+
a[o] = n.charCodeAt(o) & 255;
|
|
100
|
+
return a.buffer || a;
|
|
101
|
+
} else
|
|
102
|
+
return n;
|
|
103
|
+
}
|
|
104
|
+
const l = h(t);
|
|
105
|
+
return s(l) ? e(l) : r(c(t));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const ue = /^[og]\s*(.+)?/, pe = /^mtllib /, fe = /^usemtl /, de = /^usemap /, ee = /\s+/, te = new O(), J = new O(), se = new O(), re = new O(), L = new O(), T = new P();
|
|
109
|
+
function me() {
|
|
110
|
+
const I = {
|
|
111
|
+
objects: [],
|
|
112
|
+
object: {},
|
|
113
|
+
vertices: [],
|
|
114
|
+
normals: [],
|
|
115
|
+
colors: [],
|
|
116
|
+
uvs: [],
|
|
117
|
+
materials: {},
|
|
118
|
+
materialLibraries: [],
|
|
119
|
+
startObject: function(t, s) {
|
|
120
|
+
if (this.object && this.object.fromDeclaration === !1) {
|
|
121
|
+
this.object.name = t, this.object.fromDeclaration = s !== !1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const i = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
|
|
125
|
+
if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = {
|
|
126
|
+
name: t || "",
|
|
127
|
+
fromDeclaration: s !== !1,
|
|
128
|
+
geometry: {
|
|
129
|
+
vertices: [],
|
|
130
|
+
normals: [],
|
|
131
|
+
colors: [],
|
|
132
|
+
uvs: [],
|
|
133
|
+
hasUVIndices: !1
|
|
134
|
+
},
|
|
135
|
+
materials: [],
|
|
136
|
+
smooth: !0,
|
|
137
|
+
startMaterial: function(e, r) {
|
|
138
|
+
const c = this._finalize(!1);
|
|
139
|
+
c && (c.inherited || c.groupCount <= 0) && this.materials.splice(c.index, 1);
|
|
140
|
+
const h = {
|
|
141
|
+
index: this.materials.length,
|
|
142
|
+
name: e || "",
|
|
143
|
+
mtllib: Array.isArray(r) && r.length > 0 ? r[r.length - 1] : "",
|
|
144
|
+
smooth: c !== void 0 ? c.smooth : this.smooth,
|
|
145
|
+
groupStart: c !== void 0 ? c.groupEnd : 0,
|
|
146
|
+
groupEnd: -1,
|
|
147
|
+
groupCount: -1,
|
|
148
|
+
inherited: !1,
|
|
149
|
+
clone: function(l) {
|
|
150
|
+
const n = {
|
|
151
|
+
index: typeof l == "number" ? l : this.index,
|
|
152
|
+
name: this.name,
|
|
153
|
+
mtllib: this.mtllib,
|
|
154
|
+
smooth: this.smooth,
|
|
155
|
+
groupStart: 0,
|
|
156
|
+
groupEnd: -1,
|
|
157
|
+
groupCount: -1,
|
|
158
|
+
inherited: !1
|
|
159
|
+
};
|
|
160
|
+
return n.clone = this.clone.bind(n), n;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return this.materials.push(h), h;
|
|
164
|
+
},
|
|
165
|
+
currentMaterial: function() {
|
|
166
|
+
if (this.materials.length > 0)
|
|
167
|
+
return this.materials[this.materials.length - 1];
|
|
168
|
+
},
|
|
169
|
+
_finalize: function(e) {
|
|
170
|
+
const r = this.currentMaterial();
|
|
171
|
+
if (r && r.groupEnd === -1 && (r.groupEnd = this.geometry.vertices.length / 3, r.groupCount = r.groupEnd - r.groupStart, r.inherited = !1), e && this.materials.length > 1)
|
|
172
|
+
for (let c = this.materials.length - 1; c >= 0; c--)
|
|
173
|
+
this.materials[c].groupCount <= 0 && this.materials.splice(c, 1);
|
|
174
|
+
return e && this.materials.length === 0 && this.materials.push({
|
|
175
|
+
name: "",
|
|
176
|
+
smooth: this.smooth
|
|
177
|
+
}), r;
|
|
178
|
+
}
|
|
179
|
+
}, i && i.name && typeof i.clone == "function") {
|
|
180
|
+
const e = i.clone(0);
|
|
181
|
+
e.inherited = !0, this.object.materials.push(e);
|
|
182
|
+
}
|
|
183
|
+
this.objects.push(this.object);
|
|
184
|
+
},
|
|
185
|
+
finalize: function() {
|
|
186
|
+
this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
|
|
187
|
+
},
|
|
188
|
+
parseVertexIndex: function(t, s) {
|
|
189
|
+
const i = parseInt(t, 10);
|
|
190
|
+
return (i >= 0 ? i - 1 : i + s / 3) * 3;
|
|
191
|
+
},
|
|
192
|
+
parseNormalIndex: function(t, s) {
|
|
193
|
+
const i = parseInt(t, 10);
|
|
194
|
+
return (i >= 0 ? i - 1 : i + s / 3) * 3;
|
|
195
|
+
},
|
|
196
|
+
parseUVIndex: function(t, s) {
|
|
197
|
+
const i = parseInt(t, 10);
|
|
198
|
+
return (i >= 0 ? i - 1 : i + s / 2) * 2;
|
|
199
|
+
},
|
|
200
|
+
addVertex: function(t, s, i) {
|
|
201
|
+
const e = this.vertices, r = this.object.geometry.vertices;
|
|
202
|
+
r.push(e[t + 0], e[t + 1], e[t + 2]), r.push(e[s + 0], e[s + 1], e[s + 2]), r.push(e[i + 0], e[i + 1], e[i + 2]);
|
|
203
|
+
},
|
|
204
|
+
addVertexPoint: function(t) {
|
|
205
|
+
const s = this.vertices;
|
|
206
|
+
this.object.geometry.vertices.push(s[t + 0], s[t + 1], s[t + 2]);
|
|
207
|
+
},
|
|
208
|
+
addVertexLine: function(t) {
|
|
209
|
+
const s = this.vertices;
|
|
210
|
+
this.object.geometry.vertices.push(s[t + 0], s[t + 1], s[t + 2]);
|
|
211
|
+
},
|
|
212
|
+
addNormal: function(t, s, i) {
|
|
213
|
+
const e = this.normals, r = this.object.geometry.normals;
|
|
214
|
+
r.push(e[t + 0], e[t + 1], e[t + 2]), r.push(e[s + 0], e[s + 1], e[s + 2]), r.push(e[i + 0], e[i + 1], e[i + 2]);
|
|
215
|
+
},
|
|
216
|
+
addFaceNormal: function(t, s, i) {
|
|
217
|
+
const e = this.vertices, r = this.object.geometry.normals;
|
|
218
|
+
te.fromArray(e, t), J.fromArray(e, s), se.fromArray(e, i), L.subVectors(se, J), re.subVectors(te, J), L.cross(re), L.normalize(), r.push(L.x, L.y, L.z), r.push(L.x, L.y, L.z), r.push(L.x, L.y, L.z);
|
|
219
|
+
},
|
|
220
|
+
addColor: function(t, s, i) {
|
|
221
|
+
const e = this.colors, r = this.object.geometry.colors;
|
|
222
|
+
e[t] !== void 0 && r.push(e[t + 0], e[t + 1], e[t + 2]), e[s] !== void 0 && r.push(e[s + 0], e[s + 1], e[s + 2]), e[i] !== void 0 && r.push(e[i + 0], e[i + 1], e[i + 2]);
|
|
223
|
+
},
|
|
224
|
+
addUV: function(t, s, i) {
|
|
225
|
+
const e = this.uvs, r = this.object.geometry.uvs;
|
|
226
|
+
r.push(e[t + 0], e[t + 1]), r.push(e[s + 0], e[s + 1]), r.push(e[i + 0], e[i + 1]);
|
|
227
|
+
},
|
|
228
|
+
addDefaultUV: function() {
|
|
229
|
+
const t = this.object.geometry.uvs;
|
|
230
|
+
t.push(0, 0), t.push(0, 0), t.push(0, 0);
|
|
231
|
+
},
|
|
232
|
+
addUVLine: function(t) {
|
|
233
|
+
const s = this.uvs;
|
|
234
|
+
this.object.geometry.uvs.push(s[t + 0], s[t + 1]);
|
|
235
|
+
},
|
|
236
|
+
addFace: function(t, s, i, e, r, c, h, l, n) {
|
|
237
|
+
const a = this.vertices.length;
|
|
238
|
+
let o = this.parseVertexIndex(t, a), u = this.parseVertexIndex(s, a), d = this.parseVertexIndex(i, a);
|
|
239
|
+
if (this.addVertex(o, u, d), this.addColor(o, u, d), h !== void 0 && h !== "") {
|
|
240
|
+
const m = this.normals.length;
|
|
241
|
+
o = this.parseNormalIndex(h, m), u = this.parseNormalIndex(l, m), d = this.parseNormalIndex(n, m), this.addNormal(o, u, d);
|
|
242
|
+
} else
|
|
243
|
+
this.addFaceNormal(o, u, d);
|
|
244
|
+
if (e !== void 0 && e !== "") {
|
|
245
|
+
const m = this.uvs.length;
|
|
246
|
+
o = this.parseUVIndex(e, m), u = this.parseUVIndex(r, m), d = this.parseUVIndex(c, m), this.addUV(o, u, d), this.object.geometry.hasUVIndices = !0;
|
|
247
|
+
} else
|
|
248
|
+
this.addDefaultUV();
|
|
249
|
+
},
|
|
250
|
+
addPointGeometry: function(t) {
|
|
251
|
+
this.object.geometry.type = "Points";
|
|
252
|
+
const s = this.vertices.length;
|
|
253
|
+
for (let i = 0, e = t.length; i < e; i++) {
|
|
254
|
+
const r = this.parseVertexIndex(t[i], s);
|
|
255
|
+
this.addVertexPoint(r), this.addColor(r);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
addLineGeometry: function(t, s) {
|
|
259
|
+
this.object.geometry.type = "Line";
|
|
260
|
+
const i = this.vertices.length, e = this.uvs.length;
|
|
261
|
+
for (let r = 0, c = t.length; r < c; r++)
|
|
262
|
+
this.addVertexLine(this.parseVertexIndex(t[r], i));
|
|
263
|
+
for (let r = 0, c = s.length; r < c; r++)
|
|
264
|
+
this.addUVLine(this.parseUVIndex(s[r], e));
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
return I.startObject("", !1), I;
|
|
268
|
+
}
|
|
269
|
+
class we extends Y {
|
|
270
|
+
/**
|
|
271
|
+
* Constructs a new OBJ loader.
|
|
272
|
+
*
|
|
273
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
274
|
+
*/
|
|
275
|
+
constructor(t) {
|
|
276
|
+
super(t), this.materials = null;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Starts loading from the given URL and passes the loaded OBJ asset
|
|
280
|
+
* to the `onLoad()` callback.
|
|
281
|
+
*
|
|
282
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
283
|
+
* @param {function(Group)} onLoad - Executed when the loading process has been finished.
|
|
284
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
285
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
286
|
+
*/
|
|
287
|
+
load(t, s, i, e) {
|
|
288
|
+
const r = this, c = new Z(this.manager);
|
|
289
|
+
c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(t, function(h) {
|
|
290
|
+
try {
|
|
291
|
+
s(r.parse(h));
|
|
292
|
+
} catch (l) {
|
|
293
|
+
e ? e(l) : console.error(l), r.manager.itemError(t);
|
|
294
|
+
}
|
|
295
|
+
}, i, e);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Sets the material creator for this OBJ. This object is loaded via {@link MTLLoader}.
|
|
299
|
+
*
|
|
300
|
+
* @param {MaterialCreator} materials - An object that creates the materials for this OBJ.
|
|
301
|
+
* @return {OBJLoader} A reference to this loader.
|
|
302
|
+
*/
|
|
303
|
+
setMaterials(t) {
|
|
304
|
+
return this.materials = t, this;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Parses the given OBJ data and returns the resulting group.
|
|
308
|
+
*
|
|
309
|
+
* @param {string} text - The raw OBJ data as a string.
|
|
310
|
+
* @return {Group} The parsed OBJ.
|
|
311
|
+
*/
|
|
312
|
+
parse(t) {
|
|
313
|
+
const s = new me();
|
|
314
|
+
t.indexOf(`\r
|
|
315
|
+
`) !== -1 && (t = t.replace(/\r\n/g, `
|
|
316
|
+
`)), t.indexOf(`\\
|
|
317
|
+
`) !== -1 && (t = t.replace(/\\\n/g, ""));
|
|
318
|
+
const i = t.split(`
|
|
319
|
+
`);
|
|
320
|
+
let e = [];
|
|
321
|
+
for (let h = 0, l = i.length; h < l; h++) {
|
|
322
|
+
const n = i[h].trimStart();
|
|
323
|
+
if (n.length === 0) continue;
|
|
324
|
+
const a = n.charAt(0);
|
|
325
|
+
if (a !== "#")
|
|
326
|
+
if (a === "v") {
|
|
327
|
+
const o = n.split(ee);
|
|
328
|
+
switch (o[0]) {
|
|
329
|
+
case "v":
|
|
330
|
+
s.vertices.push(
|
|
331
|
+
parseFloat(o[1]),
|
|
332
|
+
parseFloat(o[2]),
|
|
333
|
+
parseFloat(o[3])
|
|
334
|
+
), o.length >= 7 ? (T.setRGB(
|
|
335
|
+
parseFloat(o[4]),
|
|
336
|
+
parseFloat(o[5]),
|
|
337
|
+
parseFloat(o[6]),
|
|
338
|
+
S
|
|
339
|
+
), s.colors.push(T.r, T.g, T.b)) : s.colors.push(void 0, void 0, void 0);
|
|
340
|
+
break;
|
|
341
|
+
case "vn":
|
|
342
|
+
s.normals.push(
|
|
343
|
+
parseFloat(o[1]),
|
|
344
|
+
parseFloat(o[2]),
|
|
345
|
+
parseFloat(o[3])
|
|
346
|
+
);
|
|
347
|
+
break;
|
|
348
|
+
case "vt":
|
|
349
|
+
s.uvs.push(
|
|
350
|
+
parseFloat(o[1]),
|
|
351
|
+
parseFloat(o[2])
|
|
352
|
+
);
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
} else if (a === "f") {
|
|
356
|
+
const u = n.slice(1).trim().split(ee), d = [];
|
|
357
|
+
for (let p = 0, g = u.length; p < g; p++) {
|
|
358
|
+
const b = u[p];
|
|
359
|
+
if (b.length > 0) {
|
|
360
|
+
const x = b.split("/");
|
|
361
|
+
d.push(x);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const m = d[0];
|
|
365
|
+
for (let p = 1, g = d.length - 1; p < g; p++) {
|
|
366
|
+
const b = d[p], x = d[p + 1];
|
|
367
|
+
s.addFace(
|
|
368
|
+
m[0],
|
|
369
|
+
b[0],
|
|
370
|
+
x[0],
|
|
371
|
+
m[1],
|
|
372
|
+
b[1],
|
|
373
|
+
x[1],
|
|
374
|
+
m[2],
|
|
375
|
+
b[2],
|
|
376
|
+
x[2]
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
} else if (a === "l") {
|
|
380
|
+
const o = n.substring(1).trim().split(" ");
|
|
381
|
+
let u = [];
|
|
382
|
+
const d = [];
|
|
383
|
+
if (n.indexOf("/") === -1)
|
|
384
|
+
u = o;
|
|
385
|
+
else
|
|
386
|
+
for (let m = 0, p = o.length; m < p; m++) {
|
|
387
|
+
const g = o[m].split("/");
|
|
388
|
+
g[0] !== "" && u.push(g[0]), g[1] !== "" && d.push(g[1]);
|
|
389
|
+
}
|
|
390
|
+
s.addLineGeometry(u, d);
|
|
391
|
+
} else if (a === "p") {
|
|
392
|
+
const u = n.slice(1).trim().split(" ");
|
|
393
|
+
s.addPointGeometry(u);
|
|
394
|
+
} else if ((e = ue.exec(n)) !== null) {
|
|
395
|
+
const o = (" " + e[0].slice(1).trim()).slice(1);
|
|
396
|
+
s.startObject(o);
|
|
397
|
+
} else if (fe.test(n))
|
|
398
|
+
s.object.startMaterial(n.substring(7).trim(), s.materialLibraries);
|
|
399
|
+
else if (pe.test(n))
|
|
400
|
+
s.materialLibraries.push(n.substring(7).trim());
|
|
401
|
+
else if (de.test(n))
|
|
402
|
+
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
403
|
+
else if (a === "s") {
|
|
404
|
+
if (e = n.split(" "), e.length > 1) {
|
|
405
|
+
const u = e[1].trim().toLowerCase();
|
|
406
|
+
s.object.smooth = u !== "0" && u !== "off";
|
|
407
|
+
} else
|
|
408
|
+
s.object.smooth = !0;
|
|
409
|
+
const o = s.object.currentMaterial();
|
|
410
|
+
o && (o.smooth = s.object.smooth);
|
|
411
|
+
} else {
|
|
412
|
+
if (n === "\0") continue;
|
|
413
|
+
console.warn('THREE.OBJLoader: Unexpected line: "' + n + '"');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
s.finalize();
|
|
417
|
+
const r = new ie();
|
|
418
|
+
if (r.materialLibraries = [].concat(s.materialLibraries), !(s.objects.length === 1 && s.objects[0].geometry.vertices.length === 0) === !0)
|
|
419
|
+
for (let h = 0, l = s.objects.length; h < l; h++) {
|
|
420
|
+
const n = s.objects[h], a = n.geometry, o = n.materials, u = a.type === "Line", d = a.type === "Points";
|
|
421
|
+
let m = !1;
|
|
422
|
+
if (a.vertices.length === 0) continue;
|
|
423
|
+
const p = new D();
|
|
424
|
+
p.setAttribute("position", new _(a.vertices, 3)), a.normals.length > 0 && p.setAttribute("normal", new _(a.normals, 3)), a.colors.length > 0 && (m = !0, p.setAttribute("color", new _(a.colors, 3))), a.hasUVIndices === !0 && p.setAttribute("uv", new _(a.uvs, 2));
|
|
425
|
+
const g = [];
|
|
426
|
+
for (let x = 0, C = o.length; x < C; x++) {
|
|
427
|
+
const v = o[x], j = v.name + "_" + v.smooth + "_" + m;
|
|
428
|
+
let f = s.materials[j];
|
|
429
|
+
if (this.materials !== null) {
|
|
430
|
+
if (f = this.materials.create(v.name), u && f && !(f instanceof N)) {
|
|
431
|
+
const w = new N();
|
|
432
|
+
Q.prototype.copy.call(w, f), w.color.copy(f.color), f = w;
|
|
433
|
+
} else if (d && f && !(f instanceof R)) {
|
|
434
|
+
const w = new R({ size: 10, sizeAttenuation: !1 });
|
|
435
|
+
Q.prototype.copy.call(w, f), w.color.copy(f.color), w.map = f.map, f = w;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
f === void 0 && (u ? f = new N() : d ? f = new R({ size: 1, sizeAttenuation: !1 }) : f = new ne(), f.name = v.name, f.flatShading = !v.smooth, f.vertexColors = m, s.materials[j] = f), g.push(f);
|
|
439
|
+
}
|
|
440
|
+
let b;
|
|
441
|
+
if (g.length > 1) {
|
|
442
|
+
for (let x = 0, C = o.length; x < C; x++) {
|
|
443
|
+
const v = o[x];
|
|
444
|
+
p.addGroup(v.groupStart, v.groupCount, x);
|
|
445
|
+
}
|
|
446
|
+
u ? b = new X(p, g) : d ? b = new W(p, g) : b = new K(p, g);
|
|
447
|
+
} else
|
|
448
|
+
u ? b = new X(p, g[0]) : d ? b = new W(p, g[0]) : b = new K(p, g[0]);
|
|
449
|
+
b.name = n.name, r.add(b);
|
|
450
|
+
}
|
|
451
|
+
else if (s.vertices.length > 0) {
|
|
452
|
+
const h = new R({ size: 1, sizeAttenuation: !1 }), l = new D();
|
|
453
|
+
l.setAttribute("position", new _(s.vertices, 3)), s.colors.length > 0 && s.colors[0] !== void 0 && (l.setAttribute("color", new _(s.colors, 3)), h.vertexColors = !0);
|
|
454
|
+
const n = new W(l, h);
|
|
455
|
+
r.add(n);
|
|
456
|
+
}
|
|
457
|
+
return r;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
class ye extends Y {
|
|
461
|
+
constructor(t) {
|
|
462
|
+
super(t);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Starts loading from the given URL and passes the loaded MTL asset
|
|
466
|
+
* to the `onLoad()` callback.
|
|
467
|
+
*
|
|
468
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
469
|
+
* @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished.
|
|
470
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
471
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
472
|
+
*/
|
|
473
|
+
load(t, s, i, e) {
|
|
474
|
+
const r = this, c = this.path === "" ? ae.extractUrlBase(t) : this.path, h = new Z(this.manager);
|
|
475
|
+
h.setPath(this.path), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(t, function(l) {
|
|
476
|
+
try {
|
|
477
|
+
s(r.parse(l, c));
|
|
478
|
+
} catch (n) {
|
|
479
|
+
e ? e(n) : console.error(n), r.manager.itemError(t);
|
|
480
|
+
}
|
|
481
|
+
}, i, e);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Sets the material options.
|
|
485
|
+
*
|
|
486
|
+
* @param {MTLLoader~MaterialOptions} value - The material options.
|
|
487
|
+
* @return {MTLLoader} A reference to this loader.
|
|
488
|
+
*/
|
|
489
|
+
setMaterialOptions(t) {
|
|
490
|
+
return this.materialOptions = t, this;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Parses the given MTL data and returns the resulting material creator.
|
|
494
|
+
*
|
|
495
|
+
* @param {string} text - The raw MTL data as a string.
|
|
496
|
+
* @param {string} path - The URL base path.
|
|
497
|
+
* @return {MaterialCreator} The material creator.
|
|
498
|
+
*/
|
|
499
|
+
parse(t, s) {
|
|
500
|
+
const i = t.split(`
|
|
501
|
+
`);
|
|
502
|
+
let e = {};
|
|
503
|
+
const r = /\s+/, c = {};
|
|
504
|
+
for (let l = 0; l < i.length; l++) {
|
|
505
|
+
let n = i[l];
|
|
506
|
+
if (n = n.trim(), n.length === 0 || n.charAt(0) === "#")
|
|
507
|
+
continue;
|
|
508
|
+
const a = n.indexOf(" ");
|
|
509
|
+
let o = a >= 0 ? n.substring(0, a) : n;
|
|
510
|
+
o = o.toLowerCase();
|
|
511
|
+
let u = a >= 0 ? n.substring(a + 1) : "";
|
|
512
|
+
if (u = u.trim(), o === "newmtl")
|
|
513
|
+
e = { name: u }, c[u] = e;
|
|
514
|
+
else if (o === "ka" || o === "kd" || o === "ks" || o === "ke") {
|
|
515
|
+
const d = u.split(r, 3);
|
|
516
|
+
e[o] = [parseFloat(d[0]), parseFloat(d[1]), parseFloat(d[2])];
|
|
517
|
+
} else
|
|
518
|
+
e[o] = u;
|
|
519
|
+
}
|
|
520
|
+
const h = new ge(this.resourcePath || s, this.materialOptions);
|
|
521
|
+
return h.setCrossOrigin(this.crossOrigin), h.setManager(this.manager), h.setMaterials(c), h;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
class ge {
|
|
525
|
+
constructor(t = "", s = {}) {
|
|
526
|
+
this.baseUrl = t, this.options = s, this.materialsInfo = {}, this.materials = {}, this.materialsArray = [], this.nameLookup = {}, this.crossOrigin = "anonymous", this.side = this.options.side !== void 0 ? this.options.side : oe, this.wrap = this.options.wrap !== void 0 ? this.options.wrap : le;
|
|
527
|
+
}
|
|
528
|
+
setCrossOrigin(t) {
|
|
529
|
+
return this.crossOrigin = t, this;
|
|
530
|
+
}
|
|
531
|
+
setManager(t) {
|
|
532
|
+
this.manager = t;
|
|
533
|
+
}
|
|
534
|
+
setMaterials(t) {
|
|
535
|
+
this.materialsInfo = this.convert(t), this.materials = {}, this.materialsArray = [], this.nameLookup = {};
|
|
536
|
+
}
|
|
537
|
+
convert(t) {
|
|
538
|
+
if (!this.options) return t;
|
|
539
|
+
const s = {};
|
|
540
|
+
for (const i in t) {
|
|
541
|
+
const e = t[i], r = {};
|
|
542
|
+
s[i] = r;
|
|
543
|
+
for (const c in e) {
|
|
544
|
+
let h = !0, l = e[c];
|
|
545
|
+
const n = c.toLowerCase();
|
|
546
|
+
switch (n) {
|
|
547
|
+
case "kd":
|
|
548
|
+
case "ka":
|
|
549
|
+
case "ks":
|
|
550
|
+
this.options && this.options.normalizeRGB && (l = [l[0] / 255, l[1] / 255, l[2] / 255]), this.options && this.options.ignoreZeroRGBs && l[0] === 0 && l[1] === 0 && l[2] === 0 && (h = !1);
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
h && (r[n] = l);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return s;
|
|
557
|
+
}
|
|
558
|
+
preload() {
|
|
559
|
+
for (const t in this.materialsInfo)
|
|
560
|
+
this.create(t);
|
|
561
|
+
}
|
|
562
|
+
getIndex(t) {
|
|
563
|
+
return this.nameLookup[t];
|
|
564
|
+
}
|
|
565
|
+
getAsArray() {
|
|
566
|
+
let t = 0;
|
|
567
|
+
for (const s in this.materialsInfo)
|
|
568
|
+
this.materialsArray[t] = this.create(s), this.nameLookup[s] = t, t++;
|
|
569
|
+
return this.materialsArray;
|
|
570
|
+
}
|
|
571
|
+
create(t) {
|
|
572
|
+
return this.materials[t] === void 0 && this.createMaterial_(t), this.materials[t];
|
|
573
|
+
}
|
|
574
|
+
createMaterial_(t) {
|
|
575
|
+
const s = this, i = this.materialsInfo[t], e = {
|
|
576
|
+
name: t,
|
|
577
|
+
side: this.side
|
|
578
|
+
};
|
|
579
|
+
function r(h, l) {
|
|
580
|
+
return typeof l != "string" || l === "" ? "" : /^https?:\/\//i.test(l) ? l : h + l;
|
|
581
|
+
}
|
|
582
|
+
function c(h, l) {
|
|
583
|
+
if (e[h]) return;
|
|
584
|
+
const n = s.getTextureParams(l, e), a = s.loadTexture(r(s.baseUrl, n.url));
|
|
585
|
+
a.repeat.copy(n.scale), a.offset.copy(n.offset), a.wrapS = s.wrap, a.wrapT = s.wrap, (h === "map" || h === "emissiveMap") && (a.colorSpace = S), e[h] = a;
|
|
586
|
+
}
|
|
587
|
+
for (const h in i) {
|
|
588
|
+
const l = i[h];
|
|
589
|
+
let n;
|
|
590
|
+
if (l !== "")
|
|
591
|
+
switch (h.toLowerCase()) {
|
|
592
|
+
// Ns is material specular exponent
|
|
593
|
+
case "kd":
|
|
594
|
+
e.color = q.colorSpaceToWorking(new P().fromArray(l), S);
|
|
595
|
+
break;
|
|
596
|
+
case "ks":
|
|
597
|
+
e.specular = q.colorSpaceToWorking(new P().fromArray(l), S);
|
|
598
|
+
break;
|
|
599
|
+
case "ke":
|
|
600
|
+
e.emissive = q.colorSpaceToWorking(new P().fromArray(l), S);
|
|
601
|
+
break;
|
|
602
|
+
case "map_kd":
|
|
603
|
+
c("map", l);
|
|
604
|
+
break;
|
|
605
|
+
case "map_ks":
|
|
606
|
+
c("specularMap", l);
|
|
607
|
+
break;
|
|
608
|
+
case "map_ke":
|
|
609
|
+
c("emissiveMap", l);
|
|
610
|
+
break;
|
|
611
|
+
case "norm":
|
|
612
|
+
c("normalMap", l);
|
|
613
|
+
break;
|
|
614
|
+
case "map_bump":
|
|
615
|
+
case "bump":
|
|
616
|
+
c("bumpMap", l);
|
|
617
|
+
break;
|
|
618
|
+
case "disp":
|
|
619
|
+
c("displacementMap", l);
|
|
620
|
+
break;
|
|
621
|
+
case "map_d":
|
|
622
|
+
c("alphaMap", l), e.transparent = !0;
|
|
623
|
+
break;
|
|
624
|
+
case "ns":
|
|
625
|
+
e.shininess = parseFloat(l);
|
|
626
|
+
break;
|
|
627
|
+
case "d":
|
|
628
|
+
n = parseFloat(l), n < 1 && (e.opacity = n, e.transparent = !0);
|
|
629
|
+
break;
|
|
630
|
+
case "tr":
|
|
631
|
+
n = parseFloat(l), this.options && this.options.invertTrProperty && (n = 1 - n), n > 0 && (e.opacity = 1 - n, e.transparent = !0);
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return this.materials[t] = new ne(e), this.materials[t];
|
|
636
|
+
}
|
|
637
|
+
getTextureParams(t, s) {
|
|
638
|
+
const i = {
|
|
639
|
+
scale: new $(1, 1),
|
|
640
|
+
offset: new $(0, 0)
|
|
641
|
+
}, e = t.split(/\s+/);
|
|
642
|
+
let r;
|
|
643
|
+
return r = e.indexOf("-bm"), r >= 0 && (s.bumpScale = parseFloat(e[r + 1]), e.splice(r, 2)), r = e.indexOf("-mm"), r >= 0 && (s.displacementBias = parseFloat(e[r + 1]), s.displacementScale = parseFloat(e[r + 2]), e.splice(r, 3)), r = e.indexOf("-s"), r >= 0 && (i.scale.set(parseFloat(e[r + 1]), parseFloat(e[r + 2])), e.splice(r, 4)), r = e.indexOf("-o"), r >= 0 && (i.offset.set(parseFloat(e[r + 1]), parseFloat(e[r + 2])), e.splice(r, 4)), i.url = e.join(" ").trim(), i;
|
|
644
|
+
}
|
|
645
|
+
loadTexture(t, s, i, e, r) {
|
|
646
|
+
const c = this.manager !== void 0 ? this.manager : ce;
|
|
647
|
+
let h = c.getHandler(t);
|
|
648
|
+
h === null && (h = new he(c)), h.setCrossOrigin && h.setCrossOrigin(this.crossOrigin);
|
|
649
|
+
const l = h.load(t, i, e, r);
|
|
650
|
+
return s !== void 0 && (l.mapping = s), l;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
export {
|
|
654
|
+
ye as M,
|
|
655
|
+
we as O,
|
|
656
|
+
xe as S
|
|
657
|
+
};
|