x_ite 4.7.7 → 4.7.11

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.
Files changed (82) hide show
  1. package/build/parts/default.end.frag.js +1 -2
  2. package/build/parts/default.start.frag.js +1 -8
  3. package/build/parts/x_ite.end.frag.js +0 -8
  4. package/build/parts/x_ite.start.frag.js +0 -5
  5. package/dist/assets/components/annotation.js +2 -10
  6. package/dist/assets/components/annotation.min.js +1 -1
  7. package/dist/assets/components/cad-geometry.js +2 -10
  8. package/dist/assets/components/cad-geometry.min.js +1 -1
  9. package/dist/assets/components/cube-map-texturing.js +2 -10
  10. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  11. package/dist/assets/components/dis.js +2 -10
  12. package/dist/assets/components/dis.min.js +1 -1
  13. package/dist/assets/components/event-utilities.js +2 -10
  14. package/dist/assets/components/event-utilities.min.js +1 -1
  15. package/dist/assets/components/geometry2d.js +2 -10
  16. package/dist/assets/components/geometry2d.min.js +1 -1
  17. package/dist/assets/components/geospatial.js +2 -10
  18. package/dist/assets/components/geospatial.min.js +2 -2
  19. package/dist/assets/components/h-anim.js +2 -10
  20. package/dist/assets/components/h-anim.min.js +1 -1
  21. package/dist/assets/components/key-device-sensor.js +2 -10
  22. package/dist/assets/components/key-device-sensor.min.js +1 -1
  23. package/dist/assets/components/layout.js +2 -10
  24. package/dist/assets/components/layout.min.js +1 -1
  25. package/dist/assets/components/nurbs.js +2 -10
  26. package/dist/assets/components/nurbs.min.js +2 -2
  27. package/dist/assets/components/particle-systems.js +2 -10
  28. package/dist/assets/components/particle-systems.min.js +2 -2
  29. package/dist/assets/components/picking.js +2 -10
  30. package/dist/assets/components/picking.min.js +1 -1
  31. package/dist/assets/components/projective-texture-mapping.js +2 -10
  32. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  33. package/dist/assets/components/rigid-body-physics.js +2 -10
  34. package/dist/assets/components/rigid-body-physics.min.js +17 -17
  35. package/dist/assets/components/scripting.js +2 -10
  36. package/dist/assets/components/scripting.min.js +1 -1
  37. package/dist/assets/components/texturing-3d.js +2 -10
  38. package/dist/assets/components/texturing-3d.min.js +41 -41
  39. package/dist/assets/components/volume-rendering.js +2 -10
  40. package/dist/assets/components/volume-rendering.min.js +3 -3
  41. package/dist/assets/components/x_ite.js +2 -10
  42. package/dist/assets/components/x_ite.min.js +1 -1
  43. package/dist/example.html +2 -2
  44. package/dist/x_ite.css +14 -9
  45. package/dist/x_ite.js +177 -86
  46. package/dist/x_ite.min.js +41 -41
  47. package/dist/x_ite.zip +0 -0
  48. package/docs/Accessing-the-External-Browser.md +2 -16
  49. package/docs/_config.yml +1 -1
  50. package/docs/index.md +24 -3
  51. package/docs/reference/Browser-Services.md +2 -2
  52. package/package.json +5 -4
  53. package/src/locale/de.po +4 -4
  54. package/src/locale/fr.po +4 -4
  55. package/src/standard/Utility/DataStorage.js +16 -2
  56. package/src/x_ite/Basic/X3DBaseNode.js +1 -1
  57. package/src/x_ite/Browser/Core/BrowserTimings.js +1 -3
  58. package/src/x_ite/Browser/Core/ContextMenu.js +69 -5
  59. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +1 -3
  60. package/src/x_ite/Browser/VERSION.js +1 -1
  61. package/src/x_ite/Fields/SFColor.js +15 -2
  62. package/src/x_ite/Fields/SFDouble.js +1 -1
  63. package/src/x_ite/Fields/SFFloat.js +1 -1
  64. package/src/x_ite/Fields/SFMatrix3.js +4 -4
  65. package/src/x_ite/Fields/SFMatrix4.js +5 -5
  66. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +14 -3
  67. package/src/x_ite/Fields/SFRotation.js +4 -4
  68. package/src/x_ite/Fields/SFTime.js +1 -1
  69. package/src/x_ite/Fields/SFVec2.js +4 -4
  70. package/src/x_ite/Fields/SFVec3.js +4 -4
  71. package/src/x_ite/Fields/SFVec4.js +4 -4
  72. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +6 -5
  73. package/src/x_ite/InputOutput/Generator.js +14 -3
  74. package/src/x_ite/Parser/X3DParser.js +2 -2
  75. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +1 -1
  76. package/src/x_ite/Prototype/X3DProtoDeclaration.js +1 -1
  77. package/src/x_ite/X3D.js +2 -2
  78. package/src/x_ite.config.js +0 -5
  79. package/src/x_ite.css +14 -8
  80. package/src/x_ite.html +3 -3
  81. package/src/x_ite.js +2 -2
  82. package/x_ite.min.html +3 -3
