x3d-image 2.0.26 → 2.0.28

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 CHANGED
@@ -54,9 +54,9 @@ Wait the specified number of seconds before generating the image.
54
54
 
55
55
  Modify the current view so that all objects fit in view volume.
56
56
 
57
- ### -b
57
+ ### -b *color*
58
58
 
59
- Set background to transparent. Use PNG as output image format.
59
+ Set background to specified color. Color can be any X3D or CSS RGBA color. Use PNG as output image format for transparent backgrounds.
60
60
 
61
61
  ### -e *[**CANNON**, HELIPAD, FOOTPRINT]*
62
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x3d-image",
3
- "version": "2.0.26",
3
+ "version": "2.0.28",
4
4
  "description": "Render image files from X3D",
5
5
  "main": "src/main.js",
6
6
  "bin": {
package/src/image.js CHANGED
@@ -102,7 +102,7 @@ async function generate (argv)
102
102
  {
103
103
  type: "string",
104
104
  alias: "b",
105
- description: `Set background to transparent. Use PNG as output image format.`,
105
+ description: `Set background to specified color. Color can be any X3D or CSS RGBA color. Use PNG as output image format for transparent backgrounds.`,
106
106
  array: true,
107
107
  default: [""],
108
108
  })
@@ -236,11 +236,13 @@ async function addBackground (browser, scene, color)
236
236
  background .transparency = 1;
237
237
  }
238
238
 
239
- const c = new X3D .SFColorRGBA () .fromString (color);
239
+ const c = new X3D .SFColorRGBA ();
240
+
241
+ c .fromString (color, scene);
240
242
 
241
243
  background .set_bind = true;
242
244
  background .skyColor = [c .r, c .g, c .b];
243
- background .transparency = c .a;
245
+ background .transparency = 1 - c .a;
244
246
 
245
247
  scene .addRootNode (background);
246
248