@thi.ng/geom-io-obj 0.3.126 → 0.3.128

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:18Z
3
+ - **Last updated**: 2024-06-21T19:34:38Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [0.3.128](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-io-obj@0.3.128) (2024-06-21)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
17
+
12
18
  ### [0.3.82](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-io-obj@0.3.82) (2023-11-09)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 193 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom-io-obj",
3
- "version": "0.3.126",
3
+ "version": "0.3.128",
4
4
  "description": "Wavefront OBJ parser (& exporter soon)",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/geom-io-obj#readme",
13
+ "homepage": "https://thi.ng/geom-io-obj",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -36,15 +36,15 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.1",
40
- "@thi.ng/errors": "^2.5.6",
41
- "@thi.ng/vectors": "^7.10.30"
39
+ "@thi.ng/api": "^8.11.3",
40
+ "@thi.ng/errors": "^2.5.8",
41
+ "@thi.ng/vectors": "^7.11.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@microsoft/api-extractor": "^7.43.0",
45
- "esbuild": "^0.20.2",
46
- "typedoc": "^0.25.12",
47
- "typescript": "^5.4.3"
44
+ "@microsoft/api-extractor": "^7.47.0",
45
+ "esbuild": "^0.21.5",
46
+ "typedoc": "^0.25.13",
47
+ "typescript": "^5.5.2"
48
48
  },
49
49
  "keywords": [
50
50
  "3d",
@@ -84,5 +84,5 @@
84
84
  "status": "alpha",
85
85
  "year": 2016
86
86
  },
87
- "gitHead": "aed3421c21044c005fbcb7cc37965ccf85a870d2\n"
87
+ "gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
88
88
  }
package/parser.js CHANGED
@@ -49,15 +49,15 @@ const parseOBJ = (src, opts) => {
49
49
  switch (items.length) {
50
50
  case 1:
51
51
  for (let i = 1; i < n; i++) {
52
- addID(face.v, line[i], nv);
52
+ __addID(face.v, line[i], nv);
53
53
  }
54
54
  break;
55
55
  case 2:
56
56
  opts.uvs && (face.uv = []);
57
57
  for (let i = 1; i < n; i++) {
58
58
  const f = line[i].split("/");
59
- addID(face.v, f[0], nv);
60
- face.uv && addID(face.uv, f[1], nuv);
59
+ __addID(face.v, f[0], nv);
60
+ face.uv && __addID(face.uv, f[1], nuv);
61
61
  }
62
62
  break;
63
63
  case 3:
@@ -65,9 +65,9 @@ const parseOBJ = (src, opts) => {
65
65
  opts.normals && items[2].length && (face.n = []);
66
66
  for (let i = 1; i < n; i++) {
67
67
  const f = line[i].split("/");
68
- addID(face.v, f[0], nv);
69
- face.uv && addID(face.uv, f[1], nuv);
70
- face.n && addID(face.n, f[2], nn);
68
+ __addID(face.v, f[0], nv);
69
+ face.uv && __addID(face.uv, f[1], nuv);
70
+ face.n && __addID(face.n, f[2], nn);
71
71
  }
72
72
  break;
73
73
  default:
@@ -78,7 +78,7 @@ const parseOBJ = (src, opts) => {
78
78
  const nv = vertices.length;
79
79
  const verts = [];
80
80
  for (let i = 1, n = items.length; i < n; i++) {
81
- addID(verts, items[i], nv);
81
+ __addID(verts, items[i], nv);
82
82
  }
83
83
  return verts;
84
84
  };
@@ -87,8 +87,7 @@ const parseOBJ = (src, opts) => {
87
87
  const lines = src.split(/[\n\r]+/g);
88
88
  for (let i = 0, n = lines.length; i < n; i++) {
89
89
  const l = lines[i];
90
- if (!l.length)
91
- continue;
90
+ if (!l.length) continue;
92
91
  if (l[0] === "#") {
93
92
  comments && result.comments.push(l.substring(1).trim());
94
93
  continue;
@@ -98,26 +97,26 @@ const parseOBJ = (src, opts) => {
98
97
  switch (items[0]) {
99
98
  case "v": {
100
99
  assert(len > 3, `invalid vertex @ line ${i}`);
101
- const v = readVec3(items);
100
+ const v = __readVec3(items);
102
101
  vertices.push(xform ? xform(v) : v);
103
102
  break;
104
103
  }
105
104
  case "vn": {
106
105
  assert(len > 3, `invalid normal @ line ${i}`);
107
- const v = readVec3(items);
106
+ const v = __readVec3(items);
108
107
  normals.push(xform ? xform(v) : v);
109
108
  break;
110
109
  }
111
110
  case "vt": {
112
111
  assert(len > 2, `invalid uv @ line ${i}`);
113
- const v = readVec2(items);
112
+ const v = __readVec2(items);
114
113
  uvs.push(xformUV ? xformUV(v) : v);
115
114
  break;
116
115
  }
117
116
  case "f": {
118
117
  assert(len > 3, `invalid face @ line ${i}`);
119
118
  const f = readFace(items);
120
- tessellate && f.v.length > 3 ? faces.push(...tessellateFace(f)) : faces.push(f);
119
+ tessellate && f.v.length > 3 ? faces.push(...__tessellateFace(f)) : faces.push(f);
121
120
  break;
122
121
  }
123
122
  case "l":
@@ -145,20 +144,20 @@ const parseOBJ = (src, opts) => {
145
144
  }
146
145
  return result;
147
146
  };
148
- const addID = (acc, x, num) => {
147
+ const __addID = (acc, x, num) => {
149
148
  const v = parseInt(x);
150
149
  acc.push(v < 0 ? v + num : v - 1);
151
150
  };
152
- const readVec2 = (items) => [
151
+ const __readVec2 = (items) => [
153
152
  parseFloat(items[1]),
154
153
  parseFloat(items[2])
155
154
  ];
156
- const readVec3 = (items) => [
155
+ const __readVec3 = (items) => [
157
156
  parseFloat(items[1]),
158
157
  parseFloat(items[2]),
159
158
  parseFloat(items[3])
160
159
  ];
161
- const tessellateFace = (face) => {
160
+ const __tessellateFace = (face) => {
162
161
  const { v, uv, n } = face;
163
162
  const v0 = v[0];
164
163
  const uv0 = uv && uv[0];