@jscad/obj-serializer 2.1.2 → 2.1.3
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 +8 -0
- package/index.js +2 -2
- package/package.json +3 -3
- package/tests/serialize.test.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.1.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/obj-serializer@2.1.2...@jscad/obj-serializer@2.1.3) (2022-02-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @jscad/obj-serializer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.1.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/obj-serializer@2.1.1...@jscad/obj-serializer@2.1.2) (2021-12-26)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @jscad/obj-serializer
|
package/index.js
CHANGED
|
@@ -74,7 +74,7 @@ const serialize = (options, ...objects) => {
|
|
|
74
74
|
|
|
75
75
|
// convert objects
|
|
76
76
|
// TODO: group objects together
|
|
77
|
-
let previousColor =
|
|
77
|
+
let previousColor = 'default'
|
|
78
78
|
objects3d.forEach((object, i) => {
|
|
79
79
|
options.statusCallback && options.statusCallback({ progress: 100 * i / objects3d.length })
|
|
80
80
|
body += '\n'
|
|
@@ -101,7 +101,7 @@ const serialize = (options, ...objects) => {
|
|
|
101
101
|
const indices = polygon.vertices
|
|
102
102
|
.map((v) => vertices.indexOf(convertVertex(v)) + 1)
|
|
103
103
|
// set face color
|
|
104
|
-
const color = getColorName(polygon) || objectColor ||
|
|
104
|
+
const color = getColorName(polygon) || objectColor || 'default'
|
|
105
105
|
if (color !== previousColor) {
|
|
106
106
|
body += `usemtl ${color}\n`
|
|
107
107
|
previousColor = color
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jscad/obj-serializer",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "OBJ Serializer for JSCAD",
|
|
5
5
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
6
6
|
"main": "index.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@jscad/array-utils": "2.1.1",
|
|
30
|
-
"@jscad/modeling": "2.7.
|
|
30
|
+
"@jscad/modeling": "2.7.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"ava": "3.15.0",
|
|
34
34
|
"nyc": "15.1.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "b6c5675d2d9a292e0ba24896bf22d0e9dc5d4270"
|
|
37
37
|
}
|
package/tests/serialize.test.js
CHANGED
|
@@ -41,7 +41,7 @@ test('serialize non-triangulated 3D geometry to obj', (t) => {
|
|
|
41
41
|
test('serialize color 3D geometry to obj', (t) => {
|
|
42
42
|
const testCubes = [
|
|
43
43
|
colors.colorize([1, 0.8, 0.8], primitives.cuboid({})),
|
|
44
|
-
primitives.cuboid({center: [0, 3, 0]})
|
|
44
|
+
primitives.cuboid({ center: [0, 3, 0] })
|
|
45
45
|
]
|
|
46
46
|
const observed4 = serializer.serialize({ triangulate: false }, testCubes)
|
|
47
47
|
t.is(observed4.length, 1)
|