x_ite 8.6.14 → 8.6.16

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 (86) hide show
  1. package/.vscode/settings.json +3 -2
  2. package/Makefile +2 -1
  3. package/README.md +1 -0
  4. package/dist/assets/components/Annotation.js +13 -13
  5. package/dist/assets/components/Annotation.min.js +1 -1
  6. package/dist/assets/components/CADGeometry.js +13 -13
  7. package/dist/assets/components/CADGeometry.min.js +1 -1
  8. package/dist/assets/components/CubeMapTexturing.js +31 -26
  9. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  10. package/dist/assets/components/DIS.js +13 -13
  11. package/dist/assets/components/DIS.min.js +1 -1
  12. package/dist/assets/components/EventUtilities.js +9 -9
  13. package/dist/assets/components/EventUtilities.min.js +1 -1
  14. package/dist/assets/components/Geometry2D.js +19 -19
  15. package/dist/assets/components/Geometry2D.min.js +1 -1
  16. package/dist/assets/components/Geospatial.js +33 -33
  17. package/dist/assets/components/Geospatial.min.js +1 -1
  18. package/dist/assets/components/HAnim.js +18 -18
  19. package/dist/assets/components/HAnim.min.js +1 -1
  20. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  21. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  22. package/dist/assets/components/Layout.js +27 -27
  23. package/dist/assets/components/Layout.min.js +1 -1
  24. package/dist/assets/components/NURBS.js +24 -24
  25. package/dist/assets/components/NURBS.min.js +1 -1
  26. package/dist/assets/components/ParticleSystems.js +22 -22
  27. package/dist/assets/components/ParticleSystems.min.js +1 -1
  28. package/dist/assets/components/Picking.js +18 -18
  29. package/dist/assets/components/Picking.min.js +1 -1
  30. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  31. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  32. package/dist/assets/components/Scripting.js +28 -28
  33. package/dist/assets/components/Scripting.min.js +1 -1
  34. package/dist/assets/components/Text.js +24 -26
  35. package/dist/assets/components/Text.min.js +1 -1
  36. package/dist/assets/components/TextureProjector.js +14 -14
  37. package/dist/assets/components/TextureProjector.min.js +1 -1
  38. package/dist/assets/components/Texturing3D.js +30 -30
  39. package/dist/assets/components/Texturing3D.min.js +1 -1
  40. package/dist/assets/components/VolumeRendering.js +19 -19
  41. package/dist/assets/components/VolumeRendering.min.js +1 -1
  42. package/dist/assets/components/X_ITE.js +9 -9
  43. package/dist/assets/components/X_ITE.min.js +1 -1
  44. package/dist/x_ite.css +1 -1
  45. package/dist/x_ite.js +188 -144
  46. package/dist/x_ite.min.js +1 -1
  47. package/dist/x_ite.zip +0 -0
  48. package/docs/_config.yml +1 -1
  49. package/docs/_posts/getting-started.md +4 -3
  50. package/docs/assets/js/example.js +2 -0
  51. package/package.json +3 -2
  52. package/src/assets/shaders/webgl1/PBR.fs.js +1 -1
  53. package/src/assets/shaders/webgl1/include/Material.glsl.js +1 -1
  54. package/src/assets/shaders/webgl1/include/Texture.glsl.js +7 -1
  55. package/src/assets/shaders/webgl2/PBR.fs.js +1 -1
  56. package/src/assets/shaders/webgl2/include/Material.glsl.js +1 -1
  57. package/src/standard/Math/Numbers/Color3.js +3 -12
  58. package/src/standard/Math/Numbers/Color4.js +4 -14
  59. package/src/standard/Math/Numbers/Complex.js +41 -4
  60. package/src/x_ite/Browser/Core/X3DCoreContext.js +4 -0
  61. package/src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +0 -1
  62. package/src/x_ite/Browser/Grouping/X3DGroupingContext.js +1 -2
  63. package/src/x_ite/Browser/Lighting/X3DLightingContext.js +0 -2
  64. package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +4 -0
  65. package/src/x_ite/Browser/Navigation/X3DViewer.js +2 -3
  66. package/src/x_ite/Browser/Picking/X3DPickingContext.js +0 -2
  67. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +0 -3
  68. package/src/x_ite/Browser/Scripting/X3DScriptingContext.js +1 -3
  69. package/src/x_ite/Browser/Shape/X3DShapeContext.js +0 -2
  70. package/src/x_ite/Browser/Sound/X3DSoundContext.js +1 -4
  71. package/src/x_ite/Browser/Text/X3DTextContext.js +0 -2
  72. package/src/x_ite/Browser/VERSION.js +1 -1
  73. package/src/x_ite/Browser/X3DBrowserContext.js +43 -27
  74. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +6 -1
  75. package/src/x_ite/Components/Lighting/DirectionalLight.js +4 -0
  76. package/src/x_ite/Components/Lighting/PointLight.js +4 -0
  77. package/src/x_ite/Components/Lighting/SpotLight.js +4 -0
  78. package/src/x_ite/Fields/SFColor.js +1 -1
  79. package/src/x_ite/Fields/SFColorRGBA.js +1 -1
  80. package/src/x_ite/Parser/OBJParser.js +1 -1
  81. package/src/x_ite/Routing/X3DRoutingContext.js +1 -0
  82. package/src/x_ite.html +35 -1
  83. package/x_ite.min.html +35 -1
  84. package/.gitmodules +0 -3
  85. package/tests/README.md +0 -2
  86. package/tests/tests.mdproj +0 -17
