x_ite 8.10.1 → 8.11.0

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 (137) hide show
  1. package/Makefile +3 -0
  2. package/build/bin/version.pl +28 -20
  3. package/build/docs/glTF-samples.pl +151 -0
  4. package/build/docs/nodes.pl +1 -1
  5. package/build/src/nodes.pl +41 -0
  6. package/dist/assets/components/Annotation.js +13 -13
  7. package/dist/assets/components/Annotation.min.js +1 -1
  8. package/dist/assets/components/CADGeometry.js +13 -13
  9. package/dist/assets/components/CADGeometry.min.js +1 -1
  10. package/dist/assets/components/CubeMapTexturing.js +30 -26
  11. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  12. package/dist/assets/components/DIS.js +14 -14
  13. package/dist/assets/components/DIS.min.js +1 -1
  14. package/dist/assets/components/EventUtilities.js +9 -9
  15. package/dist/assets/components/EventUtilities.min.js +1 -1
  16. package/dist/assets/components/Geometry2D.js +19 -19
  17. package/dist/assets/components/Geometry2D.min.js +1 -1
  18. package/dist/assets/components/Geospatial.js +33 -33
  19. package/dist/assets/components/Geospatial.min.js +1 -1
  20. package/dist/assets/components/HAnim.js +394 -30
  21. package/dist/assets/components/HAnim.min.js +1 -1
  22. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  23. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  24. package/dist/assets/components/Layout.js +26 -26
  25. package/dist/assets/components/Layout.min.js +1 -1
  26. package/dist/assets/components/NURBS.js +24 -24
  27. package/dist/assets/components/NURBS.min.js +1 -1
  28. package/dist/assets/components/ParticleSystems.js +73 -74
  29. package/dist/assets/components/ParticleSystems.min.js +1 -1
  30. package/dist/assets/components/Picking.js +18 -18
  31. package/dist/assets/components/Picking.min.js +1 -1
  32. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  33. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  34. package/dist/assets/components/Scripting.js +37 -37
  35. package/dist/assets/components/Scripting.min.js +1 -1
  36. package/dist/assets/components/Text.js +55 -63
  37. package/dist/assets/components/Text.min.js +1 -1
  38. package/dist/assets/components/TextureProjector.js +14 -14
  39. package/dist/assets/components/TextureProjector.min.js +1 -1
  40. package/dist/assets/components/Texturing3D.js +35 -31
  41. package/dist/assets/components/Texturing3D.min.js +1 -1
  42. package/dist/assets/components/VolumeRendering.js +20 -20
  43. package/dist/assets/components/VolumeRendering.min.js +1 -1
  44. package/dist/assets/components/X_ITE.js +9 -9
  45. package/dist/assets/components/X_ITE.min.js +1 -1
  46. package/dist/x_ite.css +1 -1
  47. package/dist/x_ite.js +1456 -844
  48. package/dist/x_ite.min.js +1 -1
  49. package/dist/x_ite.zip +0 -0
  50. package/docs/_config.yml +2 -2
  51. package/docs/_posts/components/Core/MetadataBoolean.md +6 -4
  52. package/docs/_posts/components/Core/MetadataDouble.md +6 -4
  53. package/docs/_posts/components/Core/MetadataFloat.md +6 -4
  54. package/docs/_posts/components/Core/MetadataInteger.md +6 -4
  55. package/docs/_posts/components/Core/MetadataSet.md +6 -4
  56. package/docs/_posts/components/Core/MetadataString.md +6 -4
  57. package/docs/_posts/components/DIS/DISEntityTypeMapping.md +1 -1
  58. package/docs/_posts/components/HAnim/HAnimMotion.md +48 -48
  59. package/docs/_posts/components/RigidBodyPhysics/Contact.md +1 -1
  60. package/docs/_posts/getting-started.md +45 -35
  61. package/docs/_posts/reference/browser-services.md +6 -0
  62. package/docs/_tabs/playground.html +215 -15
  63. package/docs/assets/css/style.scss +35 -2
  64. package/docs/assets/js/example.js +95 -3
  65. package/docs/laboratory/gltf-sample-viewer.html +603 -235
  66. package/package.json +2 -2
  67. package/src/assets/shaders/Types.glsl.js +4 -0
  68. package/src/assets/shaders/webgl1/include/Hatch.glsl.js +2 -3
  69. package/src/assets/shaders/webgl2/Compose.fs.js +29 -0
  70. package/src/assets/shaders/webgl2/Compose.vs.js +14 -0
  71. package/src/assets/shaders/webgl2/include/Fragment.glsl.js +24 -2
  72. package/src/assets/shaders/webgl2/include/Hatch.glsl.js +2 -3
  73. package/src/assets/shaders/webgl2/include/Stipple.glsl.js +5 -3
  74. package/src/bookmarks.js +92 -5
  75. package/src/examples.js +1 -0
  76. package/src/standard/Math/Numbers/Quaternion.js +191 -13
  77. package/src/standard/Math/Numbers/Rotation4.js +23 -0
  78. package/src/standard/Time/{MicroTime.js → Time.js} +21 -28
  79. package/src/x_ite/Base/X3DChildObject.js +5 -4
  80. package/src/x_ite/Browser/Core/BrowserOptions.js +71 -60
  81. package/src/x_ite/Browser/Core/Context.js +2 -2
  82. package/src/x_ite/Browser/Core/X3DCoreContext.js +6 -0
  83. package/src/x_ite/Browser/DOMIntegration.js +0 -17
  84. package/src/x_ite/Browser/Navigation/ExamineViewer.js +5 -4
  85. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +7 -4
  86. package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +20 -15
  87. package/src/x_ite/Browser/Shaders/Shaders.js +19 -15
  88. package/src/x_ite/Browser/Text/X3DTextContext.js +16 -16
  89. package/src/x_ite/Browser/Time/X3DTimeContext.js +3 -2
  90. package/src/x_ite/Browser/VERSION.js +1 -1
  91. package/src/x_ite/Browser/VolumeRendering/VolumeMaterial.js +2 -2
  92. package/src/x_ite/Browser/X3DBrowser.js +1 -2
  93. package/src/x_ite/Browser/X3DBrowserContext.js +0 -5
  94. package/src/x_ite/Components/Core/MetadataBoolean.js +8 -1
  95. package/src/x_ite/Components/Core/MetadataDouble.js +8 -1
  96. package/src/x_ite/Components/Core/MetadataFloat.js +8 -1
  97. package/src/x_ite/Components/Core/MetadataInteger.js +8 -1
  98. package/src/x_ite/Components/Core/MetadataSet.js +8 -1
  99. package/src/x_ite/Components/Core/MetadataString.js +8 -1
  100. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +9 -6
  101. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +2 -1
  102. package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +1 -1
  103. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +5 -1
  104. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +2 -0
  105. package/src/x_ite/Components/HAnim/HAnimHumanoid.js +34 -2
  106. package/src/x_ite/Components/HAnim/HAnimMotion.js +331 -15
  107. package/src/x_ite/Components/Lighting/DirectionalLight.js +1 -3
  108. package/src/x_ite/Components/Lighting/PointLight.js +1 -3
  109. package/src/x_ite/Components/Lighting/SpotLight.js +1 -3
  110. package/src/x_ite/Components/Networking/X3DUrlObject.js +5 -4
  111. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +47 -51
  112. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +4 -2
  113. package/src/x_ite/Components/RigidBodyPhysics/Contact.js +1 -1
  114. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +1 -1
  115. package/src/x_ite/Components/Shape/FillProperties.js +4 -0
  116. package/src/x_ite/Components/Shape/LineProperties.js +4 -0
  117. package/src/x_ite/Components/Shape/PointProperties.js +4 -0
  118. package/src/x_ite/Components/Shape/X3DMaterialNode.js +44 -20
  119. package/src/x_ite/Components/Sound/AudioClip.js +2 -1
  120. package/src/x_ite/Components/Text/X3DFontStyleNode.js +13 -23
  121. package/src/x_ite/Components/Texturing/ImageTexture.js +2 -1
  122. package/src/x_ite/Components/Texturing/MovieTexture.js +2 -1
  123. package/src/x_ite/Components/Texturing3D/ImageTextureAtlas.js +2 -1
  124. package/src/x_ite/Components/Time/TimeSensor.js +25 -24
  125. package/src/x_ite/Components/Time/X3DTimeDependentNode.js +5 -4
  126. package/src/x_ite/Execution/BindableList.js +3 -3
  127. package/src/x_ite/Execution/X3DScene.js +2 -0
  128. package/src/x_ite/Parser/XMLParser.js +12 -2
  129. package/src/x_ite/Rendering/MultiSampleFrameBuffer.js +264 -26
  130. package/src/x_ite/Rendering/PointingBuffer.js +5 -7
  131. package/src/x_ite/Rendering/TextureBuffer.js +6 -14
  132. package/src/x_ite/Rendering/X3DRenderObject.js +28 -28
  133. package/src/x_ite/X3D.js +0 -1
  134. package/src/x_ite/X3DCanvasElement.js +2 -0
  135. package/src/x_ite.html +23 -24
  136. package/x_ite.min.html +23 -24
  137. /package/build/{bin → docs}/tags.pl +0 -0
