@thi.ng/geom-io-obj 0.3.127 → 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-05-08T18:24:32Z
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.127",
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.2",
40
- "@thi.ng/errors": "^2.5.7",
41
- "@thi.ng/vectors": "^7.10.31"
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.2",
45
- "esbuild": "^0.21.1",
44
+ "@microsoft/api-extractor": "^7.47.0",
45
+ "esbuild": "^0.21.5",
46
46
  "typedoc": "^0.25.13",
47
- "typescript": "^5.4.5"
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": "df34b4a9e650cc7323575356de207d78933bdcf3\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
  };
@@ -97,26 +97,26 @@ const parseOBJ = (src, opts) => {
97
97
  switch (items[0]) {
98
98
  case "v": {
99
99
  assert(len > 3, `invalid vertex @ line ${i}`);
100
- const v = readVec3(items);
100
+ const v = __readVec3(items);
101
101
  vertices.push(xform ? xform(v) : v);
102
102
  break;
103
103
  }
104
104
  case "vn": {
105
105
  assert(len > 3, `invalid normal @ line ${i}`);
106
- const v = readVec3(items);
106
+ const v = __readVec3(items);
107
107
  normals.push(xform ? xform(v) : v);
108
108
  break;
109
109
  }
110
110
  case "vt": {
111
111
  assert(len > 2, `invalid uv @ line ${i}`);
112
- const v = readVec2(items);
112
+ const v = __readVec2(items);
113
113
  uvs.push(xformUV ? xformUV(v) : v);
114
114
  break;
115
115
  }
116
116
  case "f": {
117
117
  assert(len > 3, `invalid face @ line ${i}`);
118
118
  const f = readFace(items);
119
- 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);
120
120
  break;
121
121
  }
122
122
  case "l":
@@ -144,20 +144,20 @@ const parseOBJ = (src, opts) => {
144
144
  }
145
145
  return result;
146
146
  };
147
- const addID = (acc, x, num) => {
147
+ const __addID = (acc, x, num) => {
148
148
  const v = parseInt(x);
149
149
  acc.push(v < 0 ? v + num : v - 1);
150
150
  };
151
- const readVec2 = (items) => [
151
+ const __readVec2 = (items) => [
152
152
  parseFloat(items[1]),
153
153
  parseFloat(items[2])
154
154
  ];
155
- const readVec3 = (items) => [
155
+ const __readVec3 = (items) => [
156
156
  parseFloat(items[1]),
157
157
  parseFloat(items[2]),
158
158
  parseFloat(items[3])
159
159
  ];
160
- const tessellateFace = (face) => {
160
+ const __tessellateFace = (face) => {
161
161
  const { v, uv, n } = face;
162
162
  const v0 = v[0];
163
163
  const uv0 = uv && uv[0];