x_ite 8.6.11 → 8.6.12

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 (94) hide show
  1. package/dist/assets/components/Annotation.js +13 -13
  2. package/dist/assets/components/Annotation.min.js +1 -1
  3. package/dist/assets/components/CADGeometry.js +21 -45
  4. package/dist/assets/components/CADGeometry.min.js +1 -1
  5. package/dist/assets/components/CubeMapTexturing.js +25 -25
  6. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  7. package/dist/assets/components/DIS.js +13 -13
  8. package/dist/assets/components/DIS.min.js +1 -1
  9. package/dist/assets/components/EventUtilities.js +9 -9
  10. package/dist/assets/components/EventUtilities.min.js +1 -1
  11. package/dist/assets/components/Geometry2D.js +19 -19
  12. package/dist/assets/components/Geometry2D.min.js +1 -1
  13. package/dist/assets/components/Geospatial.js +33 -33
  14. package/dist/assets/components/Geospatial.min.js +1 -1
  15. package/dist/assets/components/HAnim.js +18 -18
  16. package/dist/assets/components/HAnim.min.js +1 -1
  17. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  18. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  19. package/dist/assets/components/Layout.js +48 -42
  20. package/dist/assets/components/Layout.min.js +1 -1
  21. package/dist/assets/components/NURBS.js +24 -24
  22. package/dist/assets/components/NURBS.min.js +1 -1
  23. package/dist/assets/components/ParticleSystems.js +136 -26
  24. package/dist/assets/components/ParticleSystems.min.js +1 -1
  25. package/dist/assets/components/Picking.js +132 -22
  26. package/dist/assets/components/Picking.min.js +1 -1
  27. package/dist/assets/components/RigidBodyPhysics.js +32 -76
  28. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  29. package/dist/assets/components/Scripting.js +28 -28
  30. package/dist/assets/components/Scripting.min.js +1 -1
  31. package/dist/assets/components/Text.js +24 -24
  32. package/dist/assets/components/Text.min.js +1 -1
  33. package/dist/assets/components/TextureProjector.js +14 -14
  34. package/dist/assets/components/TextureProjector.min.js +1 -1
  35. package/dist/assets/components/Texturing3D.js +30 -30
  36. package/dist/assets/components/Texturing3D.min.js +1 -1
  37. package/dist/assets/components/VolumeRendering.js +19 -19
  38. package/dist/assets/components/VolumeRendering.min.js +1 -1
  39. package/dist/assets/components/X_ITE.js +9 -9
  40. package/dist/assets/components/X_ITE.min.js +1 -1
  41. package/dist/x_ite.css +1 -1
  42. package/dist/x_ite.js +284 -359
  43. package/dist/x_ite.min.js +1 -1
  44. package/dist/x_ite.zip +0 -0
  45. package/docs/_config.yml +1 -1
  46. package/docs/_posts/components/Geometry3D/IndexedFaceSet.md +1 -1
  47. package/docs/_posts/components/Lighting/DirectionalLight.md +4 -4
  48. package/docs/_posts/components/Lighting/EnvironmentLight.md +4 -4
  49. package/docs/_posts/components/Lighting/PointLight.md +4 -4
  50. package/docs/_posts/components/Lighting/SpotLight.md +4 -4
  51. package/docs/_posts/components/Rendering/IndexedLineSet.md +1 -1
  52. package/docs/_posts/components/Rendering/IndexedTriangleFanSet.md +1 -1
  53. package/docs/_posts/components/RigidBodyPhysics/RigidBody.md +1 -1
  54. package/docs/_posts/components/RigidBodyPhysics/RigidBodyCollection.md +1 -1
  55. package/docs/_posts/components/RigidBodyPhysics/SingleAxisHingeJoint.md +1 -1
  56. package/docs/_posts/components/RigidBodyPhysics/SliderJoint.md +3 -3
  57. package/docs/_posts/components/X_ITE/BlendMode.md +1 -1
  58. package/docs/_posts/getting-started.md +8 -3
  59. package/docs/_posts/reference/browser-services.md +1 -1
  60. package/docs/_posts/reference/ecmascript-object-and-function-definitions.md +16 -99
  61. package/docs/_posts/what's-new.md +1 -1
  62. package/package.json +3 -3
  63. package/src/lib/jquery.js +6 -1
  64. package/src/standard/Math/Geometry/Box3.js +2 -5
  65. package/src/x_ite/Base/X3DBaseNode.js +8 -0
  66. package/src/x_ite/Base/X3DObject.js +14 -1
  67. package/src/x_ite/Browser/Core/BrowserOptions.js +27 -29
  68. package/src/x_ite/Browser/Core/BrowserTimings.js +2 -16
  69. package/src/x_ite/Browser/Core/X3DCoreContext.js +5 -0
  70. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +3 -3
  71. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +20 -15
  72. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +3 -3
  73. package/src/x_ite/Browser/VERSION.js +1 -1
  74. package/src/x_ite/Browser/X3DBrowser.js +2 -2
  75. package/src/x_ite/Browser/X3DBrowserContext.js +21 -12
  76. package/src/x_ite/Components/CADGeometry/CADFace.js +8 -32
  77. package/src/x_ite/Components/Core/X3DNode.js +1 -1
  78. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +1 -1
  79. package/src/x_ite/Components/Grouping/StaticGroup.js +19 -0
  80. package/src/x_ite/Components/Grouping/Switch.js +7 -25
  81. package/src/x_ite/Components/Grouping/X3DBoundedObject.js +0 -1
  82. package/src/x_ite/Components/Layout/Layout.js +12 -10
  83. package/src/x_ite/Components/Layout/LayoutGroup.js +9 -5
  84. package/src/x_ite/Components/Navigation/LOD.js +7 -25
  85. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +1 -1
  86. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +15 -8
  87. package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +7 -29
  88. package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +7 -29
  89. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +3 -8
  90. package/src/x_ite/Components/Shape/Shape.js +0 -5
  91. package/src/x_ite/Components/Shape/X3DShapeNode.js +21 -17
  92. package/src/x_ite/Fields/SFNode.js +8 -0
  93. package/src/x_ite/{X3DCanvas.js → X3DCanvasElement.js} +23 -4
  94. package/src/x_ite.js +4 -4
