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.
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +28 -28
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -21
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -39
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +18 -18
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +27 -27
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +22 -22
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +24 -23
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +20 -20
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +121 -193
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +30 -31
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +174 -174
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +35 -33
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +408 -405
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/_posts/reference/prototype-services.md +2 -2
- package/package.json +2 -2
- package/src/x_ite/Base/X3DBaseNode.js +8 -23
- package/src/x_ite/Base/X3DEventObject.js +1 -1
- package/src/x_ite/Base/X3DField.js +17 -18
- package/src/x_ite/Base/X3DObject.js +5 -1
- package/src/x_ite/Base/X3DObjectArrayField.js +12 -11
- package/src/x_ite/Base/X3DTypedArrayField.js +3 -3
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +8 -6
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +2 -2
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +2 -2
- package/src/x_ite/Browser/X3DBrowser.js +17 -39
- package/src/x_ite/Components/Core/X3DNode.js +2 -2
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +3 -8
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +3 -3
- package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +0 -8
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +14 -12
- package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +3 -3
- package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoMetadata.js +0 -6
- package/src/x_ite/Components/Networking/Anchor.js +36 -33
- package/src/x_ite/Components/Networking/Inline.js +3 -3
- package/src/x_ite/Components/Networking/X3DUrlObject.js +74 -23
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +6 -5
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +2 -2
- package/src/x_ite/Components/Scripting/Script.js +93 -165
- package/src/x_ite/Components/Shaders/ComposedShader.js +3 -18
- package/src/x_ite/Components/Shaders/PackagedShader.js +0 -2
- package/src/x_ite/Components/Shaders/ShaderPart.js +4 -4
- package/src/x_ite/Components/Shaders/ShaderProgram.js +0 -2
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +3 -4
- package/src/x_ite/Components/Sound/AudioClip.js +3 -3
- package/src/x_ite/Components/Text/Text.js +2 -3
- package/src/x_ite/Components/Text/X3DFontStyleNode.js +4 -4
- package/src/x_ite/Components/Texturing/ImageTexture.js +3 -3
- package/src/x_ite/Components/Texturing/MovieTexture.js +3 -3
- package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +3 -3
- package/src/x_ite/Components/Texturing3D/ImageTextureAtlas.js +3 -3
- package/src/x_ite/Components/Time/X3DTimeDependentNode.js +31 -25
- package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/VolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +11 -9
- package/src/x_ite/Execution/X3DExecutionContext.js +30 -32
- package/src/x_ite/Execution/X3DScene.js +6 -6
- package/src/x_ite/Fields/ArrayFields.js +2 -1
- package/src/x_ite/Fields/SFImage.js +0 -1
- package/src/x_ite/Fields/SFNode.js +4 -5
- package/src/x_ite/Parser/GLTF2Parser.js +45 -45
- package/src/x_ite/Parser/VRMLParser.js +2 -2
- package/src/x_ite/Parser/XMLParser.js +3 -3
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +2 -2
- 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
|
-
|
|
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 (!
|
|
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 (!
|
|
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
|
-
|
|
149
|
+
unloadData: function ()
|
|
153
150
|
{
|
|
154
151
|
this .initialize__ ("");
|
|
155
152
|
},
|
|
156
|
-
|
|
153
|
+
loadData: function ()
|
|
157
154
|
{
|
|
158
|
-
this .initialized = false;
|
|
159
|
-
|
|
160
155
|
new FileLoader (this) .loadDocument (this ._url,
|
|
161
|
-
|
|
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 (
|
|
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
|
-
|
|
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 .
|
|
196
|
+
this .globalObject = this .getGlobalObject ();
|
|
202
197
|
|
|
203
198
|
const
|
|
204
|
-
result = evaluate (this .
|
|
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
|
|
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 (
|
|
214
|
+
evaluate: function (sourceText)
|
|
220
215
|
{
|
|
221
|
-
return evaluate (this .
|
|
216
|
+
return evaluate (this .globalObject, `return (${sourceText})`);
|
|
222
217
|
},
|
|
223
|
-
|
|
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
|
|
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 (!
|
|
327
|
+
if (!(name in globalObject))
|
|
333
328
|
{
|
|
334
|
-
|
|
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
|
-
|
|
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,
|
|
346
|
+
return Object .create (Object .prototype, globalObject);
|
|
352
347
|
},
|
|
353
|
-
|
|
348
|
+
initialize__: function (sourceText)
|
|
354
349
|
{
|
|
355
|
-
|
|
356
|
-
{
|
|
357
|
-
if (field .getModificationTime () <= this .pauseTime)
|
|
358
|
-
continue;
|
|
350
|
+
this .disconnect ();
|
|
359
351
|
|
|
360
|
-
|
|
361
|
-
{
|
|
362
|
-
case X3DConstants .inputOnly:
|
|
363
|
-
{
|
|
364
|
-
const callback = this .context [field .getName ()];
|
|
352
|
+
const browser = this .getBrowser ();
|
|
365
353
|
|
|
366
|
-
|
|
367
|
-
this .set_field__ (callback, field);
|
|
354
|
+
// Create context.
|
|
368
355
|
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
case X3DConstants .inputOutput:
|
|
372
|
-
{
|
|
373
|
-
const callback = this .context ["set_" + field .getName ()];
|
|
356
|
+
this .context = this .getContext (sourceText);
|
|
374
357
|
|
|
375
|
-
|
|
376
|
-
this .set_field__ (callback, field);
|
|
358
|
+
// Call initialize function.
|
|
377
359
|
|
|
378
|
-
|
|
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
|
-
|
|
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
|
-
|
|
394
|
-
return;
|
|
365
|
+
// Connect shutdown.
|
|
395
366
|
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
if (!this .initialized)
|
|
399
|
-
{
|
|
400
|
-
this .initialized = true;
|
|
367
|
+
const shutdown = this .context .get ("shutdown");
|
|
401
368
|
|
|
402
|
-
|
|
369
|
+
if (typeof shutdown === "function")
|
|
370
|
+
$(window) .on ("unload.Script" + this .getId (), this .call__ .bind (this, shutdown, "shutdown"));
|
|
403
371
|
|
|
404
|
-
|
|
405
|
-
{
|
|
406
|
-
const browser = this .getBrowser ();
|
|
372
|
+
// Connect prepareEvents.
|
|
407
373
|
|
|
408
|
-
|
|
374
|
+
const prepareEvents = this .context .get ("prepareEvents");
|
|
409
375
|
|
|
410
|
-
|
|
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
|
-
|
|
420
|
-
}
|
|
379
|
+
// Connect eventsProcessed.
|
|
421
380
|
|
|
422
|
-
|
|
423
|
-
$(window) .on ("unload", this .shutdown__ .bind (this));
|
|
424
|
-
}
|
|
381
|
+
const eventsProcessed = this .context .get ("eventsProcessed");
|
|
425
382
|
|
|
426
|
-
|
|
427
|
-
|
|
383
|
+
if (typeof eventsProcessed === "function")
|
|
384
|
+
this .addInterest ("call__", this, eventsProcessed, "eventsProcessed");
|
|
428
385
|
|
|
429
|
-
|
|
430
|
-
this .addInterest ("eventsProcessed__", this);
|
|
386
|
+
// Connect fields.
|
|
431
387
|
|
|
432
|
-
|
|
388
|
+
for (const field of this .getUserDefinedFields ())
|
|
389
|
+
{
|
|
390
|
+
switch (field .getAccessType ())
|
|
433
391
|
{
|
|
434
|
-
|
|
392
|
+
case X3DConstants .inputOnly:
|
|
435
393
|
{
|
|
436
|
-
|
|
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
|
-
|
|
450
|
-
|
|
396
|
+
if (typeof callback === "function")
|
|
397
|
+
field .addInterest ("set_field__", this, callback);
|
|
451
398
|
|
|
452
|
-
|
|
453
|
-
}
|
|
399
|
+
break;
|
|
454
400
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
-
|
|
465
|
-
|
|
405
|
+
if (typeof callback === "function")
|
|
406
|
+
field .addInterest ("set_field__", this, callback);
|
|
466
407
|
|
|
467
|
-
|
|
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
|
-
|
|
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
|
-
|
|
491
|
-
browser .addBrowserEvent ();
|
|
421
|
+
callback (browser .getCurrentTime ());
|
|
492
422
|
}
|
|
493
423
|
catch (error)
|
|
494
424
|
{
|
|
495
|
-
this .setError (
|
|
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
|
-
|
|
449
|
+
setError: function (reason, error)
|
|
520
450
|
{
|
|
521
|
-
|
|
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
|
-
|
|
458
|
+
const shutdown = this .context ?.get ("shutdown");
|
|
524
459
|
|
|
525
|
-
|
|
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
|
-
|
|
535
|
-
},
|
|
536
|
-
shutdown__: function ()
|
|
537
|
-
{
|
|
538
|
-
const browser = this .getBrowser ();
|
|
463
|
+
// Disconnect shutdown.
|
|
539
464
|
|
|
540
|
-
|
|
465
|
+
$(window) .off (".Script" + this .getId ());
|
|
541
466
|
|
|
542
|
-
|
|
543
|
-
{
|
|
544
|
-
this .context .shutdown ();
|
|
545
|
-
}
|
|
546
|
-
catch (error)
|
|
547
|
-
{
|
|
548
|
-
this .setError ("in function 'shutdown'", error);
|
|
549
|
-
}
|
|
467
|
+
// Disconnect prepareEvents.
|
|
550
468
|
|
|
551
|
-
|
|
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
|
-
|
|
480
|
+
dispose: function ()
|
|
554
481
|
{
|
|
555
|
-
|
|
556
|
-
|
|
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 .
|
|
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 .
|
|
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 (!
|
|
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
|
-
|
|
161
|
+
unloadData: function ()
|
|
162
162
|
{
|
|
163
163
|
this .valid = false;
|
|
164
164
|
},
|
|
165
|
-
|
|
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
|
|
49
|
-
import X3DConstants
|
|
50
|
-
import
|
|
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
|
-
|
|
132
|
+
unloadData: function ()
|
|
133
133
|
{
|
|
134
134
|
this .setMedia (null);
|
|
135
135
|
},
|
|
136
|
-
|
|
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
|
-
|
|
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 (!
|
|
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
|
-
|
|
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
|
-
|
|
114
|
+
unloadData: function ()
|
|
115
115
|
{
|
|
116
116
|
this .clearTexture ();
|
|
117
117
|
},
|
|
118
|
-
|
|
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
|
-
|
|
140
|
+
unloadData: function ()
|
|
141
141
|
{
|
|
142
142
|
this .clearTexture ();
|
|
143
143
|
},
|
|
144
|
-
|
|
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
|
-
|
|
121
|
+
unloadData: function ()
|
|
122
122
|
{
|
|
123
123
|
this .clearTexture ();
|
|
124
124
|
},
|
|
125
|
-
|
|
125
|
+
loadData: function ()
|
|
126
126
|
{
|
|
127
127
|
new FileLoader (this) .loadDocument (this ._url,
|
|
128
128
|
function (data)
|