x_ite 8.6.16 → 8.6.18

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 (101) 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 +13 -13
  4. package/dist/assets/components/CADGeometry.min.js +1 -1
  5. package/dist/assets/components/CubeMapTexturing.js +28 -28
  6. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  7. package/dist/assets/components/DIS.js +13 -21
  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 -39
  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 +27 -27
  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 +22 -22
  24. package/dist/assets/components/ParticleSystems.min.js +1 -1
  25. package/dist/assets/components/Picking.js +24 -23
  26. package/dist/assets/components/Picking.min.js +1 -1
  27. package/dist/assets/components/RigidBodyPhysics.js +20 -20
  28. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  29. package/dist/assets/components/Scripting.js +121 -193
  30. package/dist/assets/components/Scripting.min.js +1 -1
  31. package/dist/assets/components/Text.js +30 -31
  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 +174 -174
  36. package/dist/assets/components/Texturing3D.min.js +1 -1
  37. package/dist/assets/components/VolumeRendering.js +35 -33
  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 +408 -405
  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/reference/prototype-services.md +2 -2
  47. package/package.json +2 -2
  48. package/src/x_ite/Base/X3DBaseNode.js +8 -23
  49. package/src/x_ite/Base/X3DEventObject.js +1 -1
  50. package/src/x_ite/Base/X3DField.js +17 -18
  51. package/src/x_ite/Base/X3DObject.js +5 -1
  52. package/src/x_ite/Base/X3DObjectArrayField.js +12 -11
  53. package/src/x_ite/Base/X3DTypedArrayField.js +3 -3
  54. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +8 -6
  55. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +2 -2
  56. package/src/x_ite/Browser/VERSION.js +1 -1
  57. package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +2 -2
  58. package/src/x_ite/Browser/X3DBrowser.js +17 -39
  59. package/src/x_ite/Components/Core/X3DNode.js +2 -2
  60. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +3 -8
  61. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +3 -3
  62. package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +0 -8
  63. package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +14 -12
  64. package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +3 -3
  65. package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +1 -1
  66. package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +1 -1
  67. package/src/x_ite/Components/Geospatial/GeoMetadata.js +0 -6
  68. package/src/x_ite/Components/Networking/Anchor.js +36 -33
  69. package/src/x_ite/Components/Networking/Inline.js +3 -3
  70. package/src/x_ite/Components/Networking/X3DUrlObject.js +74 -23
  71. package/src/x_ite/Components/Picking/X3DPickSensorNode.js +6 -5
  72. package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +1 -1
  73. package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +2 -2
  74. package/src/x_ite/Components/Scripting/Script.js +93 -165
  75. package/src/x_ite/Components/Shaders/ComposedShader.js +3 -18
  76. package/src/x_ite/Components/Shaders/PackagedShader.js +0 -2
  77. package/src/x_ite/Components/Shaders/ShaderPart.js +4 -4
  78. package/src/x_ite/Components/Shaders/ShaderProgram.js +0 -2
  79. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +3 -4
  80. package/src/x_ite/Components/Sound/AudioClip.js +3 -3
  81. package/src/x_ite/Components/Text/Text.js +2 -3
  82. package/src/x_ite/Components/Text/X3DFontStyleNode.js +4 -4
  83. package/src/x_ite/Components/Texturing/ImageTexture.js +3 -3
  84. package/src/x_ite/Components/Texturing/MovieTexture.js +3 -3
  85. package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +3 -3
  86. package/src/x_ite/Components/Texturing3D/ImageTextureAtlas.js +3 -3
  87. package/src/x_ite/Components/Time/X3DTimeDependentNode.js +31 -25
  88. package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +1 -1
  89. package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +1 -1
  90. package/src/x_ite/Components/VolumeRendering/VolumeData.js +1 -1
  91. package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +11 -9
  92. package/src/x_ite/Execution/X3DExecutionContext.js +30 -32
  93. package/src/x_ite/Execution/X3DScene.js +6 -6
  94. package/src/x_ite/Fields/ArrayFields.js +2 -1
  95. package/src/x_ite/Fields/SFImage.js +0 -1
  96. package/src/x_ite/Fields/SFNode.js +4 -5
  97. package/src/x_ite/Parser/GLTF2Parser.js +45 -45
  98. package/src/x_ite/Parser/VRMLParser.js +2 -2
  99. package/src/x_ite/Parser/XMLParser.js +3 -3
  100. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +2 -2
  101. package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +1 -1