package/dist/x_ite.zip CHANGED
Binary file
@@ -65,20 +65,6 @@ function (error)
65
65
  </script>
66
66
  ```
67
67
 
68
- ### Using the Promise return value
69
-
70
- ```js
71
- X3D () .then (function ()
72
- {
73
- const Browser = X3D .getBrowser ();
74
- })
75
- .catch (function (error)
76
- {
77
- // ooops an error.
78
- console .error (error);
79
- });
80
- ```
81
-
82
68
  ### Async use of X3D object
83
69
 
84
70
  ```js
@@ -194,7 +180,7 @@ function foo (node)
194
180
 
195
181
  #### **X3DFields**
196
182
 
197
- All X3DFields (SFColor, ..., MFBool, MFColor, and so on). The fields can be created using the object as construtor. **Note:** Scalar objects like SFBool, SFDouble, SFFloat, SFInt32, SFString, and SFTime have no constructor, just use the built-in JavaScript types Boolean, Number, and String.
183
+ All X3DFields (SFColor, ..., MFBool, MFColor, and so on). The fields can be created using the object as constructor. **Note:** Scalar objects like SFBool, SFDouble, SFFloat, SFInt32, SFString, and SFTime have no constructor, just use the built-in JavaScript types Boolean, Number, and String.
198
184
 
199
185
  ```js
200
186
  // Create a new translation vector and
@@ -294,7 +280,7 @@ function spin ()
294
280
  ### The HTML
295
281
 
296
282
  ```html
297
- <X3DCanvas src="external-browser.x3d" onload="init ()"/>
283
+ <X3DCanvas src="external-browser.x3d" onload="init ()"></X3DCanvas>
298
284
 
299
285
  <div class="buttons">
300
286
  <button id="center" class="button" onclick="center ()">Center</button>
package/docs/_config.yml CHANGED
@@ -20,7 +20,7 @@ github: [metadata]
20
20
  author:
21
21
  name: *title
22
22
  avatar: "assets/images/logo.png"
23
- bio: "Version 4.7.7"
23
+ bio: "Version 4.7.11"
24
24
  links:
25
25
  - label: "GitHub"
26
26
  icon: "fab fa-2x fa-fw fa-github"
package/docs/index.md CHANGED
@@ -838,8 +838,8 @@ If you are a developer or you always wanna be up to date:
838
838
  If you are on production and everything works fine, then use a numbered version.
839
839
 
840
840
  ```html
841
- <link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/4.7.7/dist/x_ite.css"/>
842
- <script type="text/javascript" src="https://create3000.github.io/code/x_ite/4.7.7/dist/x_ite.min.js"></script>
841
+ <link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/4.7.11/dist/x_ite.css"/>
842
+ <script type="text/javascript" src="https://create3000.github.io/code/x_ite/4.7.11/dist/x_ite.min.js"></script>
843
843
  ```
844
844
 
845
845
  ### jsDelivr CDN
@@ -946,7 +946,7 @@ A Boolean value (`true` or `false`) to indicate whether files transferred over t
946
946
 