@@ -82,7 +82,7 @@ Object .defineProperties (Contact,
82
82
  },
83
83
  containerField:
84
84
  {
85
- value: "children",
85
+ value: "contacts",
86
86
  enumerable: true,
87
87
  },
88
88
  specificationRange:
@@ -362,7 +362,7 @@ Object .assign (X3DProgrammableShaderObject .prototype,
362
362
  gl .uniform1i (uniform, browser .getDefaultTexture2DUnit ());
363
363
 
364
364
  gl .uniform1i (this .x3d_TexCoordRamp, browser .getDefaultTexture2DUnit ());
365
- gl .uniform1i (this .x3d_JoinsTexture, browser .getDefaultTexture2DUnit ());
365
+ gl .uniform1i (this .x3d_JointsTexture, browser .getDefaultTexture2DUnit ());
366
366
  gl .uniform1i (this .x3d_DisplacementsTexture, browser .getDefaultTexture2DUnit ());
367
367
  gl .uniform1i (this .x3d_JointMatricesTexture, browser .getDefaultTexture2DUnit ());
368
368
  },
@@ -81,6 +81,10 @@ Object .assign (Object .setPrototypeOf (FillProperties .prototype, X3DAppearance
81
81
  // Preload texture.
82
82
  this .getBrowser () .getHatchStyleTexture (this .hatchStyle);
83
83
  },
84
+ getStyleKey ()
85
+ {
86
+ return this .hatched ? 2 : 1;
87
+ },
84
88
  set_filled__ ()
85
89
  {
86
90
  this .filled = this ._filled .getValue ();
@@ -79,6 +79,10 @@ Object .assign (Object .setPrototypeOf (LineProperties .prototype, X3DAppearance
79
79
  // Preload texture.
80
80
  this .getBrowser () .getLinetypeTexture ();
81
81
  },
82
+ getStyleKey ()
83
+ {
84
+ return this .applied ? 2 : 1;
85
+ },
82
86
  getApplied ()
83
87
  {
84
88
  return this .applied;
@@ -86,6 +86,10 @@ Object .assign (Object .setPrototypeOf (PointProperties .prototype, X3DAppearanc
86
86
  this .set_pointSizeMaxValue__ ();
87
87
  this .set_attenuation__ ();
88
88
  },
89
+ getStyleKey ()
90
+ {
91
+ return 1;
92
+ },
89
93
  set_contentScale__ ()
90
94
  {
91
95
  this .set_pointSizeScaleFactor__ ();
@@ -65,18 +65,6 @@ function X3DMaterialNode (executionContext)
65
65
 
66
66
  Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanceChildNode .prototype),
67
67
  {
68
- initialize ()
69
- {
70
- X3DAppearanceChildNode .prototype .initialize .call (this);
71
-
72
- this .getBrowser () .getRenderingProperties () ._LogarithmicDepthBuffer .addInterest ("set_logarithmicDepthBuffer__", this);
73
-
74
- this .set_logarithmicDepthBuffer__ ();
75
- },
76
- set_logarithmicDepthBuffer__ ()
77
- {
78
- this .logarithmicDepthBuffer = this .getBrowser () .getRenderingProperty ("LogarithmicDepthBuffer");
79
- },
80
68
  setTransparent (value)
81
69
  {
82
70
  if (value !== this ._transparent .getValue ())
@@ -113,13 +101,13 @@ Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanc
113
101
  {
114
102
  const { renderObject, transparent, shadows, fogNode, shapeNode, appearanceNode, textureNode, humanoidNode, objectsCount } = renderContext;
115
103
 
116
- key += this .logarithmicDepthBuffer || renderObject .getViewpoint () .getLogarithmicDepthBuffer () ? 1 : 0;
117
104
  key += appearanceNode .getNormalizedAlphaMode (transparent);
118
105
  key += this .getMaterialKey (shadows);
106
+ key += renderObject .getLogarithmicDepthBuffer () ? 1 : 0;
119
107
  key += shadows ? 1 : 0;
120
108
  key += fogNode ?.getFogType () ?? 0;
121
109
  key += shapeNode .getShapeKey ();
122
- key += appearanceNode .getStyleProperties (geometryContext .geometryType) ? 1 : 0;
110
+ key += appearanceNode .getStyleProperties (geometryContext .geometryType) ?.getStyleKey () ?? 0;
123
111
  key += appearanceNode .getTextureTransformMapping () .size || 1;
124
112
  key += geometryContext .textureCoordinateMapping .size || 1;
125
113
  key += humanoidNode ? 1 : 0;
@@ -134,12 +122,13 @@ Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanc
134
122
  }
135
123
  else
136
124
  {
125
+ // Rubberband, X3DBackgroundNode
126
+
137
127
  const { textureNode, objectsCount } = geometryContext;
138
128
 
139
- key += this .logarithmicDepthBuffer ? 1 : 0;
140
129
  key += geometryContext .alphaMode;
141
130
  key += this .getMaterialKey (false);
142
- key += "0000110";
131
+ key += "00000110";
143
132
  key += ".";
144
133
  key += objectsCount [0]; // Clip planes
145
134
  key += ".";
@@ -173,20 +162,30 @@ Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanc
173
162
  {
174
163
  const { renderObject, fogNode, shapeNode, appearanceNode, humanoidNode, objectsCount } = renderContext;
175
164
 
176
- if (this .logarithmicDepthBuffer || renderObject .getViewpoint () .getLogarithmicDepthBuffer ())
165
+ if (renderObject .getLogarithmicDepthBuffer ())
177
166
  options .push ("X3D_LOGARITHMIC_DEPTH_BUFFER");
178
167
 
179
168
  switch (appearanceNode .getNormalizedAlphaMode (renderContext .transparent))
180
169
  {
181
170
  case AlphaMode .OPAQUE:
171
+ {
182
172
  options .push ("X3D_ALPHA_MODE_OPAQUE");
183
173
  break;
174
+ }
184
175
  case AlphaMode .MASK:
176
+ {
185
177
  options .push ("X3D_ALPHA_MODE_MASK");
186
178
  break;
179
+ }
187
180
  case AlphaMode .BLEND:
181
+ {
188
182
  options .push ("X3D_ALPHA_MODE_BLEND");
183
+
184
+ if (browser .getBrowserOption ("OrderIndependentTransparency"))
185
+ options .push ("X3D_ORDER_INDEPENDENT_TRANSPARENCY");
186
+
189
187
  break;
188
+ }
190
189
  }
191
190
 
192
191
  if (renderContext .shadows)
@@ -224,8 +223,13 @@ Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanc
224
223
  }
225
224
 
226
225
  if (appearanceNode .getStyleProperties (geometryContext .geometryType))
226
+ {
227
227
  options .push ("X3D_STYLE_PROPERTIES");
228
228
 
229
+ if (appearanceNode .getStyleProperties (geometryContext .geometryType) .getStyleKey () > 1)
230
+ options .push ("X3D_STYLE_PROPERTIES_TEXTURE");
231
+ }
232
+
229
233
  if (+this .textureBits)
230
234
  options .push ("X3D_MATERIAL_TEXTURES");
231
235
 
@@ -270,10 +274,30 @@ Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, X3DAppearanc
270
274
  }
271
275
  else
272
276
  {
273
- const { textureNode, objectsCount } = geometryContext;
277
+ const { alphaMode, textureNode, objectsCount } = geometryContext;
274
278
 
275
- if (this .logarithmicDepthBuffer)
276
- options .push ("X3D_LOGARITHMIC_DEPTH_BUFFER");
279
+ switch (alphaMode)
280
+ {
281
+ case AlphaMode .OPAQUE:
282
+ {
283
+ options .push ("X3D_ALPHA_MODE_OPAQUE");
284
+ break;
285
+ }
286
+ case AlphaMode .MASK:
287
+ {
288
+ options .push ("X3D_ALPHA_MODE_MASK");
289
+ break;
290
+ }
291
+ case AlphaMode .BLEND:
292
+ {
293
+ options .push ("X3D_ALPHA_MODE_BLEND");
294
+
295
+ if (browser .getBrowserOption ("OrderIndependentTransparency"))
296
+ options .push ("X3D_ORDER_INDEPENDENT_TRANSPARENCY");
297
+
298
+ break;
299
+ }
300
+ }
277
301
 
278
302
  if (objectsCount [0])
279
303
  {
@@ -51,6 +51,7 @@ import FieldDefinitionArray from "../../Base/FieldDefinitionArray.js";
51
51
  import X3DSoundSourceNode from "./X3DSoundSourceNode.js";
52
52
  import X3DUrlObject from "../Networking/X3DUrlObject.js";
53
53
  import X3DConstants from "../../Base/X3DConstants.js";
54
+ import Time from "../../../standard/Time/Time.js";
54
55
  import DEVELOPMENT from "../../DEVELOPMENT.js";
55
56
 
56
57
  function AudioClip (executionContext)
@@ -120,7 +121,7 @@ Object .assign (Object .setPrototypeOf (AudioClip .prototype, X3DSoundSourceNode
120
121
  if (this .URL .protocol !== "data:")
121
122
  {
122
123
  if (!this .getCache ())
123
- this .URL .searchParams .set ("_", Date .now ());
124
+ this .URL .searchParams .set ("_", Time .now ());
124
125
  }
125
126
 
126
127
  this .audio .attr ("src", this .URL .href);
@@ -52,6 +52,7 @@ import TextAlignment from "../../Browser/Text/TextAlignment.js";
52
52
  import FileLoader from "../../InputOutput/FileLoader.js";
53
53
  import X3DConstants from "../../Base/X3DConstants.js";
54
54
  import URLs from "../../Browser/Networking/URLs.js";
55
+ import Time from "../../../standard/Time/Time.js";
55
56
 
56
57
  /*
57
58
  * Font paths for default SERIF, SANS and TYPWRITER families.
@@ -205,32 +206,19 @@ Object .assign (Object .setPrototypeOf (X3DFontStyleNode .prototype, X3DNode .pr
205
206
  },
206
207
  loadNext ()
207
208
  {
208
- try
209
+ if (this .familyStack .length === 0)
209
210
  {
210
- if (this .familyStack .length === 0)
211
- {
212
- this .setLoadState (X3DConstants .FAILED_STATE);
213
- this .font = null;
214
- return;
215
- }
211
+ this .setLoadState (X3DConstants .FAILED_STATE);
212
+ this .font = null;
213
+ return;
214
+ }
216
215
 
217
- this .family = this .familyStack .shift ();
218
- this .URL = new URL (this .family, this .loader .getReferer ());
216
+ this .family = this .familyStack .shift ();
217
+ this .URL = new URL (this .family, this .loader .getReferer ());
219
218
 
220
- if (this .URL .protocol !== "data:")
221
- {
222
- if (!this .getCache ())
223
- this .URL .searchParams .set ("_", Date .now ());
224
- }
225
-
226
- this .getBrowser () .getFont (this .URL)
227
- .done (this .setFont .bind (this))
228
- .fail (this .setError .bind (this));
229
- }
230
- catch (error)
231
- {
232
- this .setError (error .message);
233
- }
219
+ this .getBrowser () .getFont (this .URL, this .getCache ())
220
+ .then (this .setFont .bind (this))
221
+ .catch (this .setError .bind (this));
234
222
  },
235
223
  setError (error)
236
224
  {
@@ -241,6 +229,8 @@ Object .assign (Object .setPrototypeOf (X3DFontStyleNode .prototype, X3DNode .pr
241
229
  },
242
230
  setFont (font)
243
231
  {
232
+ console .info (this .URL .toString ())
233
+
244
234
  this .font = font;
245
235
 
246
236
  this .setLoadState (X3DConstants .COMPLETE_STATE);
@@ -52,6 +52,7 @@ import X3DTexture2DNode from "./X3DTexture2DNode.js";
52
52
  import X3DUrlObject from "../Networking/X3DUrlObject.js";
53
53
  import X3DConstants from "../../Base/X3DConstants.js";
54
54
  import Algorithm from "../../../standard/Math/Algorithm.js";
55
+ import Time from "../../../standard/Time/Time.js";
55
56
  import DEVELOPMENT from "../../DEVELOPMENT.js";
56
57
 
57
58
  function ImageTexture (executionContext)
@@ -108,7 +109,7 @@ Object .assign (Object .setPrototypeOf (ImageTexture .prototype, X3DTexture2DNod
108
109
  if (this .URL .protocol !== "data:")
109
110
  {
110
111
  if (!this .getCache ())
111
- this .URL .searchParams .set ("_", Date .now ());
112
+ this .URL .searchParams .set ("_", Time .now ());
112
113
  }
113
114
 
114
115
  this .image .attr ("src", this .URL .href);
@@ -54,6 +54,7 @@ import X3DUrlObject from "../Networking/X3DUrlObject.js";
54
54
  import GifMedia from "../../Browser/Texturing/GIFMedia.js";
55
55
  import X3DConstants from "../../Base/X3DConstants.js";
56
56
  import Algorithm from "../../../standard/Math/Algorithm.js";
57
+ import Time from "../../../standard/Time/Time.js";
57
58
  import DEVELOPMENT from "../../DEVELOPMENT.js";
58
59
 
59
60
  function MovieTexture (executionContext)
@@ -126,7 +127,7 @@ Object .assign (Object .setPrototypeOf (MovieTexture .prototype, X3DTexture2DNod
126
127
  if (this .URL .protocol !== "data:")
127
128
  {
128
129
  if (!this .getCache ())
129
- this .URL .searchParams .set ("_", Date .now ());
130
+ this .URL .searchParams .set ("_", Time .now ());
130
131
  }
131
132
 
132
133
  if (this .URL .pathname .endsWith (".gif"))
@@ -51,6 +51,7 @@ import FieldDefinitionArray from "../../Base/FieldDefinitionArray.js";
51
51
  import X3DTexture3DNode from "./X3DTexture3DNode.js";
52
52
  import X3DUrlObject from "../Networking/X3DUrlObject.js";
53
53
  import X3DConstants from "../../Base/X3DConstants.js";
54
+ import Time from "../../../standard/Time/Time.js";
54
55
  import DEVELOPMENT from "../../DEVELOPMENT.js";
55
56
 
56
57
  function ImageTextureAtlas (executionContext)
@@ -104,7 +105,7 @@ Object .assign (Object .setPrototypeOf (ImageTextureAtlas .prototype, X3DTexture
104
105
  if (this .URL .protocol !== "data:")
105
106
  {
106
107
  if (!this .getCache ())
107
- this .URL .searchParams .set ("_", Date .now ());
108
+ this .URL .searchParams .set ("_", Time .now ());
108
109
  }
109
110
 
110
111
  this .image .attr ("src", this .URL .href);
@@ -81,52 +81,53 @@ Object .assign (Object .setPrototypeOf (TimeSensor .prototype, X3DSensorNode .pr
81
81
  this ._cycleInterval .addInterest ("set_cycleInterval__", this);
82
82
  this ._range .addInterest ("set_range__", this);
83
83
  },
84
- setRange (currentFraction, firstFraction, lastFraction)
84
+ setRange (fraction, firstFraction, lastFraction, offset)
85
85
  {
86
86
  const
87
87
  currentTime = this .getBrowser () .getCurrentTime (),
88
88
  startTime = this ._startTime .getValue (),
89
89
  cycleInterval = this ._cycleInterval .getValue ();
90
90
 
91
- this .first = firstFraction;
92
- this .last = lastFraction;
91
+ this .first = Algorithm .clamp (firstFraction, 0, 1);
92
+ this .last = Algorithm .clamp (lastFraction, 0, 1);
93
93
  this .scale = this .last - this .first;
94
94
  this .interval = cycleInterval * this .scale;
95
- this .fraction = Algorithm .fract ((currentFraction >= 1 ? 0 : currentFraction) + (this .interval ? (currentTime - startTime) / this .interval : 0));
96
- this .cycle = currentTime - (this .fraction - this .first) * cycleInterval;
95
+ this .offset = offset && this .interval ? (currentTime - startTime) / this .interval : 0;
96
+ this .fraction = Algorithm .fract (fraction + this .offset);
97
+ this .cycle = currentTime - (this .fraction - this .first) * cycleInterval;
97
98
  },
98
99
  set_cycleInterval__ ()
99
100
  {
100
- if (this ._isActive .getValue ())
101
- this .setRange (this .fraction, this ._range [1], this ._range [2]);
101
+ if (!this ._isActive .getValue ())
102
+ return;
103
+
104
+ this .setRange (this .fraction, this ._range [1], this ._range [2], false);
102
105
  },
103
106
  set_range__ ()
104
107
  {
105
- if (this ._isActive .getValue ())
106
- {
107
- this .setRange (this ._range [0], this ._range [1], this ._range [2]);
108
+ if (!this ._isActive .getValue ())
109
+ return;
108
110
 
109
- if (!this ._isPaused .getValue ())
110
- this .set_fraction (this .getBrowser () .getCurrentTime ());
111
- }
111
+ this .setRange (this ._range [0], this ._range [1], this ._range [2], false);
112
+
113
+ if (this ._isPaused .getValue ())
114
+ return;
115
+
116
+ this .set_fraction (this .getBrowser () .getCurrentTime ());
112
117
  },
113
118
  set_start ()
114
119
  {
115
- this .setRange (this ._range [0], this ._range [1], this ._range [2]);
120
+ this .setRange (this ._range [0], this ._range [1], this ._range [2], true);
116
121
 
117
- if (this .getLive () .getValue ())
118
- {
119
- this ._fraction_changed = this .fraction;
120
- this ._time = this .getBrowser () .getCurrentTime ();
121
- }
122
+ const time = this .getBrowser () .getCurrentTime ();
123
+
124
+ this ._cycleTime = time;
125
+ this ._fraction_changed = this .fraction;
126
+ this ._time = time;
122
127
  },
123
128
  set_resume (pauseInterval)
124
129
  {
125
- const
126
- currentTime = this .getBrowser () .getCurrentTime (),
127
- startTime = this ._startTime .getValue ();
128
-
129
- this .setRange (this .interval ? Algorithm .fract (this .fraction - (currentTime - startTime) / this .interval) : 0, this ._range [1], this ._range [2]);
130
+ this .setRange (this .fraction, this ._range [1], this ._range [2], false);
130
131
  },
131
132
  set_fraction (time)
132
133
  {
@@ -48,6 +48,7 @@
48
48
  import Fields from "../../Fields.js";
49
49
  import X3DChildNode from "../Core/X3DChildNode.js";
50
50
  import X3DConstants from "../../Base/X3DConstants.js";
51
+ import Time from "../../../standard/Time/Time.js";
51
52
 
52
53
  function X3DTimeDependentNode (executionContext)
53
54
  {
@@ -117,13 +118,13 @@ Object .assign (Object .setPrototypeOf (X3DTimeDependentNode .prototype, X3DChil
117
118
  {
118
119
  this .disabled = false;
119
120
 
120
- if (this ._isActive .getValue () && ! this ._isPaused .getValue ())
121
+ if (this ._isActive .getValue () && !this ._isPaused .getValue ())
121
122
  this .real_resume ();
122
123
  }
123
124
  }
124
125
  else
125
126
  {
126
- if (! this .disabled && this ._isActive .getValue () && ! this ._isPaused .getValue ())
127
+ if (!this .disabled && this ._isActive .getValue () && !this ._isPaused .getValue ())
127
128
  {
128
129
  // Only disable if needed, ie. if running!
129
130
  this .disabled = true;
@@ -263,7 +264,7 @@ Object .assign (Object .setPrototypeOf (X3DTimeDependentNode .prototype, X3DChil
263
264
  },
264
265
  real_pause ()
265
266
  {
266
- this .pause = Date .now ();
267
+ this .pause = Time .now ();
267
268
 
268
269
  this .set_pause ();
269
270
 
@@ -284,7 +285,7 @@ Object .assign (Object .setPrototypeOf (X3DTimeDependentNode .prototype, X3DChil
284
285
  },
285
286
  real_resume ()
286
287
  {
287
- const interval = (Date .now () - this .pause) / 1000;
288
+ const interval = (Time .now () - this .pause) / 1000;
288
289
 
289
290
  this .pauseInterval += interval;
290
291
 
@@ -45,8 +45,8 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DBaseNode from "../Base/X3DBaseNode.js";
49
- import X3DPrototypeInstance from "../Components/Core/X3DPrototypeInstance.js";
48
+ import X3DBaseNode from "../Base/X3DBaseNode.js";
49
+ import Time from "../../standard/Time/Time.js";
50
50
 
51
51
  function BindableList (executionContext, defaultNode)
52
52
  {
@@ -171,7 +171,7 @@ Object .assign (Object .setPrototypeOf (BindableList .prototype, X3DBaseNode .pr
171
171
 
172
172
  // Advance updateTime time.
173
173
 
174
- this .updateTime = Date .now ();
174
+ this .updateTime = Time .now ();
175
175
  },
176
176
  });
177
177
 
@@ -614,6 +614,7 @@ Object .assign (Object .setPrototypeOf (X3DScene .prototype, X3DExecutionContext
614
614
 
615
615
  generator .string += generator .Indent ();
616
616
  generator .string += "</X3D>";
617
+ generator .string += generator .TidyBreak ();
617
618
  },
618
619
  toJSONStream (generator)
619
620
  {
@@ -958,6 +959,7 @@ Object .assign (Object .setPrototypeOf (X3DScene .prototype, X3DExecutionContext
958
959
  generator .string += generator .DecIndent ();
959
960
  generator .string += generator .Indent ();
960
961
  generator .string += '}';
962
+ generator .string += generator .TidyBreak ();
961
963
  },
962
964
  },
963
965
  {
@@ -1022,10 +1022,13 @@ Object .assign (Object .setPrototypeOf (XMLParser .prototype, X3DParser .prototy
1022
1022
 
1023
1023
  try
1024
1024
  {
1025
- const containerField = xmlElement .getAttribute ("containerField") || node ?.getContainerField ();
1025
+ const containerField = xmlElement .getAttribute ("containerField") || node ?.getContainerField (true);
1026
1026
 
1027
1027
  if (!containerField)
1028
- throw new Error ("Node must have a container field attribute.");
1028
+ {
1029
+ console .warn ("Node must have a container field attribute.");
1030
+ return;
1031
+ }
1029
1032
 
1030
1033
  const field = parent .getField (containerField);
1031
1034
 
@@ -1043,6 +1046,13 @@ Object .assign (Object .setPrototypeOf (XMLParser .prototype, X3DParser .prototy
1043
1046
  catch (error)
1044
1047
  {
1045
1048
  // console .error (error);
1049
+
1050
+ if (node ?.getType () .includes (X3DConstants .X3DMetadataObject))
1051
+ {
1052
+ xmlElement .setAttribute ("containerField", "metadata");
1053
+
1054
+ this .addNode (xmlElement, node);
1055
+ }
1046
1056
  }
1047
1057
  },
1048
1058
  // Overloaded by HTMLParser.