x_ite 8.6.19 → 8.6.22
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/Makefile +1 -4
- package/README.md +1 -1
- package/build/bin/components.js +45 -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 +22 -22
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +18 -18
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- 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/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +30 -30
- 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 +796 -654
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_posts/dom-integration.md +14 -12
- package/docs/_posts/getting-started.md +31 -29
- package/docs/_posts/reference/ecmascript-object-and-function-definitions.md +1 -1
- package/docs/_posts/reference/scene-services.md +6 -3
- package/docs/_posts/report-a-bug.md +5 -3
- package/docs/_posts/setup-a-localhost-server.md +7 -7
- package/docs/_posts/tutorials/writing-program-scripts-with-ecmascript.md +1 -1
- package/docs/_tabs/playground.html +31 -28
- package/package.json +1 -1
- package/src/locale/de.po.js +9 -0
- package/src/locale/fr.po.js +31 -25
- package/src/tests.js +1 -0
- package/src/x_ite/Base/X3DBaseNode.js +2 -12
- package/src/x_ite/Base/X3DInfoArray.js +0 -2
- package/src/x_ite/Base/X3DObjectArrayField.js +0 -2
- package/src/x_ite/Base/X3DTypedArrayField.js +0 -2
- package/src/x_ite/Browser/Core/BrowserTimings.js +147 -67
- package/src/x_ite/Browser/Core/ContextMenu.js +2 -2
- package/src/x_ite/Browser/Core/X3DCoreContext.js +6 -2
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +3 -0
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +13 -5
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +14 -22
- package/src/x_ite/Browser/X3DBrowserContext.js +0 -1
- package/src/x_ite/Components/Core/X3DNode.js +40 -9
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +5 -5
- package/src/x_ite/Configuration/ComponentInfo.js +2 -1
- package/src/x_ite/Configuration/ProfileInfo.js +1 -0
- package/src/x_ite/Configuration/UnitInfo.js +3 -5
- package/src/x_ite/Execution/BindableList.js +34 -27
- package/src/x_ite/Execution/BindableStack.js +15 -17
- package/src/x_ite/Execution/X3DExecutionContext.js +11 -21
- package/src/x_ite/Execution/X3DExportedNode.js +1 -3
- package/src/x_ite/Execution/X3DImportedNode.js +2 -6
- package/src/x_ite/Execution/X3DScene.js +30 -28
- package/src/x_ite/Fields/ArrayFields.js +4 -4
- package/src/x_ite/Fields/SFColor.js +0 -3
- package/src/x_ite/Fields/SFColorRGBA.js +0 -4
- package/src/x_ite/Fields/SFImage.js +0 -4
- package/src/x_ite/Fields/SFMatrix3.js +0 -1
- package/src/x_ite/Fields/SFMatrix4.js +0 -1
- package/src/x_ite/Fields/SFRotation.js +0 -4
- package/src/x_ite/Fields/SFString.js +7 -4
- package/src/x_ite/Fields/SFVec2.js +0 -2
- package/src/x_ite/Fields/SFVec3.js +0 -3
- package/src/x_ite/Fields/SFVec4.js +0 -4
- package/src/x_ite/InputOutput/FileLoader.js +13 -18
- package/src/x_ite/InputOutput/Generator.js +86 -16
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +6 -11
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +5 -8
- package/src/x_ite/Routing/X3DRoute.js +1 -5
- package/src/x_ite/X3DCanvasElement.js +2 -0
- package/src/x_ite.css +5 -1
- package/src/x_ite.html +4 -36
- package/x_ite.min.html +4 -36
|
@@ -399,6 +399,7 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
399
399
|
},
|
|
400
400
|
toVRMLStream: function (generator)
|
|
401
401
|
{
|
|
402
|
+
generator .string += generator .Indent ();
|
|
402
403
|
generator .string += "#X3D V";
|
|
403
404
|
generator .string += LATEST_VERSION;
|
|
404
405
|
generator .string += generator .Space ();
|
|
@@ -430,34 +431,29 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
430
431
|
generator .string += generator .TidyBreak ();
|
|
431
432
|
}
|
|
432
433
|
|
|
433
|
-
|
|
434
|
-
{
|
|
435
|
-
let empty = true;
|
|
434
|
+
const units = this .getUnits () .filter (unit => unit .conversionFactor !== 1);
|
|
436
435
|
|
|
437
|
-
|
|
436
|
+
if (units .length)
|
|
437
|
+
{
|
|
438
|
+
for (const unit of units)
|
|
438
439
|
{
|
|
439
|
-
|
|
440
|
-
{
|
|
441
|
-
empty = false;
|
|
442
|
-
|
|
443
|
-
unit .toVRMLStream (generator);
|
|
440
|
+
unit .toVRMLStream (generator);
|
|
444
441
|
|
|
445
|
-
|
|
446
|
-
}
|
|
442
|
+
generator .string += generator .Break ();
|
|
447
443
|
}
|
|
448
444
|
|
|
449
|
-
|
|
450
|
-
generator .string += generator .TidyBreak ();
|
|
445
|
+
generator .string += generator .TidyBreak ();
|
|
451
446
|
}
|
|
452
447
|
|
|
453
448
|
const metadata = this .getMetaDatas ();
|
|
454
449
|
|
|
455
450
|
if (metadata .size)
|
|
456
451
|
{
|
|
457
|
-
for (const [key, values] of metadata
|
|
452
|
+
for (const [key, values] of metadata)
|
|
458
453
|
{
|
|
459
454
|
for (const value of values)
|
|
460
455
|
{
|
|
456
|
+
generator .string += generator .Indent ();
|
|
461
457
|
generator .string += "META";
|
|
462
458
|
generator .string += generator .Space ();
|
|
463
459
|
generator .string += new Fields .SFString (key) .toString ();
|
|
@@ -490,15 +486,21 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
490
486
|
},
|
|
491
487
|
toXMLStream: function (generator)
|
|
492
488
|
{
|
|
493
|
-
generator .
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
489
|
+
if (!generator .html)
|
|
490
|
+
{
|
|
491
|
+
generator .string += generator .Indent ();
|
|
492
|
+
generator .string += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
|
493
|
+
generator .string += generator .TidyBreak ();
|
|
494
|
+
generator .string += generator .Indent ();
|
|
495
|
+
generator .string += "<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D ";
|
|
496
|
+
generator .string += LATEST_VERSION;
|
|
497
|
+
generator .string += "//EN\" \"http://www.web3d.org/specifications/x3d-";
|
|
498
|
+
generator .string += LATEST_VERSION;
|
|
499
|
+
generator .string += ".dtd\">";
|
|
500
|
+
generator .string += generator .TidyBreak ();
|
|
501
|
+
}
|
|
501
502
|
|
|
503
|
+
generator .string += generator .Indent ();
|
|
502
504
|
generator .string += "<X3D";
|
|
503
505
|
generator .string += generator .Space ();
|
|
504
506
|
generator .string += "profile='";
|
|
@@ -542,7 +544,7 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
542
544
|
}
|
|
543
545
|
}
|
|
544
546
|
|
|
545
|
-
for (const [key, values] of this .getMetaDatas ()
|
|
547
|
+
for (const [key, values] of this .getMetaDatas ())
|
|
546
548
|
{
|
|
547
549
|
for (const value of values)
|
|
548
550
|
{
|
|
@@ -556,7 +558,7 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
556
558
|
generator .string += "content='";
|
|
557
559
|
generator .string += generator .XMLEncode (value);
|
|
558
560
|
generator .string += "'";
|
|
559
|
-
generator .string += "/>";
|
|
561
|
+
generator .string += generator .closingTags ? "></meta>" : "/>";
|
|
560
562
|
generator .string += generator .TidyBreak ();
|
|
561
563
|
}
|
|
562
564
|
}
|
|
@@ -612,13 +614,14 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
612
614
|
|
|
613
615
|
generator .DecIndent ();
|
|
614
616
|
|
|
617
|
+
generator .string += generator .Indent ();
|
|
615
618
|
generator .string += "</X3D>";
|
|
616
|
-
generator .string += generator .TidyBreak ();
|
|
617
619
|
},
|
|
618
620
|
toJSONStream: function (generator)
|
|
619
621
|
{
|
|
620
622
|
// X3D
|
|
621
623
|
|
|
624
|
+
generator .string += generator .Indent ();
|
|
622
625
|
generator .string += '{';
|
|
623
626
|
generator .string += generator .TidySpace ();
|
|
624
627
|
generator .string += '"';
|
|
@@ -756,9 +759,9 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
756
759
|
|
|
757
760
|
// Meta data
|
|
758
761
|
|
|
759
|
-
for (const [i, [key, values]] of [... this .getMetaDatas ()]
|
|
762
|
+
for (const [i, [key, values]] of [... this .getMetaDatas ()])
|
|
760
763
|
{
|
|
761
|
-
for (const [j, value] of values
|
|
764
|
+
for (const [j, value] of values)
|
|
762
765
|
{
|
|
763
766
|
generator .string += generator .Indent ();
|
|
764
767
|
generator .string += '{';
|
|
@@ -957,7 +960,6 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
|
|
|
957
960
|
generator .string += generator .DecIndent ();
|
|
958
961
|
generator .string += generator .Indent ();
|
|
959
962
|
generator .string += '}';
|
|
960
|
-
generator .string += generator .TidyBreak ();
|
|
961
963
|
},
|
|
962
964
|
});
|
|
963
965
|
|
|
@@ -325,7 +325,7 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
|
|
|
325
325
|
generator .string += "'";
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
generator .string += "/>";
|
|
328
|
+
generator .string += generator .closingTags ? "></NULL>" : "/>";
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
@@ -451,7 +451,7 @@ MFString .prototype = Object .assign (Object .create (X3DObjectArrayField .proto
|
|
|
451
451
|
{
|
|
452
452
|
return X3DConstants .MFString;
|
|
453
453
|
},
|
|
454
|
-
toXMLStream: function (generator)
|
|
454
|
+
toXMLStream: function (generator, sourceText)
|
|
455
455
|
{
|
|
456
456
|
const
|
|
457
457
|
target = this .getTarget (),
|
|
@@ -464,14 +464,14 @@ MFString .prototype = Object .assign (Object .create (X3DObjectArrayField .proto
|
|
|
464
464
|
for (let i = 0, n = length - 1; i < n; ++ i)
|
|
465
465
|
{
|
|
466
466
|
generator .string += "\"";
|
|
467
|
-
value [i] .toXMLStream (generator);
|
|
467
|
+
value [i] .toXMLStream (generator, sourceText);
|
|
468
468
|
generator .string += "\"";
|
|
469
469
|
generator .string += generator .Comma ();
|
|
470
470
|
generator .string += generator .TidySpace ();
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
generator .string += "\"";
|
|
474
|
-
value .at (-1) .toXMLStream (generator);
|
|
474
|
+
value .at (-1) .toXMLStream (generator, sourceText);
|
|
475
475
|
generator .string += "\"";
|
|
476
476
|
}
|
|
477
477
|
},
|
|
@@ -189,7 +189,6 @@ const r = {
|
|
|
189
189
|
this .addEvent ();
|
|
190
190
|
},
|
|
191
191
|
enumerable: true,
|
|
192
|
-
configurable: false
|
|
193
192
|
};
|
|
194
193
|
|
|
195
194
|
const g = {
|
|
@@ -203,7 +202,6 @@ const g = {
|
|
|
203
202
|
this .addEvent ();
|
|
204
203
|
},
|
|
205
204
|
enumerable: true,
|
|
206
|
-
configurable: false
|
|
207
205
|
};
|
|
208
206
|
|
|
209
207
|
const b = {
|
|
@@ -217,7 +215,6 @@ const b = {
|
|
|
217
215
|
this .addEvent ();
|
|
218
216
|
},
|
|
219
217
|
enumerable: true,
|
|
220
|
-
configurable: false
|
|
221
218
|
};
|
|
222
219
|
|
|
223
220
|
Object .defineProperty (SFColor .prototype, "r", r);
|
|
@@ -142,7 +142,6 @@ const r = {
|
|
|
142
142
|
this .addEvent ();
|
|
143
143
|
},
|
|
144
144
|
enumerable: true,
|
|
145
|
-
configurable: false
|
|
146
145
|
};
|
|
147
146
|
|
|
148
147
|
const g = {
|
|
@@ -156,7 +155,6 @@ const g = {
|
|
|
156
155
|
this .addEvent ();
|
|
157
156
|
},
|
|
158
157
|
enumerable: true,
|
|
159
|
-
configurable: false
|
|
160
158
|
};
|
|
161
159
|
|
|
162
160
|
const b = {
|
|
@@ -170,7 +168,6 @@ const b = {
|
|
|
170
168
|
this .addEvent ();
|
|
171
169
|
},
|
|
172
170
|
enumerable: true,
|
|
173
|
-
configurable: false
|
|
174
171
|
};
|
|
175
172
|
|
|
176
173
|
const a = {
|
|
@@ -184,7 +181,6 @@ const a = {
|
|
|
184
181
|
this .addEvent ();
|
|
185
182
|
},
|
|
186
183
|
enumerable: true,
|
|
187
|
-
configurable: false
|
|
188
184
|
};
|
|
189
185
|
|
|
190
186
|
Object .defineProperty (SFColorRGBA .prototype, "r", r);
|
|
@@ -299,7 +299,6 @@ const width = {
|
|
|
299
299
|
this .addEvent ();
|
|
300
300
|
},
|
|
301
301
|
enumerable: true,
|
|
302
|
-
configurable: false
|
|
303
302
|
};
|
|
304
303
|
|
|
305
304
|
const height = {
|
|
@@ -313,7 +312,6 @@ const height = {
|
|
|
313
312
|
this .addEvent ();
|
|
314
313
|
},
|
|
315
314
|
enumerable: true,
|
|
316
|
-
configurable: false
|
|
317
315
|
};
|
|
318
316
|
|
|
319
317
|
const comp = {
|
|
@@ -327,7 +325,6 @@ const comp = {
|
|
|
327
325
|
this .addEvent ();
|
|
328
326
|
},
|
|
329
327
|
enumerable: true,
|
|
330
|
-
configurable: false
|
|
331
328
|
};
|
|
332
329
|
|
|
333
330
|
const array = {
|
|
@@ -341,7 +338,6 @@ const array = {
|
|
|
341
338
|
this .addEvent ();
|
|
342
339
|
},
|
|
343
340
|
enumerable: true,
|
|
344
|
-
configurable: false
|
|
345
341
|
};
|
|
346
342
|
|
|
347
343
|
Object .defineProperty (SFImage .prototype, "width", width);
|
|
@@ -212,7 +212,6 @@ const x = {
|
|
|
212
212
|
this .addEvent ();
|
|
213
213
|
},
|
|
214
214
|
enumerable: true,
|
|
215
|
-
configurable: false
|
|
216
215
|
};
|
|
217
216
|
|
|
218
217
|
const y = {
|
|
@@ -226,7 +225,6 @@ const y = {
|
|
|
226
225
|
this .addEvent ();
|
|
227
226
|
},
|
|
228
227
|
enumerable: true,
|
|
229
|
-
configurable: false
|
|
230
228
|
};
|
|
231
229
|
|
|
232
230
|
const z = {
|
|
@@ -240,7 +238,6 @@ const z = {
|
|
|
240
238
|
this .addEvent ();
|
|
241
239
|
},
|
|
242
240
|
enumerable: true,
|
|
243
|
-
configurable: false
|
|
244
241
|
};
|
|
245
242
|
|
|
246
243
|
const angle = {
|
|
@@ -254,7 +251,6 @@ const angle = {
|
|
|
254
251
|
this .addEvent ();
|
|
255
252
|
},
|
|
256
253
|
enumerable: true,
|
|
257
|
-
configurable: false
|
|
258
254
|
};
|
|
259
255
|
|
|
260
256
|
Object .defineProperty (SFRotation .prototype, "x", x);
|
|
@@ -95,15 +95,19 @@ SFString .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
|
95
95
|
valueOf: X3DField .prototype .getValue,
|
|
96
96
|
toStream: function (generator)
|
|
97
97
|
{
|
|
98
|
-
generator .string += '"'
|
|
98
|
+
generator .string += '"';
|
|
99
|
+
generator .string += SFString .escape (this .getValue ());
|
|
100
|
+
generator .string += '"';
|
|
99
101
|
},
|
|
100
102
|
toVRMLStream: function (generator)
|
|
101
103
|
{
|
|
102
104
|
this .toStream (generator);
|
|
103
105
|
},
|
|
104
|
-
toXMLStream: function (generator)
|
|
106
|
+
toXMLStream: function (generator, sourceText)
|
|
105
107
|
{
|
|
106
|
-
generator .string +=
|
|
108
|
+
generator .string += sourceText
|
|
109
|
+
? generator .XMLEncodeSourceText (this .getValue ())
|
|
110
|
+
: generator .XMLEncode (this .getValue ());
|
|
107
111
|
},
|
|
108
112
|
toJSONStream: function (generator)
|
|
109
113
|
{
|
|
@@ -127,7 +131,6 @@ Object .defineProperty (SFString .prototype, "length",
|
|
|
127
131
|
return this .getValue () .length;
|
|
128
132
|
},
|
|
129
133
|
enumerable: true,
|
|
130
|
-
configurable: false
|
|
131
134
|
});
|
|
132
135
|
|
|
133
136
|
export default SFString;
|
|
@@ -89,7 +89,6 @@ function SFVec2Template (TypeName, Type, double)
|
|
|
89
89
|
this .addEvent ();
|
|
90
90
|
},
|
|
91
91
|
enumerable: true,
|
|
92
|
-
configurable: false
|
|
93
92
|
};
|
|
94
93
|
|
|
95
94
|
const y = {
|
|
@@ -103,7 +102,6 @@ function SFVec2Template (TypeName, Type, double)
|
|
|
103
102
|
this .addEvent ();
|
|
104
103
|
},
|
|
105
104
|
enumerable: true,
|
|
106
|
-
configurable: false
|
|
107
105
|
};
|
|
108
106
|
|
|
109
107
|
Object .defineProperty (SFVec2 .prototype, "x", x);
|
|
@@ -93,7 +93,6 @@ function SFVec3Template (TypeName, Type, double)
|
|
|
93
93
|
this .addEvent ();
|
|
94
94
|
},
|
|
95
95
|
enumerable: true,
|
|
96
|
-
configurable: false
|
|
97
96
|
};
|
|
98
97
|
|
|
99
98
|
const y = {
|
|
@@ -107,7 +106,6 @@ function SFVec3Template (TypeName, Type, double)
|
|
|
107
106
|
this .addEvent ();
|
|
108
107
|
},
|
|
109
108
|
enumerable: true,
|
|
110
|
-
configurable: false
|
|
111
109
|
};
|
|
112
110
|
|
|
113
111
|
const z = {
|
|
@@ -121,7 +119,6 @@ function SFVec3Template (TypeName, Type, double)
|
|
|
121
119
|
this .addEvent ();
|
|
122
120
|
},
|
|
123
121
|
enumerable: true,
|
|
124
|
-
configurable: false
|
|
125
122
|
};
|
|
126
123
|
|
|
127
124
|
Object .defineProperty (SFVec3 .prototype, "x", x);
|
|
@@ -89,7 +89,6 @@ function SFVec4Template (TypeName, Type, double)
|
|
|
89
89
|
this .addEvent ();
|
|
90
90
|
},
|
|
91
91
|
enumerable: true,
|
|
92
|
-
configurable: false
|
|
93
92
|
};
|
|
94
93
|
|
|
95
94
|
const y = {
|
|
@@ -103,7 +102,6 @@ function SFVec4Template (TypeName, Type, double)
|
|
|
103
102
|
this .addEvent ();
|
|
104
103
|
},
|
|
105
104
|
enumerable: true,
|
|
106
|
-
configurable: false
|
|
107
105
|
};
|
|
108
106
|
|
|
109
107
|
const z = {
|
|
@@ -117,7 +115,6 @@ function SFVec4Template (TypeName, Type, double)
|
|
|
117
115
|
this .addEvent ();
|
|
118
116
|
},
|
|
119
117
|
enumerable: true,
|
|
120
|
-
configurable: false
|
|
121
118
|
};
|
|
122
119
|
|
|
123
120
|
const w = {
|
|
@@ -131,7 +128,6 @@ function SFVec4Template (TypeName, Type, double)
|
|
|
131
128
|
this .addEvent ();
|
|
132
129
|
},
|
|
133
130
|
enumerable: true,
|
|
134
|
-
configurable: false
|
|
135
131
|
};
|
|
136
132
|
|
|
137
133
|
Object .defineProperty (SFVec4 .prototype, "x", x);
|
|
@@ -72,11 +72,10 @@ function FileLoader (node, external)
|
|
|
72
72
|
this .browser = node .getBrowser ();
|
|
73
73
|
this .external = external === undefined ? this .browser .isExternal () : external;
|
|
74
74
|
this .executionContext = this .external ? node .getExecutionContext () : this .browser .currentScene;
|
|
75
|
-
this .userAgent = this .browser .getName () + "/" + this .browser .getVersion () + " (X3D Browser; +" + this .browser .getProviderUrl () + ")";
|
|
76
75
|
this .target = "";
|
|
77
76
|
this .url = [ ];
|
|
78
77
|
this .URL = new URL (this .getReferer (), this .getReferer ());
|
|
79
|
-
this .
|
|
78
|
+
this .controller = new AbortController ();
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
@@ -84,24 +83,20 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
84
83
|
constructor: FileLoader,
|
|
85
84
|
abort: function ()
|
|
86
85
|
{
|
|
87
|
-
this .
|
|
88
|
-
|
|
89
|
-
this .
|
|
90
|
-
},
|
|
91
|
-
isPrivate: function ()
|
|
92
|
-
{
|
|
93
|
-
return true;
|
|
86
|
+
this .url .length = 0;
|
|
87
|
+
|
|
88
|
+
this .controller .abort ();
|
|
94
89
|
},
|
|
95
|
-
|
|
90
|
+
getURL: function ()
|
|
96
91
|
{
|
|
97
92
|
return this .URL;
|
|
98
93
|
},
|
|
99
94
|
getReferer: function ()
|
|
100
95
|
{
|
|
101
|
-
if (this .node
|
|
96
|
+
if (this .node instanceof X3DWorld)
|
|
102
97
|
{
|
|
103
98
|
if (this .external)
|
|
104
|
-
return this .browser .
|
|
99
|
+
return this .browser .getBaseURL ();
|
|
105
100
|
}
|
|
106
101
|
|
|
107
102
|
return this .executionContext .getWorldURL ();
|
|
@@ -199,7 +194,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
199
194
|
createX3DFromURLAsync: function (callback, data)
|
|
200
195
|
{
|
|
201
196
|
if (data === null)
|
|
202
|
-
callback (null
|
|
197
|
+
callback (null);
|
|
203
198
|
else
|
|
204
199
|
this .createX3DFromString (this .URL, data, callback, this .loadDocumentError .bind (this));
|
|
205
200
|
},
|
|
@@ -248,7 +243,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
248
243
|
if (result [3] === "base64")
|
|
249
244
|
data = atob (data);
|
|
250
245
|
else
|
|
251
|
-
data =
|
|
246
|
+
data = decodeURIComponent (data);
|
|
252
247
|
|
|
253
248
|
this .callback (data);
|
|
254
249
|
return;
|
|
@@ -288,7 +283,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
288
283
|
// Load URL async
|
|
289
284
|
|
|
290
285
|
const
|
|
291
|
-
options = { cache: this .node .getCache () ? "default" : "reload" },
|
|
286
|
+
options = { cache: this .node .getCache () ? "default" : "reload", signal: this .controller .signal },
|
|
292
287
|
response = this .handleErrors (await fetch (this .URL .href, options)),
|
|
293
288
|
contentType = response .headers .get ("content-type") ?.replace (/;.*$/, "");
|
|
294
289
|
|
|
@@ -304,10 +299,10 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
304
299
|
},
|
|
305
300
|
handleErrors: function (response)
|
|
306
301
|
{
|
|
307
|
-
if (
|
|
308
|
-
|
|
302
|
+
if (response .ok)
|
|
303
|
+
return response;
|
|
309
304
|
|
|
310
|
-
|
|
305
|
+
throw Error (response .statusText || response .status);
|
|
311
306
|
},
|
|
312
307
|
loadDocumentError: function (exception)
|
|
313
308
|
{
|
|
@@ -47,17 +47,43 @@
|
|
|
47
47
|
|
|
48
48
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
49
49
|
import { getUniqueName } from "../Execution/NamedNodesHandling.js";
|
|
50
|
+
import Algorithm from "../../standard/Math/Algorithm.js";
|
|
50
51
|
|
|
51
|
-
function Generator ({ style = "TIDY", precision = 7, doublePrecision = 15 })
|
|
52
|
+
function Generator ({ style = "TIDY", indent = "", precision = 7, doublePrecision = 15, html = false, closingTags = false })
|
|
52
53
|
{
|
|
53
|
-
this .
|
|
54
|
+
this .string = "";
|
|
55
|
+
this .indent = indent;
|
|
56
|
+
this .listIndent = indent;
|
|
57
|
+
this .precision = Algorithm .clamp (precision, 1, 21);
|
|
58
|
+
this .doublePrecision = Algorithm .clamp (doublePrecision, 1, 21);
|
|
59
|
+
this .html = html;
|
|
60
|
+
this .closingTags = html || closingTags;
|
|
61
|
+
|
|
62
|
+
this .floatFormat = new Intl .NumberFormat ("en", {
|
|
63
|
+
notation: "standard",
|
|
64
|
+
maximumSignificantDigits: this .precision,
|
|
65
|
+
useGrouping: false,
|
|
66
|
+
}) .format;
|
|
67
|
+
|
|
68
|
+
this .floatExponentialFormat = new Intl .NumberFormat ("en", {
|
|
69
|
+
notation: "scientific",
|
|
70
|
+
maximumSignificantDigits: this .precision,
|
|
71
|
+
useGrouping: false,
|
|
72
|
+
}) .format;
|
|
73
|
+
|
|
74
|
+
this .doubleFormat = new Intl .NumberFormat ("en", {
|
|
75
|
+
notation: "standard",
|
|
76
|
+
maximumSignificantDigits: this .doublePrecision,
|
|
77
|
+
useGrouping: false,
|
|
78
|
+
}) .format;
|
|
79
|
+
|
|
80
|
+
this .doubleExponentialFormat = new Intl .NumberFormat ("en", {
|
|
81
|
+
notation: "scientific",
|
|
82
|
+
maximumSignificantDigits: this .doublePrecision,
|
|
83
|
+
useGrouping: false,
|
|
84
|
+
}) .format;
|
|
54
85
|
|
|
55
|
-
this .
|
|
56
|
-
this .indent = "";
|
|
57
|
-
this .listIndent = "";
|
|
58
|
-
this .precision = precision;
|
|
59
|
-
this .doublePrecision = doublePrecision;
|
|
60
|
-
this .removeTrailingZeros = /(?:\.|(\.[0-9]*?))0*(?=[eE]|$)/;
|
|
86
|
+
this .Style (style);
|
|
61
87
|
|
|
62
88
|
this .executionContextStack = [ null ];
|
|
63
89
|
this .importedNodesIndex = new Map ();
|
|
@@ -84,6 +110,8 @@ Generator .prototype =
|
|
|
84
110
|
{
|
|
85
111
|
case "CLEAN":
|
|
86
112
|
{
|
|
113
|
+
this .listIndent = "";
|
|
114
|
+
|
|
87
115
|
this .comma = " ";
|
|
88
116
|
this .break = " ";
|
|
89
117
|
this .tidyBreak = "";
|
|
@@ -97,6 +125,8 @@ Generator .prototype =
|
|
|
97
125
|
}
|
|
98
126
|
case "SMALL":
|
|
99
127
|
{
|
|
128
|
+
this .listIndent = "";
|
|
129
|
+
|
|
100
130
|
this .comma = ",";
|
|
101
131
|
this .break = "\n";
|
|
102
132
|
this .tidyBreak = "\n";
|
|
@@ -110,6 +140,8 @@ Generator .prototype =
|
|
|
110
140
|
}
|
|
111
141
|
case "COMPACT":
|
|
112
142
|
{
|
|
143
|
+
this .listIndent = "";
|
|
144
|
+
|
|
113
145
|
this .comma = ",";
|
|
114
146
|
this .break = "\n";
|
|
115
147
|
this .tidyBreak = "\n";
|
|
@@ -194,18 +226,42 @@ Generator .prototype =
|
|
|
194
226
|
},
|
|
195
227
|
DecIndent: function ()
|
|
196
228
|
{
|
|
197
|
-
this .indent
|
|
229
|
+
this .indent = this .indent .slice (0, this .indent .length - this .indentChar .length);
|
|
198
230
|
this .listIndent = this .listIndent .slice (0, this .listIndent .length - this .listIndentChar .length);
|
|
199
231
|
|
|
200
232
|
return "";
|
|
201
233
|
},
|
|
202
|
-
Precision: function
|
|
234
|
+
Precision: function (value)
|
|
203
235
|
{
|
|
204
|
-
|
|
236
|
+
if (Number .isFinite (value))
|
|
237
|
+
{
|
|
238
|
+
const exponent = Math .log10 (Math .abs (value));
|
|
239
|
+
|
|
240
|
+
if ((this .precision > exponent && exponent >= -4) || value === 0)
|
|
241
|
+
return this .floatFormat (Math .fround (value));
|
|
242
|
+
|
|
243
|
+
return this .floatExponentialFormat (Math .fround (value)) .toLowerCase ();
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
{
|
|
247
|
+
return String (value);
|
|
248
|
+
}
|
|
205
249
|
},
|
|
206
|
-
DoublePrecision: function
|
|
250
|
+
DoublePrecision: function (value)
|
|
207
251
|
{
|
|
208
|
-
|
|
252
|
+
if (Number .isFinite (value))
|
|
253
|
+
{
|
|
254
|
+
const exponent = Math .log10 (Math .abs (value));
|
|
255
|
+
|
|
256
|
+
if ((this .doublePrecision > exponent && exponent >= -4) || value === 0)
|
|
257
|
+
return this .doubleFormat (value);
|
|
258
|
+
|
|
259
|
+
return this .doubleExponentialFormat (value) .toLowerCase ();
|
|
260
|
+
}
|
|
261
|
+
else
|
|
262
|
+
{
|
|
263
|
+
return String (value);
|
|
264
|
+
}
|
|
209
265
|
},
|
|
210
266
|
PushExecutionContext: function (executionContext)
|
|
211
267
|
{
|
|
@@ -471,10 +527,24 @@ Generator .prototype =
|
|
|
471
527
|
return string .replace (regex, char => map [char]);
|
|
472
528
|
};
|
|
473
529
|
})(),
|
|
474
|
-
|
|
530
|
+
XMLEncodeSourceText: (function ()
|
|
475
531
|
{
|
|
476
|
-
|
|
477
|
-
|
|
532
|
+
const map = {
|
|
533
|
+
"\\": "\\\\",
|
|
534
|
+
"\"": "\\\"",
|
|
535
|
+
"'": "'",
|
|
536
|
+
"<": "<",
|
|
537
|
+
">": ">",
|
|
538
|
+
"&": "&",
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
const regex = /([\\"'<>&])/g;
|
|
542
|
+
|
|
543
|
+
return function (string)
|
|
544
|
+
{
|
|
545
|
+
return string .replace (regex, char => map [char]);
|
|
546
|
+
};
|
|
547
|
+
})(),
|
|
478
548
|
JSONEncode: (function ()
|
|
479
549
|
{
|
|
480
550
|
const map = {
|