package/dist/x_ite.zip CHANGED
Binary file
package/docs/_config.yml CHANGED
@@ -20,7 +20,7 @@ timezone:
20
20
  # ↓ --------------------------
21
21
 
22
22
  title: X_ITE X3D Browser # the main title
23
- version: 8.6.14 # x_ite latest version
23
+ version: 8.6.15 # x_ite latest version
24
24
  size: 290 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
@@ -554,6 +554,7 @@ It can be used in [Electron](https://www.electronjs.org){:target="_blank"} apps
554
554
  window .addEventListener ("DOMContentLoaded", () =>
555
555
  {
556
556
  const X3D = require ("x_ite")
557
+ ...
557
558
  })
558
559
  ```
559
560
 
@@ -584,15 +585,15 @@ Open Source CDN, free, fast, and reliable.
584
585
  You can always replace »latest« by the version number you prefer.
585
586
 
586
587
  ```html
587
- <script src="https://cdn.jsdelivr.net/gh/create3000/x_ite@latest/dist/x_ite.min.js"></script>
588
+ <script src="https://cdn.jsdelivr.net/npm/x_ite@latest/dist/x_ite.min.js"></script>
588
589
  ```
589
590
 
590
591
  #### For Production
591
592
 
592
- If you are in production and everything is working fine, then use a numbered version.
593
+ If you are in production and everything is working well, then use a fixed version.
593
594
 
594
595
  ```html
595
- <script src="https://cdn.jsdelivr.net/gh/create3000/x_ite@{{ site.version }}/dist/x_ite.min.js"></script>
596
+ <script src="https://cdn.jsdelivr.net/npm/x_ite@{{ site.version }}/dist/x_ite.min.js"></script>
596
597
  ```
597
598
 
598
599
  ## Embedding X_ITE within a Web Page
@@ -30,5 +30,7 @@ $("table.examples a") .on ("click", function ()
30
30
  canvas .attr ("src", $(this) .attr ("href"));
31
31
  zip .attr ("href", $(this) .attr ("href") .replace (/\.x3d$/, ".zip"));
32
32
 
33
+ console .log (`Loading ${$(this) .attr ("title")} ...`);
34
+
33
35
  return false;
34
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "8.6.14",
3
+ "version": "8.6.16",
4
4
  "description": "X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.",
5
5
  "homepage": "https://create3000.github.io/x_ite/",
6
6
  "author": "Holger Seelig <holger.seelig@gmail.com>",
@@ -71,11 +71,12 @@
71
71
  "opentype.js": "^1.3.4",
72
72
  "pako": "^2.1.0",
73
73
  "string-replace-webpack-plugin": "^0.1.3",
74
- "webpack": "^5.76.3",
74
+ "webpack": "^5.78.0",
75
75
  "webpack-cli": "^5.0.1",
76
76
  "webpack-shell-plugin-next": "^2.3.1"
77
77
  },
78
78
  "scripts": {
79
+ "test": "cd ../x_ite-tests && npm test",
79
80
  "lint": "jshint **",
80
81
  "build": "make",
81
82
  "-prebuild:js": "npm run lint"
@@ -330,7 +330,7 @@ getMaterialColor ()
330
330
  vec3 diffuseSpecContrib = light .intensity * (diffuseContrib + specContrib);
331
331
 
332
332
  #if defined (X3D_SHADOWS)
333
- if (NdotL > 0.001)
333
+ if (NdotL > 0.001 && light .shadowIntensity > 0.0)
334
334
  diffuseSpecContrib = mix (diffuseSpecContrib, light .shadowColor, getShadowIntensity (i, light));
335
335
  #endif
336
336
 
@@ -44,7 +44,7 @@ getMaterialColor (const in vec3 vertex, const in vec3 N, const in vec3 ambientCo
44
44
  vec3 diffuseSpecularTerm = light .intensity * (diffuseTerm + specularTerm);
45
45
 
46
46
  #if defined (X3D_FRAGMENT_SHADER) && defined (X3D_SHADOWS)
47
- if (lightAngle > 0.0)
47
+ if (lightAngle > 0.0 && light .shadowIntensity > 0.0)
48
48
  diffuseSpecularTerm = mix (diffuseSpecularTerm, light .shadowColor, getShadowIntensity (i, light));
49
49
  #endif
50
50
 
@@ -228,6 +228,12 @@ getTexture (const in int i, const in vec3 texCoord)
228
228
  uniform x3d_MultiTextureParameters x3d_MultiTexture [X3D_NUM_TEXTURES];
229
229
  #endif
230
230
 
231
+ int
232
+ minI (const in int a, const in int b)
233
+ {
234
+ return a < b ? a : b;
235
+ }
236
+
231
237
  vec4
232
238
  getTextureColor (const in vec4 diffuseColor, const in vec4 specularColor)
233
239
  {
@@ -238,7 +244,7 @@ getTextureColor (const in vec4 diffuseColor, const in vec4 specularColor)
238
244
  {
239
245
  // Get texture color.
240
246
 
241
- vec3 texCoord = getTexCoord (min (i, X3D_NUM_TEXTURE_TRANSFORMS - 1), min (i, X3D_NUM_TEXTURE_COORDINATES - 1));
247
+ vec3 texCoord = getTexCoord (minI (i, X3D_NUM_TEXTURE_TRANSFORMS - 1), minI (i, X3D_NUM_TEXTURE_COORDINATES - 1));
242
248
  vec4 textureColor = getTexture (i, texCoord);
243
249
 
244
250
  // Multi texturing
@@ -337,7 +337,7 @@ getMaterialColor ()
337
337
  vec3 diffuseSpecContrib = light .intensity * (diffuseContrib + specContrib);
338
338
 
339
339
  #if defined (X3D_SHADOWS)
340
- if (NdotL > 0.001)
340
+ if (NdotL > 0.001 && light .shadowIntensity > 0.0)
341
341
  diffuseSpecContrib = mix (diffuseSpecContrib, light .shadowColor, getShadowIntensity (i, light));
342
342
  #endif
343
343
 
@@ -44,7 +44,7 @@ getMaterialColor (const in vec3 vertex, const in vec3 N, const in vec3 ambientCo
44
44
  vec3 diffuseSpecularTerm = light .intensity * (diffuseTerm + specularTerm);
45
45
 
46
46
  #if defined (X3D_FRAGMENT_SHADER) && defined (X3D_SHADOWS)
47
- if (lightAngle > 0.0)
47
+ if (lightAngle > 0.0 && light .shadowIntensity > 0.0)
48
48
  diffuseSpecularTerm = mix (diffuseSpecularTerm, light .shadowColor, getShadowIntensity (i, light));
49
49
  #endif
50
50
 
@@ -56,18 +56,9 @@ const
56
56
 
57
57
  function Color3 (r, g, b)
58
58
  {
59
- if (arguments .length)
60
- {
61
- this [_r] = clamp (r, 0, 1);
62
- this [_g] = clamp (g, 0, 1);
63
- this [_b] = clamp (b, 0, 1);
64
- }
65
- else
66
- {
67
- this [_r] = 0;
68
- this [_g] = 0;
69
- this [_b] = 0;
70
- }
59
+ this [_r] = clamp (r, 0, 1);
60
+ this [_g] = clamp (g, 0, 1);
61
+ this [_b] = clamp (b, 0, 1);
71
62
  }
72
63
 
73
64
  Color3 .prototype =
@@ -58,20 +58,10 @@ const
58
58
 
59
59
  function Color4 (r, g, b, a)
60
60
  {
61
- if (arguments .length)
62
- {
63
- this [_r] = clamp (r, 0, 1);
64
- this [_g] = clamp (g, 0, 1);
65
- this [_b] = clamp (b, 0, 1);
66
- this [_a] = clamp (a, 0, 1);
67
- }
68
- else
69
- {
70
- this [_r] = 0;
71
- this [_g] = 0;
72
- this [_b] = 0;
73
- this [_a] = 0;
74
- }
61
+ this [_r] = clamp (r, 0, 1);
62
+ this [_g] = clamp (g, 0, 1);
63
+ this [_b] = clamp (b, 0, 1);
64
+ this [_a] = clamp (a, 0, 1);
75
65
  }
76
66
 
77
67
  Color4 .prototype =
@@ -54,6 +54,7 @@ function Complex (real, imag)
54
54
  Complex .prototype =
55
55
  {
56
56
  constructor: Complex,
57
+ length: 2,
57
58
  [Symbol .iterator]: function* ()
58
59
  {
59
60
  yield this .real;
@@ -77,6 +78,12 @@ Complex .prototype =
77
78
  return this .real === complex .real &&
78
79
  this .imag === complex .imag;
79
80
  },
81
+ set: function (real, imag)
82
+ {
83
+ this .real = real;
84
+ this .imag = imag;
85
+ return this;
86
+ },
80
87
  setPolar: function (magnitude, angle)
81
88
  {
82
89
  this .real = magnitude * Math .cos (angle);
@@ -130,10 +137,12 @@ Complex .prototype =
130
137
  this .imag = ar * bi + ai * br;
131
138
  return this;
132
139
  },
133
- //divide: function (value)
134
- //{
135
- // return this;
136
- //},
140
+ divide: function (value)
141
+ {
142
+ this .real /= value;
143
+ this .imag /= value;
144
+ return this;
145
+ },
137
146
  divComp: function (value)
138
147
  {
139
148
  const
@@ -154,6 +163,34 @@ Complex .prototype =
154
163
  },
155
164
  };
156
165
 
166
+ Object .defineProperty (Complex .prototype, "0",
167
+ {
168
+ get: function ()
169
+ {
170
+ return this .real;
171
+ },
172
+ set: function (value)
173
+ {
174
+ this .real = value;
175
+ },
176
+ enumerable: false,
177
+ configurable: false
178
+ });
179
+
180
+ Object .defineProperty (Complex .prototype, "1",
181
+ {
182
+ get: function ()
183
+ {
184
+ return this .imag;
185
+ },
186
+ set: function (value)
187
+ {
188
+ this .imag = value;
189
+ },
190
+ enumerable: false,
191
+ configurable: false
192
+ });
193
+
157
194
  Object .defineProperty (Complex .prototype, "magnitude",
158
195
  {
159
196
  get: function ()
@@ -643,6 +643,10 @@ X3DCoreContext .prototype =
643
643
  document .execCommand ("copy");
644
644
  tmp .remove ();
645
645
  },
646
+ dispose: function ()
647
+ {
648
+ this [_context] .getExtension ("WEBGL_lose_context") ?.loseContext ();
649
+ },
646
650
  };
647
651
 
648
652
  export default X3DCoreContext;
@@ -53,7 +53,6 @@ function X3DEnvironmentalEffectsContext () { }
53
53
 
54
54
  X3DEnvironmentalEffectsContext .prototype =
55
55
  {
56
- initialize: function () { },
57
56
  getBackgroundTextureProperties: function ()
58
57
  {
59
58
  this [_backgroundTextureProperties] = new TextureProperties (this .getPrivateScene ());
@@ -55,7 +55,6 @@ function X3DGroupingContext () { }
55
55
 
56
56
  X3DGroupingContext .prototype =
57
57
  {
58
- initialize: function () { },
59
58
  getBBoxNode: function ()
60
59
  {
61
60
  const
@@ -79,7 +78,7 @@ X3DGroupingContext .prototype =
79
78
  Object .defineProperty (this, "getBBoxNode", { enumerable: false });
80
79
 
81
80
  return bboxShape;
82
- }
81
+ },
83
82
  };
84
83
 
85
84
  export default X3DGroupingContext;
@@ -67,8 +67,6 @@ function X3DLightingContext ()
67
67
 
68
68
  X3DLightingContext .prototype =
69
69
  {
70
- initialize: function ()
71
- { },
72
70
  getMaxLights: function ()
73
71
  {
74
72
  return this [_maxLights];
@@ -230,6 +230,10 @@ X3DNavigationContext .prototype =
230
230
 
231
231
  this [_viewerNode] .setup ();
232
232
  },
233
+ dispose: function ()
234
+ {
235
+ this [_viewerNode] ?.dispose ();
236
+ },
233
237
  };
234
238
 
235
239
  export default X3DNavigationContext;
@@ -67,8 +67,7 @@ X3DViewer .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
67
67
  {
68
68
  return "X3DViewer";
69
69
  },
70
- initialize: function ()
71
- { },
70
+
72
71
  getActiveLayer: function ()
73
72
  {
74
73
  return this .getBrowser () .getActiveLayer ();
@@ -200,7 +199,7 @@ X3DViewer .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
200
199
  {
201
200
  return this .getBrowser () .touch (x, y);
202
201
  },
203
- dispose: function () { },
202
+
204
203
  });
205
204
 
206
205
  function tbProjectToSphere (r, x, y)
@@ -66,8 +66,6 @@ function X3DPickingContext ()
66
66
 
67
67
  X3DPickingContext .prototype =
68
68
  {
69
- initialize: function ()
70
- { },
71
69
  addTransformSensor: function (transformSensorNode)
72
70
  {
73
71
  this [_transformSensorNodes] .add (transformSensorNode);
@@ -100,9 +100,6 @@ X3DPointingDeviceSensorContext .prototype =
100
100
  {
101
101
  initialize: function ()
102
102
  {
103
- // Preload shaders.
104
- // this .initialized () .addInterest ("touch", this, 1, 1);
105
-
106
103
  this .setCursor ("DEFAULT");
107
104
 
108
105
  this [_pointingDevice] .setup ();
@@ -54,8 +54,6 @@ function X3DScriptingContext ()
54
54
 
55
55
  X3DScriptingContext .prototype =
56
56
  {
57
- initialize: function ()
58
- { },
59
57
  isExternal: function ()
60
58
  {
61
59
  return this [_scripts] .length === 1;
@@ -63,7 +61,7 @@ X3DScriptingContext .prototype =
63
61
  getScriptStack: function ()
64
62
  {
65
63
  return this [_scripts];
66
- }
64
+ },
67
65
  };
68
66
 
69
67
  export default X3DScriptingContext;
@@ -71,8 +71,6 @@ function X3DShapeContext ()
71
71
 
72
72
  X3DShapeContext .prototype =
73
73
  {
74
- initialize: function ()
75
- { },
76
74
  getDefaultAppearance: function ()
77
75
  {
78
76
  this [_defaultAppearance] = new Appearance (this .getPrivateScene ());
@@ -53,9 +53,6 @@ function X3DSoundContext ()
53
53
  "mute", new Fields .SFBool ());
54
54
  }
55
55
 
56
- X3DSoundContext .prototype =
57
- {
58
- initialize: function () { },
59
- };
56
+ X3DSoundContext .prototype = { };
60
57
 
61
58
  export default X3DSoundContext;
@@ -60,8 +60,6 @@ function X3DTextContext ()
60
60
 
61
61
  X3DTextContext .prototype =
62
62
  {
63
- initialize: function ()
64
- { },
65
63
  getDefaultFontStyle: function ()
66
64
  {
67
65
  this [_defaultFontStyle] = new FontStyle (this .getPrivateScene ());
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.6.14";
48
+ export default "8.6.15";
@@ -155,31 +155,28 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
155
155
  constructor: X3DBrowserContext,
156
156
  initialize: function ()
157
157
  {
158
- X3DBaseNode .prototype .initialize .call (this);
159
- X3DRoutingContext .prototype .initialize .call (this);
160
- X3DCoreContext .prototype .initialize .call (this);
161
- X3DScriptingContext .prototype .initialize .call (this);
162
- X3DNetworkingContext .prototype .initialize .call (this);
163
- X3DTexturingContext .prototype .initialize .call (this);
164
- X3DShadersContext .prototype .initialize .call (this);
165
- X3DRenderingContext .prototype .initialize .call (this);
166
- X3DShapeContext .prototype .initialize .call (this);
167
- X3DGroupingContext .prototype .initialize .call (this);
168
- X3DGeometry3DContext .prototype .initialize .call (this);
169
- X3DPointingDeviceSensorContext .prototype .initialize .call (this);
170
- X3DNavigationContext .prototype .initialize .call (this);
171
- X3DLayeringContext .prototype .initialize .call (this);
172
- X3DEnvironmentalEffectsContext .prototype .initialize .call (this);
173
- X3DLightingContext .prototype .initialize .call (this);
174
- X3DPickingContext .prototype .initialize .call (this);
175
- X3DSoundContext .prototype .initialize .call (this);
176
- X3DTimeContext .prototype .initialize .call (this);
158
+ X3DBaseNode .prototype .initialize ?.call (this);
159
+ X3DRoutingContext .prototype .initialize ?.call (this);
160
+ X3DCoreContext .prototype .initialize ?.call (this);
161
+ X3DScriptingContext .prototype .initialize ?.call (this);
162
+ X3DNetworkingContext .prototype .initialize ?.call (this);
163
+ X3DTexturingContext .prototype .initialize ?.call (this);
164
+ X3DShadersContext .prototype .initialize ?.call (this);
165
+ X3DRenderingContext .prototype .initialize ?.call (this);
166
+ X3DShapeContext .prototype .initialize ?.call (this);
167
+ X3DGroupingContext .prototype .initialize ?.call (this);
168
+ X3DGeometry3DContext .prototype .initialize ?.call (this);
169
+ X3DPointingDeviceSensorContext .prototype .initialize ?.call (this);
170
+ X3DNavigationContext .prototype .initialize ?.call (this);
171
+ X3DLayeringContext .prototype .initialize ?.call (this);
172
+ X3DEnvironmentalEffectsContext .prototype .initialize ?.call (this);
173
+ X3DLightingContext .prototype .initialize ?.call (this);
174
+ X3DPickingContext .prototype .initialize ?.call (this);
175
+ X3DSoundContext .prototype .initialize ?.call (this);
176
+ X3DTimeContext .prototype .initialize ?.call (this);
177
177
 
178
178
  for (const browserContext of browserContexts)
179
- {
180
- if (typeof browserContext .prototype .initialize === "function")
181
- browserContext .prototype .initialize .call (this);
182
- }
179
+ browserContext .prototype .initialize ?.call (this);
183
180
 
184
181
  // Process events from context creation. This will setup nodes like
185
182
  // geometry option nodes before any node is created.
@@ -350,7 +347,28 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
350
347
  {
351
348
  browsers .delete (this);
352
349
 
353
- X3DBaseNode .prototype .dispose .call (this);
350
+ for (const browserContext of browserContexts)
351
+ browserContext .prototype .dispose ?.call (this);
352
+
353
+ X3DTimeContext .prototype .dispose ?.call (this);
354
+ X3DSoundContext .prototype .dispose ?.call (this);
355
+ X3DPickingContext .prototype .dispose ?.call (this);
356
+ X3DLightingContext .prototype .dispose ?.call (this);
357
+ X3DEnvironmentalEffectsContext .prototype .dispose ?.call (this);
358
+ X3DLayeringContext .prototype .dispose ?.call (this);
359
+ X3DNavigationContext .prototype .dispose ?.call (this);
360
+ X3DPointingDeviceSensorContext .prototype .dispose ?.call (this);
361
+ X3DGeometry3DContext .prototype .dispose ?.call (this);
362
+ X3DGroupingContext .prototype .dispose ?.call (this);
363
+ X3DShapeContext .prototype .dispose ?.call (this);
364
+ X3DRenderingContext .prototype .dispose ?.call (this);
365
+ X3DShadersContext .prototype .dispose ?.call (this);
366
+ X3DTexturingContext .prototype .dispose ?.call (this);
367
+ X3DNetworkingContext .prototype .dispose ?.call (this);
368
+ X3DScriptingContext .prototype .dispose ?.call (this);
369
+ X3DCoreContext .prototype .dispose ?.call (this);
370
+ X3DRoutingContext .prototype .dispose ?.call (this);
371
+ X3DBaseNode .prototype .dispose ?.call (this);
354
372
  },
355
373
  });
356
374
 
@@ -380,9 +398,7 @@ Object .assign (X3DBrowserContext,
380
398
  for (const browser of browsers)
381
399
  {
382
400
  browserContext .call (browser);
383
-
384
- if (typeof browserContext .prototype .initialize === "function")
385
- browserContext .prototype .initialize .call (browser);
401
+ browserContext .prototype .initialize ?.call (browser);
386
402
 
387
403
  // Process events from context creation. This will setup nodes like
388
404
  // geometry option nodes before any node is created.
@@ -207,7 +207,12 @@ ComposedCubeMapTexture .prototype = Object .assign (Object .create (X3DEnvironme
207
207
  case X3DConstants .MovieTexture:
208
208
  {
209
209
  gl .bindTexture (this .getTarget (), this .getTexture ());
210
- gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
210
+
211
+ if (gl .getVersion () >= 2)
212
+ gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
213
+ else
214
+ gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
215
+
211
216
  break;
212
217
  }
213
218
  default:
@@ -209,6 +209,10 @@ DirectionalLightContainer .prototype =
209
209
  gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray);
210
210
  gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ());
211
211
  }
212
+ else
213
+ {
214
+ gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0);
215
+ }
212
216
  },
213
217
  dispose: function ()
214
218
  {
@@ -245,6 +245,10 @@ PointLightContainer .prototype =
245
245
  gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray);
246
246
  gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ());
247
247
  }
248
+ else
249
+ {
250
+ gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0);
251
+ }
248
252
  },
249
253
  dispose: function ()
250
254
  {
@@ -236,6 +236,10 @@ SpotLightContainer .prototype =
236
236
  gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray);
237
237
  gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ());
238
238
  }
239
+ else
240
+ {
241
+ gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0);
242
+ }
239
243
  },
240
244
  dispose: function ()
241
245
  {
@@ -54,7 +54,7 @@ function SFColor (r, g, b)
54
54
  switch (arguments .length)
55
55
  {
56
56
  case 0:
57
- return X3DField .call (this, new Color3 ());
57
+ return X3DField .call (this, new Color3 (0, 0, 0));
58
58
 
59
59
  case 1:
60
60
  return X3DField .call (this, arguments [0]);
@@ -55,7 +55,7 @@ function SFColorRGBA (r, g, b, a)
55
55
  switch (arguments .length)
56
56
  {
57
57
  case 0:
58
- return X3DField .call (this, new Color4 ());
58
+ return X3DField .call (this, new Color4 (0, 0, 0, 0));
59
59
 
60
60
  case 1:
61
61
  return X3DField .call (this, arguments [0]);
@@ -736,7 +736,7 @@ function MaterialParser (scene, input)
736
736
  this .material = scene .createNode ("Material");
737
737
  this .materials = new Map ();
738
738
  this .textures = new Map ();
739
- this .color3 = new Color3 ();
739
+ this .color3 = new Color3 (0, 0, 0);
740
740
  this .id = "";
741
741
  }
742
742
 
@@ -111,6 +111,7 @@ X3DRoutingContext .prototype =
111
111
  }
112
112
  while (this [_taintedFields] .length);
113
113
  },
114
+ dispose: function () { },
114
115
  };
115
116
 
116
117
  export default X3DRoutingContext;
package/src/x_ite.html CHANGED
@@ -148,6 +148,40 @@ X3D (function ()
148
148
  return
149
149
  }
150
150
  });
151
+
152
+ function sleep (duration)
153
+ {
154
+ return new Promise (function (resolve, reject)
155
+ {
156
+ setTimeout (resolve, duration);
157
+ });
158
+ }
159
+
160
+ $("#bug") .on ("click", async () =>
161
+ {
162
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/CubeMapTexturing/GeneratedCubeMapTexture/GeneratedCubeMapTexture.x3d"));
163
+ await sleep (1000);
164
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/Lighting/DirectionalLight/DirectionalLight.x3d"));
165
+ await sleep (1000);
166
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/Lighting/Shadows/Shadows.x3d"));
167
+ await sleep (1000);
168
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/Navigation/NavigationInfo/NavigationInfo.x3d"));
169
+ await sleep (1000);
170
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/ParticleSystems/ParticleSystem/ParticleSystem.x3d"));
171
+ await sleep (1000);
172
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/RigidBodyPhysics/CollidableShape/CollidableShape.x3d"));
173
+ await sleep (1000);
174
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/RigidBodyPhysics/RigidBody/RigidBody.x3d"));
175
+ await sleep (1000);
176
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/RigidBodyPhysics/RigidBodyCollection/RigidBodyCollection.x3d"));
177
+ await sleep (1000);
178
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/TextureProjector/TextureProjector/TextureProjector.x3d"));
179
+ await sleep (1000);
180
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/Texturing/MultiTexture/MultiTexture.x3d"));
181
+ await sleep (1000);
182
+ await Browser .loadURL (new X3D .MFString ("https://create3000.github.io/media/examples/X3D/NYC/NYC.x3d"));
183
+ await sleep (1000);
184
+ });
151
185
  });
152
186
  </script>
153
187
  <style>
@@ -416,7 +450,7 @@ main.color-management #browser {
416
450
  <button id="location-go" type="button">Load URL</button>
417
451
  </div>
418
452
  <div id="buttons">
419
- <a href="#" id="view-all">▣</a><a id="print-xml" href="#">XML</a><a id="print-vrml" href="#">VRML</a><a id="print-json" href="#">JSON</a><a href="../dist/example.html">example page</a><a href="tests/d3-x3d/">d3-x3d</a><a href="tests/dom-integration/">dom-integration</a><a href="tests/legacy/">legacy</a>
453
+ <a href="#" id="view-all">▣</a><a id="print-xml" href="#">XML</a><a id="print-vrml" href="#">VRML</a><a id="print-json" href="#">JSON</a><a href="../dist/example.html">example page</a><a href="tests/d3-x3d/">d3-x3d</a><a href="tests/dom-integration/">dom-integration</a><a href="tests/legacy/">legacy</a><a href="#" id="bug">▣</a>
420
454
  </div>
421
455
  <div id="links">
422
456
  <a href="../x_ite.min.html">x_ite.min.html</a><a href="https://rawgit.com/create3000/x_ite/main/x_ite.min.html">github</a>