x_ite 8.3.0 → 8.3.2
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/README.md +5 -2
- package/build/bin/tests.pl +2 -0
- 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 +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 +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/ProjectiveTextureMapping.js +14 -14
- package/dist/assets/components/ProjectiveTextureMapping.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/Texturing3D.js +46 -46
- 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 +445 -294
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -1
- package/docs/_posts/custom-shaders.md +1 -1
- package/docs/_posts/dom-integration.md +52 -25
- package/docs/_posts/getting-started.md +6 -3
- package/docs/_posts/reference/field-services-and-objects.md +2 -34
- package/docs/_posts/tutorials/basic-nodes.md +2 -2
- package/docs/_posts/tutorials/building-a-x3d-world.md +20 -4
- package/docs/_posts/tutorials/building-primitive-shapes.md +4 -4
- package/docs/_posts/tutorials/creating-new-node-types.md +22 -0
- package/docs/_posts/tutorials/hello-world.md +6 -6
- package/docs/_posts/tutorials/improving-performance.md +2 -2
- package/docs/_posts/tutorials/writing-program-scripts-with-ecmascript.md +2 -2
- package/docs/_tabs/playground.html +74 -17
- package/docs/assets/css/style.scss +7 -1
- package/package.json +2 -2
- package/src/x_ite/Base/X3DArrayField.js +3 -0
- package/src/x_ite/Base/X3DBaseNode.js +4 -0
- package/src/x_ite/Base/X3DInfoArray.js +7 -3
- package/src/x_ite/Browser/Core/ContextMenu.js +5 -7
- package/src/x_ite/Browser/DOMIntegration.js +62 -55
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +1 -1
- package/src/x_ite/Browser/X3DBrowserContext.js +3 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +1 -1
- package/src/x_ite/Components/Networking/Inline.js +21 -2
- package/src/x_ite/Configuration/SupportedNodes.js +1 -5
- package/src/x_ite/Execution/X3DScene.js +74 -58
- package/src/x_ite/Parser/JSONParser.js +1 -1
- package/src/x_ite/Parser/XMLParser.js +151 -49
- package/src/x_ite.html +2 -2
- package/webpack.config.js +2 -2
|
@@ -73,6 +73,8 @@ function XMLParser (scene)
|
|
|
73
73
|
this .parents = [ ];
|
|
74
74
|
this .parser = new VRMLParser (scene);
|
|
75
75
|
this .url = new Fields .MFString ();
|
|
76
|
+
this .protoNames = new Map ();
|
|
77
|
+
this .protoFields = new WeakMap ();
|
|
76
78
|
|
|
77
79
|
try
|
|
78
80
|
{
|
|
@@ -102,12 +104,23 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
102
104
|
xmlElement = $.parseXML (xmlElement);
|
|
103
105
|
|
|
104
106
|
this .input = xmlElement;
|
|
107
|
+
this .xml = this .isXML (xmlElement);
|
|
108
|
+
|
|
109
|
+
if (! this .xml)
|
|
110
|
+
Object .assign (this, HTMLParser);
|
|
105
111
|
}
|
|
106
112
|
catch (error)
|
|
107
113
|
{
|
|
108
114
|
this .input = undefined;
|
|
109
115
|
}
|
|
110
116
|
},
|
|
117
|
+
isXML: function (element)
|
|
118
|
+
{
|
|
119
|
+
if (element instanceof HTMLElement)
|
|
120
|
+
return false;
|
|
121
|
+
else
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
111
124
|
parseIntoScene: function (success, error)
|
|
112
125
|
{
|
|
113
126
|
this .success = success;
|
|
@@ -118,16 +131,6 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
118
131
|
|
|
119
132
|
this .xmlElement (this .input);
|
|
120
133
|
},
|
|
121
|
-
parseIntoNode: function (node, xmlElement)
|
|
122
|
-
{
|
|
123
|
-
this .pushExecutionContext (node .getExecutionContext ());
|
|
124
|
-
this .pushParent (node);
|
|
125
|
-
|
|
126
|
-
this .childElement (xmlElement);
|
|
127
|
-
|
|
128
|
-
this .popParent ();
|
|
129
|
-
this .popExecutionContext ();
|
|
130
|
-
},
|
|
131
134
|
xmlElement: function (xmlElement)
|
|
132
135
|
{
|
|
133
136
|
if (xmlElement === null)
|
|
@@ -480,8 +483,9 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
480
483
|
var externproto = new X3DExternProtoDeclaration (this .getExecutionContext (), this .url);
|
|
481
484
|
|
|
482
485
|
this .pushParent (externproto);
|
|
483
|
-
this .protoInterfaceElement (xmlElement);
|
|
486
|
+
this .protoInterfaceElement (xmlElement);
|
|
484
487
|
this .popParent ();
|
|
488
|
+
this .addProtoFieldNames (externproto);
|
|
485
489
|
|
|
486
490
|
externproto .setup ();
|
|
487
491
|
|
|
@@ -495,6 +499,8 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
495
499
|
{ }
|
|
496
500
|
|
|
497
501
|
this .getExecutionContext () .updateExternProtoDeclaration (name, externproto);
|
|
502
|
+
|
|
503
|
+
this .addProtoName (name);
|
|
498
504
|
}
|
|
499
505
|
},
|
|
500
506
|
protoDeclareElement: function (xmlElement)
|
|
@@ -519,6 +525,7 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
519
525
|
this .pushParent (proto);
|
|
520
526
|
this .protoInterfaceElement (child);
|
|
521
527
|
this .popParent ();
|
|
528
|
+
this .addProtoFieldNames (proto);
|
|
522
529
|
break;
|
|
523
530
|
}
|
|
524
531
|
default:
|
|
@@ -565,6 +572,8 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
565
572
|
{ }
|
|
566
573
|
|
|
567
574
|
this .getExecutionContext () .updateProtoDeclaration (name, proto);
|
|
575
|
+
|
|
576
|
+
this .addProtoName (name);
|
|
568
577
|
}
|
|
569
578
|
},
|
|
570
579
|
protoInterfaceElement: function (xmlElement)
|
|
@@ -715,7 +724,7 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
715
724
|
if (! node)
|
|
716
725
|
throw new Error ("Unknown proto or externproto type '" + name + "'.");
|
|
717
726
|
|
|
718
|
-
|
|
727
|
+
///DOMIntegration: attach node to DOM xmlElement for access from DOM.
|
|
719
728
|
$.data (xmlElement, "node", node);
|
|
720
729
|
|
|
721
730
|
this .defAttribute (xmlElement, node);
|
|
@@ -786,12 +795,19 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
786
795
|
|
|
787
796
|
var node = this .getExecutionContext () .createNode (this .nodeNameToCamelCase (xmlElement .nodeName), false);
|
|
788
797
|
|
|
798
|
+
if (! node)
|
|
799
|
+
var node = this .getExecutionContext () .createProto (this .protoNameToCamelCase (xmlElement .nodeName), false);
|
|
800
|
+
|
|
789
801
|
if (! node)
|
|
790
802
|
throw new Error ("Unknown node type '" + xmlElement .nodeName + "', you probably have insufficient component/profile statements.");
|
|
791
803
|
|
|
792
|
-
|
|
804
|
+
///DOMIntegration: attach node to DOM xmlElement for access from DOM.
|
|
793
805
|
$.data (xmlElement, "node", node);
|
|
794
806
|
|
|
807
|
+
//DOMIntegration: Script node support for HTML.
|
|
808
|
+
if (xmlElement .nodeName === "SCRIPT")
|
|
809
|
+
this .scriptElement (xmlElement);
|
|
810
|
+
|
|
795
811
|
this .defAttribute (xmlElement, node);
|
|
796
812
|
this .addNode (xmlElement, node);
|
|
797
813
|
this .pushParent (node);
|
|
@@ -819,6 +835,22 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
819
835
|
console .error (error);
|
|
820
836
|
}
|
|
821
837
|
},
|
|
838
|
+
scriptElement (element)
|
|
839
|
+
{
|
|
840
|
+
const
|
|
841
|
+
domParser = new DOMParser (),
|
|
842
|
+
scriptDocument = domParser .parseFromString (element .outerHTML, "application/xml"),
|
|
843
|
+
childNodes = scriptDocument .children [0] .childNodes;
|
|
844
|
+
|
|
845
|
+
element .textContent = "// Content moved into childNodes.";
|
|
846
|
+
|
|
847
|
+
for (const childNode of childNodes)
|
|
848
|
+
{
|
|
849
|
+
// Add elements and cdata.
|
|
850
|
+
if (childNode .nodeType === 1 || childNode .nodeType === 4)
|
|
851
|
+
element .appendChild (childNode);
|
|
852
|
+
}
|
|
853
|
+
},
|
|
822
854
|
routeElement: function (xmlElement)
|
|
823
855
|
{
|
|
824
856
|
try
|
|
@@ -847,7 +879,7 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
847
879
|
destinationNode = executionContext .getLocalNode (destinationNodeName),
|
|
848
880
|
route = executionContext .addRoute (sourceNode, sourceField, destinationNode, destinationField);
|
|
849
881
|
|
|
850
|
-
|
|
882
|
+
///DOMIntegration: attach node to DOM xmlElement for access from DOM.
|
|
851
883
|
$.data (xmlElement, "node", route);
|
|
852
884
|
}
|
|
853
885
|
catch (error)
|
|
@@ -988,11 +1020,9 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
988
1020
|
{
|
|
989
1021
|
try
|
|
990
1022
|
{
|
|
991
|
-
|
|
992
|
-
field = node .getField (this .attributeToCamelCase (xmlAttribute .name)),
|
|
993
|
-
accessType = field .getAccessType ();
|
|
1023
|
+
const field = node .getField (this .attributeToCamelCase (node, xmlAttribute .name));
|
|
994
1024
|
|
|
995
|
-
if (
|
|
1025
|
+
if (field .isInitializable ())
|
|
996
1026
|
this .fieldValue (field, xmlAttribute .value);
|
|
997
1027
|
}
|
|
998
1028
|
catch (error)
|
|
@@ -1012,6 +1042,32 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1012
1042
|
|
|
1013
1043
|
this .parser .popExecutionContext ();
|
|
1014
1044
|
},
|
|
1045
|
+
id: function (string)
|
|
1046
|
+
{
|
|
1047
|
+
if (string === null)
|
|
1048
|
+
return false;
|
|
1049
|
+
|
|
1050
|
+
if (string .length === 0)
|
|
1051
|
+
return false;
|
|
1052
|
+
|
|
1053
|
+
return true;
|
|
1054
|
+
},
|
|
1055
|
+
getParents: function ()
|
|
1056
|
+
{
|
|
1057
|
+
return this .parents;
|
|
1058
|
+
},
|
|
1059
|
+
getParent: function ()
|
|
1060
|
+
{
|
|
1061
|
+
return this .parents .at (-1);
|
|
1062
|
+
},
|
|
1063
|
+
pushParent: function (parent)
|
|
1064
|
+
{
|
|
1065
|
+
return this .parents .push (parent);
|
|
1066
|
+
},
|
|
1067
|
+
popParent: function ()
|
|
1068
|
+
{
|
|
1069
|
+
this .parents .pop ();
|
|
1070
|
+
},
|
|
1015
1071
|
addNode: function (xmlElement, node)
|
|
1016
1072
|
{
|
|
1017
1073
|
if (this .parents .length === 0 || this .getParent () instanceof X3DProtoDeclaration)
|
|
@@ -1070,41 +1126,22 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1070
1126
|
//console .warn (error .message);
|
|
1071
1127
|
}
|
|
1072
1128
|
},
|
|
1073
|
-
|
|
1129
|
+
// Overloaded by HTMLParser.
|
|
1130
|
+
addProtoName: function (name)
|
|
1131
|
+
{ },
|
|
1132
|
+
addProtoFieldNames: function (protoNode)
|
|
1133
|
+
{ },
|
|
1134
|
+
protoNameToCamelCase: function (typeName)
|
|
1074
1135
|
{
|
|
1075
|
-
return
|
|
1136
|
+
return typeName;
|
|
1076
1137
|
},
|
|
1077
|
-
|
|
1138
|
+
nodeNameToCamelCase: function (typeName)
|
|
1078
1139
|
{
|
|
1079
|
-
return
|
|
1140
|
+
return typeName;
|
|
1080
1141
|
},
|
|
1081
|
-
|
|
1142
|
+
attributeToCamelCase: function (node, name)
|
|
1082
1143
|
{
|
|
1083
|
-
return
|
|
1084
|
-
},
|
|
1085
|
-
popParent: function ()
|
|
1086
|
-
{
|
|
1087
|
-
this .parents .pop ();
|
|
1088
|
-
},
|
|
1089
|
-
id: function (string)
|
|
1090
|
-
{
|
|
1091
|
-
if (string === null)
|
|
1092
|
-
return false;
|
|
1093
|
-
|
|
1094
|
-
if (string .length === 0)
|
|
1095
|
-
return false;
|
|
1096
|
-
|
|
1097
|
-
return true;
|
|
1098
|
-
},
|
|
1099
|
-
nodeNameToCamelCase: function (nodeName)
|
|
1100
|
-
{
|
|
1101
|
-
// Function also needed by X_ITE DOM.
|
|
1102
|
-
return HTMLSupport .getNodeTypeName (nodeName);
|
|
1103
|
-
},
|
|
1104
|
-
attributeToCamelCase: function (name)
|
|
1105
|
-
{
|
|
1106
|
-
// Function also needed by X_ITE DOM.
|
|
1107
|
-
return HTMLSupport .getFieldName (name);
|
|
1144
|
+
return name;
|
|
1108
1145
|
},
|
|
1109
1146
|
});
|
|
1110
1147
|
|
|
@@ -1157,7 +1194,7 @@ XMLParser .prototype .fieldTypes [X3DConstants .MFVec4f] = VRMLParser .proto
|
|
|
1157
1194
|
* Lazy parse functions.
|
|
1158
1195
|
*/
|
|
1159
1196
|
|
|
1160
|
-
|
|
1197
|
+
const
|
|
1161
1198
|
infs = /\binf\b/g,
|
|
1162
1199
|
nans = /\bnan\b/g,
|
|
1163
1200
|
trimWhitespaces = /^[\x20\n,\t\r"]+|[\x20\n,\t\r"]+$/g,
|
|
@@ -1254,4 +1291,69 @@ XMLParser .prototype .fieldTypes [X3DConstants .MFString] = function (field)
|
|
|
1254
1291
|
field .setValue (prepareStrings (this .getInput ()));
|
|
1255
1292
|
};
|
|
1256
1293
|
|
|
1294
|
+
// HTML Support
|
|
1295
|
+
|
|
1296
|
+
const HTMLParser =
|
|
1297
|
+
{
|
|
1298
|
+
addProtoName: function (name)
|
|
1299
|
+
{
|
|
1300
|
+
//DOMIntegration: add uppercase versions of proto name.
|
|
1301
|
+
|
|
1302
|
+
this .protoNames .set (name, name);
|
|
1303
|
+
this .protoNames .set (name .toUpperCase (), name);
|
|
1304
|
+
},
|
|
1305
|
+
addProtoFieldNames: (function ()
|
|
1306
|
+
{
|
|
1307
|
+
const reservedAttributes = new Set ();
|
|
1308
|
+
|
|
1309
|
+
for (const reservedAttribute of [
|
|
1310
|
+
"DEF",
|
|
1311
|
+
"USE",
|
|
1312
|
+
"containerField",
|
|
1313
|
+
])
|
|
1314
|
+
{
|
|
1315
|
+
reservedAttributes
|
|
1316
|
+
.add (reservedAttribute)
|
|
1317
|
+
.add (reservedAttribute .toLowerCase ());
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
return function (protoNode)
|
|
1321
|
+
{
|
|
1322
|
+
//DOMIntegration: handle lowercase versions of field names.
|
|
1323
|
+
|
|
1324
|
+
const fields = new Map ();
|
|
1325
|
+
|
|
1326
|
+
this .protoFields .set (protoNode, fields);
|
|
1327
|
+
|
|
1328
|
+
for (const { name } of protoNode .getFieldDefinitions ())
|
|
1329
|
+
{
|
|
1330
|
+
if (reservedAttributes .has (name))
|
|
1331
|
+
continue;
|
|
1332
|
+
|
|
1333
|
+
fields .set (name, name);
|
|
1334
|
+
fields .set (name .toLowerCase (), name);
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
})(),
|
|
1338
|
+
protoNameToCamelCase: function (typeName)
|
|
1339
|
+
{
|
|
1340
|
+
//DOMIntegration: handle uppercase versions of node names.
|
|
1341
|
+
return this .protoNames .get (typeName);
|
|
1342
|
+
},
|
|
1343
|
+
nodeNameToCamelCase: function (typeName)
|
|
1344
|
+
{
|
|
1345
|
+
//DOMIntegration: handle uppercase versions of node names.
|
|
1346
|
+
return HTMLSupport .getNodeTypeName (typeName);
|
|
1347
|
+
},
|
|
1348
|
+
attributeToCamelCase: function (node, name)
|
|
1349
|
+
{
|
|
1350
|
+
//DOMIntegration: handle lowercase versions of field names.
|
|
1351
|
+
|
|
1352
|
+
if (node instanceof X3DPrototypeInstance)
|
|
1353
|
+
return this .protoFields .get (node .getProtoNode ()) .get (name);
|
|
1354
|
+
|
|
1355
|
+
return HTMLSupport .getFieldName (name);
|
|
1356
|
+
},
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1257
1359
|
export default XMLParser;
|
package/src/x_ite.html
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
<!-- Text -->
|
|
15
15
|
<script src="../node_modules/opentype.js/dist/opentype.js"></script>
|
|
16
16
|
<!-- Texturing3D -->
|
|
17
|
-
<script src="../node_modules/CharLS.js/dist/charLS-
|
|
17
|
+
<script src="../node_modules/CharLS.js/dist/charLS-DynamicMemory-browser.js"></script>
|
|
18
18
|
<script src="../node_modules/dicom-parser/dist/dicomParser.js"></script>
|
|
19
19
|
<script src="../node_modules/jpeg-js/lib/decoder.js"></script>
|
|
20
20
|
<script src="../node_modules/jpeg-lossless-decoder-js/release/current/lossless.js"></script>
|
|
21
|
-
<script src="../node_modules/OpenJPEG.js/dist/openJPEG-
|
|
21
|
+
<script src="../node_modules/OpenJPEG.js/dist/openJPEG-DynamicMemory-browser.js"></script>
|
|
22
22
|
<!-- X_ITE END -->
|
|
23
23
|
<!-- JQUERY -->
|
|
24
24
|
|
package/webpack.config.js
CHANGED
|
@@ -223,10 +223,10 @@ export default __default__;`;
|
|
|
223
223
|
opentype: "opentype.js/dist/opentype.js",
|
|
224
224
|
},
|
|
225
225
|
Texturing3D: {
|
|
226
|
-
CharLS: "CharLS.js/dist/charLS-
|
|
226
|
+
CharLS: "CharLS.js/dist/charLS-DynamicMemory-browser.js",
|
|
227
227
|
dicomParser: "dicom-parser/dist/dicomParser.js",
|
|
228
228
|
jpeg: "jpeg-lossless-decoder-js/release/current/lossless.js",
|
|
229
|
-
OpenJPEG: "OpenJPEG.js/dist/openJPEG-
|
|
229
|
+
OpenJPEG: "OpenJPEG.js/dist/openJPEG-DynamicMemory-browser.js",
|
|
230
230
|
JpegImage: "jpeg-js/lib/decoder.js",
|
|
231
231
|
},
|
|
232
232
|
}
|