ss-component-new 1.2.2 → 1.2.4

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.
Files changed (119) hide show
  1. package/dist/OrbitControls-Co_9huz0.cjs +1 -0
  2. package/dist/OrbitControls-DA4VpOM_.js +458 -0
  3. package/dist/STLLoader-DmGTF0Nv.js +657 -0
  4. package/dist/STLLoader-RU7KqloS.cjs +6 -0
  5. package/dist/{animationData-BDq02_ir.js → animationData-9n1X4UvO.js} +4 -4
  6. package/dist/{animationData-BRDoJBuV.cjs → animationData-CfT99nMO.cjs} +1 -1
  7. package/dist/{array-BtZq8qON.cjs → array-BPHS7JFA.cjs} +1 -1
  8. package/dist/{array-A59WrroX.js → array-pg68Qbs1.js} +1 -1
  9. package/dist/config.js +1 -1
  10. package/dist/{iconfont-7cEds3Xj.js → iconfont-ljBfzBSE.js} +2 -2
  11. package/dist/{iconfont-CsuwJCas.cjs → iconfont-t5epssvu.cjs} +1 -1
  12. package/dist/{index-wq8KZGnQ.js → index---6UATT0.js} +3 -3
  13. package/dist/{index-D8S0DVkq.cjs → index-1DtctdYW.cjs} +1 -1
  14. package/dist/index-5hLZZ6t-.cjs +1 -0
  15. package/dist/{index-DygW4mGC.js → index-8CcD03tl.js} +6 -6
  16. package/dist/{index-C6Uddqal.js → index-B5gNufYw.js} +2 -2
  17. package/dist/{index-BgJn4mlV.js → index-B5srJr0o.js} +2 -2
  18. package/dist/{index-B_k7wRBo.cjs → index-B5vIeQUq.cjs} +1 -1
  19. package/dist/{index-DS3OziT5.cjs → index-B8J_v2Ky.cjs} +1 -1
  20. package/dist/{index-DQTI3BuS.cjs → index-B9nZeing.cjs} +1 -1
  21. package/dist/{index-BeqNCviq.js → index-BAj0dyBF.js} +152 -152
  22. package/dist/{index-BeTQ6ief.js → index-BEJOd_29.js} +4 -4
  23. package/dist/{index-Dn9I5-1H.cjs → index-BKhDFqMM.cjs} +1 -1
  24. package/dist/{index-Cz03X-rX.js → index-BNNxPuEV.js} +1 -1
  25. package/dist/{index-DmwVXfrE.cjs → index-BOVdAFDH.cjs} +1 -1
  26. package/dist/{index-Crd4LGue.cjs → index-Bi7yv8jC.cjs} +1 -1
  27. package/dist/{index-CFg3-0Tk.js → index-BjXcyVvp.js} +2 -2
  28. package/dist/{index-CxnH4vfV.cjs → index-BrsIZVyD.cjs} +1 -1
  29. package/dist/{index-BB6zZsmY.cjs → index-Bsdjuxq1.cjs} +1 -1
  30. package/dist/{index-C461j30b.js → index-BuKHInQb.js} +1 -1
  31. package/dist/{index-CJzA3AAO.cjs → index-Bx4qIiIa.cjs} +1 -1
  32. package/dist/{index-HFf3Z0Ft.cjs → index-C-AOuDkl.cjs} +1 -1
  33. package/dist/{index-C3CD2NW8.cjs → index-C0HHmjrg.cjs} +1 -1
  34. package/dist/{index-BTrjEMt1.js → index-C1lB8apW.js} +4 -4
  35. package/dist/{index-DqquxuCt.cjs → index-CAHYTZ1Q.cjs} +1 -1
  36. package/dist/{index-BdL8I_2i.cjs → index-CCIJ-P3X.cjs} +1 -1
  37. package/dist/{index-B9j8fCyS.js → index-CCsSOTaB.js} +2 -2
  38. package/dist/{index-YQnrEK_K.js → index-CDXq3gs4.js} +21 -21
  39. package/dist/{index-CrWFG4Wb.cjs → index-CK_O7QdV.cjs} +1 -1
  40. package/dist/{index-N7dEiXLQ.js → index-CLtFz5gE.js} +3 -3
  41. package/dist/{index-6t33eejU.cjs → index-CMlYJD5U.cjs} +1 -1
  42. package/dist/{index-BxPnA2or.js → index-CdPbJekh.js} +448 -448
  43. package/dist/{index-CjI5pDiU.cjs → index-CmlXlH2b.cjs} +1 -1
  44. package/dist/{index-C_VamYcq.js → index-CpE8hbs0.js} +6 -6
  45. package/dist/{index-CNJzNn6z.cjs → index-CxNBcsll.cjs} +1 -1
  46. package/dist/{index-BqCCREh3.js → index-CyP2hcVu.js} +6 -6
  47. package/dist/{index-gjDjqhNq.cjs → index-D-r_YKrq.cjs} +2 -2
  48. package/dist/{index-C23iUpXa.js → index-D0_4keB8.js} +5 -5
  49. package/dist/{index-db5CgGrA.js → index-DBScQH7L.js} +13 -13
  50. package/dist/{index-Cx302rHQ.cjs → index-DCf7Tz40.cjs} +1 -1
  51. package/dist/{index-DNE4QDIf.js → index-DEwcUkb-.js} +3 -3
  52. package/dist/{index-qoqka5Nb.js → index-DFg-bhPI.js} +1 -1
  53. package/dist/{index-CtPy-3S1.cjs → index-DJ1PTHpx.cjs} +1 -1
  54. package/dist/{index-DqaA5Rvx.cjs → index-DOlPMLvf.cjs} +1 -1
  55. package/dist/{index-Kg96Vvn5.cjs → index-DPaTtF3h.cjs} +1 -1
  56. package/dist/{index-CVl84S8B.cjs → index-DPyzaxnq.cjs} +1 -1
  57. package/dist/{index-DH0dVg0N.js → index-DS5z17Mc.js} +7 -7
  58. package/dist/{index-B35e4i9n.js → index-DSsZtYMz.js} +2 -2
  59. package/dist/{index-DVvt9_w0.js → index-Dk8D9SRm.js} +1 -1
  60. package/dist/{index-wHil9Fox.js → index-DsHRVZ0E.js} +2 -2
  61. package/dist/{index-DmB0dlGH.cjs → index-DszzdQnM.cjs} +1 -1
  62. package/dist/{index-BwjuTBrR.js → index-FxX6NP0J.js} +1 -1
  63. package/dist/{index-CtG-uyjY.cjs → index-LXb5DfDE.cjs} +1 -1
  64. package/dist/{index-byBdKAky.cjs → index-NFCeQcv4.cjs} +1 -1
  65. package/dist/{index-BvPC1LSv.js → index-PIEkAjRf.js} +12 -12
  66. package/dist/{index-CYp77kPp.js → index-UN4JU0ly.js} +1 -1
  67. package/dist/{index-CvEj4aiY.js → index-Y7MUJdPv.js} +2 -2
  68. package/dist/{index-aneoZx5F.js → index-bj8hK6Pe.js} +2 -2
  69. package/dist/{index-1z9RrjZc.cjs → index-d6tSWKtY.cjs} +1 -1
  70. package/dist/{index-DIm3MBK_.cjs → index-nUEWiqy9.cjs} +1 -1
  71. package/dist/{index-dqBbhGfy.js → index-pLeOyTaj.js} +6 -6
  72. package/dist/{index-nq9fleOT.js → index-xHEf6hcO.js} +2 -2
  73. package/dist/{index-XQxaEXgz.cjs → index-zQVJFawn.cjs} +1 -1
  74. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dmm4yqcc.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.js} +2 -2
  75. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CzcK5mCc.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.cjs} +1 -1
  76. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-B0Ivzvcp.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Bg_c-oAL.js} +6 -6
  77. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-xm0hMPwT.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-C795GAHK.cjs} +1 -1
  78. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Czu5g16A.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-9kDr7Iek.js} +13 -13
  79. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CMx9TLjC.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Bn5qXF4J.cjs} +1 -1
  80. package/dist/{index.vue_vue_type_style_index_1_lang-CXwGS60-.cjs → index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs} +46 -45
  81. package/dist/{index.vue_vue_type_style_index_1_lang-BxEXAMMV.js → index.vue_vue_type_style_index_1_lang-D1n_3_F6.js} +5100 -5012
  82. package/dist/{index.vue_vue_type_style_index_1_lang-AXp5rRSK.js → index.vue_vue_type_style_index_1_lang-Exyt6qTf.js} +525 -525
  83. package/dist/{index.vue_vue_type_style_index_1_lang-j5HrYuvy.cjs → index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs} +2 -2
  84. package/dist/{isString-BNK38WbE.js → isString-BAN9KLwf.js} +1 -1
  85. package/dist/{isString-BmAegMGI.cjs → isString-ChvWbctO.cjs} +1 -1
  86. package/dist/{main-BgpAXuSa.cjs → main-BUEuCNq-.cjs} +1 -1
  87. package/dist/{main-t7yIujwl.js → main-Dk3BZDsa.js} +5 -5
  88. package/dist/ss-component.cjs +1 -1
  89. package/dist/ss-component.css +1 -1
  90. package/dist/ss-component.js +11 -11
  91. package/dist/ss-component2.cjs +1 -1
  92. package/dist/ss-component2.js +12 -12
  93. package/dist/three-viewport-gizmo-BHznJ6W3.js +26015 -0
  94. package/dist/three-viewport-gizmo-BV37JzRa.cjs +4197 -0
  95. package/dist/{threeLatheView-sTBlm0tt.js → threeLatheView-DcuDjVv0.js} +4 -4
  96. package/dist/{threeLatheView-BzHB-t_G.cjs → threeLatheView-DfSxRY8B.cjs} +1 -1
  97. package/dist/{threeModel-BudPgWiX.cjs → threeModel-DjjtL0-a.cjs} +1 -1
  98. package/dist/{threeModel-11Yk8w2d.js → threeModel-YRFvkgXU.js} +5 -5
  99. package/dist/threePreview-ByUYJkts.cjs +1 -0
  100. package/dist/threePreview-CyYfnbB6.js +1972 -0
  101. package/dist/{threeSceneView-DT-STxuj.cjs → threeSceneView-mhrcH0WG.cjs} +1 -1
  102. package/dist/{threeSceneView-Bwed326O.js → threeSceneView-zvyCHrp1.js} +24 -24
  103. package/dist/{threeSceneViewForCPMPIP-RRDb_tZ0.cjs → threeSceneViewForCPMPIP-DA-twBdG.cjs} +2 -2
  104. package/dist/{threeSceneViewForCPMPIP-PgPPGBxu.js → threeSceneViewForCPMPIP-axjwKt9X.js} +27 -27
  105. package/dist/{threeViewerHost-Brgx-J3Q.cjs → threeViewerHost-B02OtfCk.cjs} +1 -1
  106. package/dist/{threeViewerHost-k5I66uBW.js → threeViewerHost-D7L1FW__.js} +4 -4
  107. package/dist/{useRayCaster-TCYe6KMI.js → useRayCaster-CAqupK7D.js} +12 -12
  108. package/dist/{useRayCaster-CLcetetd.cjs → useRayCaster-ClcofJkf.cjs} +1 -1
  109. package/package.json +1 -1
  110. package/public/config.js +1 -1
  111. package/dist/OrbitControls-D1lM0xvz.cjs +0 -1
  112. package/dist/OrbitControls-DI8fa9gz.js +0 -419
  113. package/dist/STLLoader-KxFIlfhN.cjs +0 -6
  114. package/dist/STLLoader-memlq1bT.js +0 -609
  115. package/dist/index-TXrydBPq.cjs +0 -1
  116. package/dist/three-viewport-gizmo-BxFHxv_x.js +0 -18587
  117. package/dist/three-viewport-gizmo-CwaL5sMV.cjs +0 -4195
  118. package/dist/threePreview-Cy7NY-gw.cjs +0 -1
  119. package/dist/threePreview-DPyqhBkJ.js +0 -1873