@@ -75,8 +75,6 @@ function Script (executionContext)
75
75
  X3DScriptNode .call (this, executionContext);
76
76
 
77
77
  this .addType (X3DConstants .Script);
78
-
79
- this .pauseTime = 0;
80
78
  }
81
79
 
82
80
  Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
@@ -112,10 +110,7 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
112
110
  {
113
111
  X3DScriptNode .prototype .initialize .call (this);
114
112
 
115
- for (const field of this .getUserDefinedFields ())
116
- field .setModificationTime (0);
117
-
118
- this .requestImmediateLoad ();
113
+ this .requestImmediateLoad () .catch (Function .prototype);
119
114
  },
120
115
  getExtendedEventHandling: function ()
121
116
  {
@@ -129,36 +124,36 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
129
124
  {
130
125
  X3DScriptNode .prototype .addUserDefinedField .call (this, accessType, name, field);
131
126
 
132
- if (! this .isInitialized ())
127
+ if (!this .isInitialized ())
133
128
  return;
134
129
 
135
130
  this .setLoadState (X3DConstants .NOT_STARTED_STATE);
136
- this .requestImmediateLoad ();
131
+ this .requestImmediateLoad () .catch (Function .prototype);
137
132
  },
138
133
  removeUserDefinedField: function (name)
139
134
  {
135
+ this .getUserDefinedFields () .get (name) ?.removeInterest ("set_field__", this);
136
+
140
137
  X3DScriptNode .prototype .removeUserDefinedField .call (this, name);
141
138
 
142
- if (! this .isInitialized ())
139
+ if (!this .isInitialized ())
143
140
  return;
144
141
 
145
142
  this .setLoadState (X3DConstants .NOT_STARTED_STATE);
146
- this .requestImmediateLoad ();
143
+ this .requestImmediateLoad () .catch (Function .prototype);
147
144
  },
148
145
  getSourceText: function ()
149
146
  {
150
147
  return this ._url;
151
148
  },
152
- unLoadNow: function ()
149
+ unloadData: function ()
153
150
  {
154
151
  this .initialize__ ("");
155
152
  },
156
- loadNow: function ()
153
+ loadData: function ()
157
154
  {
158
- this .initialized = false;
159
-
160
155
  new FileLoader (this) .loadDocument (this ._url,
161
- function (data)
156
+ (data) =>
162
157
  {
163
158
  if (data === null)
164
159
  {
@@ -168,12 +163,12 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
168
163
  else
169
164
  {
170
165
  this .setLoadState (X3DConstants .COMPLETE_STATE);
166
+
171
167
  this .initialize__ ($.decodeText (data));
172
168
  }
173
- }
174
- .bind (this));
169
+ });
175
170
  },
176
- getContext: function (text)
171
+ getContext: function (sourceText)
177
172
  {
178
173
  try
179
174
  {
@@ -192,20 +187,20 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
192
187
  }
193
188
  }
194
189
 
195
- text += "\nreturn [" + callbacks .map (function (c)
190
+ sourceText += "\nreturn [" + callbacks .map (function (c)
196
191
  {
197
192
  return `typeof ${c} !== "undefined" ? ${c} : undefined`;
198
193
  })
199
194
  .join (",") + "];";
200
195
 
201
- this .global = this .getGlobal ();
196
+ this .globalObject = this .getGlobalObject ();
202
197
 
203
198
  const
204
- result = evaluate (this .global, text),
205
- context = { };
199
+ result = evaluate (this .globalObject, sourceText),
200
+ context = new Map ();
206
201
 
207
202
  for (let i = 0; i < callbacks .length; ++ i)
208
- context [callbacks [i]] = result [i];
203
+ context .set (callbacks [i], result [i]);
209
204
 
210
205
  return context;
211
206
  }
@@ -213,14 +208,14 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
213
208
  {
214
209
  this .setError ("while evaluating script source", error);
215
210
 
216
- return { };
211
+ return new Map ();
217
212
  }
