x_ite 8.6.13 → 8.6.14
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 +21 -21
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +27 -27
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- 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 +23 -23
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +40 -40
- 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 +10 -10
- 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 +28 -28
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +30 -30
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +22 -22
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +37 -37
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +31 -31
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +25 -25
- 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 +32 -32
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +28 -28
- 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 +746 -683
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/package.json +1 -1
- package/src/standard/Math/Numbers/Matrix2.js +3 -3
- package/src/standard/Math/Numbers/Vector4.js +1 -0
- package/src/x_ite/Base/X3DBaseNode.js +58 -53
- package/src/x_ite/Browser/Core/BrowserOptions.js +2 -1
- package/src/x_ite/Browser/Core/X3DCoreContext.js +2 -3
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/FlyViewer.js +0 -2
- package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +10 -12
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +40 -21
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +19 -19
- package/src/x_ite/Components/CADGeometry/CADFace.js +8 -8
- package/src/x_ite/Components/Core/MetadataBoolean.js +4 -4
- package/src/x_ite/Components/Core/MetadataDouble.js +4 -4
- package/src/x_ite/Components/Core/MetadataFloat.js +4 -4
- package/src/x_ite/Components/Core/MetadataInteger.js +4 -4
- package/src/x_ite/Components/Core/MetadataSet.js +4 -4
- package/src/x_ite/Components/Core/MetadataString.js +4 -4
- package/src/x_ite/Components/Core/X3DNode.js +17 -16
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +11 -14
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +2 -2
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +2 -2
- package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +2 -2
- package/src/x_ite/Components/Followers/X3DFollowerNode.js +2 -2
- package/src/x_ite/Components/Geometry2D/Arc2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/ArcClose2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Circle2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Disk2D.js +1 -1
- package/src/x_ite/Components/Geometry3D/Cone.js +1 -1
- package/src/x_ite/Components/Geometry3D/Cylinder.js +1 -1
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +10 -10
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +3 -3
- package/src/x_ite/Components/Geometry3D/Sphere.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +7 -7
- package/src/x_ite/Components/Grouping/Switch.js +7 -7
- package/src/x_ite/Components/KeyDeviceSensor/X3DKeyDeviceSensorNode.js +2 -2
- package/src/x_ite/Components/Layering/X3DLayerNode.js +40 -49
- package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +4 -4
- package/src/x_ite/Components/Navigation/Collision.js +4 -4
- package/src/x_ite/Components/Navigation/LOD.js +7 -7
- package/src/x_ite/Components/Networking/Inline.js +2 -2
- package/src/x_ite/Components/Networking/X3DUrlObject.js +2 -2
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +8 -8
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +4 -4
- package/src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +28 -19
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +11 -11
- package/src/x_ite/Components/Rendering/LineSet.js +12 -12
- package/src/x_ite/Components/Rendering/PointSet.js +11 -11
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +14 -14
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +6 -6
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +6 -6
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +4 -4
- package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +7 -7
- package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +7 -7
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +3 -3
- package/src/x_ite/Components/RigidBodyPhysics/RigidBodyCollection.js +2 -2
- package/src/x_ite/Components/Scripting/Script.js +3 -3
- package/src/x_ite/Components/Shaders/ComposedShader.js +5 -7
- package/src/x_ite/Components/Shaders/ShaderPart.js +0 -2
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +3 -3
- package/src/x_ite/Components/Shape/Appearance.js +4 -4
- package/src/x_ite/Components/Shape/Material.js +1 -1
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -1
- package/src/x_ite/Components/Shape/UnlitMaterial.js +1 -1
- package/src/x_ite/Components/Shape/X3DMaterialNode.js +1 -1
- package/src/x_ite/Components/Shape/X3DShapeNode.js +1 -1
- package/src/x_ite/Components/Sound/AudioClip.js +2 -2
- package/src/x_ite/Components/Sound/Sound.js +2 -2
- package/src/x_ite/Components/Text/Text.js +1 -1
- package/src/x_ite/Components/Texturing/ImageTexture.js +2 -2
- package/src/x_ite/Components/Texturing/MovieTexture.js +2 -2
- package/src/x_ite/Components/Texturing3D/ImageTextureAtlas.js +2 -2
- package/src/x_ite/Components/Time/TimeSensor.js +1 -1
- package/src/x_ite/Components/Time/X3DTimeDependentNode.js +6 -6
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +8 -8
- package/src/x_ite/Execution/BindableList.js +16 -19
- package/src/x_ite/Execution/X3DExecutionContext.js +19 -13
- package/src/x_ite/Execution/X3DScene.js +4 -0
- package/src/x_ite/Fields/ArrayFields.js +42 -22
- package/src/x_ite/Fields/SFNode.js +3 -6
- package/src/x_ite/Fields/SFNodeCache.js +34 -19
- package/src/x_ite/InputOutput/FileLoader.js +22 -14
- package/src/x_ite/Parser/GLTF2Parser.js +48 -48
- package/src/x_ite/Parser/VRMLParser.js +65 -33
- package/src/x_ite/Parser/X3DParser.js +9 -36
- package/src/x_ite/Parser/XMLParser.js +8 -8
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +2 -2
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +1 -2
- package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
|
@@ -115,7 +115,7 @@ Sound .prototype = Object .assign (Object .create (X3DSoundNode .prototype),
|
|
|
115
115
|
{
|
|
116
116
|
X3DSoundNode .prototype .initialize .call (this);
|
|
117
117
|
|
|
118
|
-
this .
|
|
118
|
+
this .getLive () .addInterest ("set_live__", this);
|
|
119
119
|
this ._traversed .addInterest ("set_live__", this);
|
|
120
120
|
|
|
121
121
|
this ._source .addInterest ("set_source__", this);
|
|
@@ -144,7 +144,7 @@ Sound .prototype = Object .assign (Object .create (X3DSoundNode .prototype),
|
|
|
144
144
|
},
|
|
145
145
|
set_live__: function ()
|
|
146
146
|
{
|
|
147
|
-
if (this .
|
|
147
|
+
if (this .getLive () .getValue () && this ._traversed .getValue ())
|
|
148
148
|
{
|
|
149
149
|
this .getBrowser () .sensorEvents () .addInterest ("update", this);
|
|
150
150
|
}
|
|
@@ -118,7 +118,7 @@ Text .prototype = Object .assign (Object .create (X3DGeometryNode .prototype),
|
|
|
118
118
|
{
|
|
119
119
|
X3DGeometryNode .prototype .set_live__ .call (this);
|
|
120
120
|
|
|
121
|
-
if (this .
|
|
121
|
+
if (this .getLive () .getValue ())
|
|
122
122
|
this .getBrowser () .getBrowserOptions () ._PrimitiveQuality .addInterest ("requestRebuild", this);
|
|
123
123
|
else
|
|
124
124
|
this .getBrowser () .getBrowserOptions () ._PrimitiveQuality .removeInterest ("requestRebuild", this);
|
|
@@ -144,7 +144,7 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
144
144
|
setError: function (event)
|
|
145
145
|
{
|
|
146
146
|
if (this .URL .protocol !== "data:")
|
|
147
|
-
console .warn (
|
|
147
|
+
console .warn (`Error loading image '${decodeURI (this .URL .href)}'`, event .type);
|
|
148
148
|
|
|
149
149
|
this .loadNext ();
|
|
150
150
|
},
|
|
@@ -153,7 +153,7 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
153
153
|
if (DEBUG)
|
|
154
154
|
{
|
|
155
155
|
if (this .URL .protocol !== "data:")
|
|
156
|
-
console .info (
|
|
156
|
+
console .info (`Done loading image '${decodeURI (this .URL .href)}'`);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
try
|
|
@@ -198,7 +198,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
198
198
|
setError: function (event)
|
|
199
199
|
{
|
|
200
200
|
if (this .URL .protocol !== "data:")
|
|
201
|
-
console .warn (
|
|
201
|
+
console .warn (`Error loading movie '${decodeURI (this .URL .href)}'`, event .type);
|
|
202
202
|
|
|
203
203
|
this .loadNext ();
|
|
204
204
|
},
|
|
@@ -207,7 +207,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
207
207
|
if (DEBUG)
|
|
208
208
|
{
|
|
209
209
|
if (this .URL .protocol !== "data:")
|
|
210
|
-
console .info (
|
|
210
|
+
console .info (`Done loading movie '${decodeURI (this .URL .href)}'`);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
try
|
|
@@ -144,7 +144,7 @@ ImageTextureAtlas .prototype = Object .assign (Object .create (X3DTexture3DNode
|
|
|
144
144
|
setError: function (event)
|
|
145
145
|
{
|
|
146
146
|
if (this .URL .protocol !== "data:")
|
|
147
|
-
console .warn (
|
|
147
|
+
console .warn (`Error loading image '${decodeURI (this .URL .href)}'`, event .type);
|
|
148
148
|
|
|
149
149
|
this .loadNext ();
|
|
150
150
|
},
|
|
@@ -153,7 +153,7 @@ ImageTextureAtlas .prototype = Object .assign (Object .create (X3DTexture3DNode
|
|
|
153
153
|
if (DEBUG)
|
|
154
154
|
{
|
|
155
155
|
if (this .URL .protocol !== "data:")
|
|
156
|
-
console .info (
|
|
156
|
+
console .info (`Done loading image '${decodeURI (this .URL .href)}'`);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
try
|
|
@@ -148,7 +148,7 @@ TimeSensor .prototype = Object .assign (Object .create (X3DSensorNode .prototype
|
|
|
148
148
|
{
|
|
149
149
|
this .setRange (this ._range [0], this ._range [1], this ._range [2]);
|
|
150
150
|
|
|
151
|
-
if (this .
|
|
151
|
+
if (this .getLive () .getValue ())
|
|
152
152
|
{
|
|
153
153
|
this ._fraction_changed = this .fraction;
|
|
154
154
|
this ._time = this .getBrowser () .getCurrentTime ();
|
|
@@ -75,7 +75,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
75
75
|
constructor: X3DTimeDependentNode,
|
|
76
76
|
initialize: function ()
|
|
77
77
|
{
|
|
78
|
-
this .
|
|
78
|
+
this .getLive () .addInterest ("set_live__", this);
|
|
79
79
|
this ._isEvenLive .addInterest ("set_live__", this);
|
|
80
80
|
|
|
81
81
|
this ._initialized .addInterest ("set_loop__", this);
|
|
@@ -101,7 +101,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
101
101
|
{
|
|
102
102
|
/// Determines the live state of this node.
|
|
103
103
|
|
|
104
|
-
return this .
|
|
104
|
+
return this .isLive () && (this .getExecutionContext () .getLive () .getValue () || this ._isEvenLive .getValue ());
|
|
105
105
|
},
|
|
106
106
|
getElapsedTime: function ()
|
|
107
107
|
{
|
|
@@ -115,7 +115,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
115
115
|
},
|
|
116
116
|
set_live__: function ()
|
|
117
117
|
{
|
|
118
|
-
if (this .
|
|
118
|
+
if (this .getLive () .getValue () || this ._isEvenLive .getValue ())
|
|
119
119
|
{
|
|
120
120
|
if (this .disabled)
|
|
121
121
|
{
|
|
@@ -241,7 +241,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
241
241
|
|
|
242
242
|
this .set_start ();
|
|
243
243
|
|
|
244
|
-
if (this .
|
|
244
|
+
if (this .getLive () .getValue ())
|
|
245
245
|
{
|
|
246
246
|
this .getBrowser () .timeEvents () .addInterest ("set_time" ,this);
|
|
247
247
|
}
|
|
@@ -261,7 +261,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
261
261
|
if (this .pauseTimeValue !== this .getBrowser () .getCurrentTime ())
|
|
262
262
|
this .pauseTimeValue = this .getBrowser () .getCurrentTime ();
|
|
263
263
|
|
|
264
|
-
if (this .
|
|
264
|
+
if (this .getLive () .getValue ())
|
|
265
265
|
this .real_pause ();
|
|
266
266
|
}
|
|
267
267
|
},
|
|
@@ -282,7 +282,7 @@ X3DTimeDependentNode .prototype = Object .assign (Object .create (X3DChildNode .
|
|
|
282
282
|
if (this .resumeTimeValue !== this .getBrowser () .getCurrentTime ())
|
|
283
283
|
this .resumeTimeValue = this .getBrowser () .getCurrentTime ();
|
|
284
284
|
|
|
285
|
-
if (this .
|
|
285
|
+
if (this .getLive () .getValue ())
|
|
286
286
|
this .real_resume ();
|
|
287
287
|
}
|
|
288
288
|
},
|
|
@@ -60,14 +60,14 @@ function X3DVolumeDataNode (executionContext)
|
|
|
60
60
|
|
|
61
61
|
this .addType (X3DConstants .X3DVolumeDataNode);
|
|
62
62
|
|
|
63
|
-
this .proximitySensorNode = executionContext .createNode ("ProximitySensor", false);
|
|
64
|
-
this .transformNode = executionContext .createNode ("Transform", false);
|
|
65
|
-
this .shapeNode = executionContext .createNode ("Shape", false);
|
|
66
|
-
this .appearanceNode = executionContext .createNode ("Appearance", false);
|
|
67
|
-
this .textureTransformNode = executionContext .createNode ("TextureTransform3D", false);
|
|
68
|
-
this .geometryNode = executionContext .createNode ("QuadSet", false);
|
|
69
|
-
this .textureCoordinateNode = executionContext .createNode ("TextureCoordinate3D", false);
|
|
70
|
-
this .coordinateNode = executionContext .createNode ("Coordinate", false);
|
|
63
|
+
this .proximitySensorNode = executionContext .createNode ("ProximitySensor", { setup: false, warn: false });
|
|
64
|
+
this .transformNode = executionContext .createNode ("Transform", { setup: false, warn: false });
|
|
65
|
+
this .shapeNode = executionContext .createNode ("Shape", { setup: false, warn: false });
|
|
66
|
+
this .appearanceNode = executionContext .createNode ("Appearance", { setup: false, warn: false });
|
|
67
|
+
this .textureTransformNode = executionContext .createNode ("TextureTransform3D", { setup: false, warn: false });
|
|
68
|
+
this .geometryNode = executionContext .createNode ("QuadSet", { setup: false, warn: false });
|
|
69
|
+
this .textureCoordinateNode = executionContext .createNode ("TextureCoordinate3D", { setup: false, warn: false });
|
|
70
|
+
this .coordinateNode = executionContext .createNode ("Coordinate", { setup: false, warn: false });
|
|
71
71
|
this .volumeMaterialNode = new VolumeMaterial (executionContext, this);
|
|
72
72
|
this .textureNormalMatrixArray = new Float32Array (9);
|
|
73
73
|
|
|
@@ -71,25 +71,24 @@ BindableList .prototype = Object .assign (Object .create (X3DBaseNode .prototype
|
|
|
71
71
|
},
|
|
72
72
|
getBound: function (name)
|
|
73
73
|
{
|
|
74
|
-
|
|
74
|
+
const length = this .array .length;
|
|
75
|
+
|
|
76
|
+
if (length === 1)
|
|
75
77
|
return this .array [0]; // Return default viewpoint.
|
|
76
78
|
|
|
77
|
-
const
|
|
78
|
-
enableInlineBindables = false,
|
|
79
|
-
mainScene = this .getMainScene ();
|
|
79
|
+
const enableInlineBindables = false;
|
|
80
80
|
|
|
81
81
|
if (name)
|
|
82
82
|
{
|
|
83
83
|
// Return first viewpoint with @name.
|
|
84
84
|
|
|
85
|
-
for (let i = 1
|
|
85
|
+
for (let i = 1; i < length; ++ i)
|
|
86
86
|
{
|
|
87
87
|
const
|
|
88
|
-
node
|
|
89
|
-
|
|
90
|
-
scene = outerNode instanceof X3DPrototypeInstance ? outerNode .getScene () : node .getScene ();
|
|
88
|
+
node = this .array [i],
|
|
89
|
+
scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene ();
|
|
91
90
|
|
|
92
|
-
if (!enableInlineBindables && scene
|
|
91
|
+
if (!enableInlineBindables && !scene .isMainScene ())
|
|
93
92
|
continue;
|
|
94
93
|
|
|
95
94
|
if (node .getName () == name)
|
|
@@ -99,14 +98,13 @@ BindableList .prototype = Object .assign (Object .create (X3DBaseNode .prototype
|
|
|
99
98
|
|
|
100
99
|
// Return first bound viewpoint in scene.
|
|
101
100
|
|
|
102
|
-
for (let i = 1
|
|
101
|
+
for (let i = 1; i < length; ++ i)
|
|
103
102
|
{
|
|
104
103
|
const
|
|
105
|
-
node
|
|
106
|
-
|
|
107
|
-
scene = outerNode instanceof X3DPrototypeInstance ? outerNode .getScene () : node .getScene ();
|
|
104
|
+
node = this .array [i],
|
|
105
|
+
scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene ();
|
|
108
106
|
|
|
109
|
-
if (!enableInlineBindables && scene
|
|
107
|
+
if (!enableInlineBindables && !scene .isMainScene ())
|
|
110
108
|
continue;
|
|
111
109
|
|
|
112
110
|
if (node ._isBound .getValue ())
|
|
@@ -115,14 +113,13 @@ BindableList .prototype = Object .assign (Object .create (X3DBaseNode .prototype
|
|
|
115
113
|
|
|
116
114
|
// Return first viewpoint in scene.
|
|
117
115
|
|
|
118
|
-
for (let i = 1
|
|
116
|
+
for (let i = 1; i < length; ++ i)
|
|
119
117
|
{
|
|
120
118
|
const
|
|
121
|
-
node
|
|
122
|
-
|
|
123
|
-
scene = outerNode instanceof X3DPrototypeInstance ? outerNode .getScene () : node .getScene ();
|
|
119
|
+
node = this .array [i],
|
|
120
|
+
scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene ();
|
|
124
121
|
|
|
125
|
-
if (!enableInlineBindables && scene
|
|
122
|
+
if (!enableInlineBindables && !scene .isMainScene ())
|
|
126
123
|
continue;
|
|
127
124
|
|
|
128
125
|
return node;
|
|
@@ -72,7 +72,7 @@ const
|
|
|
72
72
|
_routes = Symbol (),
|
|
73
73
|
_outerNode = Symbol ();
|
|
74
74
|
|
|
75
|
-
function X3DExecutionContext (executionContext)
|
|
75
|
+
function X3DExecutionContext (executionContext, outerNode = null)
|
|
76
76
|
{
|
|
77
77
|
X3DBaseNode .call (this, executionContext);
|
|
78
78
|
|
|
@@ -90,6 +90,7 @@ function X3DExecutionContext (executionContext)
|
|
|
90
90
|
this ._rootNodes .setAccessType (X3DConstants .initializeOnly);
|
|
91
91
|
this ._rootNodes .addCloneCount (1);
|
|
92
92
|
|
|
93
|
+
this [_outerNode] = outerNode;
|
|
93
94
|
this [_namedNodes] = new NamedNodesArray ();
|
|
94
95
|
this [_importedNodes] = new ImportedNodesArray ();
|
|
95
96
|
this [_protos] = new ProtoDeclarationArray ();
|
|
@@ -119,16 +120,11 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
119
120
|
{
|
|
120
121
|
return "X3DExecutionContext";
|
|
121
122
|
},
|
|
122
|
-
[_outerNode]: null,
|
|
123
123
|
getOuterNode: function ()
|
|
124
124
|
{
|
|
125
125
|
// Can be either of type X3DProtoDeclaration or X3DPrototypeInstance, or null.
|
|
126
126
|
return this [_outerNode];
|
|
127
127
|
},
|
|
128
|
-
setOuterNode: function (value)
|
|
129
|
-
{
|
|
130
|
-
this [_outerNode] = value;
|
|
131
|
-
},
|
|
132
128
|
getSpecificationVersion: function ()
|
|
133
129
|
{
|
|
134
130
|
return this .getExecutionContext () .getSpecificationVersion ();
|
|
@@ -149,6 +145,10 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
149
145
|
{
|
|
150
146
|
return this .getExecutionContext () .getComponents ();
|
|
151
147
|
},
|
|
148
|
+
hasComponent: function (componentName)
|
|
149
|
+
{
|
|
150
|
+
return this .getExecutionContext () .hasComponent (componentName);
|
|
151
|
+
},
|
|
152
152
|
fromUnit: function (category, value)
|
|
153
153
|
{
|
|
154
154
|
return this .getExecutionContext () .fromUnit (category, value);
|
|
@@ -161,7 +161,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
161
161
|
{
|
|
162
162
|
return this .getExecutionContext () .getUnits ();
|
|
163
163
|
},
|
|
164
|
-
createNode: function (typeName, setup = true)
|
|
164
|
+
createNode: function (typeName, { setup = true, warn = true } = { })
|
|
165
165
|
{
|
|
166
166
|
typeName = String (typeName);
|
|
167
167
|
|
|
@@ -180,6 +180,9 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
180
180
|
if (this .getSpecificationVersion () > specificationRange [1])
|
|
181
181
|
return null;
|
|
182
182
|
|
|
183
|
+
if (warn && !this .hasComponent (Type .prototype .getComponentName ()))
|
|
184
|
+
console .warn (`Node type '${typeName}' does not match component/profile statements in '${this .getWorldURL ()}'.`);
|
|
185
|
+
|
|
183
186
|
return new Type (this);
|
|
184
187
|
}
|
|
185
188
|
else
|
|
@@ -187,15 +190,18 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
187
190
|
const Type = this .getBrowser () .getSupportedNode (typeName);
|
|
188
191
|
|
|
189
192
|
if (! Type)
|
|
190
|
-
throw new Error (
|
|
193
|
+
throw new Error (`Unknown node type '${typeName}'.`);
|
|
191
194
|
|
|
192
195
|
const specificationRange = Type .prototype .getSpecificationRange ();
|
|
193
196
|
|
|
194
197
|
if (this .getSpecificationVersion () < specificationRange [0])
|
|
195
|
-
throw new Error (
|
|
198
|
+
throw new Error (`Node type '${typeName}' does not match specification version in '${this .getWorldURL ()}.`);
|
|
196
199
|
|
|
197
200
|
if (this .getSpecificationVersion () > specificationRange [1])
|
|
198
|
-
throw new Error (
|
|
201
|
+
throw new Error (`Node type '${typeName}' does not match specification version in '${this .getWorldURL ()}.`);
|
|
202
|
+
|
|
203
|
+
if (warn && !this .hasComponent (Type .prototype .getComponentName ()))
|
|
204
|
+
console .warn (`Node type '${typeName}' does not match component/profile statements in '${this .getWorldURL ()}'.`);
|
|
199
205
|
|
|
200
206
|
const baseNode = new Type (this);
|
|
201
207
|
|
|
@@ -204,7 +210,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
204
210
|
return SFNodeCache .get (baseNode);
|
|
205
211
|
}
|
|
206
212
|
},
|
|
207
|
-
createProto: function (name, setup = true)
|
|
213
|
+
createProto: function (name, { setup = true } = { })
|
|
208
214
|
{
|
|
209
215
|
name = String (name);
|
|
210
216
|
|
|
@@ -215,12 +221,12 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
215
221
|
const proto = executionContext .protos .get (name);
|
|
216
222
|
|
|
217
223
|
if (proto)
|
|
218
|
-
return proto .createInstance (this, setup);
|
|
224
|
+
return proto .createInstance (this, { setup: setup });
|
|
219
225
|
|
|
220
226
|
const externproto = executionContext .externprotos .get (name);
|
|
221
227
|
|
|
222
228
|
if (externproto)
|
|
223
|
-
return externproto .createInstance (this, setup);
|
|
229
|
+
return externproto .createInstance (this, { setup: setup });
|
|
224
230
|
|
|
225
231
|
if (executionContext .isScene ())
|
|
226
232
|
break;
|
|
@@ -169,6 +169,10 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
169
169
|
{
|
|
170
170
|
return this [_components];
|
|
171
171
|
},
|
|
172
|
+
hasComponent: function (componentName)
|
|
173
|
+
{
|
|
174
|
+
return (this [_profile] ?.components .has (componentName) ?? true) || this [_components] .has (componentName);
|
|
175
|
+
},
|
|
172
176
|
updateUnit: function (category, name, conversionFactor)
|
|
173
177
|
{
|
|
174
178
|
// Private function.
|
|
@@ -136,29 +136,37 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
136
136
|
},
|
|
137
137
|
addCloneCount: function (count)
|
|
138
138
|
{
|
|
139
|
-
this
|
|
139
|
+
const target = this .getTarget ();
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
target [_cloneCount] += count;
|
|
142
|
+
|
|
143
|
+
for (const element of target .getValue ())
|
|
142
144
|
element .addCloneCount (count);
|
|
143
145
|
},
|
|
144
146
|
removeCloneCount: function (count)
|
|
145
147
|
{
|
|
146
|
-
this
|
|
148
|
+
const target = this .getTarget ();
|
|
149
|
+
|
|
150
|
+
target [_cloneCount] -= count;
|
|
147
151
|
|
|
148
|
-
for (const element of
|
|
152
|
+
for (const element of target .getValue ())
|
|
149
153
|
element .removeCloneCount (count);
|
|
150
154
|
},
|
|
151
155
|
addChildObject: function (value)
|
|
152
156
|
{
|
|
153
|
-
|
|
157
|
+
const target = this .getTarget ();
|
|
154
158
|
|
|
155
|
-
|
|
159
|
+
X3DObjectArrayField .prototype .addChildObject .call (target, value);
|
|
160
|
+
|
|
161
|
+
value .addCloneCount (target [_cloneCount]);
|
|
156
162
|
},
|
|
157
163
|
removeChildObject: function (value)
|
|
158
164
|
{
|
|
159
|
-
|
|
165
|
+
const target = this .getTarget ();
|
|
166
|
+
|
|
167
|
+
X3DObjectArrayField .prototype .removeChildObject .call (target, value);
|
|
160
168
|
|
|
161
|
-
value .removeCloneCount (
|
|
169
|
+
value .removeCloneCount (target [_cloneCount]);
|
|
162
170
|
},
|
|
163
171
|
toStream: function (generator)
|
|
164
172
|
{
|
|
@@ -210,11 +218,13 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
210
218
|
},
|
|
211
219
|
toVRMLString: function ()
|
|
212
220
|
{
|
|
213
|
-
this .
|
|
221
|
+
const target = this .getTarget ();
|
|
214
222
|
|
|
215
|
-
|
|
223
|
+
target .addCloneCount (1);
|
|
216
224
|
|
|
217
|
-
|
|
225
|
+
const string = X3DObjectArrayField .prototype .toVRMLString .call (target);
|
|
226
|
+
|
|
227
|
+
target .removeCloneCount (1);
|
|
218
228
|
|
|
219
229
|
return string;
|
|
220
230
|
},
|
|
@@ -268,23 +278,27 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
268
278
|
},
|
|
269
279
|
toXMLString: function ()
|
|
270
280
|
{
|
|
271
|
-
this .
|
|
281
|
+
const target = this .getTarget ();
|
|
282
|
+
|
|
283
|
+
target .addCloneCount (1);
|
|
272
284
|
|
|
273
|
-
const string = X3DObjectArrayField .prototype .toXMLString .call (
|
|
285
|
+
const string = X3DObjectArrayField .prototype .toXMLString .call (target);
|
|
274
286
|
|
|
275
|
-
|
|
287
|
+
target .removeCloneCount (1);
|
|
276
288
|
|
|
277
289
|
return string;
|
|
278
290
|
},
|
|
279
291
|
toXMLStream: function (generator)
|
|
280
292
|
{
|
|
281
|
-
const
|
|
293
|
+
const
|
|
294
|
+
target = this .getTarget (),
|
|
295
|
+
length = target .length;
|
|
282
296
|
|
|
283
297
|
if (length)
|
|
284
298
|
{
|
|
285
299
|
generator .EnterScope ();
|
|
286
300
|
|
|
287
|
-
const array =
|
|
301
|
+
const array = target .getValue ();
|
|
288
302
|
|
|
289
303
|
for (let i = 0, n = length - 1; i < n; ++ i)
|
|
290
304
|
{
|
|
@@ -343,11 +357,13 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
343
357
|
},
|
|
344
358
|
toJSONStream: function (generator)
|
|
345
359
|
{
|
|
346
|
-
const
|
|
360
|
+
const
|
|
361
|
+
target = this .getTarget (),
|
|
362
|
+
length = target .length;
|
|
347
363
|
|
|
348
364
|
if (length)
|
|
349
365
|
{
|
|
350
|
-
const array =
|
|
366
|
+
const array = target .getValue ();
|
|
351
367
|
|
|
352
368
|
generator .EnterScope ();
|
|
353
369
|
|
|
@@ -391,9 +407,11 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
391
407
|
},
|
|
392
408
|
dispose: function ()
|
|
393
409
|
{
|
|
394
|
-
this .
|
|
410
|
+
const target = this .getTarget ();
|
|
395
411
|
|
|
396
|
-
|
|
412
|
+
target .resize (0);
|
|
413
|
+
|
|
414
|
+
X3DObjectArrayField .prototype .dispose .call (target);
|
|
397
415
|
},
|
|
398
416
|
});
|
|
399
417
|
|
|
@@ -434,11 +452,13 @@ MFString .prototype = Object .assign (Object .create (X3DObjectArrayField .proto
|
|
|
434
452
|
},
|
|
435
453
|
toXMLStream: function (generator)
|
|
436
454
|
{
|
|
437
|
-
const
|
|
455
|
+
const
|
|
456
|
+
target = this .getTarget (),
|
|
457
|
+
length = target .length;
|
|
438
458
|
|
|
439
459
|
if (length)
|
|
440
460
|
{
|
|
441
|
-
const value =
|
|
461
|
+
const value = target .getValue ();
|
|
442
462
|
|
|
443
463
|
for (let i = 0, n = length - 1; i < n; ++ i)
|
|
444
464
|
{
|
|
@@ -51,7 +51,7 @@ import Generator from "../InputOutput/Generator.js";
|
|
|
51
51
|
import SFNodeCache from "./SFNodeCache.js";
|
|
52
52
|
|
|
53
53
|
const
|
|
54
|
-
_target = Symbol (),
|
|
54
|
+
_target = Symbol .for ("X_ITE.SFNode.target"),
|
|
55
55
|
_proxy = Symbol (),
|
|
56
56
|
_cloneCount = Symbol ();
|
|
57
57
|
|
|
@@ -469,12 +469,9 @@ SFNode .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
|
469
469
|
},
|
|
470
470
|
dispose: function ()
|
|
471
471
|
{
|
|
472
|
-
const
|
|
473
|
-
target = this [_target],
|
|
474
|
-
value = target .getValue ();
|
|
472
|
+
const target = this [_target];
|
|
475
473
|
|
|
476
|
-
|
|
477
|
-
value .dispose ();
|
|
474
|
+
target .setValue (null);
|
|
478
475
|
|
|
479
476
|
X3DField .prototype .dispose .call (target);
|
|
480
477
|
},
|
|
@@ -45,32 +45,47 @@
|
|
|
45
45
|
*
|
|
46
46
|
******************************************************************************/
|
|
47
47
|
|
|
48
|
-
import SFNode
|
|
48
|
+
import SFNode from "./SFNode.js";
|
|
49
|
+
import X3DField from "../Base/X3DField.js";
|
|
49
50
|
|
|
50
|
-
const
|
|
51
|
+
const cache = new WeakMap ();
|
|
52
|
+
|
|
53
|
+
class SFNodeCache
|
|
51
54
|
{
|
|
52
|
-
get
|
|
55
|
+
static get (baseNode)
|
|
53
56
|
{
|
|
54
|
-
const
|
|
57
|
+
const node = cache .get (baseNode);
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
if (node)
|
|
60
|
+
{
|
|
61
|
+
return node;
|
|
62
|
+
}
|
|
63
|
+
else
|
|
57
64
|
{
|
|
58
|
-
const node =
|
|
65
|
+
const node = new SFNode (baseNode);
|
|
66
|
+
|
|
67
|
+
node .dispose = dispose;
|
|
68
|
+
|
|
69
|
+
cache .set (baseNode, node);
|
|
70
|
+
|
|
71
|
+
return node;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const _target = Symbol .for ("X_ITE.SFNode.target");
|
|
77
|
+
|
|
78
|
+
function dispose ()
|
|
79
|
+
{
|
|
80
|
+
const
|
|
81
|
+
target = this [_target],
|
|
82
|
+
value = target .getValue ();
|
|
59
83
|
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
return node;
|
|
63
|
-
}
|
|
64
|
-
else
|
|
65
|
-
{
|
|
66
|
-
const node = new SFNode (baseNode);
|
|
84
|
+
cache .delete (value);
|
|
67
85
|
|
|
68
|
-
|
|
86
|
+
value ?.dispose ();
|
|
69
87
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
})(),
|
|
74
|
-
};
|
|
88
|
+
X3DField .prototype .dispose .call (target);
|
|
89
|
+
}
|
|
75
90
|
|
|
76
91
|
export default SFNodeCache;
|
|
@@ -156,6 +156,8 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
156
156
|
},
|
|
157
157
|
set_initLoadCount__: function (scene, success, error, field)
|
|
158
158
|
{
|
|
159
|
+
// Wait for extern protos to be loaded.
|
|
160
|
+
|
|
159
161
|
if (field .getValue ())
|
|
160
162
|
return;
|
|
161
163
|
|
|
@@ -163,22 +165,28 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
163
165
|
|
|
164
166
|
delete scene .loader;
|
|
165
167
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
catch (exception)
|
|
168
|
+
// Wait for instances to be created.
|
|
169
|
+
|
|
170
|
+
setTimeout (function ()
|
|
171
171
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
try
|
|
173
|
+
{
|
|
174
|
+
success (scene);
|
|
175
|
+
}
|
|
176
|
+
catch (exception)
|
|
177
|
+
{
|
|
178
|
+
if (error)
|
|
179
|
+
error (exception);
|
|
180
|
+
else
|
|
181
|
+
throw exception;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
0);
|
|
177
185
|
|
|
178
186
|
if (DEBUG)
|
|
179
187
|
{
|
|
180
188
|
if (this .URL .protocol !== "data:")
|
|
181
|
-
console .info (
|
|
189
|
+
console .info (`Done loading scene '${decodeURI (this .URL .href)}'`);
|
|
182
190
|
}
|
|
183
191
|
},
|
|
184
192
|
createX3DFromURL: function (url, parameter, callback, bindViewpoint, foreign)
|
|
@@ -283,7 +291,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
283
291
|
const
|
|
284
292
|
options = { cache: this .node .getCache () ? "default" : "reload" },
|
|
285
293
|
response = this .handleErrors (await fetch (this .URL .href, options)),
|
|
286
|
-
contentType = response .headers .get ("content-type")?.replace (/;.*$/, "");
|
|
294
|
+
contentType = response .headers .get ("content-type") ?.replace (/;.*$/, "");
|
|
287
295
|
|
|
288
296
|
if (this .foreign)
|
|
289
297
|
{
|
|
@@ -323,9 +331,9 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
323
331
|
error: function (exception)
|
|
324
332
|
{
|
|
325
333
|
if (this .URL .protocol === "data:")
|
|
326
|
-
console .warn (
|
|
334
|
+
console .warn (`Couldn't load data URL: ${exception .message}`);
|
|
327
335
|
else
|
|
328
|
-
console .warn (
|
|
336
|
+
console .warn (`Couldn't load URL '${decodeURI (this .URL .href)}': ${exception .message}`);
|
|
329
337
|
|
|
330
338
|
if (DEBUG)
|
|
331
339
|
console .error (exception);
|