ss-component-new 1.2.12 → 1.2.13
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/OrbitControls-BoyGapft.js +419 -0
- package/dist/OrbitControls-D1lM0xvz.cjs +1 -0
- package/dist/STLLoader-BBRISxpD.js +609 -0
- package/dist/STLLoader-KxFIlfhN.cjs +6 -0
- package/dist/{animationData-CyP8-u7i.cjs → animationData-82Fw-zug.cjs} +1 -1
- package/dist/{animationData-C_gV7XAN.js → animationData-CVzu3q7-.js} +2 -2
- package/dist/{iconfont-pt17sMx3.js → iconfont-B9HCA4uh.js} +2 -2
- package/dist/{iconfont-t5epssvu.cjs → iconfont-CsuwJCas.cjs} +1 -1
- package/dist/{index-Dwr4RHei.cjs → index-6tUa2D9P.cjs} +1 -1
- package/dist/{index-DJMHw-xb.js → index-6zoxugAS.js} +7 -7
- package/dist/{index-C40ofXP7.cjs → index-B6h8Kdsz.cjs} +1 -1
- package/dist/{index-BQ4Rjf8F.js → index-B6t23GGZ.js} +3 -3
- package/dist/{index-7eyGTvr0.cjs → index-BZJCScX4.cjs} +1 -1
- package/dist/{index-DQZ_oAyj.js → index-Bafw9B9F.js} +3 -3
- package/dist/{index-ESNVepXU.js → index-BlNTaxba.js} +3 -3
- package/dist/{index-CAewC69j.cjs → index-C85eyyuX.cjs} +1 -1
- package/dist/{index-BMYtLkw8.js → index-CA_ygidl.js} +3 -3
- package/dist/{index-CVDv-Zz-.js → index-CCA-lJNu.js} +14 -14
- package/dist/{index-CApZYDIm.cjs → index-CEi2ZplO.cjs} +1 -1
- package/dist/{index-H_3u1NA_.js → index-CG28BBGh.js} +1 -1
- package/dist/{index-DGBDGLOK.cjs → index-CTOqmp6o.cjs} +1 -1
- package/dist/{index-CoVAbxHN.js → index-CU2AYT-o.js} +1 -1
- package/dist/{index-BAOnUk_J.cjs → index-CXT_ri7C.cjs} +1 -1
- package/dist/{index-CN29uy_G.js → index-CZrlCt19.js} +6 -6
- package/dist/{index-DTkAIcvV.js → index-Cas62aFl.js} +1 -1
- package/dist/{index-CTRmgnKQ.js → index-ChlZgZzn.js} +5 -5
- package/dist/{index-DHQH1rlQ.js → index-Cne-8ofR.js} +1 -1
- package/dist/{index-B7g38Yte.js → index-Cq2pDYGK.js} +1 -1
- package/dist/{index-i50hp6po.cjs → index-CrD_T8_i.cjs} +1 -1
- package/dist/{index-DnU2slQv.cjs → index-CrH5xDEc.cjs} +1 -1
- package/dist/{index-DfKkN76b.js → index-CsOVkfJs.js} +150 -150
- package/dist/{index-D5ShC3zu.cjs → index-CuPtpGC-.cjs} +1 -1
- package/dist/{index-2nEz-J89.js → index-D2puM6vk.js} +2 -2
- package/dist/{index-DDhAMgrO.js → index-D6_JNPhy.js} +1 -1
- package/dist/{index-ecVCII_e.js → index-D7tU_Vmu.js} +1 -1
- package/dist/{index-D9l1Z4TO.cjs → index-D8NHvYsq.cjs} +1 -1
- package/dist/{index-CkA2IZJB.js → index-D9MBiU6x.js} +1 -1
- package/dist/{index-QkDZ18PI.cjs → index-DR5VU4-m.cjs} +1 -1
- package/dist/{index-B9OZcnHm.cjs → index-DvYKkz_M.cjs} +1 -1
- package/dist/{index-B_ZGJtId.js → index-Dvaz3uPH.js} +1 -1
- package/dist/{index-BJBNtx2b.cjs → index-Dy5yN3zf.cjs} +1 -1
- package/dist/{index-CKLBlQoK.js → index-DzopeJWR.js} +3 -3
- package/dist/{index-C5gPrwPs.cjs → index-Ez9VvZ1_.cjs} +1 -1
- package/dist/{index-CVadHkfS.cjs → index-JyPuO9N5.cjs} +1 -1
- package/dist/{index-BUUEqGRN.cjs → index-NU04ABjS.cjs} +1 -1
- package/dist/{index-BDaeo6qO.js → index-YWDxEpkt.js} +1 -1
- package/dist/{index-B_mFQujY.cjs → index-Yc43ZpIg.cjs} +1 -1
- package/dist/{index-DP7rcz4I.cjs → index-d5IX5LQw.cjs} +1 -1
- package/dist/{index-DsQ-qtQ9.cjs → index-dPS3R0YJ.cjs} +1 -1
- package/dist/{index-DkG4A3iE.cjs → index-hKtCBiTZ.cjs} +1 -1
- package/dist/{index-Adqs5vHH.cjs → index-iXcYsTKr.cjs} +1 -1
- package/dist/{index-D4CVC2Sk.js → index-nmkuI4hH.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dwdjsitu.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BKTlb5a7.cjs} +56 -56
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BRxOMo6y.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dkl1cH-C.js} +1713 -1718
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-e_PTrAf6.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-BeE2rxjq.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DfqsvuRy.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-RjUkBHAd.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BqmMCEyN.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-B1G9k32g.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-7HSISF9c.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CBxXCho0.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-CsY5rIO4.js → index.vue_vue_type_style_index_1_lang-Cl6e-PP2.js} +5012 -5100
- package/dist/{index.vue_vue_type_style_index_1_lang-DOjFqzi3.cjs → index.vue_vue_type_style_index_1_lang-NCxR30Hn.cjs} +45 -46
- package/dist/{main-DIbH2rlN.js → main-BZIvGaGC.js} +2 -2
- package/dist/{main-CVaemyhm.cjs → main-Bmym9xf7.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/three-viewport-gizmo-BlxFLyPm.js +18587 -0
- package/dist/three-viewport-gizmo-CwaL5sMV.cjs +4195 -0
- package/dist/{threeLatheView-CZdorls1.cjs → threeLatheView-BsuPsR7B.cjs} +1 -1
- package/dist/{threeLatheView-Bp0kjo_V.js → threeLatheView-DZZ-1LxL.js} +3 -3
- package/dist/{threeModel-C0Jdw2O3.cjs → threeModel-C7W6Z6bA.cjs} +1 -1
- package/dist/{threeModel-27sl0tTS.js → threeModel-WY_j9cKP.js} +4 -4
- package/dist/threePreview-Cy7NY-gw.cjs +1 -0
- package/dist/threePreview-DKlyIJKv.js +1873 -0
- package/dist/{threeSceneView-CEpBvJSV.cjs → threeSceneView-BfpO8VDG.cjs} +1 -1
- package/dist/{threeSceneView-ZDXqO8ZA.js → threeSceneView-L7mPphX4.js} +23 -23
- package/dist/{threeSceneViewForCPMPIP-BPPWM68P.js → threeSceneViewForCPMPIP-K0nm7l_H.js} +26 -26
- package/dist/{threeSceneViewForCPMPIP-B0VPmBWd.cjs → threeSceneViewForCPMPIP-zkgB6OW3.cjs} +2 -2
- package/dist/{threeViewerHost-CKE2a4PV.js → threeViewerHost-Wcy-3BQ6.js} +2 -2
- package/dist/{threeViewerHost-yHvsk7TK.cjs → threeViewerHost-pddFZ8Z9.cjs} +1 -1
- package/dist/{urdfTree-BuTtRGdl.js → urdfTree-Dnh2rJyF.js} +2 -2
- package/dist/urdfTree-bbDs2Fhg.cjs +1 -0
- package/dist/{useRayCaster-BM9XKGKx.js → useRayCaster-O1MYiDpT.js} +12 -12
- package/dist/{useRayCaster-1DNcSYPR.cjs → useRayCaster-h-sWQwPj.cjs} +1 -1
- package/package.json +1 -1
- package/dist/OrbitControls-C0QRmW6_.js +0 -458
- package/dist/OrbitControls-Co_9huz0.cjs +0 -1
- package/dist/STLLoader-CiUjaQtA.js +0 -657
- package/dist/STLLoader-RU7KqloS.cjs +0 -6
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/dist/three-viewport-gizmo-BV37JzRa.cjs +0 -4197
- package/dist/three-viewport-gizmo-CkQ98n-T.js +0 -26015
- package/dist/threePreview-C_mY_TBC.cjs +0 -1
- package/dist/threePreview-DFFjm93P.js +0 -1972
- package/dist/urdfTree-CCktg0FK.cjs +0 -1
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -1,657 +0,0 @@
|
|
|
1
|
-
import { y as Y, F as Z, C as P, b as S, n as ie, p as R, ax as A, ab as H, aa as X, a9 as B, h as ne, af as K, ah as N, e as Q, V as O, z as ae, au as oe, a6 as le, at as W, J as $, aD as ce, Y as he, _ as q } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
2
|
-
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(), D = new P();
|
|
3
|
-
function me() {
|
|
4
|
-
const I = {
|
|
5
|
-
objects: [],
|
|
6
|
-
object: {},
|
|
7
|
-
vertices: [],
|
|
8
|
-
normals: [],
|
|
9
|
-
colors: [],
|
|
10
|
-
uvs: [],
|
|
11
|
-
materials: {},
|
|
12
|
-
materialLibraries: [],
|
|
13
|
-
startObject: function(t, s) {
|
|
14
|
-
if (this.object && this.object.fromDeclaration === !1) {
|
|
15
|
-
this.object.name = t, this.object.fromDeclaration = s !== !1;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const i = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
|
|
19
|
-
if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = {
|
|
20
|
-
name: t || "",
|
|
21
|
-
fromDeclaration: s !== !1,
|
|
22
|
-
geometry: {
|
|
23
|
-
vertices: [],
|
|
24
|
-
normals: [],
|
|
25
|
-
colors: [],
|
|
26
|
-
uvs: [],
|
|
27
|
-
hasUVIndices: !1
|
|
28
|
-
},
|
|
29
|
-
materials: [],
|
|
30
|
-
smooth: !0,
|
|
31
|
-
startMaterial: function(e, r) {
|
|
32
|
-
const c = this._finalize(!1);
|
|
33
|
-
c && (c.inherited || c.groupCount <= 0) && this.materials.splice(c.index, 1);
|
|
34
|
-
const h = {
|
|
35
|
-
index: this.materials.length,
|
|
36
|
-
name: e || "",
|
|
37
|
-
mtllib: Array.isArray(r) && r.length > 0 ? r[r.length - 1] : "",
|
|
38
|
-
smooth: c !== void 0 ? c.smooth : this.smooth,
|
|
39
|
-
groupStart: c !== void 0 ? c.groupEnd : 0,
|
|
40
|
-
groupEnd: -1,
|
|
41
|
-
groupCount: -1,
|
|
42
|
-
inherited: !1,
|
|
43
|
-
clone: function(l) {
|
|
44
|
-
const n = {
|
|
45
|
-
index: typeof l == "number" ? l : this.index,
|
|
46
|
-
name: this.name,
|
|
47
|
-
mtllib: this.mtllib,
|
|
48
|
-
smooth: this.smooth,
|
|
49
|
-
groupStart: 0,
|
|
50
|
-
groupEnd: -1,
|
|
51
|
-
groupCount: -1,
|
|
52
|
-
inherited: !1
|
|
53
|
-
};
|
|
54
|
-
return n.clone = this.clone.bind(n), n;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return this.materials.push(h), h;
|
|
58
|
-
},
|
|
59
|
-
currentMaterial: function() {
|
|
60
|
-
if (this.materials.length > 0)
|
|
61
|
-
return this.materials[this.materials.length - 1];
|
|
62
|
-
},
|
|
63
|
-
_finalize: function(e) {
|
|
64
|
-
const r = this.currentMaterial();
|
|
65
|
-
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)
|
|
66
|
-
for (let c = this.materials.length - 1; c >= 0; c--)
|
|
67
|
-
this.materials[c].groupCount <= 0 && this.materials.splice(c, 1);
|
|
68
|
-
return e && this.materials.length === 0 && this.materials.push({
|
|
69
|
-
name: "",
|
|
70
|
-
smooth: this.smooth
|
|
71
|
-
}), r;
|
|
72
|
-
}
|
|
73
|
-
}, i && i.name && typeof i.clone == "function") {
|
|
74
|
-
const e = i.clone(0);
|
|
75
|
-
e.inherited = !0, this.object.materials.push(e);
|
|
76
|
-
}
|
|
77
|
-
this.objects.push(this.object);
|
|
78
|
-
},
|
|
79
|
-
finalize: function() {
|
|
80
|
-
this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
|
|
81
|
-
},
|
|
82
|
-
parseVertexIndex: function(t, s) {
|
|
83
|
-
const i = parseInt(t, 10);
|
|
84
|
-
return (i >= 0 ? i - 1 : i + s / 3) * 3;
|
|
85
|
-
},
|
|
86
|
-
parseNormalIndex: function(t, s) {
|
|
87
|
-
const i = parseInt(t, 10);
|
|
88
|
-
return (i >= 0 ? i - 1 : i + s / 3) * 3;
|
|
89
|
-
},
|
|
90
|
-
parseUVIndex: function(t, s) {
|
|
91
|
-
const i = parseInt(t, 10);
|
|
92
|
-
return (i >= 0 ? i - 1 : i + s / 2) * 2;
|
|
93
|
-
},
|
|
94
|
-
addVertex: function(t, s, i) {
|
|
95
|
-
const e = this.vertices, r = this.object.geometry.vertices;
|
|
96
|
-
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]);
|
|
97
|
-
},
|
|
98
|
-
addVertexPoint: function(t) {
|
|
99
|
-
const s = this.vertices;
|
|
100
|
-
this.object.geometry.vertices.push(s[t + 0], s[t + 1], s[t + 2]);
|
|
101
|
-
},
|
|
102
|
-
addVertexLine: function(t) {
|
|
103
|
-
const s = this.vertices;
|
|
104
|
-
this.object.geometry.vertices.push(s[t + 0], s[t + 1], s[t + 2]);
|
|
105
|
-
},
|
|
106
|
-
addNormal: function(t, s, i) {
|
|
107
|
-
const e = this.normals, r = this.object.geometry.normals;
|
|
108
|
-
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]);
|
|
109
|
-
},
|
|
110
|
-
addFaceNormal: function(t, s, i) {
|
|
111
|
-
const e = this.vertices, r = this.object.geometry.normals;
|
|
112
|
-
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);
|
|
113
|
-
},
|
|
114
|
-
addColor: function(t, s, i) {
|
|
115
|
-
const e = this.colors, r = this.object.geometry.colors;
|
|
116
|
-
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]);
|
|
117
|
-
},
|
|
118
|
-
addUV: function(t, s, i) {
|
|
119
|
-
const e = this.uvs, r = this.object.geometry.uvs;
|
|
120
|
-
r.push(e[t + 0], e[t + 1]), r.push(e[s + 0], e[s + 1]), r.push(e[i + 0], e[i + 1]);
|
|
121
|
-
},
|
|
122
|
-
addDefaultUV: function() {
|
|
123
|
-
const t = this.object.geometry.uvs;
|
|
124
|
-
t.push(0, 0), t.push(0, 0), t.push(0, 0);
|
|
125
|
-
},
|
|
126
|
-
addUVLine: function(t) {
|
|
127
|
-
const s = this.uvs;
|
|
128
|
-
this.object.geometry.uvs.push(s[t + 0], s[t + 1]);
|
|
129
|
-
},
|
|
130
|
-
addFace: function(t, s, i, e, r, c, h, l, n) {
|
|
131
|
-
const a = this.vertices.length;
|
|
132
|
-
let o = this.parseVertexIndex(t, a), u = this.parseVertexIndex(s, a), d = this.parseVertexIndex(i, a);
|
|
133
|
-
if (this.addVertex(o, u, d), this.addColor(o, u, d), h !== void 0 && h !== "") {
|
|
134
|
-
const m = this.normals.length;
|
|
135
|
-
o = this.parseNormalIndex(h, m), u = this.parseNormalIndex(l, m), d = this.parseNormalIndex(n, m), this.addNormal(o, u, d);
|
|
136
|
-
} else
|
|
137
|
-
this.addFaceNormal(o, u, d);
|
|
138
|
-
if (e !== void 0 && e !== "") {
|
|
139
|
-
const m = this.uvs.length;
|
|
140
|
-
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;
|
|
141
|
-
} else
|
|
142
|
-
this.addDefaultUV();
|
|
143
|
-
},
|
|
144
|
-
addPointGeometry: function(t) {
|
|
145
|
-
this.object.geometry.type = "Points";
|
|
146
|
-
const s = this.vertices.length;
|
|
147
|
-
for (let i = 0, e = t.length; i < e; i++) {
|
|
148
|
-
const r = this.parseVertexIndex(t[i], s);
|
|
149
|
-
this.addVertexPoint(r), this.addColor(r);
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
addLineGeometry: function(t, s) {
|
|
153
|
-
this.object.geometry.type = "Line";
|
|
154
|
-
const i = this.vertices.length, e = this.uvs.length;
|
|
155
|
-
for (let r = 0, c = t.length; r < c; r++)
|
|
156
|
-
this.addVertexLine(this.parseVertexIndex(t[r], i));
|
|
157
|
-
for (let r = 0, c = s.length; r < c; r++)
|
|
158
|
-
this.addUVLine(this.parseUVIndex(s[r], e));
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
return I.startObject("", !1), I;
|
|
162
|
-
}
|
|
163
|
-
class xe extends Y {
|
|
164
|
-
/**
|
|
165
|
-
* Constructs a new OBJ loader.
|
|
166
|
-
*
|
|
167
|
-
* @param {LoadingManager} [manager] - The loading manager.
|
|
168
|
-
*/
|
|
169
|
-
constructor(t) {
|
|
170
|
-
super(t), this.materials = null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Starts loading from the given URL and passes the loaded OBJ asset
|
|
174
|
-
* to the `onLoad()` callback.
|
|
175
|
-
*
|
|
176
|
-
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
177
|
-
* @param {function(Group)} onLoad - Executed when the loading process has been finished.
|
|
178
|
-
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
179
|
-
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
180
|
-
*/
|
|
181
|
-
load(t, s, i, e) {
|
|
182
|
-
const r = this, c = new Z(this.manager);
|
|
183
|
-
c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(t, function(h) {
|
|
184
|
-
try {
|
|
185
|
-
s(r.parse(h));
|
|
186
|
-
} catch (l) {
|
|
187
|
-
e ? e(l) : console.error(l), r.manager.itemError(t);
|
|
188
|
-
}
|
|
189
|
-
}, i, e);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Sets the material creator for this OBJ. This object is loaded via {@link MTLLoader}.
|
|
193
|
-
*
|
|
194
|
-
* @param {MaterialCreator} materials - An object that creates the materials for this OBJ.
|
|
195
|
-
* @return {OBJLoader} A reference to this loader.
|
|
196
|
-
*/
|
|
197
|
-
setMaterials(t) {
|
|
198
|
-
return this.materials = t, this;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Parses the given OBJ data and returns the resulting group.
|
|
202
|
-
*
|
|
203
|
-
* @param {string} text - The raw OBJ data as a string.
|
|
204
|
-
* @return {Group} The parsed OBJ.
|
|
205
|
-
*/
|
|
206
|
-
parse(t) {
|
|
207
|
-
const s = new me();
|
|
208
|
-
t.indexOf(`\r
|
|
209
|
-
`) !== -1 && (t = t.replace(/\r\n/g, `
|
|
210
|
-
`)), t.indexOf(`\\
|
|
211
|
-
`) !== -1 && (t = t.replace(/\\\n/g, ""));
|
|
212
|
-
const i = t.split(`
|
|
213
|
-
`);
|
|
214
|
-
let e = [];
|
|
215
|
-
for (let h = 0, l = i.length; h < l; h++) {
|
|
216
|
-
const n = i[h].trimStart();
|
|
217
|
-
if (n.length === 0) continue;
|
|
218
|
-
const a = n.charAt(0);
|
|
219
|
-
if (a !== "#")
|
|
220
|
-
if (a === "v") {
|
|
221
|
-
const o = n.split(ee);
|
|
222
|
-
switch (o[0]) {
|
|
223
|
-
case "v":
|
|
224
|
-
s.vertices.push(
|
|
225
|
-
parseFloat(o[1]),
|
|
226
|
-
parseFloat(o[2]),
|
|
227
|
-
parseFloat(o[3])
|
|
228
|
-
), o.length >= 7 ? (D.setRGB(
|
|
229
|
-
parseFloat(o[4]),
|
|
230
|
-
parseFloat(o[5]),
|
|
231
|
-
parseFloat(o[6]),
|
|
232
|
-
S
|
|
233
|
-
), s.colors.push(D.r, D.g, D.b)) : s.colors.push(void 0, void 0, void 0);
|
|
234
|
-
break;
|
|
235
|
-
case "vn":
|
|
236
|
-
s.normals.push(
|
|
237
|
-
parseFloat(o[1]),
|
|
238
|
-
parseFloat(o[2]),
|
|
239
|
-
parseFloat(o[3])
|
|
240
|
-
);
|
|
241
|
-
break;
|
|
242
|
-
case "vt":
|
|
243
|
-
s.uvs.push(
|
|
244
|
-
parseFloat(o[1]),
|
|
245
|
-
parseFloat(o[2])
|
|
246
|
-
);
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
} else if (a === "f") {
|
|
250
|
-
const u = n.slice(1).trim().split(ee), d = [];
|
|
251
|
-
for (let p = 0, g = u.length; p < g; p++) {
|
|
252
|
-
const b = u[p];
|
|
253
|
-
if (b.length > 0) {
|
|
254
|
-
const x = b.split("/");
|
|
255
|
-
d.push(x);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const m = d[0];
|
|
259
|
-
for (let p = 1, g = d.length - 1; p < g; p++) {
|
|
260
|
-
const b = d[p], x = d[p + 1];
|
|
261
|
-
s.addFace(
|
|
262
|
-
m[0],
|
|
263
|
-
b[0],
|
|
264
|
-
x[0],
|
|
265
|
-
m[1],
|
|
266
|
-
b[1],
|
|
267
|
-
x[1],
|
|
268
|
-
m[2],
|
|
269
|
-
b[2],
|
|
270
|
-
x[2]
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
} else if (a === "l") {
|
|
274
|
-
const o = n.substring(1).trim().split(" ");
|
|
275
|
-
let u = [];
|
|
276
|
-
const d = [];
|
|
277
|
-
if (n.indexOf("/") === -1)
|
|
278
|
-
u = o;
|
|
279
|
-
else
|
|
280
|
-
for (let m = 0, p = o.length; m < p; m++) {
|
|
281
|
-
const g = o[m].split("/");
|
|
282
|
-
g[0] !== "" && u.push(g[0]), g[1] !== "" && d.push(g[1]);
|
|
283
|
-
}
|
|
284
|
-
s.addLineGeometry(u, d);
|
|
285
|
-
} else if (a === "p") {
|
|
286
|
-
const u = n.slice(1).trim().split(" ");
|
|
287
|
-
s.addPointGeometry(u);
|
|
288
|
-
} else if ((e = ue.exec(n)) !== null) {
|
|
289
|
-
const o = (" " + e[0].slice(1).trim()).slice(1);
|
|
290
|
-
s.startObject(o);
|
|
291
|
-
} else if (fe.test(n))
|
|
292
|
-
s.object.startMaterial(n.substring(7).trim(), s.materialLibraries);
|
|
293
|
-
else if (pe.test(n))
|
|
294
|
-
s.materialLibraries.push(n.substring(7).trim());
|
|
295
|
-
else if (de.test(n))
|
|
296
|
-
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
297
|
-
else if (a === "s") {
|
|
298
|
-
if (e = n.split(" "), e.length > 1) {
|
|
299
|
-
const u = e[1].trim().toLowerCase();
|
|
300
|
-
s.object.smooth = u !== "0" && u !== "off";
|
|
301
|
-
} else
|
|
302
|
-
s.object.smooth = !0;
|
|
303
|
-
const o = s.object.currentMaterial();
|
|
304
|
-
o && (o.smooth = s.object.smooth);
|
|
305
|
-
} else {
|
|
306
|
-
if (n === "\0") continue;
|
|
307
|
-
console.warn('THREE.OBJLoader: Unexpected line: "' + n + '"');
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
s.finalize();
|
|
311
|
-
const r = new ie();
|
|
312
|
-
if (r.materialLibraries = [].concat(s.materialLibraries), !(s.objects.length === 1 && s.objects[0].geometry.vertices.length === 0) === !0)
|
|
313
|
-
for (let h = 0, l = s.objects.length; h < l; h++) {
|
|
314
|
-
const n = s.objects[h], a = n.geometry, o = n.materials, u = a.type === "Line", d = a.type === "Points";
|
|
315
|
-
let m = !1;
|
|
316
|
-
if (a.vertices.length === 0) continue;
|
|
317
|
-
const p = new R();
|
|
318
|
-
p.setAttribute("position", new A(a.vertices, 3)), a.normals.length > 0 && p.setAttribute("normal", new A(a.normals, 3)), a.colors.length > 0 && (m = !0, p.setAttribute("color", new A(a.colors, 3))), a.hasUVIndices === !0 && p.setAttribute("uv", new A(a.uvs, 2));
|
|
319
|
-
const g = [];
|
|
320
|
-
for (let x = 0, C = o.length; x < C; x++) {
|
|
321
|
-
const v = o[x], j = v.name + "_" + v.smooth + "_" + m;
|
|
322
|
-
let f = s.materials[j];
|
|
323
|
-
if (this.materials !== null) {
|
|
324
|
-
if (f = this.materials.create(v.name), u && f && !(f instanceof H)) {
|
|
325
|
-
const w = new H();
|
|
326
|
-
X.prototype.copy.call(w, f), w.color.copy(f.color), f = w;
|
|
327
|
-
} else if (d && f && !(f instanceof B)) {
|
|
328
|
-
const w = new B({ size: 10, sizeAttenuation: !1 });
|
|
329
|
-
X.prototype.copy.call(w, f), w.color.copy(f.color), w.map = f.map, f = w;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
f === void 0 && (u ? f = new H() : d ? f = new B({ 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);
|
|
333
|
-
}
|
|
334
|
-
let b;
|
|
335
|
-
if (g.length > 1) {
|
|
336
|
-
for (let x = 0, C = o.length; x < C; x++) {
|
|
337
|
-
const v = o[x];
|
|
338
|
-
p.addGroup(v.groupStart, v.groupCount, x);
|
|
339
|
-
}
|
|
340
|
-
u ? b = new K(p, g) : d ? b = new N(p, g) : b = new Q(p, g);
|
|
341
|
-
} else
|
|
342
|
-
u ? b = new K(p, g[0]) : d ? b = new N(p, g[0]) : b = new Q(p, g[0]);
|
|
343
|
-
b.name = n.name, r.add(b);
|
|
344
|
-
}
|
|
345
|
-
else if (s.vertices.length > 0) {
|
|
346
|
-
const h = new B({ size: 1, sizeAttenuation: !1 }), l = new R();
|
|
347
|
-
l.setAttribute("position", new A(s.vertices, 3)), s.colors.length > 0 && s.colors[0] !== void 0 && (l.setAttribute("color", new A(s.colors, 3)), h.vertexColors = !0);
|
|
348
|
-
const n = new N(l, h);
|
|
349
|
-
r.add(n);
|
|
350
|
-
}
|
|
351
|
-
return r;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
class we extends Y {
|
|
355
|
-
constructor(t) {
|
|
356
|
-
super(t);
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Starts loading from the given URL and passes the loaded MTL asset
|
|
360
|
-
* to the `onLoad()` callback.
|
|
361
|
-
*
|
|
362
|
-
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
363
|
-
* @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished.
|
|
364
|
-
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
365
|
-
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
366
|
-
*/
|
|
367
|
-
load(t, s, i, e) {
|
|
368
|
-
const r = this, c = this.path === "" ? ae.extractUrlBase(t) : this.path, h = new Z(this.manager);
|
|
369
|
-
h.setPath(this.path), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(t, function(l) {
|
|
370
|
-
try {
|
|
371
|
-
s(r.parse(l, c));
|
|
372
|
-
} catch (n) {
|
|
373
|
-
e ? e(n) : console.error(n), r.manager.itemError(t);
|
|
374
|
-
}
|
|
375
|
-
}, i, e);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Sets the material options.
|
|
379
|
-
*
|
|
380
|
-
* @param {MTLLoader~MaterialOptions} value - The material options.
|
|
381
|
-
* @return {MTLLoader} A reference to this loader.
|
|
382
|
-
*/
|
|
383
|
-
setMaterialOptions(t) {
|
|
384
|
-
return this.materialOptions = t, this;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Parses the given MTL data and returns the resulting material creator.
|
|
388
|
-
*
|
|
389
|
-
* @param {string} text - The raw MTL data as a string.
|
|
390
|
-
* @param {string} path - The URL base path.
|
|
391
|
-
* @return {MaterialCreator} The material creator.
|
|
392
|
-
*/
|
|
393
|
-
parse(t, s) {
|
|
394
|
-
const i = t.split(`
|
|
395
|
-
`);
|
|
396
|
-
let e = {};
|
|
397
|
-
const r = /\s+/, c = {};
|
|
398
|
-
for (let l = 0; l < i.length; l++) {
|
|
399
|
-
let n = i[l];
|
|
400
|
-
if (n = n.trim(), n.length === 0 || n.charAt(0) === "#")
|
|
401
|
-
continue;
|
|
402
|
-
const a = n.indexOf(" ");
|
|
403
|
-
let o = a >= 0 ? n.substring(0, a) : n;
|
|
404
|
-
o = o.toLowerCase();
|
|
405
|
-
let u = a >= 0 ? n.substring(a + 1) : "";
|
|
406
|
-
if (u = u.trim(), o === "newmtl")
|
|
407
|
-
e = { name: u }, c[u] = e;
|
|
408
|
-
else if (o === "ka" || o === "kd" || o === "ks" || o === "ke") {
|
|
409
|
-
const d = u.split(r, 3);
|
|
410
|
-
e[o] = [parseFloat(d[0]), parseFloat(d[1]), parseFloat(d[2])];
|
|
411
|
-
} else
|
|
412
|
-
e[o] = u;
|
|
413
|
-
}
|
|
414
|
-
const h = new ge(this.resourcePath || s, this.materialOptions);
|
|
415
|
-
return h.setCrossOrigin(this.crossOrigin), h.setManager(this.manager), h.setMaterials(c), h;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
class ge {
|
|
419
|
-
constructor(t = "", s = {}) {
|
|
420
|
-
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;
|
|
421
|
-
}
|
|
422
|
-
setCrossOrigin(t) {
|
|
423
|
-
return this.crossOrigin = t, this;
|
|
424
|
-
}
|
|
425
|
-
setManager(t) {
|
|
426
|
-
this.manager = t;
|
|
427
|
-
}
|
|
428
|
-
setMaterials(t) {
|
|
429
|
-
this.materialsInfo = this.convert(t), this.materials = {}, this.materialsArray = [], this.nameLookup = {};
|
|
430
|
-
}
|
|
431
|
-
convert(t) {
|
|
432
|
-
if (!this.options) return t;
|
|
433
|
-
const s = {};
|
|
434
|
-
for (const i in t) {
|
|
435
|
-
const e = t[i], r = {};
|
|
436
|
-
s[i] = r;
|
|
437
|
-
for (const c in e) {
|
|
438
|
-
let h = !0, l = e[c];
|
|
439
|
-
const n = c.toLowerCase();
|
|
440
|
-
switch (n) {
|
|
441
|
-
case "kd":
|
|
442
|
-
case "ka":
|
|
443
|
-
case "ks":
|
|
444
|
-
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);
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
h && (r[n] = l);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return s;
|
|
451
|
-
}
|
|
452
|
-
preload() {
|
|
453
|
-
for (const t in this.materialsInfo)
|
|
454
|
-
this.create(t);
|
|
455
|
-
}
|
|
456
|
-
getIndex(t) {
|
|
457
|
-
return this.nameLookup[t];
|
|
458
|
-
}
|
|
459
|
-
getAsArray() {
|
|
460
|
-
let t = 0;
|
|
461
|
-
for (const s in this.materialsInfo)
|
|
462
|
-
this.materialsArray[t] = this.create(s), this.nameLookup[s] = t, t++;
|
|
463
|
-
return this.materialsArray;
|
|
464
|
-
}
|
|
465
|
-
create(t) {
|
|
466
|
-
return this.materials[t] === void 0 && this.createMaterial_(t), this.materials[t];
|
|
467
|
-
}
|
|
468
|
-
createMaterial_(t) {
|
|
469
|
-
const s = this, i = this.materialsInfo[t], e = {
|
|
470
|
-
name: t,
|
|
471
|
-
side: this.side
|
|
472
|
-
};
|
|
473
|
-
function r(h, l) {
|
|
474
|
-
return typeof l != "string" || l === "" ? "" : /^https?:\/\//i.test(l) ? l : h + l;
|
|
475
|
-
}
|
|
476
|
-
function c(h, l) {
|
|
477
|
-
if (e[h]) return;
|
|
478
|
-
const n = s.getTextureParams(l, e), a = s.loadTexture(r(s.baseUrl, n.url));
|
|
479
|
-
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;
|
|
480
|
-
}
|
|
481
|
-
for (const h in i) {
|
|
482
|
-
const l = i[h];
|
|
483
|
-
let n;
|
|
484
|
-
if (l !== "")
|
|
485
|
-
switch (h.toLowerCase()) {
|
|
486
|
-
// Ns is material specular exponent
|
|
487
|
-
case "kd":
|
|
488
|
-
e.color = W.colorSpaceToWorking(new P().fromArray(l), S);
|
|
489
|
-
break;
|
|
490
|
-
case "ks":
|
|
491
|
-
e.specular = W.colorSpaceToWorking(new P().fromArray(l), S);
|
|
492
|
-
break;
|
|
493
|
-
case "ke":
|
|
494
|
-
e.emissive = W.colorSpaceToWorking(new P().fromArray(l), S);
|
|
495
|
-
break;
|
|
496
|
-
case "map_kd":
|
|
497
|
-
c("map", l);
|
|
498
|
-
break;
|
|
499
|
-
case "map_ks":
|
|
500
|
-
c("specularMap", l);
|
|
501
|
-
break;
|
|
502
|
-
case "map_ke":
|
|
503
|
-
c("emissiveMap", l);
|
|
504
|
-
break;
|
|
505
|
-
case "norm":
|
|
506
|
-
c("normalMap", l);
|
|
507
|
-
break;
|
|
508
|
-
case "map_bump":
|
|
509
|
-
case "bump":
|
|
510
|
-
c("bumpMap", l);
|
|
511
|
-
break;
|
|
512
|
-
case "disp":
|
|
513
|
-
c("displacementMap", l);
|
|
514
|
-
break;
|
|
515
|
-
case "map_d":
|
|
516
|
-
c("alphaMap", l), e.transparent = !0;
|
|
517
|
-
break;
|
|
518
|
-
case "ns":
|
|
519
|
-
e.shininess = parseFloat(l);
|
|
520
|
-
break;
|
|
521
|
-
case "d":
|
|
522
|
-
n = parseFloat(l), n < 1 && (e.opacity = n, e.transparent = !0);
|
|
523
|
-
break;
|
|
524
|
-
case "tr":
|
|
525
|
-
n = parseFloat(l), this.options && this.options.invertTrProperty && (n = 1 - n), n > 0 && (e.opacity = 1 - n, e.transparent = !0);
|
|
526
|
-
break;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
return this.materials[t] = new ne(e), this.materials[t];
|
|
530
|
-
}
|
|
531
|
-
getTextureParams(t, s) {
|
|
532
|
-
const i = {
|
|
533
|
-
scale: new $(1, 1),
|
|
534
|
-
offset: new $(0, 0)
|
|
535
|
-
}, e = t.split(/\s+/);
|
|
536
|
-
let r;
|
|
537
|
-
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;
|
|
538
|
-
}
|
|
539
|
-
loadTexture(t, s, i, e, r) {
|
|
540
|
-
const c = this.manager !== void 0 ? this.manager : ce;
|
|
541
|
-
let h = c.getHandler(t);
|
|
542
|
-
h === null && (h = new he(c)), h.setCrossOrigin && h.setCrossOrigin(this.crossOrigin);
|
|
543
|
-
const l = h.load(t, i, e, r);
|
|
544
|
-
return s !== void 0 && (l.mapping = s), l;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
class ye extends Y {
|
|
548
|
-
/**
|
|
549
|
-
* Constructs a new STL loader.
|
|
550
|
-
*
|
|
551
|
-
* @param {LoadingManager} [manager] - The loading manager.
|
|
552
|
-
*/
|
|
553
|
-
constructor(t) {
|
|
554
|
-
super(t);
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Starts loading from the given URL and passes the loaded STL asset
|
|
558
|
-
* to the `onLoad()` callback.
|
|
559
|
-
*
|
|
560
|
-
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
561
|
-
* @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
|
|
562
|
-
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
563
|
-
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
564
|
-
*/
|
|
565
|
-
load(t, s, i, e) {
|
|
566
|
-
const r = this, c = new Z(this.manager);
|
|
567
|
-
c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(t, function(h) {
|
|
568
|
-
try {
|
|
569
|
-
s(r.parse(h));
|
|
570
|
-
} catch (l) {
|
|
571
|
-
e ? e(l) : console.error(l), r.manager.itemError(t);
|
|
572
|
-
}
|
|
573
|
-
}, i, e);
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Parses the given STL data and returns the resulting geometry.
|
|
577
|
-
*
|
|
578
|
-
* @param {ArrayBuffer} data - The raw STL data as an array buffer.
|
|
579
|
-
* @return {BufferGeometry} The parsed geometry.
|
|
580
|
-
*/
|
|
581
|
-
parse(t) {
|
|
582
|
-
function s(n) {
|
|
583
|
-
const a = new DataView(n), o = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8, u = a.getUint32(80, !0);
|
|
584
|
-
if (80 + 32 / 8 + u * o === a.byteLength)
|
|
585
|
-
return !0;
|
|
586
|
-
const m = [115, 111, 108, 105, 100];
|
|
587
|
-
for (let p = 0; p < 5; p++)
|
|
588
|
-
if (i(m, a, p)) return !1;
|
|
589
|
-
return !0;
|
|
590
|
-
}
|
|
591
|
-
function i(n, a, o) {
|
|
592
|
-
for (let u = 0, d = n.length; u < d; u++)
|
|
593
|
-
if (n[u] !== a.getUint8(o + u)) return !1;
|
|
594
|
-
return !0;
|
|
595
|
-
}
|
|
596
|
-
function e(n) {
|
|
597
|
-
const a = new DataView(n), o = a.getUint32(80, !0);
|
|
598
|
-
let u, d, m, p = !1, g, b, x, C, v;
|
|
599
|
-
for (let y = 0; y < 70; y++)
|
|
600
|
-
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);
|
|
601
|
-
const j = 84, f = 12 * 4 + 2, w = new R(), M = new Float32Array(o * 3 * 3), V = new Float32Array(o * 3 * 3), k = new P();
|
|
602
|
-
for (let y = 0; y < o; y++) {
|
|
603
|
-
const U = j + y * f, E = a.getFloat32(U, !0), z = a.getFloat32(U + 4, !0), T = a.getFloat32(U + 8, !0);
|
|
604
|
-
if (p) {
|
|
605
|
-
const F = a.getUint16(U + 48, !0);
|
|
606
|
-
(F & 32768) === 0 ? (u = (F & 31) / 31, d = (F >> 5 & 31) / 31, m = (F >> 10 & 31) / 31) : (u = b, d = x, m = C);
|
|
607
|
-
}
|
|
608
|
-
for (let F = 1; F <= 3; F++) {
|
|
609
|
-
const G = U + F * 12, _ = y * 3 * 3 + (F - 1) * 3;
|
|
610
|
-
M[_] = a.getFloat32(G, !0), M[_ + 1] = a.getFloat32(G + 4, !0), M[_ + 2] = a.getFloat32(G + 8, !0), V[_] = E, V[_ + 1] = z, V[_ + 2] = T, p && (k.setRGB(u, d, m, S), g[_] = k.r, g[_ + 1] = k.g, g[_ + 2] = k.b);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return w.setAttribute("position", new q(M, 3)), w.setAttribute("normal", new q(V, 3)), p && (w.setAttribute("color", new q(g, 3)), w.hasColors = !0, w.alpha = v), w;
|
|
614
|
-
}
|
|
615
|
-
function r(n) {
|
|
616
|
-
const a = new R(), o = /solid([\s\S]*?)endsolid/g, u = /facet([\s\S]*?)endfacet/g, d = /solid\s(.+)/;
|
|
617
|
-
let m = 0;
|
|
618
|
-
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();
|
|
619
|
-
let f, w = 0, M = 0, V = 0;
|
|
620
|
-
for (; (f = o.exec(n)) !== null; ) {
|
|
621
|
-
M = V;
|
|
622
|
-
const k = f[0], y = (f = d.exec(k)) !== null ? f[1] : "";
|
|
623
|
-
for (v.push(y); (f = u.exec(k)) !== null; ) {
|
|
624
|
-
let z = 0, T = 0;
|
|
625
|
-
const F = f[0];
|
|
626
|
-
for (; (f = b.exec(F)) !== null; )
|
|
627
|
-
j.x = parseFloat(f[1]), j.y = parseFloat(f[2]), j.z = parseFloat(f[3]), T++;
|
|
628
|
-
for (; (f = g.exec(F)) !== null; )
|
|
629
|
-
x.push(parseFloat(f[1]), parseFloat(f[2]), parseFloat(f[3])), C.push(j.x, j.y, j.z), z++, V++;
|
|
630
|
-
T !== 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++;
|
|
631
|
-
}
|
|
632
|
-
const U = M, E = V - M;
|
|
633
|
-
a.userData.groupNames = v, a.addGroup(U, E, w), w++;
|
|
634
|
-
}
|
|
635
|
-
return a.setAttribute("position", new A(x, 3)), a.setAttribute("normal", new A(C, 3)), a;
|
|
636
|
-
}
|
|
637
|
-
function c(n) {
|
|
638
|
-
return typeof n != "string" ? new TextDecoder().decode(n) : n;
|
|
639
|
-
}
|
|
640
|
-
function h(n) {
|
|
641
|
-
if (typeof n == "string") {
|
|
642
|
-
const a = new Uint8Array(n.length);
|
|
643
|
-
for (let o = 0; o < n.length; o++)
|
|
644
|
-
a[o] = n.charCodeAt(o) & 255;
|
|
645
|
-
return a.buffer || a;
|
|
646
|
-
} else
|
|
647
|
-
return n;
|
|
648
|
-
}
|
|
649
|
-
const l = h(t);
|
|
650
|
-
return s(l) ? e(l) : r(c(t));
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
export {
|
|
654
|
-
we as M,
|
|
655
|
-
xe as O,
|
|
656
|
-
ye as S
|
|
657
|
-
};
|