@@ -1,609 +0,0 @@
1
- import { y as J, F as W, C as P, o as re, p as T, ax as M, ab as E, aa as Y, a9 as R, h as se, af as Z, ah as H, e as X, V as I, z as ne, au as ie, a6 as oe, J as K, aD as ae, Y as le, b as ce, _ as N } from "./three-viewport-gizmo-BxFHxv_x.js";
2
- const he = /^[og]\s*(.+)?/, ue = /^mtllib /, pe = /^usemtl /, fe = /^usemap /, Q = /\s+/, $ = new I(), q = new I(), ee = new I(), te = new I(), F = new I(), B = new P();
3
- function de() {
4
- const S = {
5
- objects: [],
6
- object: {},
7
- vertices: [],
8
- normals: [],
9
- colors: [],
10
- uvs: [],
11
- materials: {},
12
- materialLibraries: [],
13
- startObject: function(e, s) {
14
- if (this.object && this.object.fromDeclaration === !1) {
15
- this.object.name = e, 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: e || "",
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(t, r) {
32
- const h = this._finalize(!1);
33
- h && (h.inherited || h.groupCount <= 0) && this.materials.splice(h.index, 1);
34
- const c = {
35
- index: this.materials.length,
36
- name: t || "",
37
- mtllib: Array.isArray(r) && r.length > 0 ? r[r.length - 1] : "",
38
- smooth: h !== void 0 ? h.smooth : this.smooth,
39
- groupStart: h !== void 0 ? h.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(c), c;
58
- },
59
- currentMaterial: function() {
60
- if (this.materials.length > 0)
61
- return this.materials[this.materials.length - 1];
62
- },
63
- _finalize: function(t) {
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), t && this.materials.length > 1)
66
- for (let h = this.materials.length - 1; h >= 0; h--)
67
- this.materials[h].groupCount <= 0 && this.materials.splice(h, 1);
68
- return t && 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 t = i.clone(0);
75
- t.inherited = !0, this.object.materials.push(t);
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(e, s) {
83
- const i = parseInt(e, 10);
84
- return (i >= 0 ? i - 1 : i + s / 3) * 3;
85
- },
86
- parseNormalIndex: function(e, s) {
87
- const i = parseInt(e, 10);
88
- return (i >= 0 ? i - 1 : i + s / 3) * 3;
89
- },
90
- parseUVIndex: function(e, s) {
91
- const i = parseInt(e, 10);
92
- return (i >= 0 ? i - 1 : i + s / 2) * 2;
93
- },
94
- addVertex: function(e, s, i) {
95
- const t = this.vertices, r = this.object.geometry.vertices;
96
- r.push(t[e + 0], t[e + 1], t[e + 2]), r.push(t[s + 0], t[s + 1], t[s + 2]), r.push(t[i + 0], t[i + 1], t[i + 2]);
97
- },
98
- addVertexPoint: function(e) {
99
- const s = this.vertices;
100
- this.object.geometry.vertices.push(s[e + 0], s[e + 1], s[e + 2]);
101
- },
102
- addVertexLine: function(e) {
103
- const s = this.vertices;
104
- this.object.geometry.vertices.push(s[e + 0], s[e + 1], s[e + 2]);
105
- },
106
- addNormal: function(e, s, i) {
107
- const t = this.normals, r = this.object.geometry.normals;
108
- r.push(t[e + 0], t[e + 1], t[e + 2]), r.push(t[s + 0], t[s + 1], t[s + 2]), r.push(t[i + 0], t[i + 1], t[i + 2]);
109
- },
110
- addFaceNormal: function(e, s, i) {
111
- const t = this.vertices, r = this.object.geometry.normals;
112
- $.fromArray(t, e), q.fromArray(t, s), ee.fromArray(t, i), F.subVectors(ee, q), te.subVectors($, q), F.cross(te), F.normalize(), r.push(F.x, F.y, F.z), r.push(F.x, F.y, F.z), r.push(F.x, F.y, F.z);
113
- },
114
- addColor: function(e, s, i) {
115
- const t = this.colors, r = this.object.geometry.colors;
116
- t[e] !== void 0 && r.push(t[e + 0], t[e + 1], t[e + 2]), t[s] !== void 0 && r.push(t[s + 0], t[s + 1], t[s + 2]), t[i] !== void 0 && r.push(t[i + 0], t[i + 1], t[i + 2]);
117
- },
118
- addUV: function(e, s, i) {
119
- const t = this.uvs, r = this.object.geometry.uvs;
120
- r.push(t[e + 0], t[e + 1]), r.push(t[s + 0], t[s + 1]), r.push(t[i + 0], t[i + 1]);
121
- },
122
- addDefaultUV: function() {
123
- const e = this.object.geometry.uvs;
124
- e.push(0, 0), e.push(0, 0), e.push(0, 0);
125
- },
126
- addUVLine: function(e) {
127
- const s = this.uvs;
128
- this.object.geometry.uvs.push(s[e + 0], s[e + 1]);
129
- },
130
- addFace: function(e, s, i, t, r, h, c, l, n) {
131
- const o = this.vertices.length;
132
- let a = this.parseVertexIndex(e, o), u = this.parseVertexIndex(s, o), d = this.parseVertexIndex(i, o);
133
- if (this.addVertex(a, u, d), this.addColor(a, u, d), c !== void 0 && c !== "") {
134
- const m = this.normals.length;
135
- a = this.parseNormalIndex(c, m), u = this.parseNormalIndex(l, m), d = this.parseNormalIndex(n, m), this.addNormal(a, u, d);
136
- } else
137
- this.addFaceNormal(a, u, d);
138
- if (t !== void 0 && t !== "") {
139
- const m = this.uvs.length;
140
- a = this.parseUVIndex(t, m), u = this.parseUVIndex(r, m), d = this.parseUVIndex(h, m), this.addUV(a, u, d), this.object.geometry.hasUVIndices = !0;
141
- } else
142
- this.addDefaultUV();
143
- },
144
- addPointGeometry: function(e) {
145
- this.object.geometry.type = "Points";
146
- const s = this.vertices.length;
147
- for (let i = 0, t = e.length; i < t; i++) {
148
- const r = this.parseVertexIndex(e[i], s);
149
- this.addVertexPoint(r), this.addColor(r);
150
- }
151
- },
152
- addLineGeometry: function(e, s) {
153
- this.object.geometry.type = "Line";
154
- const i = this.vertices.length, t = this.uvs.length;
155
- for (let r = 0, h = e.length; r < h; r++)
156
- this.addVertexLine(this.parseVertexIndex(e[r], i));
157
- for (let r = 0, h = s.length; r < h; r++)
158
- this.addUVLine(this.parseUVIndex(s[r], t));
159
- }
160
- };
161
- return S.startObject("", !1), S;
162
- }
163
- class be extends J {
164
- constructor(e) {
165
- super(e), this.materials = null;
166
- }
167
- load(e, s, i, t) {
168
- const r = this, h = new W(this.manager);
169
- h.setPath(this.path), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(e, function(c) {
170
- try {
171
- s(r.parse(c));
172
- } catch (l) {
173
- t ? t(l) : console.error(l), r.manager.itemError(e);
174
- }
175
- }, i, t);
176
- }
177
- setMaterials(e) {
178
- return this.materials = e, this;
179
- }
180
- parse(e) {
181
- const s = new de();
182
- e.indexOf(`\r
183
- `) !== -1 && (e = e.replace(/\r\n/g, `
184
- `)), e.indexOf(`\\
185
- `) !== -1 && (e = e.replace(/\\\n/g, ""));
186
- const i = e.split(`
187
- `);
188
- let t = [];
189
- for (let c = 0, l = i.length; c < l; c++) {
190
- const n = i[c].trimStart();
191
- if (n.length === 0) continue;
192
- const o = n.charAt(0);
193
- if (o !== "#")
194
- if (o === "v") {
195
- const a = n.split(Q);
196
- switch (a[0]) {
197
- case "v":
198
- s.vertices.push(
199
- parseFloat(a[1]),
200
- parseFloat(a[2]),
201
- parseFloat(a[3])
202
- ), a.length >= 7 ? (B.setRGB(
203
- parseFloat(a[4]),
204
- parseFloat(a[5]),
205
- parseFloat(a[6])
206
- ).convertSRGBToLinear(), s.colors.push(B.r, B.g, B.b)) : s.colors.push(void 0, void 0, void 0);
207
- break;
208
- case "vn":
209
- s.normals.push(
210
- parseFloat(a[1]),
211
- parseFloat(a[2]),
212
- parseFloat(a[3])
213
- );
214
- break;
215
- case "vt":
216
- s.uvs.push(
217
- parseFloat(a[1]),
218
- parseFloat(a[2])
219
- );
220
- break;
221
- }
222
- } else if (o === "f") {
223
- const u = n.slice(1).trim().split(Q), d = [];
224
- for (let p = 0, g = u.length; p < g; p++) {
225
- const b = u[p];
226
- if (b.length > 0) {
227
- const x = b.split("/");
228
- d.push(x);
229
- }
230
- }
231
- const m = d[0];
232
- for (let p = 1, g = d.length - 1; p < g; p++) {
233
- const b = d[p], x = d[p + 1];
234
- s.addFace(
235
- m[0],
236
- b[0],
237
- x[0],
238
- m[1],
239
- b[1],
240
- x[1],
241
- m[2],
242
- b[2],
243
- x[2]
244
- );
245
- }
246
- } else if (o === "l") {
247
- const a = n.substring(1).trim().split(" ");
248
- let u = [];
249
- const d = [];
250
- if (n.indexOf("/") === -1)
251
- u = a;
252
- else
253
- for (let m = 0, p = a.length; m < p; m++) {
254
- const g = a[m].split("/");
255
- g[0] !== "" && u.push(g[0]), g[1] !== "" && d.push(g[1]);
256
- }
257
- s.addLineGeometry(u, d);
258
- } else if (o === "p") {
259
- const u = n.slice(1).trim().split(" ");
260
- s.addPointGeometry(u);
261
- } else if ((t = he.exec(n)) !== null) {
262
- const a = (" " + t[0].slice(1).trim()).slice(1);
263
- s.startObject(a);
264
- } else if (pe.test(n))
265
- s.object.startMaterial(n.substring(7).trim(), s.materialLibraries);
266
- else if (ue.test(n))
267
- s.materialLibraries.push(n.substring(7).trim());
268
- else if (fe.test(n))
269
- console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
270
- else if (o === "s") {
271
- if (t = n.split(" "), t.length > 1) {
272
- const u = t[1].trim().toLowerCase();
273
- s.object.smooth = u !== "0" && u !== "off";
274
- } else
275
- s.object.smooth = !0;
276
- const a = s.object.currentMaterial();
277
- a && (a.smooth = s.object.smooth);
278
- } else {
279
- if (n === "\0") continue;
280
- console.warn('THREE.OBJLoader: Unexpected line: "' + n + '"');
281
- }
282
- }
283
- s.finalize();
284
- const r = new re();
285
- if (r.materialLibraries = [].concat(s.materialLibraries), !(s.objects.length === 1 && s.objects[0].geometry.vertices.length === 0) === !0)
286
- for (let c = 0, l = s.objects.length; c < l; c++) {
287
- const n = s.objects[c], o = n.geometry, a = n.materials, u = o.type === "Line", d = o.type === "Points";
288
- let m = !1;
289
- if (o.vertices.length === 0) continue;
290
- const p = new T();
291
- p.setAttribute("position", new M(o.vertices, 3)), o.normals.length > 0 && p.setAttribute("normal", new M(o.normals, 3)), o.colors.length > 0 && (m = !0, p.setAttribute("color", new M(o.colors, 3))), o.hasUVIndices === !0 && p.setAttribute("uv", new M(o.uvs, 2));
292
- const g = [];
293
- for (let x = 0, C = a.length; x < C; x++) {
294
- const v = a[x], j = v.name + "_" + v.smooth + "_" + m;
295
- let f = s.materials[j];
296
- if (this.materials !== null) {
297
- if (f = this.materials.create(v.name), u && f && !(f instanceof E)) {
298
- const w = new E();
299
- Y.prototype.copy.call(w, f), w.color.copy(f.color), f = w;
300
- } else if (d && f && !(f instanceof R)) {
301
- const w = new R({ size: 10, sizeAttenuation: !1 });
302
- Y.prototype.copy.call(w, f), w.color.copy(f.color), w.map = f.map, f = w;
303
- }
304
- }
305
- f === void 0 && (u ? f = new E() : d ? f = new R({ size: 1, sizeAttenuation: !1 }) : f = new se(), f.name = v.name, f.flatShading = !v.smooth, f.vertexColors = m, s.materials[j] = f), g.push(f);
306
- }
307
- let b;
308
- if (g.length > 1) {
309
- for (let x = 0, C = a.length; x < C; x++) {
310
- const v = a[x];
311
- p.addGroup(v.groupStart, v.groupCount, x);
312
- }
313
- u ? b = new Z(p, g) : d ? b = new H(p, g) : b = new X(p, g);
314
- } else
315
- u ? b = new Z(p, g[0]) : d ? b = new H(p, g[0]) : b = new X(p, g[0]);
316
- b.name = n.name, r.add(b);
317
- }
318
- else if (s.vertices.length > 0) {
319
- const c = new R({ size: 1, sizeAttenuation: !1 }), l = new T();
320
- l.setAttribute("position", new M(s.vertices, 3)), s.colors.length > 0 && s.colors[0] !== void 0 && (l.setAttribute("color", new M(s.colors, 3)), c.vertexColors = !0);
321
- const n = new H(l, c);
322
- r.add(n);
323
- }
324
- return r;
325
- }
326
- }
327
- class xe extends J {
328
- constructor(e) {
329
- super(e);
330
- }
331
- /**
332
- * Loads and parses a MTL asset from a URL.
333
- *
334
- * @param {String} url - URL to the MTL file.
335
- * @param {Function} [onLoad] - Callback invoked with the loaded object.
336
- * @param {Function} [onProgress] - Callback for download progress.
337
- * @param {Function} [onError] - Callback for download errors.
338
- *
339
- * @see setPath setResourcePath
340
- *
341
- * @note In order for relative texture references to resolve correctly
342
- * you must call setResourcePath() explicitly prior to load.
343
- */
344
- load(e, s, i, t) {
345
- const r = this, h = this.path === "" ? ne.extractUrlBase(e) : this.path, c = new W(this.manager);
346
- c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
347
- try {
348
- s(r.parse(l, h));
349
- } catch (n) {
350
- t ? t(n) : console.error(n), r.manager.itemError(e);
351
- }
352
- }, i, t);
353
- }
354
- setMaterialOptions(e) {
355
- return this.materialOptions = e, this;
356
- }
357
- /**
358
- * Parses a MTL file.
359
- *
360
- * @param {String} text - Content of MTL file
361
- * @return {MaterialCreator}
362
- *
363
- * @see setPath setResourcePath
364
- *
365
- * @note In order for relative texture references to resolve correctly
366
- * you must call setResourcePath() explicitly prior to parse.
367
- */
368
- parse(e, s) {
369
- const i = e.split(`
370
- `);
371
- let t = {};
372
- const r = /\s+/, h = {};
373
- for (let l = 0; l < i.length; l++) {
374
- let n = i[l];
375
- if (n = n.trim(), n.length === 0 || n.charAt(0) === "#")
376
- continue;
377
- const o = n.indexOf(" ");
378
- let a = o >= 0 ? n.substring(0, o) : n;
379
- a = a.toLowerCase();
380
- let u = o >= 0 ? n.substring(o + 1) : "";
381
- if (u = u.trim(), a === "newmtl")
382
- t = { name: u }, h[u] = t;
383
- else if (a === "ka" || a === "kd" || a === "ks" || a === "ke") {
384
- const d = u.split(r, 3);
385
- t[a] = [parseFloat(d[0]), parseFloat(d[1]), parseFloat(d[2])];
386
- } else
387
- t[a] = u;
388
- }
389
- const c = new me(this.resourcePath || s, this.materialOptions);
390
- return c.setCrossOrigin(this.crossOrigin), c.setManager(this.manager), c.setMaterials(h), c;
391
- }
392
- }
393
- class me {
394
- constructor(e = "", s = {}) {
395
- this.baseUrl = e, this.options = s, this.materialsInfo = {}, this.materials = {}, this.materialsArray = [], this.nameLookup = {}, this.crossOrigin = "anonymous", this.side = this.options.side !== void 0 ? this.options.side : ie, this.wrap = this.options.wrap !== void 0 ? this.options.wrap : oe;
396
- }
397
- setCrossOrigin(e) {
398
- return this.crossOrigin = e, this;
399
- }
400
- setManager(e) {
401
- this.manager = e;
402
- }
403
- setMaterials(e) {
404
- this.materialsInfo = this.convert(e), this.materials = {}, this.materialsArray = [], this.nameLookup = {};
405
- }
406
- convert(e) {
407
- if (!this.options) return e;
408
- const s = {};
409
- for (const i in e) {
410
- const t = e[i], r = {};
411
- s[i] = r;
412
- for (const h in t) {
413
- let c = !0, l = t[h];
414
- const n = h.toLowerCase();
415
- switch (n) {
416
- case "kd":
417
- case "ka":
418
- case "ks":
419
- 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 && (c = !1);
420
- break;
421
- }
422
- c && (r[n] = l);
423
- }
424
- }
425
- return s;
426
- }
427
- preload() {
428
- for (const e in this.materialsInfo)
429
- this.create(e);
430
- }
431
- getIndex(e) {
432
- return this.nameLookup[e];
433
- }
434
- getAsArray() {
435
- let e = 0;
436
- for (const s in this.materialsInfo)
437
- this.materialsArray[e] = this.create(s), this.nameLookup[s] = e, e++;
438
- return this.materialsArray;
439
- }
440
- create(e) {
441
- return this.materials[e] === void 0 && this.createMaterial_(e), this.materials[e];
442
- }
443
- createMaterial_(e) {
444
- const s = this, i = this.materialsInfo[e], t = {
445
- name: e,
446
- side: this.side
447
- };
448
- function r(c, l) {
449
- return typeof l != "string" || l === "" ? "" : /^https?:\/\//i.test(l) ? l : c + l;
450
- }
451
- function h(c, l) {
452
- if (t[c]) return;
453
- const n = s.getTextureParams(l, t), o = s.loadTexture(r(s.baseUrl, n.url));
454
- o.repeat.copy(n.scale), o.offset.copy(n.offset), o.wrapS = s.wrap, o.wrapT = s.wrap, (c === "map" || c === "emissiveMap") && (o.colorSpace = ce), t[c] = o;
455
- }
456
- for (const c in i) {
457
- const l = i[c];
458
- let n;
459
- if (l !== "")
460
- switch (c.toLowerCase()) {
461
- // Ns is material specular exponent
462
- case "kd":
463
- t.color = new P().fromArray(l).convertSRGBToLinear();
464
- break;
465
- case "ks":
466
- t.specular = new P().fromArray(l).convertSRGBToLinear();
467
- break;
468
- case "ke":
469
- t.emissive = new P().fromArray(l).convertSRGBToLinear();
470
- break;
471
- case "map_kd":
472
- h("map", l);
473
- break;
474
- case "map_ks":
475
- h("specularMap", l);
476
- break;
477
- case "map_ke":
478
- h("emissiveMap", l);
479
- break;
480
- case "norm":
481
- h("normalMap", l);
482
- break;
483
- case "map_bump":
484
- case "bump":
485
- h("bumpMap", l);
486
- break;
487
- case "map_d":
488
- h("alphaMap", l), t.transparent = !0;
489
- break;
490
- case "ns":
491
- t.shininess = parseFloat(l);
492
- break;
493
- case "d":
494
- n = parseFloat(l), n < 1 && (t.opacity = n, t.transparent = !0);
495
- break;
496
- case "tr":
497
- n = parseFloat(l), this.options && this.options.invertTrProperty && (n = 1 - n), n > 0 && (t.opacity = 1 - n, t.transparent = !0);
498
- break;
499
- }
500
- }
501
- return this.materials[e] = new se(t), this.materials[e];
502
- }
503
- getTextureParams(e, s) {
504
- const i = {
505
- scale: new K(1, 1),
506
- offset: new K(0, 0)
507
- }, t = e.split(/\s+/);
508
- let r;
509
- return r = t.indexOf("-bm"), r >= 0 && (s.bumpScale = parseFloat(t[r + 1]), t.splice(r, 2)), r = t.indexOf("-s"), r >= 0 && (i.scale.set(parseFloat(t[r + 1]), parseFloat(t[r + 2])), t.splice(r, 4)), r = t.indexOf("-o"), r >= 0 && (i.offset.set(parseFloat(t[r + 1]), parseFloat(t[r + 2])), t.splice(r, 4)), i.url = t.join(" ").trim(), i;
510
- }
511
- loadTexture(e, s, i, t, r) {
512
- const h = this.manager !== void 0 ? this.manager : ae;
513
- let c = h.getHandler(e);
514
- c === null && (c = new le(h)), c.setCrossOrigin && c.setCrossOrigin(this.crossOrigin);
515
- const l = c.load(e, i, t, r);
516
- return s !== void 0 && (l.mapping = s), l;
517
- }
518
- }
519
- class we extends J {
520
- constructor(e) {
521
- super(e);
522
- }
523
- load(e, s, i, t) {
524
- const r = this, h = new W(this.manager);
525
- h.setPath(this.path), h.setResponseType("arraybuffer"), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(e, function(c) {
526
- try {
527
- s(r.parse(c));
528
- } catch (l) {
529
- t ? t(l) : console.error(l), r.manager.itemError(e);
530
- }
531
- }, i, t);
532
- }
533
- parse(e) {
534
- function s(n) {
535
- const o = new DataView(n), a = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8, u = o.getUint32(80, !0);
536
- if (80 + 32 / 8 + u * a === o.byteLength)
537
- return !0;
538
- const m = [115, 111, 108, 105, 100];
539
- for (let p = 0; p < 5; p++)
540
- if (i(m, o, p)) return !1;
541
- return !0;
542
- }
543
- function i(n, o, a) {
544
- for (let u = 0, d = n.length; u < d; u++)
545
- if (n[u] !== o.getUint8(a + u)) return !1;
546
- return !0;
547
- }
548
- function t(n) {
549
- const o = new DataView(n), a = o.getUint32(80, !0);
550
- let u, d, m, p = !1, g, b, x, C, v;
551
- for (let y = 0; y < 70; y++)
552
- o.getUint32(y, !1) == 1129270351 && o.getUint8(y + 4) == 82 && o.getUint8(y + 5) == 61 && (p = !0, g = new Float32Array(a * 3 * 3), b = o.getUint8(y + 6) / 255, x = o.getUint8(y + 7) / 255, C = o.getUint8(y + 8) / 255, v = o.getUint8(y + 9) / 255);
553
- const j = 84, f = 12 * 4 + 2, w = new T(), V = new Float32Array(a * 3 * 3), A = new Float32Array(a * 3 * 3), k = new P();
554
- for (let y = 0; y < a; y++) {
555
- const U = j + y * f, D = o.getFloat32(U, !0), O = o.getFloat32(U + 4, !0), z = o.getFloat32(U + 8, !0);
556
- if (p) {
557
- const L = o.getUint16(U + 48, !0);
558
- (L & 32768) === 0 ? (u = (L & 31) / 31, d = (L >> 5 & 31) / 31, m = (L >> 10 & 31) / 31) : (u = b, d = x, m = C);
559
- }
560
- for (let L = 1; L <= 3; L++) {
561
- const G = U + L * 12, _ = y * 3 * 3 + (L - 1) * 3;
562
- V[_] = o.getFloat32(G, !0), V[_ + 1] = o.getFloat32(G + 4, !0), V[_ + 2] = o.getFloat32(G + 8, !0), A[_] = D, A[_ + 1] = O, A[_ + 2] = z, p && (k.set(u, d, m).convertSRGBToLinear(), g[_] = k.r, g[_ + 1] = k.g, g[_ + 2] = k.b);
563
- }
564
- }
565
- return w.setAttribute("position", new N(V, 3)), w.setAttribute("normal", new N(A, 3)), p && (w.setAttribute("color", new N(g, 3)), w.hasColors = !0, w.alpha = v), w;
566
- }
567
- function r(n) {
568
- const o = new T(), a = /solid([\s\S]*?)endsolid/g, u = /facet([\s\S]*?)endfacet/g, d = /solid\s(.+)/;
569
- let m = 0;
570
- 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 I();
571
- let f, w = 0, V = 0, A = 0;
572
- for (; (f = a.exec(n)) !== null; ) {
573
- V = A;
574
- const k = f[0], y = (f = d.exec(k)) !== null ? f[1] : "";
575
- for (v.push(y); (f = u.exec(k)) !== null; ) {
576
- let O = 0, z = 0;
577
- const L = f[0];
578
- for (; (f = b.exec(L)) !== null; )
579
- j.x = parseFloat(f[1]), j.y = parseFloat(f[2]), j.z = parseFloat(f[3]), z++;
580
- for (; (f = g.exec(L)) !== null; )
581
- x.push(parseFloat(f[1]), parseFloat(f[2]), parseFloat(f[3])), C.push(j.x, j.y, j.z), O++, A++;
582
- z !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + m), O !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + m), m++;
583
- }
584
- const U = V, D = A - V;
585
- o.userData.groupNames = v, o.addGroup(U, D, w), w++;
586
- }
587
- return o.setAttribute("position", new M(x, 3)), o.setAttribute("normal", new M(C, 3)), o;
588
- }
589
- function h(n) {
590
- return typeof n != "string" ? new TextDecoder().decode(n) : n;
591
- }
592
- function c(n) {
593
- if (typeof n == "string") {
594
- const o = new Uint8Array(n.length);
595
- for (let a = 0; a < n.length; a++)
596
- o[a] = n.charCodeAt(a) & 255;
597
- return o.buffer || o;
598
- } else
599
- return n;
600
- }
601
- const l = c(e);
602
- return s(l) ? t(l) : r(h(e));
603
- }
604
- }
605
- export {
606
- xe as M,
607
- be as O,
608
- we as S
609
- };