218
213
  },
219
- evaluate: function (text)
214
+ evaluate: function (sourceText)
220
215
  {
221
- return evaluate (this .global, `return (${text})`);
216
+ return evaluate (this .globalObject, `return (${sourceText})`);
222
217
  },
223
- getGlobal: function ()
218
+ getGlobalObject: function ()
224
219
  {
225
220
  const
226
221
  browser = this .getBrowser (),
@@ -249,7 +244,7 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
249
244
 
250
245
  SFNode .prototype = Fields .SFNode .prototype;
251
246
 
252
- const global =
247
+ const globalObject =
253
248
  {
254
249
  NULL: { value: null },
255
250
  FALSE: { value: false },
@@ -329,9 +324,9 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
329
324
  if (field .getAccessType () === X3DConstants .inputOnly)
330
325
  continue;
331
326
 
332
- if (! (name in global))
327
+ if (!(name in globalObject))
333
328
  {
334
- global [name] =
329
+ globalObject [name] =
335
330
  {
336
331
  get: field .valueOf .bind (field),
337
332
  set: field .setValue .bind (field),
@@ -340,7 +335,7 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
340
335
 
341
336
  if (field .getAccessType () === X3DConstants .inputOutput)
342
337
  {
343
- global [name + "_changed"] =
338
+ globalObject [name + "_changed"] =
344
339
  {
345
340
  get: field .valueOf .bind (field),
346
341
  set: field .setValue .bind (field),
@@ -348,138 +343,74 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
348
343
  }
349
344
  }
350
345
 
351
- return Object .create (Object .prototype, global);
346
+ return Object .create (Object .prototype, globalObject);
352
347
  },
353
- processOutstandingEvents: function ()
348
+ initialize__: function (sourceText)
354
349
  {
355
- for (const field of this .getUserDefinedFields ())
356
- {
357
- if (field .getModificationTime () <= this .pauseTime)
358
- continue;
350
+ this .disconnect ();
359
351
 
360
- switch (field .getAccessType ())
361
- {
362
- case X3DConstants .inputOnly:
363
- {
364
- const callback = this .context [field .getName ()];
352
+ const browser = this .getBrowser ();
365
353
 
366
- if (typeof callback === "function")
367
- this .set_field__ (callback, field);
354
+ // Create context.
368
355
 
369
- break;
370
- }
371
- case X3DConstants .inputOutput:
372
- {
373
- const callback = this .context ["set_" + field .getName ()];
356
+ this .context = this .getContext (sourceText);
374
357
 
375
- if (typeof callback === "function")
376
- this .set_field__ (callback, field);
358
+ // Call initialize function.
377
359
 
378
- break;
379
- }
380
- }
381
- }
382
- },
383
- initialize__: function (text)
384
- {
385
- this .context = this .getContext (text);
360
+ const initialize = this .context .get ("initialize");
386
361
 
387
- this .set_live__ ();
388
- },
389
- set_live__: function ()
390
- {
391
- X3DScriptNode .prototype .set_live__ .call (this);
362
+ if (typeof initialize === "function")
363
+ this .call__ (initialize, "initialize");
392
364
 
393
- if (!this .context)
394
- return;
365
+ // Connect shutdown.
395
366
 
396
- if (this .getLive () .getValue ())
397
- {
398
- if (!this .initialized)
399
- {
400
- this .initialized = true;
367
+ const shutdown = this .context .get ("shutdown");
401
368
 
402
- // Call initialize function.
369
+ if (typeof shutdown === "function")
370
+ $(window) .on ("unload.Script" + this .getId (), this .call__ .bind (this, shutdown, "shutdown"));
403
371
 
404
- if (typeof this .context .initialize === "function")
405
- {
406
- const browser = this .getBrowser ();
372
+ // Connect prepareEvents.
407
373
 
408
- browser .getScriptStack () .push (this);
374
+ const prepareEvents = this .context .get ("prepareEvents");
409
375
 
410
- try
411
- {
412
- this .context .initialize ();
413
- }
414
- catch (error)
415
- {
416
- this .setError ("in function 'initialize'", error);
417
- }
376
+ if (typeof prepareEvents === "function")
377
+ browser .prepareEvents () .addInterest ("call__", this, prepareEvents, "prepareEvents");
418
378
 
419
- browser .getScriptStack () .pop ();
420
- }
379
+ // Connect eventsProcessed.
421
380
 
422
- if (typeof this .context .shutdown === "function")
423
- $(window) .on ("unload", this .shutdown__ .bind (this));
424
- }
381
+ const eventsProcessed = this .context .get ("eventsProcessed");
425
382
 
426
- if (typeof this .context .prepareEvents === "function")
427
- this .getBrowser () .prepareEvents () .addInterest ("prepareEvents__", this);
383
+ if (typeof eventsProcessed === "function")
384
+ this .addInterest ("call__", this, eventsProcessed, "eventsProcessed");
428
385
 
429
- if (typeof this .context .eventsProcessed === "function")
430
- this .addInterest ("eventsProcessed__", this);
386
+ // Connect fields.
431
387
 
432
- for (const field of this .getUserDefinedFields ())
388
+ for (const field of this .getUserDefinedFields ())
389
+ {
390
+ switch (field .getAccessType ())
433
391
  {
434
- switch (field .getAccessType ())
392
+ case X3DConstants .inputOnly:
435
393
  {
436
- case X3DConstants .inputOnly:
437
- {
438
- const callback = this .context [field .getName ()];
439
-
440
- if (typeof callback === "function")
441
- field .addInterest ("set_field__", this, callback);
442
-
443
- break;
444
- }
445
- case X3DConstants .inputOutput:
446
- {
447
- const callback = this .context ["set_" + field .getName ()];
394
+ const callback = this .context .get (field .getName ());
448
395
 
449
- if (typeof callback === "function")
450
- field .addInterest ("set_field__", this, callback);
396
+ if (typeof callback === "function")
397
+ field .addInterest ("set_field__", this, callback);
451
398
 
452
- break;
453
- }
399
+ break;
454
400
  }
455
- }
456
-
457
- this .processOutstandingEvents ();
458
- }
459
- else
460
- {
461
- if (this .context .prepareEvents)
462
- this .getBrowser () .prepareEvents () .removeInterest ("prepareEvents__", this);
401
+ case X3DConstants .inputOutput:
402
+ {
403
+ const callback = this .context .get ("set_" + field .getName ());
463
404
 
464
- if (this .context .eventsProcessed)
465
- this .removeInterest ("eventsProcessed__", this);
405
+ if (typeof callback === "function")
406
+ field .addInterest ("set_field__", this, callback);
466
407
 
467
- for (const field of this .getUserDefinedFields ())
468
- {
469
- switch (field .getAccessType ())
470
- {
471
- case X3DConstants .inputOnly:
472
- case X3DConstants .inputOutput:
473
- field .removeInterest ("set_field__", this);
474
- break;
408
+ break;
475
409
  }
476
410
  }
477
-
478
- if (this .initialized)
479
- this .pauseTime = Date .now ();
480
411
  }
481
412
  },
482
- prepareEvents__: function ()
413
+ call__: function (callback, name)
483
414
  {
484
415
  const browser = this .getBrowser ();
485
416
 
@@ -487,12 +418,11 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
487
418
 
488
419
  try
489
420
  {
490
- this .context .prepareEvents (browser .getCurrentTime ());
491
- browser .addBrowserEvent ();
421
+ callback (browser .getCurrentTime ());
492
422
  }
493
423
  catch (error)
494
424
  {
495
- this .setError ("in function 'prepareEvents'", error);
425
+ this .setError (`in function '${name}'`, error);
496
426
  }
497
427
 
498
428
  browser .getScriptStack () .pop ();
@@ -516,44 +446,42 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
516
446
  browser .getScriptStack () .pop ();
517
447
  field .setTainted (false);
518
448
  },
519
- eventsProcessed__: function ()
449
+ setError: function (reason, error)
520
450
  {
521
- const browser = this .getBrowser ();
451
+ console .error ("JavaScript Error in Script '" + this .getName () + "', " + reason + "\nworld url is '" + this .getExecutionContext () .getWorldURL () + "':");
452
+ console .error (error);
453
+ },
454
+ disconnect: function ()
455
+ {
456
+ // Call shutdown.
522
457
 
523
- browser .getScriptStack () .push (this);
458
+ const shutdown = this .context ?.get ("shutdown");
524
459
 
525
- try
526
- {
527
- this .context .eventsProcessed ();
528
- }
529
- catch (error)
530
- {
531
- this .setError ("in function 'eventsProcessed'", error);
532
- }
460
+ if (typeof shutdown === "function")
461
+ this .call__ (shutdown, "shutdown");
533
462
 
534
- browser .getScriptStack () .pop ();
535
- },
536
- shutdown__: function ()
537
- {
538
- const browser = this .getBrowser ();
463
+ // Disconnect shutdown.
539
464
 
540
- browser .getScriptStack () .push (this);
465
+ $(window) .off (".Script" + this .getId ());
541
466
 
542
- try
543
- {
544
- this .context .shutdown ();
545
- }
546
- catch (error)
547
- {
548
- this .setError ("in function 'shutdown'", error);
549
- }
467
+ // Disconnect prepareEvents.
550
468
 
551
- browser .getScriptStack () .pop ();
469
+ this .getBrowser () .prepareEvents () .removeInterest ("call__", this);
470
+
471
+ // Disconnect eventsProcessed.
472
+
473
+ this .removeInterest ("call__", this);
474
+
475
+ // Disconnect fields.
476
+
477
+ for (const field of this .getUserDefinedFields ())
478
+ field .removeInterest ("set_field__", this);
552
479
  },
553
- setError: function (reason, error)
480
+ dispose: function ()
554
481
  {
555
- console .error ("JavaScript Error in Script '" + this .getName () + "', " + reason + "\nworld url is '" + this .getExecutionContext () .getWorldURL () + "':");
556
- console .error (error);
482
+ this .disconnect ();
483
+
484
+ X3DScriptNode .prototype .dispose .call (this);
557
485
  },
558
486
  });
559
487
 
@@ -99,8 +99,6 @@ ComposedShader .prototype = Object .assign (Object .create (X3DShaderNode .proto
99
99
  X3DShaderNode .prototype .initialize .call (this);
100
100
  X3DProgrammableShaderObject .prototype .initialize .call (this);
101
101
 
102
- this .getLive () .addInterest ("set_live__", this);
103
-
104
102
  // https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/shaders_glsl.html#relinkingprograms
105
103
  this ._activate .addInterest ("set_activate__", this);
106
104
 
@@ -123,7 +121,7 @@ ComposedShader .prototype = Object .assign (Object .create (X3DShaderNode .proto
123
121
  },
124
122
  addUserDefinedField: function (accessType, name, field)
125
123
  {
126
- const shaderFields = this .isInitialized () && this .getLive () .getValue () && this .isValid ();
124
+ const shaderFields = this .isInitialized () && this .isValid ();
127
125
 
128
126
  if (shaderFields)
129
127
  this .removeShaderFields ();
@@ -135,7 +133,7 @@ ComposedShader .prototype = Object .assign (Object .create (X3DShaderNode .proto
135
133
  },
136
134
  removeUserDefinedField: function (name)
137
135
  {
138
- const shaderFields = this .isInitialized () && this .getLive () .getValue () && this .isValid ();
136
+ const shaderFields = this .isInitialized () && this .isValid ();
139
137
 
140
138
  if (shaderFields)
141
139
  this .removeShaderFields ();
@@ -153,22 +151,9 @@ ComposedShader .prototype = Object .assign (Object .create (X3DShaderNode .proto
153
151
  {
154
152
  return this .program;
155
153
  },
156
- set_live__: function ()
157
- {
158
- if (this .getLive () .getValue ())
159
- {
160
- if (this .isValid ())
161
- this .addShaderFields ();
162
- }
163
- else
164
- {
165
- if (this .isValid ())
166
- this .removeShaderFields ();
167
- }
168
- },
169
154
  set_activate__: function ()
170
155
  {
171
- if (! this ._activate .getValue ())
156
+ if (!this ._activate .getValue ())
172
157
  return;
173
158
 
174
159
  this .set_loaded__ ();
@@ -101,8 +101,6 @@ PackagedShader .prototype = Object .assign (Object .create (X3DShaderNode .proto
101
101
  },
102
102
  requestImmediateLoad: function (cache = true)
103
103
  { },
104
- requestUnload: function ()
105
- { },
106
104
  initialize: function ()
107
105
  {
108
106
  X3DShaderNode .prototype .initialize .call (this);
@@ -118,13 +118,13 @@ ShaderPart .prototype = Object .assign (Object .create (X3DNode .prototype),
118
118
 
119
119
  this ._type .addInterest ("set_type__", this);
120
120
 
121
- this .requestImmediateLoad ();
121
+ this .requestImmediateLoad () .catch (Function .prototype);
122
122
  },
123
123
  set_type__: function ()
124
124
  {
125
125
  this .setLoadState (X3DConstants .NOT_STARTED_STATE);
126
126
 
127
- this .requestImmediateLoad ();
127
+ this .requestImmediateLoad () .catch (Function .prototype);
128
128
  },
129
129
  getSourceText: function ()
130
130
  {
@@ -158,11 +158,11 @@ ShaderPart .prototype = Object .assign (Object .create (X3DNode .prototype),
158
158
  return shaderTypes .get (this ._type .getValue ()) || "VERTEX_SHADER";
159
159
  };
160
160
  })(),
161
- unLoadNow: function ()
161
+ unloadData: function ()
162
162
  {
163
163
  this .valid = false;
164
164
  },
165
- loadNow: function ()
165
+ loadData: function ()
166
166
  {
167
167
  new FileLoader (this) .loadDocument (this ._url,
168
168
  function (data, url)
@@ -98,8 +98,6 @@ ShaderProgram .prototype = Object .assign (Object .create (X3DNode .prototype),
98
98
  },
99
99
  requestImmediateLoad: function (cache = true)
100
100
  { },
101
- requestUnload: function ()
102
- { },
103
101
  initialize: function ()
104
102
  {
105
103
  X3DNode .prototype .initialize .call (this);
@@ -45,10 +45,9 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DCast from "../../Base/X3DCast.js";
49
- import X3DConstants from "../../Base/X3DConstants.js";
50
- import OrthoViewpoint from "../Navigation/OrthoViewpoint.js";
51
- import Matrix3 from "../../../standard/Math/Numbers/Matrix3.js";
48
+ import X3DCast from "../../Base/X3DCast.js";
49
+ import X3DConstants from "../../Base/X3DConstants.js";
50
+ import Matrix3 from "../../../standard/Math/Numbers/Matrix3.js";
52
51
 
53
52
  const _uniformLocation = Symbol .for ("X3DField.uniformLocation");
54
53
 
@@ -118,7 +118,7 @@ AudioClip .prototype = Object .assign (Object .create (X3DSoundSourceNode .proto
118
118
  this .audio .prop ("preload", "auto");
119
119
  this .audio .prop ("muted", true);
120
120
 
121
- this .requestImmediateLoad ();
121
+ this .requestImmediateLoad () .catch (Function .prototype);
122
122
  },
123
123
  getElement: function ()
124
124
  {
@@ -129,11 +129,11 @@ AudioClip .prototype = Object .assign (Object .create (X3DSoundSourceNode .proto
129
129
  X3DSoundSourceNode .prototype .set_live__ .call (this);
130
130
  X3DUrlObject .prototype .set_live__ .call (this);
131
131
  },
132
- unLoadNow: function ()
132
+ unloadData: function ()
133
133
  {
134
134
  this .setMedia (null);
135
135
  },
136
- loadNow: function ()
136
+ loadData: function ()
137
137
  {
138
138
  this .setMedia (null);
139
139
  this .urlStack .setValue (this ._url);
@@ -125,12 +125,11 @@ Text .prototype = Object .assign (Object .create (X3DGeometryNode .prototype),
125
125
  },
126
126
  set_fontStyle__: function ()
127
127
  {
128
- if (this .fontStyleNode)
129
- this .fontStyleNode .removeInterest ("requestRebuild", this);
128
+ this .fontStyleNode ?.removeInterest ("requestRebuild", this);
130
129
 
131
130
  this .fontStyleNode = X3DCast (X3DConstants .X3DFontStyleNode, this ._fontStyle);
132
131
 
133
- if (! this .fontStyleNode)
132
+ if (!this .fontStyleNode)
134
133
  this .fontStyleNode = this .getBrowser () .getDefaultFontStyle ();
135
134
 
136
135
  this .fontStyleNode .addInterest ("requestRebuild", this);
@@ -112,10 +112,10 @@ X3DFontStyleNode .prototype = Object .assign (Object .create (X3DNode .prototype
112
112
  this .font = null;
113
113
  this .familyIndex = 0;
114
114
 
115
+ // Don't call set_style__.
115
116
  this .set_justify__ ();
116
- this .set_style__ ();
117
117
 
118
- this .requestImmediateLoad ();
118
+ this .requestImmediateLoad () .catch (Function .prototype);
119
119
  },
120
120
  set_style__: function ()
121
121
  {
@@ -124,7 +124,7 @@ X3DFontStyleNode .prototype = Object .assign (Object .create (X3DNode .prototype
124
124
 
125
125
  this .setLoadState (X3DConstants .NOT_STARTED_STATE);
126
126
 
127
- this .requestImmediateLoad ();
127
+ this .requestImmediateLoad () .catch (Function .prototype);
128
128
  },
129
129
  set_justify__: function ()
130
130
  {
@@ -186,7 +186,7 @@ X3DFontStyleNode .prototype = Object .assign (Object .create (X3DNode .prototype
186
186
 
187
187
  return;
188
188
  },
189
- loadNow: function ()
189
+ loadData: function ()
190
190
  {
191
191
  // Add default font to family array.
192
192
 
@@ -105,17 +105,17 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
105
105
  this .image .on ("abort error", this .setError .bind (this));
106
106
  this .image .prop ("crossOrigin", "Anonymous");
107
107
 
108
- this .requestImmediateLoad ();
108
+ this .requestImmediateLoad () .catch (Function .prototype);
109
109
  },
110
110
  getElement: function ()
111
111
  {
112
112
  return this .image [0];
113
113
  },
114
- unLoadNow: function ()
114
+ unloadData: function ()
115
115
  {
116
116
  this .clearTexture ();
117
117
  },
118
- loadNow: function ()
118
+ loadData: function ()
119
119
  {
120
120
  this .urlStack .setValue (this ._url);
121
121
  this .loadNext ();
@@ -126,7 +126,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
126
126
  this .video .prop ("preload", "auto");
127
127
  this .video .prop ("muted", true);
128
128
 
129
- this .requestImmediateLoad ();
129
+ this .requestImmediateLoad () .catch (Function .prototype);
130
130
  },
131
131
  getElement: function ()
132
132
  {
@@ -137,11 +137,11 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
137
137
  X3DSoundSourceNode .prototype .set_live__ .call (this);
138
138
  X3DUrlObject .prototype .set_live__ .call (this);
139
139
  },
140
- unLoadNow: function ()
140
+ unloadData: function ()
141
141
  {
142
142
  this .clearTexture ();
143
143
  },
144
- loadNow: function ()
144
+ loadData: function ()
145
145
  {
146
146
  delete this .gif;
147
147
  this .setMedia (null);
@@ -100,7 +100,7 @@ ImageTexture3D .prototype = Object .assign (Object .create (X3DTexture3DNode .pr
100
100
  X3DTexture3DNode .prototype .initialize .call (this);
101
101
  X3DUrlObject .prototype .initialize .call (this);
102
102
 
103
- this .requestImmediateLoad ();
103
+ this .requestImmediateLoad () .catch (Function .prototype);
104
104
  },
105
105
  getInternalType: function (components)
106
106
  {
@@ -118,11 +118,11 @@ ImageTexture3D .prototype = Object .assign (Object .create (X3DTexture3DNode .pr
118
118
  return gl .RGBA;
119
119
  }
120
120
  },
121
- unLoadNow: function ()
121
+ unloadData: function ()
122
122
  {
123
123
  this .clearTexture ();
124
124
  },
125
- loadNow: function ()
125
+ loadData: function ()
126
126
  {
127
127
  new FileLoader (this) .loadDocument (this ._url,
128
128
  function (data)