@@ -325,6 +325,11 @@ X3DCoreContext .prototype =
325
325
  this .loadURL (new Fields .MFString (newValue), new Fields .MFString ());
326
326
  break;
327
327
  }
328
+ case "timings":
329
+ {
330
+ this .setBrowserOption ("Timings", this .parseBooleanAttribute (newValue, false));
331
+ break;
332
+ }
328
333
  case "url":
329
334
  {
330
335
  this .loadURL (this .parseUrlAttribute (newValue), new Fields .MFString ());
@@ -184,7 +184,7 @@ X3DFlyViewer .prototype = Object .assign (Object .create (X3DViewer .prototype),
184
184
  this .addFly ();
185
185
 
186
186
  if (this .getBrowser () .getBrowserOption ("Rubberband"))
187
- this .getBrowser () .finished () .addInterest ("display", this, MOVE);
187
+ this .getBrowser () .finishedEvents () .addInterest ("display", this, MOVE);
188
188
  }
189
189
 
190
190
  this ._isActive = true;
@@ -215,7 +215,7 @@ X3DFlyViewer .prototype = Object .assign (Object .create (X3DViewer .prototype),
215
215
  this .addPan ();
216
216
 
217
217
  if (this .getBrowser () .getBrowserOption ("Rubberband"))
218
- this .getBrowser () .finished () .addInterest ("display", this, PAN);
218
+ this .getBrowser () .finishedEvents () .addInterest ("display", this, PAN);
219
219
 
220
220
  this ._isActive = true;
221
221
  break;
@@ -704,7 +704,7 @@ X3DFlyViewer .prototype = Object .assign (Object .create (X3DViewer .prototype),
704
704
 
705
705
  browser .prepareEvents () .removeInterest ("fly", this);
706
706
  browser .prepareEvents () .removeInterest ("pan", this);
707
- browser .finished () .removeInterest ("display", this);
707
+ browser .finishedEvents () .removeInterest ("display", this);
708
708
 
709
709
  this .orientationChaser ._value_changed .removeInterest ("set_orientationOffset__", this);
710
710
 
@@ -55,7 +55,8 @@ const
55
55
  _loadingObjects = Symbol (),
56
56
  _loading = Symbol (),
57
57
  _location = Symbol (),
58
- _defaultScene = Symbol ();
58
+ _defaultScene = Symbol (),
59
+ _set_loadCount = Symbol ();
59
60
 
60
61
  function getBaseURI (element)
61
62
  {
@@ -82,7 +83,9 @@ function X3DNetworkingContext ()
82
83
  X3DNetworkingContext .prototype =
83
84
  {
84
85
  initialize: function ()
85
- { },
86
+ {
87
+ this ._loadCount .addInterest (_set_loadCount, this);
88
+ },
86
89
  getProviderUrl: function ()
87
90
  {
88
91
  return URLs .getProviderUrl ();
@@ -163,12 +166,25 @@ X3DNetworkingContext .prototype =
163
166
  setLoadCount: function (value)
164
167
  {
165
168
  this ._loadCount = value;
169
+ },
170
+ resetLoadCount: function ()
171
+ {
172
+ this ._loadCount = 0;
173
+ this [_loadingDisplay] = 0;
174
+ this [_loadingTotal] = 0;
175
+
176
+ this [_loadingObjects] .clear ();
166
177
 
178
+ for (const object of this .getPrivateScene () .getLoadingObjects ())
179
+ this .addLoadingObject (object);
180
+ },
181
+ [_set_loadCount]: function ()
182
+ {
167
183
  const loadingDisplay = [... this [_loadingObjects]]
168
184
  .filter (o => o .isPrivate)
169
185
  .reduce ((v, o) => v + !o .isPrivate (), 0);
170
186
 
171
- if (value || this [_loading])
187
+ if (this ._loadCount .getValue () || this [_loading])
172
188
  {
173
189
  var string = ((loadingDisplay || 1) === 1
174
190
  ? _ ("Loading %1 file")
@@ -184,7 +200,7 @@ X3DNetworkingContext .prototype =
184
200
  {
185
201
  this .getSplashScreen () .find (".x_ite-private-spinner-text") .text (string);
186
202
  this .getSplashScreen () .find (".x_ite-private-progressbar div")
187
- .css ("width", (100 - 100 * value / this [_loadingTotal]) + "%");
203
+ .css ("width", (100 - 100 * this ._loadCount .getValue () / this [_loadingTotal]) + "%");
188
204
  }
189
205
  else
190
206
  {
@@ -194,17 +210,6 @@ X3DNetworkingContext .prototype =
194
210
 
195
211
  this [_loadingDisplay] = loadingDisplay;
196
212
  },
197
- resetLoadCount: function ()
198
- {
199
- this ._loadCount = 0;
200
- this [_loadingDisplay] = 0;
201
- this [_loadingTotal] = 0;
202
-
203
- this [_loadingObjects] .clear ();
204
-
205
- for (const object of this .getPrivateScene () .getLoadingObjects ())
206
- this .addLoadingObject (object);
207
- },
208
213
  };
209
214
 
210
215
  export default X3DNetworkingContext;
@@ -124,7 +124,7 @@ PointingDevice .prototype = Object .assign (Object .create (X3DBaseNode .prototy
124
124
  event .stopImmediatePropagation (); // Keeps the rest of the handlers from being executed
125
125
 
126
126
  browser .setCursor ("HAND");
127
- browser .finished () .addInterest ("onverifymotion", this, x, y);
127
+ browser .finishedEvents () .addInterest ("onverifymotion", this, x, y);
128
128
  }
129
129
  }
130
130
  },
@@ -145,7 +145,7 @@ PointingDevice .prototype = Object .assign (Object .create (X3DBaseNode .prototy
145
145
 
146
146
  browser .buttonReleaseEvent ();
147
147
  browser .setCursor (this .isOver ? "HAND" : "DEFAULT");
148
- browser .finished () .addInterest ("onverifymotion", this, x, y);
148
+ browser .finishedEvents () .addInterest ("onverifymotion", this, x, y);
149
149
  browser .addBrowserEvent ();
150
150
 
151
151
  this .cursor = "DEFAULT";
@@ -272,7 +272,7 @@ PointingDevice .prototype = Object .assign (Object .create (X3DBaseNode .prototy
272
272
  // and the new child has a sensor node inside. This sensor node must be update to
273
273
  // reflect the correct isOver state.
274
274
 
275
- this .getBrowser () .finished () .removeInterest ("onverifymotion", this);
275
+ this .getBrowser () .finishedEvents () .removeInterest ("onverifymotion", this);
276
276
 
277
277
  this .onmotion (x, y);
278
278
  },
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.6.11";
48
+ export default "8.6.12";
@@ -813,14 +813,14 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
813
813
  beginUpdate: function ()
814
814
  {
815
815
  this .setLive (true);
816
- this .getExecutionContext () .setLive (true);
816
+ this .getExecutionContext () .beginUpdate ();
817
817
  this .advanceTime ();
818
818
  this .addBrowserEvent ();
819
819
  },
820
820
  endUpdate: function ()
821
821
  {
822
822
  this .setLive (false);
823
- this .getExecutionContext () .setLive (false);
823
+ this .getExecutionContext () .endUpdate ();
824
824
  },
825
825
  print: function ()
826
826
  {
@@ -114,12 +114,13 @@ function X3DBrowserContext (element)
114
114
  for (const browserContext of browserContexts)
115
115
  browserContext .call (this);
116
116
 
117
- this .addChildObjects ("initialized", new SFTime (),
118
- "shutdown", new SFTime (),
119
- "prepareEvents", new SFTime (),
120
- "timeEvents", new SFTime (),
121
- "sensorEvents", new SFTime (),
122
- "finished", new SFTime ());
117
+ this .addChildObjects ("initialized", new SFTime (),
118
+ "shutdown", new SFTime (),
119
+ "prepareEvents", new SFTime (),
120
+ "timeEvents", new SFTime (),
121
+ "sensorEvents", new SFTime (),
122
+ "displayEvents", new SFTime (),
123
+ "finishedEvents", new SFTime ());
123
124
 
124
125
  this [_changedTime] = 0;
125
126
  this [_previousTime] = 0;
@@ -204,9 +205,13 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
204
205
  {
205
206
  return this ._sensorEvents;
206
207
  },
207
- finished: function ()
208
+ displayEvents: function ()
208
209
  {
209
- return this ._finished;
210
+ return this ._displayEvents;
211
+ },
212
+ finishedEvents: function ()
213
+ {
214
+ return this ._finishedEvents;
210
215
  },
211
216
  getBrowser: function ()
212
217
  {
@@ -267,10 +272,10 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
267
272
 
268
273
  // Events
269
274
 
270
- this ._prepareEvents .processInterests ();
275
+ this .addTaintedField (this ._prepareEvents);
271
276
  this [_processEvents] ();
272
277
 
273
- this ._timeEvents .processInterests ();
278
+ this .addTaintedField (this ._timeEvents);
274
279
  this [_processEvents] ();
275
280
 
276
281
  // Camera
@@ -290,13 +295,16 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
290
295
 
291
296
  // Events
292
297
 
293
- this ._sensorEvents .processInterests ();
298
+ this .addTaintedField (this ._sensorEvents);
294
299
  this [_processEvents] ();
295
300
 
296
301
  // Display
297
302
 
298
303
  this [_displayTime] .start ()
299
304
 
305
+ this .addTaintedField (this ._displayEvents);
306
+ this [_processEvents] ();
307
+
300
308
  const gl = this .getContext ();
301
309
 
302
310
  this .getFrameBuffer () .bind ();
@@ -312,7 +320,8 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
312
320
 
313
321
  // Finish
314
322
 
315
- this ._finished .processInterests ();
323
+ this .addTaintedField (this ._finishedEvents);
324
+ this [_processEvents] ();
316
325
 
317
326
  this [_browserTime] .stop ();
318
327
  this [_systemTime] .start ();
@@ -102,14 +102,7 @@ CADFace .prototype = Object .assign (Object .create (X3DProductStructureChildNod
102
102
  getBBox: function (bbox, shadows)
103
103
  {
104
104
  if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ()))
105
- {
106
- const boundedObject = this .visibleNode;
107
-
108
- if (boundedObject)
109
- return boundedObject .getBBox (bbox, shadows);
110
-
111
- return bbox .set ();
112
- }
105
+ return this .visibleNode?.getBBox (bbox, shadows) ?? bbox .set ();
113
106
 
114
107
  return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
115
108
  },
@@ -173,11 +166,11 @@ CADFace .prototype = Object .assign (Object .create (X3DProductStructureChildNod
173
166
  },
174
167
  set_cameraObject__: function ()
175
168
  {
176
- this .setCameraObject (!!(this .visibleNode && this .visibleNode .isCameraObject ()));
169
+ this .setCameraObject (!!this .visibleNode?.isCameraObject ());
177
170
  },
178
171
  set_transformSensors__: function ()
179
172
  {
180
- this .setPickableObject (!!(this .visibleNode && this .visibleNode .isPickableObject ()));
173
+ this .setPickableObject (!!this .visibleNode?.isPickableObject ());
181
174
  },
182
175
  set_visible__: function ()
183
176
  {
@@ -204,11 +197,7 @@ CADFace .prototype = Object .assign (Object .create (X3DProductStructureChildNod
204
197
  case TraverseType .CAMERA:
205
198
  case TraverseType .SHADOW:
206
199
  {
207
- const visibleNode = this .visibleNode;
208
-
209
- if (visibleNode)
210
- visibleNode .traverse (type, renderObject);
211
-
200
+ this .visibleNode?.traverse (type, renderObject);
212
201
  return;
213
202
  }
214
203
  case TraverseType .PICKING:
@@ -219,34 +208,21 @@ CADFace .prototype = Object .assign (Object .create (X3DProductStructureChildNod
219
208
 
220
209
  pickingHierarchy .push (this);
221
210
 
222
- const visibleNode = this .visibleNode;
223
-
224
- if (visibleNode)
225
- visibleNode .traverse (type, renderObject);
211
+ this .visibleNode?.traverse (type, renderObject);
226
212
 
227
213
  pickingHierarchy .pop ();
228
214
  return;
229
215
  }
230
216
  case TraverseType .COLLISION:
231
217
  {
232
- const visibleNode = this .visibleNode;
233
-
234
- if (visibleNode)
235
- visibleNode .traverse (type, renderObject);
218
+ this .visibleNode?.traverse (type, renderObject);
236
219
  return;
237
220
  }
238
221
  case TraverseType .DISPLAY:
239
222
  {
240
- const visibleNode = this .visibleNode;
241
-
242
- if (visibleNode)
243
- visibleNode .traverse (type, renderObject);
244
-
245
- const boundedObject = this .boundedObject;
246
-
247
- if (boundedObject)
248
- boundedObject .displayBBox (type, renderObject);
223
+ this .visibleNode?.traverse (type, renderObject);
249
224
 
225
+ this .boundedObject?.displayBBox (type, renderObject);
250
226
  return;
251
227
  }
252
228
  }
@@ -651,7 +651,7 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
651
651
  case X3DConstants .SFNode:
652
652
  case X3DConstants .MFNode:
653
653
  {
654
- generator .PushContainerField (field);
654
+ generator .PushContainerField (null);
655
655
 
656
656
  generator .string += ">";
657
657
  generator .string += generator .TidyBreak ();
@@ -533,7 +533,7 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
533
533
  {
534
534
  if (field .getValue () !== null)
535
535
  {
536
- generator .PushContainerField (field);
536
+ generator .PushContainerField (null);
537
537
 
538
538
  generator .string += generator .Indent ();
539
539
  generator .string += "<fieldValue";
@@ -106,6 +106,8 @@ StaticGroup .prototype = Object .assign (Object .create (X3DChildNode .prototype
106
106
  X3DChildNode .prototype .initialize .call (this);
107
107
  X3DBoundedObject .prototype .initialize .call (this);
108
108
 
109
+ this .getBrowser () .getBrowserOptions () ._OptimizeStaticGroup .addInterest ("set_optimize__", this);
110
+
109
111
  this ._bboxSize .addFieldInterest (this .groupNode ._bboxSize);
110
112
  this ._bboxCenter .addFieldInterest (this .groupNode ._bboxCenter);
111
113
  this ._children .addFieldInterest (this .groupNode ._children);
@@ -124,12 +126,24 @@ StaticGroup .prototype = Object .assign (Object .create (X3DChildNode .prototype
124
126
  this .setCameraObject (this .groupNode .isCameraObject ());
125
127
  this .setPickableObject (this .groupNode .isPickableObject ());
126
128
 
129
+ this .set_optimize__ ();
127
130
  this .set_children__ ();
128
131
  },
129
132
  getBBox: function (bbox, shadows)
130
133
  {
131
134
  return bbox .assign (shadows ? this .shadowBBox : this .bbox);
132
135
  },
136
+ set_optimize__: function ()
137
+ {
138
+ if (this .getBrowser () .getBrowserOption ("OptimizeStaticGroup"))
139
+ {
140
+ delete this .traverse;
141
+ }
142
+ else
143
+ {
144
+ this .traverse = traverse;
145
+ }
146
+ },
133
147
  set_children__: function ()
134
148
  {
135
149
  this .groupNode .getBBox (this .bbox);
@@ -226,4 +240,9 @@ StaticGroup .prototype = Object .assign (Object .create (X3DChildNode .prototype
226
240
  },
227
241
  });
228
242
 
243
+ function traverse (type, renderObject)
244
+ {
245
+ this .groupNode .traverse (type, renderObject);
246
+ }
247
+
229
248
  export default StaticGroup;
@@ -108,10 +108,7 @@ Switch .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
108
108
  {
109
109
  const boundedObject = X3DCast (X3DConstants .X3DBoundedObject, this .visibleNode);
110
110
 
111
- if (boundedObject)
112
- return boundedObject .getBBox (bbox, shadows);
113
-
114
- return bbox .set ();
111
+ return boundedObject?.getBBox (bbox, shadows) ?? bbox .set ();
115
112
  }
116
113
 
117
114
  return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
@@ -165,11 +162,11 @@ Switch .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
165
162
  },
166
163
  set_cameraObject__: function ()
167
164
  {
168
- this .setCameraObject (!!(this .visibleNode && this .visibleNode .isCameraObject ()));
165
+ this .setCameraObject (!!this .visibleNode?.isCameraObject ());
169
166
  },
170
167
  set_transformSensors__: function ()
171
168
  {
172
- this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode && this .visibleNode .isPickableObject ()));
169
+ this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode?.isPickableObject ()));
173
170
  },
174
171
  set_visible__: function ()
175
172
  {
@@ -196,11 +193,7 @@ Switch .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
196
193
  case TraverseType .CAMERA:
197
194
  case TraverseType .SHADOW:
198
195
  {
199
- const visibleNode = this .visibleNode;
200
-
201
- if (visibleNode)
202
- visibleNode .traverse (type, renderObject);
203
-
196
+ this .visibleNode?.traverse (type, renderObject);
204
197
  return;
205
198
  }
206
199
  case TraverseType .PICKING:
@@ -232,25 +225,14 @@ Switch .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
232
225
  }
233
226
  case TraverseType .COLLISION:
234
227
  {
235
- const visibleNode = this .visibleNode;
236
-
237
- if (visibleNode)
238
- visibleNode .traverse (type, renderObject);
239
-
228
+ this .visibleNode?.traverse (type, renderObject);
240
229
  return;
241
230
  }
242
231
  case TraverseType .DISPLAY:
243
232
  {
244
- const visibleNode = this .visibleNode;
245
-
246
- if (visibleNode)
247
- visibleNode .traverse (type, renderObject);
248
-
249
- const boundedObject = this .boundedObject;
250
-
251
- if (boundedObject)
252
- boundedObject .displayBBox (type, renderObject);
233
+ this .visibleNode?.traverse (type, renderObject);
253
234
 
235
+ this .boundedObject?.displayBBox (type, renderObject);
254
236
  return;
255
237
  }
256
238
  }
@@ -106,7 +106,6 @@ X3DBoundedObject .prototype =
106
106
  const modelViewMatrix = renderObject .getModelViewMatrix ();
107
107
 
108
108
  this .getBBox (bbox);
109
-
110
109
  matrix .set (bbox .center, null, bbox .size);
111
110
 
112
111
  modelViewMatrix .push ();
@@ -56,8 +56,9 @@ import Vector3 from "../../../standard/Math/Numbers/Vector3.js";
56
56
  import Rotation4 from "../../../standard/Math/Numbers/Rotation4.js";
57
57
  import Matrix4 from "../../../standard/Math/Numbers/Matrix4.js";
58
58
 
59
- var
60
- i = 0,
59
+ let i = 0;
60
+
61
+ const
61
62
  LEFT = i++,
62
63
  CENTER = i++,
63
64
  RIGHT = i++,
@@ -441,11 +442,11 @@ Layout .prototype = Object .assign (Object .create (X3DLayoutNode .prototype),
441
442
  },
442
443
  transform: function (type, renderObject)
443
444
  {
444
- var parent = this .parent = renderObject .getParentLayout ();
445
+ const parent = this .parent = renderObject .getParentLayout ();
445
446
 
446
447
  // Calculate rectangleSize
447
448
 
448
- var
449
+ const
449
450
  browser = this .getBrowser (),
450
451
  contentScale = browser .getRenderingProperty ("ContentScale"),
451
452
  matrix = this .matrix,
@@ -488,7 +489,7 @@ Layout .prototype = Object .assign (Object .create (X3DLayoutNode .prototype),
488
489
 
489
490
  // Calculate translation
490
491
 
491
- var translation = this .translation .set (0, 0, 0);
492
+ const translation = this .translation .set (0, 0, 0);
492
493
 
493
494
  switch (this .getAlignX ())
494
495
  {
@@ -524,7 +525,7 @@ Layout .prototype = Object .assign (Object .create (X3DLayoutNode .prototype),
524
525
 
525
526
  // Calculate offset
526
527
 
527
- var offset = this .offset .set (0, 0, 0);
528
+ const offset = this .offset .set (0, 0, 0);
528
529
 
529
530
  switch (this .getOffsetUnitX ())
530
531
  {
@@ -548,13 +549,14 @@ Layout .prototype = Object .assign (Object .create (X3DLayoutNode .prototype),
548
549
 
549
550
  // Calculate scale
550
551
 
551
- var
552
+ const
552
553
  scale = this .scale .set (1, 1, 1),
553
554
  currentTranslation = this .currentTranslation,
554
555
  currentRotation = this .currentRotation,
555
556
  currentScale = this .currentScale;
556
557
 
557
- var modelViewMatrix = renderObject .getModelViewMatrix () .get ();
558
+ const modelViewMatrix = renderObject .getModelViewMatrix () .get ();
559
+
558
560
  modelViewMatrix .get (currentTranslation, currentRotation, currentScale);
559
561
 
560
562
  switch (this .getScaleModeX ())
@@ -612,10 +614,10 @@ Layout .prototype = Object .assign (Object .create (X3DLayoutNode .prototype),
612
614
 
613
615
  // Transform
614
616
 
615
- rectangleCenter .assign (translation) .add (offset);
617
+ rectangleCenter .assign (translation .add (offset));
616
618
 
617
619
  matrix .set (currentTranslation, currentRotation);
618
- matrix .translate (translation .add (offset));
620
+ matrix .translate (translation);
619
621
  matrix .scale (scale);
620
622
 
621
623
  return matrix;
@@ -52,6 +52,7 @@ import X3DGroupingNode from "../Grouping/X3DGroupingNode.js";
52
52
  import X3DCast from "../../Base/X3DCast.js";
53
53
  import TraverseType from "../../Rendering/TraverseType.js";
54
54
  import X3DConstants from "../../Base/X3DConstants.js";
55
+ import Vector3 from "../../../standard/Math/Numbers/Vector3.js";
55
56
  import Matrix4 from "../../../standard/Math/Numbers/Matrix4.js";
56
57
 
57
58
  function LayoutGroup (executionContext)
@@ -62,6 +63,7 @@ function LayoutGroup (executionContext)
62
63
 
63
64
  this .viewportNode = null;
64
65
  this .layoutNode = null;
66
+ this .matrix = new Matrix4 ();
65
67
  this .modelViewMatrix = new Matrix4 ();
66
68
  this .screenMatrix = new Matrix4 ();
67
69
  }
@@ -118,11 +120,13 @@ LayoutGroup .prototype = Object .assign (Object .create (X3DGroupingNode .protot
118
120
  getMatrix: function ()
119
121
  {
120
122
  if (this .layoutNode)
121
- this .matrix .assign (this .modelViewMatrix) .inverse () .multLeft (this .screenMatrix);
122
- else
123
- this .matrix .identity ();
123
+ return this .matrix .assign (this .modelViewMatrix) .inverse () .multLeft (this .screenMatrix);
124
124
 
125
- return this .matrix;
125
+ return this .matrix .identity ();
126
+ },
127
+ getLayout: function ()
128
+ {
129
+ return this .layoutNode;
126
130
  },
127
131
  traverse: function (type, renderObject)
128
132
  {
@@ -139,7 +143,7 @@ LayoutGroup .prototype = Object .assign (Object .create (X3DGroupingNode .protot
139
143
 
140
144
  if (this .layoutNode)
141
145
  {
142
- var modelViewMatrix = renderObject .getModelViewMatrix ();
146
+ const modelViewMatrix = renderObject .getModelViewMatrix ();
143
147
 
144
148
  this .modelViewMatrix .assign (modelViewMatrix .get ());
145
149
  this .screenMatrix .assign (this .layoutNode .transform (type, renderObject));
@@ -115,10 +115,7 @@ LOD .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
115
115
  {
116
116
  const boundedObject = X3DCast (X3DConstants .X3DBoundedObject, this .visibleNode);
117
117
 
118
- if (boundedObject)
119
- return boundedObject .getBBox (bbox, shadows);
120
-
121
- return bbox .set ();
118
+ return boundedObject?.getBBox (bbox, shadows) ?? bbox .set ();
122
119
  }
123
120
 
124
121
  return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
@@ -174,11 +171,11 @@ LOD .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
174
171
  },
175
172
  set_cameraObject__: function ()
176
173
  {
177
- this .setCameraObject (!!(this .visibleNode && this .visibleNode .isCameraObject ()));
174
+ this .setCameraObject (!!this .visibleNode?.isCameraObject ());
178
175
  },
179
176
  set_transformSensors__: function ()
180
177
  {
181
- this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode && this .visibleNode .isPickableObject ()));
178
+ this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode?.isPickableObject ()));
182
179
  },
183
180
  set_visible__: function ()
184
181
  {
@@ -250,11 +247,7 @@ LOD .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
250
247
  case TraverseType .CAMERA:
251
248
  case TraverseType .SHADOW:
252
249
  {
253
- const visibleNode = this .visibleNode;
254
-
255
- if (visibleNode)
256
- visibleNode .traverse (type, renderObject);
257
-
250
+ this .visibleNode?.traverse (type, renderObject);
258
251
  return;
259
252
  }
260
253
  case TraverseType .PICKING:
@@ -286,11 +279,7 @@ LOD .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
286
279
  }
287
280
  case TraverseType .COLLISION:
288
281
  {
289
- const visibleNode = this .visibleNode;
290
-
291
- if (visibleNode)
292
- visibleNode .traverse (type, renderObject);
293
-
282
+ this .visibleNode?.traverse (type, renderObject);
294
283
  return;
295
284
  }
296
285
  case TraverseType .DISPLAY:
@@ -318,16 +307,9 @@ LOD .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
318
307
  }
319
308
  }
320
309
 
321
- const visibleNode = this .visibleNode;
322
-
323
- if (visibleNode)
324
- visibleNode .traverse (type, renderObject);
325
-
326
- const boundedObject = this .boundedObject;
327
-
328
- if (boundedObject)
329
- boundedObject .displayBBox (type, renderObject);
310
+ this .visibleNode?.traverse (type, renderObject);
330
311
 
312
+ this .boundedObject?.displayBBox (type, renderObject);
331
313
  return;
332
314
  }
333
315
  }
@@ -442,7 +442,7 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
442
442
  {
443
443
  bbox = bbox .copy () .multRight (Matrix4 .inverse (this .getModelMatrix ()));
444
444
 
445
- const minDistance = layerNode .getNavigationInfo () .getNearValue () * 2;
445
+ const minDistance = Math .max (layerNode .getNavigationInfo () .getNearValue () * 2, this .getLookAtDistance (bbox));
446
446
 
447
447
  this .lookAt (layerNode, bbox .center, minDistance, factor, straighten);
448
448
  },