x3d-image 1.0.5 → 1.0.6
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/README.md +19 -1
- package/package.json +15 -3
- package/src/image.js +14 -0
- package/tests/view-all.png +0 -0
package/README.md
CHANGED
|
@@ -32,6 +32,24 @@ A Number between 0 and 1 indicating the image quality to be used when creating i
|
|
|
32
32
|
|
|
33
33
|
Wait the specified number of seconds before generating the image.
|
|
34
34
|
|
|
35
|
+
### -v
|
|
36
|
+
|
|
37
|
+
Modify the current view so that all objects fit in view volume.
|
|
38
|
+
|
|
39
|
+
## Supported Input File Types
|
|
40
|
+
|
|
41
|
+
| Encoding | File Extension | MIME Type |
|
|
42
|
+
|------------------|----------------|-----------------|
|
|
43
|
+
| X3D XML | .x3d, .x3dz | model/x3d+xml |
|
|
44
|
+
| X3D JSON | .x3dj, .x3djz | model/x3d+json |
|
|
45
|
+
| X3D Classic VRML | .x3dv, .x3dvz | model/x3d+vrml |
|
|
46
|
+
| VRML | .wrl, .wrz | model/vrml |
|
|
47
|
+
| glTF | .gltf, .glb | model/gltf+json |
|
|
48
|
+
| Wavefront OBJ | .obj | model/obj |
|
|
49
|
+
| STL | .stl | model/stl |
|
|
50
|
+
| PLY | .ply | model/ply |
|
|
51
|
+
| SVG Document | .svg, .svgz | image/svg+xml |
|
|
52
|
+
|
|
35
53
|
## Supported Output File Types
|
|
36
54
|
|
|
37
55
|
| Description | File Extension | MIME Type |
|
|
@@ -41,7 +59,7 @@ Wait the specified number of seconds before generating the image.
|
|
|
41
59
|
|
|
42
60
|
## Examples
|
|
43
61
|
|
|
44
|
-
Generate an JPEG image from X3D.
|
|
62
|
+
Generate an JPEG image from X3D with size 1600x900.
|
|
45
63
|
|
|
46
64
|
```sh
|
|
47
65
|
$ npx x3d-image -s 1600x900 -i file.x3d -o file.jpg
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x3d-image",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Generate image files from X3D.",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,10 +15,22 @@
|
|
|
15
15
|
"url": "git+https://github.com/create3000/x3d-image.git"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
|
-
"
|
|
18
|
+
"GLB",
|
|
19
|
+
"glTF2",
|
|
19
20
|
"image",
|
|
21
|
+
"JPEG",
|
|
22
|
+
"JSON",
|
|
23
|
+
"npx",
|
|
24
|
+
"PLY",
|
|
20
25
|
"PNG",
|
|
21
|
-
"
|
|
26
|
+
"STL",
|
|
27
|
+
"SVG",
|
|
28
|
+
"VRML",
|
|
29
|
+
"Wavefront-OBJ",
|
|
30
|
+
"wrl",
|
|
31
|
+
"x_ite",
|
|
32
|
+
"X3D",
|
|
33
|
+
"XML"
|
|
22
34
|
],
|
|
23
35
|
"author": "Holger Seelig",
|
|
24
36
|
"license": "GPL-3.0",
|
package/src/image.js
CHANGED
|
@@ -83,6 +83,12 @@ async function generate (argv)
|
|
|
83
83
|
description: "Wait the specified number of seconds before generating the image.",
|
|
84
84
|
default: 0,
|
|
85
85
|
})
|
|
86
|
+
.option ("view-all",
|
|
87
|
+
{
|
|
88
|
+
type: "boolean",
|
|
89
|
+
alias: "v",
|
|
90
|
+
description: "Modify the current view so that all objects fit in view volume.",
|
|
91
|
+
})
|
|
86
92
|
.help ()
|
|
87
93
|
.alias ("help", "h") .argv
|
|
88
94
|
|
|
@@ -103,6 +109,12 @@ async function generate (argv)
|
|
|
103
109
|
|
|
104
110
|
await Browser .loadURL (new X3D .MFString (input))
|
|
105
111
|
|
|
112
|
+
if (args ["view-all"])
|
|
113
|
+
{
|
|
114
|
+
Browser .viewAll (0)
|
|
115
|
+
await wait ()
|
|
116
|
+
}
|
|
117
|
+
|
|
106
118
|
if (args .delay)
|
|
107
119
|
await sleep (args .delay * 1000)
|
|
108
120
|
|
|
@@ -131,4 +143,6 @@ function mimeTypeFromPath (filename)
|
|
|
131
143
|
}
|
|
132
144
|
}
|
|
133
145
|
|
|
146
|
+
const wait = () => new Promise (resolve => requestAnimationFrame (resolve))
|
|
147
|
+
|
|
134
148
|
const sleep = delay => new Promise (resolve => setTimeout (resolve, delay))
|
|
Binary file
|