947
947
  ### contextMenu
948
948
 
949
- A Boolean value (`true` or `false`) to indicate whether a context menu should be displayed on right click. The default value for the contextMenu attribute is `true`.
949
+ A Boolean value (`true` or `false`) to indicate whether a context menu should be displayed on right click. The default value for the contextMenu attribute is `true`. The context menu can also be extended, [see here](#extending-the-context-menu).
950
950
  {: .notice}
951
951
 
952
952
  ### notifications
@@ -999,6 +999,27 @@ A MFString value with urls that should be loaded on page load. If no url attribu
999
999
 
1000
1000
  More options can be adjusted using the [Browser Object](/x_ite/reference/Browser-Services.html#browser-object) and [Browser Options](/x_ite/reference/Browser-Services.html#browser-options) for scene specific adjustments.
1001
1001
 
1002
+ ## Extending the Context Menu
1003
+
1004
+ The context menu is the jQuery Context Menu plugin, and it can be extended using the `items` syntax. The full documentation [can be found here](https://swisnl.github.io/jQuery-contextMenu/docs/items.html).
1005
+
1006
+ ### Example
1007
+
1008
+ ```js
1009
+ Browser .getContextMenu () .setUserMenu (function ()
1010
+ {
1011
+ return {
1012
+ "command-1": {
1013
+ name: "Command 1",
1014
+ callback: function (key, opt)
1015
+ {
1016
+ console .log ("Clicked on " + key);
1017
+ },
1018
+ },
1019
+ };
1020
+ });
1021
+ ```
1022
+
1002
1023
  ## Accessing the External Browser
1003
1024
 
1004
1025
  X\_ITE is designed to provide access to a browser and its contained scene graph via JavaScript, either within an internal X3D Script node or an external HTML script.
@@ -189,7 +189,7 @@ Returns a browser option with the corresponding name.
189
189
  <tr>
190
190
  <td>Shading</td>
191
191
  <td>Specify shading mode for all objects.</td>
192
- <td>Wireframe, Flat, Gouraud, Phong</td>
192
+ <td>Point, Wireframe, Flat, Gouraud, Phong</td>
193
193
  <td>Gouraud</td>
194
194
  </tr>
195
195
  <tr>
@@ -253,7 +253,7 @@ Returns a rendering property with the corresponding *name*.
253
253
  <tr>
254
254
  <td>Shading</td>
255
255
  <td>String</td>
256
- <td>The type of shading algorithm in use. Typical values are Flat, Gouraud, Phong, Wireframe.</td>
256
+ <td>The type of shading algorithm in use. Typical values are Flat, Gouraud, Phong, Wireframe, Point.</td>
257
257
  </tr>
258
258
  <tr>
259
259
  <td>MaxTextureSize</td>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "4.7.7",
4
- "revision": "1133",
3
+ "version": "4.7.11",
4
+ "revision": "1137",
5
5
  "description": "X_ITE X3D Browser, a framework for integrating and manipulating X3D and VRML scenes in HTML.",
6
6
  "main": "dist/x_ite.js",
7
7
  "repository": {
@@ -17,7 +17,9 @@
17
17
  "wrl",
18
18
  "JavaScript",
19
19
  "JSON",
20
- "xite"
20
+ "xite",
21
+ "node",
22
+ "electron"
21
23
  ],
22
24
  "author": "Holger Seelig <holger.seelig@gmail.com>",
23
25
  "license": "GPL-3.0",
@@ -64,7 +66,6 @@
64
66
  "require": "^0.4.4",
65
67
  "requirejs": ">=2.3.6",
66
68
  "requirejs-text": ">=2.0.15",
67
- "sprintf-js": ">=1.1.2",
68
69
  "uglify-js-es6": ">=2.8.9"
69
70
  },
70
71
  "scripts": {
package/src/locale/de.po CHANGED
@@ -153,11 +153,11 @@ msgstr "Auf Objekte zielen"
153
153
  msgid "None Viewer"
154
154
  msgstr "Kein Betrachter"
155
155
 
156
- msgid "Loading %d file"
157
- msgstr "Lade %d Datei"
156
+ msgid "Loading %1 file"
157
+ msgstr "Lade %1 Datei"
158
158
 
159
- msgid "Loading %d files"
160
- msgstr "Lade %d Dateien"
159
+ msgid "Loading %1 files"
160
+ msgstr "Lade %1 Dateien"
161
161
 
162
162
  msgid "Loading done"
163
163
  msgstr "Fertig mit Laden"
package/src/locale/fr.po CHANGED
@@ -153,11 +153,11 @@ msgstr "Regarder un objet de près"
153
153
  msgid "None Viewer"
154
154
  msgstr "Pas de visionneur"
155
155
 
156
- msgid "Loading %d file"
157
- msgstr "Télécharger %d fichier"
156
+ msgid "Loading %1 file"
157
+ msgstr "Télécharger %1 fichier"
158
158
 
159
- msgid "Loading %d files"
160
- msgstr "Télécharger %d fichiers"
159
+ msgid "Loading %1 files"
160
+ msgstr "Télécharger %1 fichiers"
161
161
 
162
162
  msgid "Loading done"
163
163
  msgstr "Téléchargement fini"
@@ -53,7 +53,8 @@ define (function ()
53
53
 
54
54
  const
55
55
  storages = new WeakMap (),
56
- namespaces = new WeakMap ();
56
+ namespaces = new WeakMap (),
57
+ defaults = new WeakMap ();
57
58
 
58
59
  const handler =
59
60
  {
@@ -67,7 +68,7 @@ define (function ()
67
68
  var value = target .getStorage () [target .getNameSpace () + key];
68
69
 
69
70
  if (value === undefined || value === "undefined" || value === null)
70
- return undefined;
71
+ return target .getDefaultValue (key);
71
72
 
72
73
  return JSON .parse (value);
73
74
  },
@@ -89,6 +90,7 @@ define (function ()
89
90
 
90
91
  storages .set (this, storage);
91
92
  namespaces .set (this, namespace);
93
+ defaults .set (this, { });
92
94
 
93
95
  return new Proxy (this, handler);
94
96
  }
@@ -103,6 +105,18 @@ define (function ()
103
105
  {
104
106
  return namespaces .get (this .target);
105
107
  },
108
+ addNameSpace: function (namespace)
109
+ {
110
+ return new DataStorage (this .getStorage (), this .getNameSpace () + namespace);
111
+ },
112
+ addDefaultValues: function (defaults)
113
+ {
114
+ Object .assign (defaults .get (this .target), object);
115
+ },
116
+ getDefaultValue (key)
117
+ {
118
+ return defaults .get (this .target) [key];
119
+ },
106
120
  clear: function ()
107
121
  {
108
122
  const
@@ -954,7 +954,7 @@ function (X3DEventObject,
954
954
  references = [ ],
955
955
  childNodes = [ ];
956
956
 
957
- const cdata = this .getSourceText ();
957
+ let cdata = this .getSourceText ();
958
958
 
959
959
  if (cdata && cdata .length === 0)
960
960
  cdata = null;
@@ -49,18 +49,16 @@
49
49
 
50
50
  define ([
51
51
  "jquery",
52
- "x_ite/Fields/SFBool",
53
52
  "x_ite/Basic/X3DBaseNode",
54
53
  "locale/gettext",
55
54
  ],
56
55
  function ($,
57
- SFBool,
58
56
  X3DBaseNode,
59
57
  _)
60
58
  {
61
59
  "use strict";
62
60
 
63
- function f2 (n) { return Math .floor (n * 100) / 100; }
61
+ function f2 (n) { return n .toFixed (2); }
64
62
 
65
63
  function BrowserTimings (executionContext)
66
64
  {
@@ -64,7 +64,8 @@ function ($,
64
64
  {
65
65
  X3DBaseNode .call (this, executionContext);
66
66
 
67
- this .active = false;
67
+ this .userMenu = null;
68
+ this .active = false;
68
69
  }
69
70
 
70
71
  ContextMenu .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
@@ -116,15 +117,57 @@ function ($,
116
117
  },
117
118
  1);
118
119
  }
119
-
120
+ },
121
+ activated: function (options)
122
+ {
120
123
  // Display submenus on left side if there is no space on right side.
121
124
 
122
125
  if (options .$menu .hasClass ("x_ite-private-menu-submenus-left"))
123
126
  {
124
- options .$menu .find (".context-menu-item > .context-menu-list") .css ({
125
- "right": options .$menu .width () + "px",
127
+ options .$menu .find (".context-menu-list") .each (function (i, e)
128
+ {
129
+ $(e) .css ("right", $(e) .parent () .parent () .css ("width"));
126
130
  });
127
131
  }
132
+ else
133
+ {
134
+ options .$menu .find (".context-menu-list") .each (function (i, e)
135
+ {
136
+ $(e) .css ("left", (parseInt ($(e) .parent () .parent () .css ("width")) - 2) + "px");
137
+ });
138
+ }
139
+
140
+ // If the submenu is higher than vh, add scrollbars.
141
+ options .$menu .find (".context-menu-list") .each (function (i, e)
142
+ {
143
+ if ($(e) .height () > $(window) .height ())
144
+ {
145
+ $(e) .css ({
146
+ "overflow-y": "scroll",
147
+ "max-height": "100vh",
148
+ });
149
+ }
150
+ });
151
+
152
+ // If the submenu is higher than vh, reposition it.
153
+ options .$menu .find (".context-menu-item") .on ("mouseenter", function (event)
154
+ {
155
+ event .stopImmediatePropagation ();
156
+
157
+ const
158
+ t = $(event .target),
159
+ e = t .children (".context-menu-list");
160
+
161
+ if (!e .length)
162
+ return;
163
+
164
+ e .css ("top", "");
165
+
166
+ const bottom = e .offset () .top + e .height () - $(window) .scrollTop () - $(window) .height ();
167
+
168
+ if (bottom > 0)
169
+ e .offset ({ "top": e .offset () .top - bottom });
170
+ });
128
171
  }
129
172
  .bind (this),
130
173
  hide: function (options)
@@ -135,6 +178,14 @@ function ($,
135
178
  },
136
179
  });
137
180
  },
181
+ getUserMenu: function ()
182
+ {
183
+ return this .userMenu;
184
+ },
185
+ setUserMenu: function (userMenu)
186
+ {
187
+ this .userMenu = userMenu;
188
+ },
138
189
  getActive: function ()
139
190
  {
140
191
  return this .active;
@@ -414,9 +465,22 @@ function ($,
414
465
  window .open (browser .getProviderUrl ());
415
466
  },
416
467
  },
417
- }
468
+ },
418
469
  };
419
470
 
471
+ if ($.isFunction (this .userMenu))
472
+ {
473
+ const userMenu = this .userMenu ();
474
+
475
+ if ($.isPlainObject (userMenu))
476
+ {
477
+ Object .assign (menu .items, { "separator4": "--------" });
478
+
479
+ for (const key in userMenu)
480
+ menu .items ["user-" + key] = userMenu [key];
481
+ }
482
+ }
483
+
420
484
  if (leftSubMenus)
421
485
  menu .className += " x_ite-private-menu-submenus-left";
422
486
 
@@ -50,12 +50,10 @@
50
50
  define ([
51
51
  "x_ite/Fields",
52
52
  "x_ite/Browser/Networking/urls",
53
- "sprintf",
54
53
  "locale/gettext",
55
54
  ],
56
55
  function (Fields,
57
56
  urls,
58
- sprintf,
59
57
  _)
60
58
  {
61
59
  "use strict";
@@ -176,7 +174,7 @@ function (Fields,
176
174
 
177
175
  if (value)
178
176
  {
179
- var string = sprintf .sprintf (value == 1 ? _ ("Loading %d file") : _ ("Loading %d files"), value);
177
+ var string = (value == 1 ? _ ("Loading %1 file") : _ ("Loading %1 files")) .replace ("%1", value);
180
178
  }
181
179
  else
182
180
  {
@@ -49,5 +49,5 @@
49
49
 
50
50
  define (function ()
51
51
  {
52
- return "4.7.7";
52
+ return "4.7.11";
53
53
  });
@@ -51,10 +51,12 @@ define ([
51
51
  "standard/Math/Numbers/Color3",
52
52
  "x_ite/Basic/X3DField",
53
53
  "x_ite/Bits/X3DConstants",
54
+ "x_ite/InputOutput/Generator",
54
55
  ],
55
56
  function (Color3,
56
57
  X3DField,
57
- X3DConstants)
58
+ X3DConstants,
59
+ Generator)
58
60
  {
59
61
  "use strict";
60
62
 
@@ -136,7 +138,18 @@ function (Color3,
136
138
  })(),
137
139
  toStream: function (stream)
138
140
  {
139
- stream .string += this .getValue () .toString ();
141
+ const
142
+ generator = Generator .Get (stream),
143
+ value = this .getValue (),
144
+ last = value .length - 1;
145
+
146
+ for (let i = 0; i < last; ++ i)
147
+ {
148
+ stream .string += generator .Precision (value [i]);
149
+ stream .string += " ";
150
+ }
151
+
152
+ stream .string += generator .Precision (value [last]);
140
153
  },
141
154
  toVRMLStream: function (stream)
142
155
  {
@@ -93,7 +93,7 @@ function (X3DField,
93
93
  generator = Generator .Get (stream),
94
94
  category = generator .Unit (this .getUnit ());
95
95
 
96
- stream .string += String (generator .ToUnit (category, this .getValue ()));
96
+ stream .string += generator .DoublePrecision (generator .ToUnit (category, this .getValue ()));
97
97
  },
98
98
  toVRMLStream: function (stream)
99
99
  {
@@ -93,7 +93,7 @@ function (X3DField,
93
93
  generator = Generator .Get (stream),
94
94
  category = generator .Unit (this .getUnit ());
95
95
 
96
- stream .string += String (generator .ToUnit (category, this .getValue ()));
96
+ stream .string += generator .Precision (generator .ToUnit (category, this .getValue ()));
97
97
  },
98
98
  toVRMLStream: function (stream)
99
99
  {
@@ -63,7 +63,7 @@ function (X3DField,
63
63
  {
64
64
  "use strict";
65
65
 
66
- function SFMatrix3Template (TypeName, Type, SFVec2)
66
+ function SFMatrix3Template (TypeName, Type, SFVec2, double)
67
67
  {
68
68
  function SFMatrix3 (m00, m01, m02,
69
69
  m10, m11, m12,
@@ -87,7 +87,7 @@ function (X3DField,
87
87
  }
88
88
 
89
89
  SFMatrix3 .prototype = Object .assign (Object .create (X3DField .prototype),
90
- SFMatrixPrototypeTemplate (Matrix3, SFVec2),
90
+ SFMatrixPrototypeTemplate (Matrix3, SFVec2, double),
91
91
  {
92
92
  constructor: SFMatrix3,
93
93
  getTypeName: function ()
@@ -135,7 +135,7 @@ function (X3DField,
135
135
  }
136
136
 
137
137
  return {
138
- SFMatrix3d: SFMatrix3Template ("SFMatrix3d", X3DConstants .SFMatrix3d, SFVec2 .SFVec2d),
139
- SFMatrix3f: SFMatrix3Template ("SFMatrix3f", X3DConstants .SFMatrix3f, SFVec2 .SFVec2f),
138
+ SFMatrix3d: SFMatrix3Template ("SFMatrix3d", X3DConstants .SFMatrix3d, SFVec2 .SFVec2d, true),
139
+ SFMatrix3f: SFMatrix3Template ("SFMatrix3f", X3DConstants .SFMatrix3f, SFVec2 .SFVec2f, false),
140
140
  };
141
141
  });
@@ -62,7 +62,7 @@ function (X3DField,
62
62
  {
63
63
  "use strict";
64
64
 
65
- function SFMatrix4Template (TypeName, Type, SFVec3)
65
+ function SFMatrix4Template (TypeName, Type, SFVec3, double)
66
66
  {
67
67
  function SFMatrix4 (m00, m01, m02, m03,
68
68
  m10, m11, m12, m13,
@@ -88,7 +88,7 @@ function (X3DField,
88
88
  }
89
89
 
90
90
  SFMatrix4 .prototype = Object .assign (Object .create (X3DField .prototype),
91
- SFMatrixPrototypeTemplate (Matrix4, SFVec3),
91
+ SFMatrixPrototypeTemplate (Matrix4, SFVec3, double),
92
92
  {
93
93
  constructor: SFMatrix4,
94
94
  getTypeName: function ()
@@ -126,8 +126,8 @@ function (X3DField,
126
126
  }
127
127
 
128
128
  return {
129
- SFMatrix4d: SFMatrix4Template ("SFMatrix4d", X3DConstants .SFMatrix4d, SFVec3 .SFVec3d),
130
- SFMatrix4f: SFMatrix4Template ("SFMatrix4f", X3DConstants .SFMatrix4f, SFVec3 .SFVec3f),
131
- VrmlMatrix: SFMatrix4Template ("VrmlMatrix", X3DConstants .VrmlMatrix, SFVec3 .SFVec3f),
129
+ SFMatrix4d: SFMatrix4Template ("SFMatrix4d", X3DConstants .SFMatrix4d, SFVec3 .SFVec3d, true),
130
+ SFMatrix4f: SFMatrix4Template ("SFMatrix4f", X3DConstants .SFMatrix4f, SFVec3 .SFVec3f, false),
131
+ VrmlMatrix: SFMatrix4Template ("VrmlMatrix", X3DConstants .VrmlMatrix, SFVec3 .SFVec3f, false),
132
132
  };
133
133
  });
@@ -54,7 +54,7 @@ function (X3DField)
54
54
  {
55
55
  "use strict";
56
56
 
57
- return function (Matrix, SFVec)
57
+ return function (Matrix, SFVec, double)
58
58
  {
59
59
  return Object .assign (Object .create (X3DField .prototype),
60
60
  {
@@ -132,9 +132,20 @@ function (X3DField)
132
132
  },
133
133
  toStream: function (stream)
134
134
  {
135
- stream .string += this .getValue () .toString ();
135
+ const
136
+ generator = Generator .Get (stream),
137
+ value = this .getValue (),
138
+ last = value .length - 1;
139
+
140
+ for (let i = 0; i < last; ++ i)
141
+ {
142
+ stream .string += double ? generator .DoublePrecision (value [i]) : generator .Precision (value [i]);
143
+ stream .string += " ";
144
+ }
145
+
146
+ stream .string += double ? generator .DoublePrecision (value [last]) : generator .Precision (value [last]);
136
147
  },
137
- toVRMLStream: function (stream)
148
+ toVRMLStream: function (stream)
138
149
  {
139
150
  this .toStream (stream);
140
151
  },
@@ -145,10 +145,10 @@ function (SFVec3,
145
145
  generator = Generator .Get (stream),
146
146
  rotation = this .getValue ();
147
147
 
148
- stream .string += rotation .x + " " +
149
- rotation .y + " " +
150
- rotation .z + " " +
151
- generator .ToUnit ("angle", rotation .angle);
148
+ stream .string += generator .DoublePrecision (rotation .x) + " " +
149
+ generator .DoublePrecision (rotation .y) + " " +
150
+ generator .DoublePrecision (rotation .z) + " " +
151
+ generator .DoublePrecision (generator .ToUnit ("angle", rotation .angle));
152
152
  },
153
153
  toVRMLStream: function (stream)
154
154
  {
@@ -87,7 +87,7 @@ function (X3DField,
87
87
  valueOf: X3DField .prototype .getValue,
88
88
  toStream: function (stream)
89
89
  {
90
- stream .string += String (this .getValue ());
90
+ stream .string += this .getValue ();
91
91
  },
92
92
  toVRMLStream: function (stream)
93
93
  {
@@ -57,7 +57,7 @@ function (X3DField, SFVecPrototypeTemplate, X3DConstants, Vector2)
57
57
  {
58
58
  "use strict";
59
59
 
60
- function SFVec2Template (TypeName, Type)
60
+ function SFVec2Template (TypeName, Type, double)
61
61
  {
62
62
  function SFVec2 (x, y)
63
63
  {
@@ -77,7 +77,7 @@ function (X3DField, SFVecPrototypeTemplate, X3DConstants, Vector2)
77
77
  }
78
78
 
79
79
  SFVec2 .prototype = Object .assign (Object .create (X3DField .prototype),
80
- SFVecPrototypeTemplate (Vector2),
80
+ SFVecPrototypeTemplate (Vector2, double),
81
81
  {
82
82
  constructor: SFVec2,
83
83
  getTypeName: function ()
@@ -131,7 +131,7 @@ function (X3DField, SFVecPrototypeTemplate, X3DConstants, Vector2)
131
131
  }
132
132
 
133
133
  return {
134
- SFVec2d: SFVec2Template ("SFVec2d", X3DConstants .SFVec2d),
135
- SFVec2f: SFVec2Template ("SFVec2f", X3DConstants .SFVec2f),
134
+ SFVec2d: SFVec2Template ("SFVec2d", X3DConstants .SFVec2d, true),
135
+ SFVec2f: SFVec2Template ("SFVec2f", X3DConstants .SFVec2f, false),
136
136
  };
137
137
  });
@@ -60,7 +60,7 @@ function (X3DField,
60
60
  {
61
61
  "use strict";
62
62
 
63
- function SFVec3Template (TypeName, Type)
63
+ function SFVec3Template (TypeName, Type, double)
64
64
  {
65
65
  function SFVec3 (x, y, z)
66
66
  {
@@ -80,7 +80,7 @@ function (X3DField,
80
80
  }
81
81
 
82
82
  SFVec3 .prototype = Object .assign (Object .create (X3DField .prototype),
83
- SFVecPrototypeTemplate (Vector3),
83
+ SFVecPrototypeTemplate (Vector3, double),
84
84
  {
85
85
  constructor: SFVec3,
86
86
  getTypeName: function ()
@@ -155,7 +155,7 @@ function (X3DField,
155
155
  }
156
156
 
157
157
  return {
158
- SFVec3d: SFVec3Template ("SFVec3d", X3DConstants .SFVec3d),
159
- SFVec3f: SFVec3Template ("SFVec3f", X3DConstants .SFVec3f),
158
+ SFVec3d: SFVec3Template ("SFVec3d", X3DConstants .SFVec3d, true),
159
+ SFVec3f: SFVec3Template ("SFVec3f", X3DConstants .SFVec3f, false),
160
160
  };
161
161
  });
@@ -60,7 +60,7 @@ function (X3DField,
60
60
  {
61
61
  "use strict";
62
62
 
63
- function SFVec4Template (TypeName, Type)
63
+ function SFVec4Template (TypeName, Type, double)
64
64
  {
65
65
  function SFVec4 (x, y, z, w)
66
66
  {
@@ -80,7 +80,7 @@ function (X3DField,
80
80
  }
81
81
 
82
82
  SFVec4 .prototype = Object .assign (Object .create (X3DField .prototype),
83
- SFVecPrototypeTemplate (Vector4),
83
+ SFVecPrototypeTemplate (Vector4, double),
84
84
  {
85
85
  constructor: SFVec4,
86
86
  getTypeName: function ()
@@ -168,7 +168,7 @@ function (X3DField,
168
168
  }
169
169
 
170
170
  return {
171
- SFVec4d: SFVec4Template ("SFVec4d", X3DConstants .SFVec4d),
172
- SFVec4f: SFVec4Template ("SFVec4f", X3DConstants .SFVec4f),
171
+ SFVec4d: SFVec4Template ("SFVec4d", X3DConstants .SFVec4d, true),
172
+ SFVec4f: SFVec4Template ("SFVec4f", X3DConstants .SFVec4f, false),
173
173
  };
174
174
  });