x_ite 8.3.2 → 8.3.3
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/.github/workflows/pages-deploy.yml +1 -1
- package/.vscode/settings.json +2 -1
- package/dist/LICENSE.md +4 -4
- 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 +25 -25
- 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 +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +61 -74
- 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 +23 -23
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +19 -19
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +17 -17
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +28 -28
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +24 -24
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/{ProjectiveTextureMapping.js → TextureProjector.js} +39 -39
- package/dist/assets/components/TextureProjector.min.js +1 -0
- package/dist/assets/components/Texturing3D.js +27 -27
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- 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 +1492 -1291
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/Gemfile +1 -4
- package/docs/_config.yml +3 -3
- package/docs/_posts/getting-started.md +147 -441
- package/docs/_posts/reference/scene-services.md +13 -2
- package/docs/_posts/what's-new.md +21 -3
- package/docs/_tabs/playground.html +36 -40
- package/docs/assets/css/style.scss +18 -0
- package/package.json +1 -1
- package/src/assets/components/{ProjectiveTextureMapping.js → TextureProjector.js} +5 -5
- package/src/examples.js +1 -1
- package/src/tests.js +5 -5
- package/src/x_ite/Base/X3DInfoArray.js +21 -21
- package/src/x_ite/Base/X3DObject.js +29 -20
- package/src/x_ite/Base/X3DObjectArrayField.js +27 -26
- package/src/x_ite/Base/X3DTypedArrayField.js +34 -32
- package/src/x_ite/Browser/DOMIntegration.js +4 -3
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +43 -28
- package/src/x_ite/Components/Core/X3DNode.js +196 -187
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +113 -90
- package/src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +18 -43
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +24 -25
- package/src/x_ite/Components/HAnim/HAnimJoint.js +19 -31
- package/src/x_ite/Components/Sound/X3DSoundProcessingNode.js +14 -1
- package/src/x_ite/Components/Sound/X3DSoundSourceNode.js +0 -1
- package/src/x_ite/Components/{ProjectiveTextureMapping → TextureProjector}/TextureProjector.js +1 -1
- package/src/x_ite/Components/{ProjectiveTextureMapping → TextureProjector}/TextureProjectorParallel.js +1 -1
- package/src/x_ite/Components/{ProjectiveTextureMapping → TextureProjector}/X3DTextureProjectorNode.js +0 -0
- package/src/x_ite/Components/Time/TimeSensor.js +5 -0
- package/src/x_ite/Components/Time/X3DTimeDependentNode.js +1 -0
- package/src/x_ite/Configuration/ComponentInfo.js +20 -23
- package/src/x_ite/Configuration/ProfileInfo.js +6 -6
- package/src/x_ite/Configuration/SupportedComponents.js +22 -20
- package/src/x_ite/Configuration/SupportedProfiles.js +1 -1
- package/src/x_ite/Configuration/UnitInfo.js +24 -27
- package/src/x_ite/Execution/X3DExecutionContext.js +28 -59
- package/src/x_ite/Execution/X3DExportedNode.js +23 -28
- package/src/x_ite/Execution/X3DImportedNode.js +63 -67
- package/src/x_ite/Execution/X3DScene.js +98 -117
- package/src/x_ite/Fields/ArrayFields.js +57 -55
- package/src/x_ite/Fields/SFBool.js +6 -6
- package/src/x_ite/Fields/SFColor.js +10 -12
- package/src/x_ite/Fields/SFDouble.js +7 -10
- package/src/x_ite/Fields/SFFloat.js +7 -10
- package/src/x_ite/Fields/SFImage.js +33 -8
- package/src/x_ite/Fields/SFInt32.js +6 -6
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +13 -13
- package/src/x_ite/Fields/SFNode.js +42 -19
- package/src/x_ite/Fields/SFRotation.js +13 -13
- package/src/x_ite/Fields/SFString.js +6 -7
- package/src/x_ite/Fields/SFTime.js +6 -6
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +10 -10
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/InputOutput/Generator.js +117 -17
- package/src/x_ite/Parser/VRMLParser.js +24 -27
- package/src/x_ite/Parser/X3DParser.js +0 -4
- package/src/x_ite/Parser/XMLParser.js +2 -2
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +59 -64
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +86 -93
- package/src/x_ite/Rendering/X3DRenderObject.js +6 -1
- package/src/x_ite/Routing/X3DRoute.js +37 -40
- package/src/x_ite.html +1 -1
- package/x_ite.min.html +1 -1
- package/dist/assets/components/ProjectiveTextureMapping.min.js +0 -1
- package/docs/Gemfile.lock +0 -116
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
|
|
48
48
|
import X3DField from "../Base/X3DField.js";
|
|
49
49
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
50
|
-
import Generator from "../InputOutput/Generator.js";
|
|
51
50
|
|
|
52
51
|
const
|
|
53
52
|
unescape = /\\(.)/g,
|
|
@@ -98,17 +97,17 @@ SFString .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
|
98
97
|
X3DField .prototype .set .call (this, "" + value);
|
|
99
98
|
},
|
|
100
99
|
valueOf: X3DField .prototype .getValue,
|
|
101
|
-
toStream: function (
|
|
100
|
+
toStream: function (generator)
|
|
102
101
|
{
|
|
103
|
-
|
|
102
|
+
generator .string += '"' + SFString .escape (this .getValue ()) + '"';
|
|
104
103
|
},
|
|
105
|
-
toVRMLStream: function (
|
|
104
|
+
toVRMLStream: function (generator)
|
|
106
105
|
{
|
|
107
|
-
this .toStream (
|
|
106
|
+
this .toStream (generator);
|
|
108
107
|
},
|
|
109
|
-
toXMLStream: function (
|
|
108
|
+
toXMLStream: function (generator)
|
|
110
109
|
{
|
|
111
|
-
|
|
110
|
+
generator .string += generator .XMLEncode (this .getValue ());
|
|
112
111
|
},
|
|
113
112
|
});
|
|
114
113
|
|
|
@@ -77,17 +77,17 @@ SFTime .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
|
77
77
|
X3DField .prototype .set .call (this, +value);
|
|
78
78
|
},
|
|
79
79
|
valueOf: X3DField .prototype .getValue,
|
|
80
|
-
toStream: function (
|
|
80
|
+
toStream: function (generator)
|
|
81
81
|
{
|
|
82
|
-
|
|
82
|
+
generator .string += this .getValue ();
|
|
83
83
|
},
|
|
84
|
-
toVRMLStream: function (
|
|
84
|
+
toVRMLStream: function (generator)
|
|
85
85
|
{
|
|
86
|
-
this .toStream (
|
|
86
|
+
this .toStream (generator);
|
|
87
87
|
},
|
|
88
|
-
toXMLStream: function (
|
|
88
|
+
toXMLStream: function (generator)
|
|
89
89
|
{
|
|
90
|
-
this .toStream (
|
|
90
|
+
this .toStream (generator);
|
|
91
91
|
},
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -46,10 +46,11 @@
|
|
|
46
46
|
******************************************************************************/
|
|
47
47
|
|
|
48
48
|
import X3DField from "../Base/X3DField.js";
|
|
49
|
-
import Generator from "../InputOutput/Generator.js";
|
|
50
49
|
|
|
51
50
|
function SFVecPrototypeTemplate (TypeName, Type, ValueType, double)
|
|
52
51
|
{
|
|
52
|
+
const _formatter = double ? "DoublePrecision" : "Precision";
|
|
53
|
+
|
|
53
54
|
return Object .assign (Object .create (X3DField .prototype),
|
|
54
55
|
{
|
|
55
56
|
[Symbol .iterator]: function* ()
|
|
@@ -144,29 +145,28 @@ function SFVecPrototypeTemplate (TypeName, Type, ValueType, double)
|
|
|
144
145
|
{
|
|
145
146
|
return new (this .constructor) (ValueType .subtract (this .getValue (), vector .getValue ()));
|
|
146
147
|
},
|
|
147
|
-
toStream: function (
|
|
148
|
+
toStream: function (generator)
|
|
148
149
|
{
|
|
149
150
|
const
|
|
150
|
-
generator = Generator .Get (stream),
|
|
151
151
|
value = this .getValue (),
|
|
152
152
|
category = generator .Unit (this .getUnit ()),
|
|
153
153
|
last = value .length - 1;
|
|
154
154
|
|
|
155
155
|
for (let i = 0; i < last; ++ i)
|
|
156
156
|
{
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
generator .string += generator [_formatter] (generator .ToUnit (category, value [i]));
|
|
158
|
+
generator .string += generator .Space ();
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
generator .string += generator [_formatter] (generator .ToUnit (category, value [last]));
|
|
162
162
|
},
|
|
163
|
-
toVRMLStream: function (
|
|
163
|
+
toVRMLStream: function (generator)
|
|
164
164
|
{
|
|
165
|
-
this .toStream (
|
|
165
|
+
this .toStream (generator);
|
|
166
166
|
},
|
|
167
|
-
toXMLStream: function (
|
|
167
|
+
toXMLStream: function (generator)
|
|
168
168
|
{
|
|
169
|
-
this .toStream (
|
|
169
|
+
this .toStream (generator);
|
|
170
170
|
},
|
|
171
171
|
});
|
|
172
172
|
}
|
|
@@ -101,7 +101,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
101
101
|
{
|
|
102
102
|
return this .URL;
|
|
103
103
|
},
|
|
104
|
-
createX3DFromString: function (worldURL, string, success, error)
|
|
104
|
+
createX3DFromString: function (worldURL, string = "", success, error)
|
|
105
105
|
{
|
|
106
106
|
try
|
|
107
107
|
{
|
|
@@ -47,13 +47,16 @@
|
|
|
47
47
|
|
|
48
48
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
49
49
|
|
|
50
|
-
function Generator ()
|
|
50
|
+
function Generator ({ style = "TIDY", precision = 6, doublePrecision = 14 })
|
|
51
51
|
{
|
|
52
|
+
this .Style (style);
|
|
53
|
+
|
|
54
|
+
this .string = "";
|
|
52
55
|
this .indent = "";
|
|
53
|
-
this .
|
|
54
|
-
this .precision =
|
|
55
|
-
this .doublePrecision =
|
|
56
|
-
this .removeTrailingZeros =
|
|
56
|
+
this .listIndent = "";
|
|
57
|
+
this .precision = precision;
|
|
58
|
+
this .doublePrecision = doublePrecision;
|
|
59
|
+
this .removeTrailingZeros = /(?:\.|(\.[0-9]*?))0*(?=[eE]|$)/;
|
|
57
60
|
|
|
58
61
|
this .executionContextStack = [ null ];
|
|
59
62
|
this .importedNodesIndex = new Map ();
|
|
@@ -75,17 +78,122 @@ function Generator ()
|
|
|
75
78
|
Generator .prototype =
|
|
76
79
|
{
|
|
77
80
|
constructor: Generator,
|
|
81
|
+
Style: function (style)
|
|
82
|
+
{
|
|
83
|
+
switch (style)
|
|
84
|
+
{
|
|
85
|
+
case "CLEAN":
|
|
86
|
+
{
|
|
87
|
+
this .comma = " ";
|
|
88
|
+
this .break = " ";
|
|
89
|
+
this .tidyBreak = "";
|
|
90
|
+
this .tidySpace = "";
|
|
91
|
+
this .indentChar = "";
|
|
92
|
+
this .listEnclosure = "";
|
|
93
|
+
this .listBreak = "";
|
|
94
|
+
this .listIndentChar = "";
|
|
95
|
+
this .attribBreak = " ";
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "SMALL":
|
|
99
|
+
{
|
|
100
|
+
this .comma = ",";
|
|
101
|
+
this .break = "\n";
|
|
102
|
+
this .tidyBreak = "\n";
|
|
103
|
+
this .tidySpace = "";
|
|
104
|
+
this .indentChar = "";
|
|
105
|
+
this .listEnclosure = "";
|
|
106
|
+
this .listBreak = "";
|
|
107
|
+
this .listIndentChar = "";
|
|
108
|
+
this .attribBreak = " ";
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case "COMPACT":
|
|
112
|
+
{
|
|
113
|
+
this .comma = ",";
|
|
114
|
+
this .break = "\n";
|
|
115
|
+
this .tidyBreak = "\n";
|
|
116
|
+
this .tidySpace = " ";
|
|
117
|
+
this .indentChar = " ";
|
|
118
|
+
this .listEnclosure = "";
|
|
119
|
+
this .listBreak = " ";
|
|
120
|
+
this .listIndentChar = "";
|
|
121
|
+
this .attribBreak = " ";
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "TIDY":
|
|
125
|
+
default:
|
|
126
|
+
{
|
|
127
|
+
this .comma = ",";
|
|
128
|
+
this .break = "\n";
|
|
129
|
+
this .tidyBreak = "\n";
|
|
130
|
+
this .tidySpace = " ";
|
|
131
|
+
this .indentChar = " ";
|
|
132
|
+
this .listEnclosure = "\n";
|
|
133
|
+
this .listBreak = "\n";
|
|
134
|
+
this .listIndentChar = " ";
|
|
135
|
+
this .attribBreak = "\n";
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
Comma: function ()
|
|
141
|
+
{
|
|
142
|
+
return this .comma;
|
|
143
|
+
},
|
|
144
|
+
Break: function ()
|
|
145
|
+
{
|
|
146
|
+
return this .break;
|
|
147
|
+
},
|
|
148
|
+
TidyBreak: function ()
|
|
149
|
+
{
|
|
150
|
+
return this .tidyBreak;
|
|
151
|
+
},
|
|
152
|
+
ForceBreak: function ()
|
|
153
|
+
{
|
|
154
|
+
return "\n";
|
|
155
|
+
},
|
|
156
|
+
Space: function ()
|
|
157
|
+
{
|
|
158
|
+
return " ";
|
|
159
|
+
},
|
|
160
|
+
TidySpace: function ()
|
|
161
|
+
{
|
|
162
|
+
return this .tidySpace;
|
|
163
|
+
},
|
|
164
|
+
ListStart: function ()
|
|
165
|
+
{
|
|
166
|
+
return this .listEnclosure;
|
|
167
|
+
},
|
|
168
|
+
ListEnd: function ()
|
|
169
|
+
{
|
|
170
|
+
return this .listEnclosure;
|
|
171
|
+
},
|
|
172
|
+
ListBreak: function ()
|
|
173
|
+
{
|
|
174
|
+
return this .listBreak;
|
|
175
|
+
},
|
|
176
|
+
AttribBreak: function ()
|
|
177
|
+
{
|
|
178
|
+
return this .attribBreak;
|
|
179
|
+
},
|
|
78
180
|
Indent: function ()
|
|
79
181
|
{
|
|
80
182
|
return this .indent;
|
|
81
183
|
},
|
|
184
|
+
ListIndent: function ()
|
|
185
|
+
{
|
|
186
|
+
return this .listIndent;
|
|
187
|
+
},
|
|
82
188
|
IncIndent: function ()
|
|
83
189
|
{
|
|
84
|
-
this .indent
|
|
190
|
+
this .indent += this .indentChar;
|
|
191
|
+
this .listIndent += this .listIndentChar;
|
|
85
192
|
},
|
|
86
193
|
DecIndent: function ()
|
|
87
194
|
{
|
|
88
|
-
this .indent = this .indent .
|
|
195
|
+
this .indent = this .indent .slice (0, this .indent .length - this .indentChar .length);
|
|
196
|
+
this .listIndent = this .listIndent .slice (0, this .listIndent .length - this .listIndentChar .length);
|
|
89
197
|
},
|
|
90
198
|
PadRight: function (string, pad)
|
|
91
199
|
{
|
|
@@ -96,11 +204,11 @@ Generator .prototype =
|
|
|
96
204
|
},
|
|
97
205
|
Precision: function (value)
|
|
98
206
|
{
|
|
99
|
-
return Math .fround (value) .toPrecision (this .precision) .replace (this .removeTrailingZeros, "");
|
|
207
|
+
return Math .fround (value) .toPrecision (this .precision) .replace (this .removeTrailingZeros, "$1");
|
|
100
208
|
},
|
|
101
209
|
DoublePrecision: function (value)
|
|
102
210
|
{
|
|
103
|
-
return value .toPrecision (this .doublePrecision) .replace (this .removeTrailingZeros, "");
|
|
211
|
+
return value .toPrecision (this .doublePrecision) .replace (this .removeTrailingZeros, "$1");
|
|
104
212
|
},
|
|
105
213
|
PushExecutionContext: function (executionContext)
|
|
106
214
|
{
|
|
@@ -416,12 +524,4 @@ Generator .prototype =
|
|
|
416
524
|
for (const key of Reflect .ownKeys (Generator .prototype))
|
|
417
525
|
Object .defineProperty (Generator .prototype, key, { enumerable: false });
|
|
418
526
|
|
|
419
|
-
Generator .Get = function (stream)
|
|
420
|
-
{
|
|
421
|
-
if (! stream .generator)
|
|
422
|
-
stream .generator = new Generator ();
|
|
423
|
-
|
|
424
|
-
return stream .generator;
|
|
425
|
-
};
|
|
426
|
-
|
|
427
527
|
export default Generator;
|
|
@@ -443,11 +443,11 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
443
443
|
|
|
444
444
|
if (this .success)
|
|
445
445
|
{
|
|
446
|
-
this .loadComponents () .then (
|
|
446
|
+
this .loadComponents () .then (() =>
|
|
447
447
|
{
|
|
448
448
|
try
|
|
449
449
|
{
|
|
450
|
-
this .statements ();
|
|
450
|
+
this .statements (this .getScene () .rootNodes);
|
|
451
451
|
|
|
452
452
|
if (this .lastIndex < this .input .length)
|
|
453
453
|
throw new Error ("Unknown statement.");
|
|
@@ -459,17 +459,12 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
459
459
|
//console .error (error);
|
|
460
460
|
this .error (new Error (this .getError (error)));
|
|
461
461
|
}
|
|
462
|
-
}
|
|
463
|
-
.bind (this))
|
|
464
|
-
.catch (function (error)
|
|
465
|
-
{
|
|
466
|
-
this .error (error);
|
|
467
|
-
}
|
|
468
|
-
.bind (this));
|
|
462
|
+
})
|
|
463
|
+
.catch (this .error .bind (this));
|
|
469
464
|
}
|
|
470
465
|
else
|
|
471
466
|
{
|
|
472
|
-
this .statements ();
|
|
467
|
+
this .statements (this .getScene () .rootNodes);
|
|
473
468
|
|
|
474
469
|
if (this .lastIndex < this .input .length)
|
|
475
470
|
throw new Error ("Unknown statement.");
|
|
@@ -730,12 +725,12 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
730
725
|
}
|
|
731
726
|
return false;
|
|
732
727
|
},
|
|
733
|
-
statements: function ()
|
|
728
|
+
statements: function (field)
|
|
734
729
|
{
|
|
735
|
-
while (this .statement ())
|
|
730
|
+
while (this .statement (field))
|
|
736
731
|
;
|
|
737
732
|
},
|
|
738
|
-
statement: function ()
|
|
733
|
+
statement: function (field)
|
|
739
734
|
{
|
|
740
735
|
if (this .protoStatement ())
|
|
741
736
|
return true;
|
|
@@ -753,7 +748,7 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
753
748
|
|
|
754
749
|
if (node !== false)
|
|
755
750
|
{
|
|
756
|
-
|
|
751
|
+
field .push (node);
|
|
757
752
|
return true;
|
|
758
753
|
}
|
|
759
754
|
|
|
@@ -835,7 +830,7 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
835
830
|
this .pushPrototype (proto);
|
|
836
831
|
this .pushExecutionContext (proto .getBody ());
|
|
837
832
|
|
|
838
|
-
this .protoBody ();
|
|
833
|
+
this .protoBody (proto .getBody () .rootNodes);
|
|
839
834
|
|
|
840
835
|
this .popExecutionContext ();
|
|
841
836
|
this .popPrototype ();
|
|
@@ -877,16 +872,16 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
877
872
|
|
|
878
873
|
return false;
|
|
879
874
|
},
|
|
880
|
-
protoBody: function ()
|
|
875
|
+
protoBody: function (rootNodes)
|
|
881
876
|
{
|
|
882
877
|
this .protoStatements ();
|
|
883
878
|
|
|
884
|
-
|
|
879
|
+
const rootNodeStatement = this .rootNodeStatement ();
|
|
885
880
|
|
|
886
881
|
if (rootNodeStatement !== false)
|
|
887
|
-
|
|
882
|
+
rootNodes .push (rootNodeStatement);
|
|
888
883
|
|
|
889
|
-
this .statements ();
|
|
884
|
+
this .statements (rootNodes);
|
|
890
885
|
},
|
|
891
886
|
rootNodeStatement: function ()
|
|
892
887
|
{
|
|
@@ -1323,11 +1318,11 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1323
1318
|
{
|
|
1324
1319
|
var
|
|
1325
1320
|
nodeTypeId = this .result [1],
|
|
1326
|
-
baseNode = this .getExecutionContext () .
|
|
1321
|
+
baseNode = this .getExecutionContext () .createProto (nodeTypeId, false);
|
|
1327
1322
|
|
|
1328
1323
|
if (! baseNode)
|
|
1329
1324
|
{
|
|
1330
|
-
baseNode = this .getExecutionContext () .
|
|
1325
|
+
baseNode = this .getExecutionContext () .createNode (nodeTypeId, false);
|
|
1331
1326
|
|
|
1332
1327
|
if (! baseNode)
|
|
1333
1328
|
throw new Error ("Unknown node type or proto '" + nodeTypeId + "', you probably have insufficient component/profile statements.");
|
|
@@ -2409,14 +2404,16 @@ VRMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2409
2404
|
},
|
|
2410
2405
|
nodeStatements: function (field)
|
|
2411
2406
|
{
|
|
2412
|
-
|
|
2407
|
+
this .statements (field);
|
|
2413
2408
|
|
|
2414
|
-
|
|
2415
|
-
{
|
|
2416
|
-
field .push (node);
|
|
2409
|
+
// var node = this .nodeStatement ();
|
|
2417
2410
|
|
|
2418
|
-
|
|
2419
|
-
|
|
2411
|
+
// while (node !== false)
|
|
2412
|
+
// {
|
|
2413
|
+
// field .push (node);
|
|
2414
|
+
|
|
2415
|
+
// node = this .nodeStatement ();
|
|
2416
|
+
// }
|
|
2420
2417
|
},
|
|
2421
2418
|
sfrotationValue: function (field)
|
|
2422
2419
|
{
|
|
@@ -793,10 +793,10 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
793
793
|
if (this .useAttribute (xmlElement))
|
|
794
794
|
return;
|
|
795
795
|
|
|
796
|
-
var node = this .getExecutionContext () .
|
|
796
|
+
var node = this .getExecutionContext () .createProto (this .protoNameToCamelCase (xmlElement .nodeName), false);
|
|
797
797
|
|
|
798
798
|
if (! node)
|
|
799
|
-
|
|
799
|
+
node = this .getExecutionContext () .createNode (this .nodeNameToCamelCase (xmlElement .nodeName), false);
|
|
800
800
|
|
|
801
801
|
if (! node)
|
|
802
802
|
throw new Error ("Unknown node type '" + xmlElement .nodeName + "', you probably have insufficient component/profile statements.");
|
|
@@ -53,7 +53,6 @@ import X3DUrlObject from "../Components/Networking/X3DUrlObject.js";
|
|
|
53
53
|
import X3DProtoDeclarationNode from "./X3DProtoDeclarationNode.js";
|
|
54
54
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
55
55
|
import FileLoader from "../InputOutput/FileLoader.js";
|
|
56
|
-
import Generator from "../InputOutput/Generator.js";
|
|
57
56
|
|
|
58
57
|
SupportedNodes .addAbstractType ("X3DExternProtoDeclaration", X3DExternProtoDeclaration);
|
|
59
58
|
|
|
@@ -173,85 +172,80 @@ X3DExternProtoDeclaration .prototype = Object .assign (Object .create (X3DProtoD
|
|
|
173
172
|
this .setLoadState (X3DConstants .FAILED_STATE);
|
|
174
173
|
this .setProtoDeclaration (null);
|
|
175
174
|
},
|
|
176
|
-
toVRMLStream: function (
|
|
175
|
+
toVRMLStream: function (generator)
|
|
177
176
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
stream .string += " ";
|
|
185
|
-
stream .string += "[";
|
|
177
|
+
generator .string += generator .Indent ();
|
|
178
|
+
generator .string += "EXTERNPROTO";
|
|
179
|
+
generator .string += generator .Space ();
|
|
180
|
+
generator .string += this .getName ();
|
|
181
|
+
generator .string += generator .TidySpace ();
|
|
182
|
+
generator .string += "[";
|
|
186
183
|
|
|
187
184
|
const userDefinedFields = this .getUserDefinedFields ();
|
|
188
185
|
|
|
189
|
-
let
|
|
190
|
-
fieldTypeLength = 0,
|
|
191
|
-
accessTypeLength = 0;
|
|
192
|
-
|
|
193
186
|
if (userDefinedFields .length === 0)
|
|
194
187
|
{
|
|
195
|
-
|
|
188
|
+
generator .string += generator .TidySpace ();
|
|
196
189
|
}
|
|
197
190
|
else
|
|
198
191
|
{
|
|
192
|
+
let
|
|
193
|
+
fieldTypeLength = 0,
|
|
194
|
+
accessTypeLength = 0;
|
|
195
|
+
|
|
199
196
|
for (const field of userDefinedFields)
|
|
200
197
|
{
|
|
201
198
|
fieldTypeLength = Math .max (fieldTypeLength, field .getTypeName () .length);
|
|
202
199
|
accessTypeLength = Math .max (accessTypeLength, generator .AccessType (field .getAccessType ()) .length);
|
|
203
200
|
}
|
|
204
201
|
|
|
205
|
-
|
|
202
|
+
generator .string += generator .TidyBreak ();
|
|
206
203
|
|
|
207
204
|
generator .IncIndent ();
|
|
208
205
|
|
|
209
206
|
for (const field of userDefinedFields)
|
|
210
207
|
{
|
|
211
|
-
this .toVRMLStreamUserDefinedField (
|
|
212
|
-
|
|
208
|
+
this .toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength);
|
|
209
|
+
|
|
210
|
+
generator .string += generator .Break ();
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
generator .DecIndent ();
|
|
216
214
|
|
|
217
|
-
|
|
215
|
+
generator .string += generator .Indent ();
|
|
218
216
|
}
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
stream .string += generator .Indent ();
|
|
218
|
+
generator .string += "]";
|
|
219
|
+
generator .string += generator .TidyBreak ();
|
|
220
|
+
generator .string += generator .Indent ();
|
|
224
221
|
|
|
225
|
-
this ._url .toVRMLStream (
|
|
222
|
+
this ._url .toVRMLStream (generator);
|
|
226
223
|
},
|
|
227
|
-
toVRMLStreamUserDefinedField: function (
|
|
224
|
+
toVRMLStreamUserDefinedField: function (generator, field, fieldTypeLength, accessTypeLength)
|
|
228
225
|
{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
stream .string += " ";
|
|
236
|
-
stream .string += field .getName ();
|
|
226
|
+
generator .string += generator .Indent ();
|
|
227
|
+
generator .string += generator .PadRight (generator .AccessType (field .getAccessType ()), accessTypeLength);
|
|
228
|
+
generator .string += generator .Space ();
|
|
229
|
+
generator .string += generator .PadRight (field .getTypeName (), fieldTypeLength);
|
|
230
|
+
generator .string += generator .Space ();
|
|
231
|
+
generator .string += field .getName ();
|
|
237
232
|
},
|
|
238
|
-
toXMLStream: function (
|
|
233
|
+
toXMLStream: function (generator)
|
|
239
234
|
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
stream .string += " ";
|
|
249
|
-
stream .string += "url='";
|
|
235
|
+
generator .string += generator .Indent ();
|
|
236
|
+
generator .string += "<ExternProtoDeclare";
|
|
237
|
+
generator .string += generator .Space ();
|
|
238
|
+
generator .string += "name='";
|
|
239
|
+
generator .string += generator .XMLEncode (this .getName ());
|
|
240
|
+
generator .string += "'";
|
|
241
|
+
generator .string += generator .Space ();
|
|
242
|
+
generator .string += "url='";
|
|
250
243
|
|
|
251
|
-
this ._url .toXMLStream (
|
|
244
|
+
this ._url .toXMLStream (generator);
|
|
252
245
|
|
|
253
|
-
|
|
254
|
-
|
|
246
|
+
generator .string += "'";
|
|
247
|
+
generator .string += ">";
|
|
248
|
+
generator .string += generator .TidyBreak ();
|
|
255
249
|
|
|
256
250
|
generator .IncIndent ();
|
|
257
251
|
|
|
@@ -259,27 +253,28 @@ X3DExternProtoDeclaration .prototype = Object .assign (Object .create (X3DProtoD
|
|
|
259
253
|
|
|
260
254
|
for (const field of userDefinedFields)
|
|
261
255
|
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
256
|
+
generator .string += generator .Indent ();
|
|
257
|
+
generator .string += "<field";
|
|
258
|
+
generator .string += generator .Space ();
|
|
259
|
+
generator .string += "accessType='";
|
|
260
|
+
generator .string += generator .AccessType (field .getAccessType ());
|
|
261
|
+
generator .string += "'";
|
|
262
|
+
generator .string += generator .Space ();
|
|
263
|
+
generator .string += "type='";
|
|
264
|
+
generator .string += field .getTypeName ();
|
|
265
|
+
generator .string += "'";
|
|
266
|
+
generator .string += generator .Space ();
|
|
267
|
+
generator .string += "name='";
|
|
268
|
+
generator .string += generator .XMLEncode (field .getName ());
|
|
269
|
+
generator .string += "'";
|
|
270
|
+
generator .string += "/>";
|
|
271
|
+
generator .string += generator .TidyBreak ();
|
|
277
272
|
}
|
|
278
273
|
|
|
279
274
|
generator .DecIndent ();
|
|
280
275
|
|
|
281
|
-
|
|
282
|
-
|
|
276
|
+
generator .string += generator .Indent ();
|
|
277
|
+
generator .string += "</ExternProtoDeclare>";
|
|
283
278
|
},
|
|
284
279
|
});
|
|
285
280
|
|