x_ite 8.6.8 → 8.6.9

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.
Files changed (102) hide show
  1. package/.vscode/tasks.json +1 -1
  2. package/dist/assets/components/Annotation.js +13 -13
  3. package/dist/assets/components/Annotation.min.js +1 -1
  4. package/dist/assets/components/CADGeometry.js +13 -13
  5. package/dist/assets/components/CADGeometry.min.js +1 -1
  6. package/dist/assets/components/CubeMapTexturing.js +25 -25
  7. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  8. package/dist/assets/components/DIS.js +13 -13
  9. package/dist/assets/components/DIS.min.js +1 -1
  10. package/dist/assets/components/EventUtilities.js +9 -9
  11. package/dist/assets/components/EventUtilities.min.js +1 -1
  12. package/dist/assets/components/Geometry2D.js +19 -19
  13. package/dist/assets/components/Geometry2D.min.js +1 -1
  14. package/dist/assets/components/Geospatial.js +33 -33
  15. package/dist/assets/components/Geospatial.min.js +1 -1
  16. package/dist/assets/components/HAnim.js +18 -18
  17. package/dist/assets/components/HAnim.min.js +1 -1
  18. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  19. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  20. package/dist/assets/components/Layout.js +27 -27
  21. package/dist/assets/components/Layout.min.js +1 -1
  22. package/dist/assets/components/NURBS.js +24 -24
  23. package/dist/assets/components/NURBS.min.js +1 -1
  24. package/dist/assets/components/ParticleSystems.js +25 -27
  25. package/dist/assets/components/ParticleSystems.min.js +1 -1
  26. package/dist/assets/components/Picking.js +19 -19
  27. package/dist/assets/components/Picking.min.js +1 -1
  28. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  29. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  30. package/dist/assets/components/Scripting.js +28 -28
  31. package/dist/assets/components/Scripting.min.js +1 -1
  32. package/dist/assets/components/Text.js +24 -24
  33. package/dist/assets/components/Text.min.js +1 -1
  34. package/dist/assets/components/TextureProjector.js +14 -14
  35. package/dist/assets/components/TextureProjector.min.js +1 -1
  36. package/dist/assets/components/Texturing3D.js +30 -30
  37. package/dist/assets/components/Texturing3D.min.js +1 -1
  38. package/dist/assets/components/VolumeRendering.js +19 -19
  39. package/dist/assets/components/VolumeRendering.min.js +1 -1
  40. package/dist/assets/components/X_ITE.js +9 -9
  41. package/dist/assets/components/X_ITE.min.js +1 -1
  42. package/dist/x_ite.css +1 -1
  43. package/dist/x_ite.js +897 -660
  44. package/dist/x_ite.min.js +1 -1
  45. package/dist/x_ite.zip +0 -0
  46. package/docs/_config.yml +2 -2
  47. package/docs/laboratory/gltf-sample-viewer.html +4 -4
  48. package/package.json +1 -1
  49. package/src/assets/shaders/webgl1/Pointing.fs.js +1 -1
  50. package/src/assets/shaders/webgl1/include/Fragment.glsl.js +17 -1
  51. package/src/assets/shaders/webgl1/include/Point.glsl.js +10 -2
  52. package/src/assets/shaders/webgl1/include/Texture.glsl.js +31 -1
  53. package/src/assets/shaders/webgl1/include/Vertex.glsl.js +24 -0
  54. package/src/assets/shaders/webgl2/Pointing.fs.js +1 -1
  55. package/src/assets/shaders/webgl2/include/Fragment.glsl.js +18 -0
  56. package/src/assets/shaders/webgl2/include/Point.glsl.js +12 -4
  57. package/src/assets/shaders/webgl2/include/Texture.glsl.js +17 -20
  58. package/src/assets/shaders/webgl2/include/Vertex.glsl.js +24 -0
  59. package/src/bookmarks.js +1 -1
  60. package/src/tests.js +1 -0
  61. package/src/x_ite/Browser/Core/BrowserOptions.js +3 -0
  62. package/src/x_ite/Browser/Core/BrowserTimings.js +12 -11
  63. package/src/x_ite/Browser/Core/Context.js +64 -64
  64. package/src/x_ite/Browser/Core/ContextMenu.js +0 -9
  65. package/src/x_ite/Browser/Navigation/ExamineViewer.js +1 -1
  66. package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +8 -0
  67. package/src/x_ite/Browser/VERSION.js +1 -1
  68. package/src/x_ite/Browser/X3DBrowser.js +1 -1
  69. package/src/x_ite/Components/Core/X3DBindableNode.js +0 -2
  70. package/src/x_ite/Components/Core/X3DNode.js +3 -8
  71. package/src/x_ite/Components/Layering/X3DLayerNode.js +6 -2
  72. package/src/x_ite/Components/Navigation/NavigationInfo.js +1 -0
  73. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +34 -21
  74. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +2 -4
  75. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +5 -19
  76. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +6 -12
  77. package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +4 -8
  78. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +28 -27
  79. package/src/x_ite/Components/Shape/Material.js +4 -0
  80. package/src/x_ite/Components/Shape/PhysicalMaterial.js +4 -0
  81. package/src/x_ite/Components/Shape/TwoSidedMaterial.js +1 -0
  82. package/src/x_ite/Components/Shape/X3DMaterialNode.js +21 -19
  83. package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +4 -0
  84. package/src/x_ite/Components/Texturing/ImageTexture.js +77 -48
  85. package/src/x_ite/Components/Texturing/MultiTexture.js +7 -4
  86. package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +19 -16
  87. package/src/x_ite/Components/Texturing/MultiTextureTransform.js +16 -32
  88. package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +1 -1
  89. package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +2 -8
  90. package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +2 -8
  91. package/src/x_ite/Execution/NamedNodesHandling.js +84 -0
  92. package/src/x_ite/Execution/X3DExecutionContext.js +7 -37
  93. package/src/x_ite/Execution/X3DScene.js +5 -0
  94. package/src/x_ite/InputOutput/FileLoader.js +1 -1
  95. package/src/x_ite/InputOutput/Generator.js +32 -81
  96. package/src/x_ite/Parser/GLTF2Parser.js +109 -43
  97. package/src/x_ite/Parser/OBJParser.js +42 -30
  98. package/src/x_ite/Parser/STLAParser.js +3 -0
  99. package/src/x_ite/Parser/SVGParser.js +4 -0
  100. package/src/x_ite/Rendering/X3DRenderObject.js +2 -0
  101. package/src/x_ite.html +52 -46
  102. package/x_ite.min.html +52 -46
@@ -0,0 +1,84 @@
1
+ /*******************************************************************************
2
+ *
3
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
+ *
5
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
6
+ *
7
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
8
+ *
9
+ * The copyright notice above does not evidence any actual of intended
10
+ * publication of such source code, and is an unpublished work by create3000.
11
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
12
+ * create3000.
13
+ *
14
+ * No permission is granted to copy, distribute, or create derivative works from
15
+ * the contents of this software, in whole or in part, without the prior written
16
+ * permission of create3000.
17
+ *
18
+ * NON-MILITARY USE ONLY
19
+ *
20
+ * All create3000 software are effectively free software with a non-military use
21
+ * restriction. It is free. Well commented source is provided. You may reuse the
22
+ * source in any way you please with the exception anything that uses it must be
23
+ * marked to indicate is contains 'non-military use only' components.
24
+ *
25
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26
+ *
27
+ * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
28
+ *
29
+ * This file is part of the X_ITE Project.
30
+ *
31
+ * X_ITE is free software: you can redistribute it and/or modify it under the
32
+ * terms of the GNU General Public License version 3 only, as published by the
33
+ * Free Software Foundation.
34
+ *
35
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
36
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
37
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
38
+ * details (a copy is included in the LICENSE file that accompanied this code).
39
+ *
40
+ * You should have received a copy of the GNU General Public License version 3
41
+ * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
42
+ * copy of the GPLv3 License.
43
+ *
44
+ * For Silvio, Joy and Adi.
45
+ *
46
+ ******************************************************************************/
47
+
48
+ export const getUniqueName = function (array, name = "", number = false)
49
+ {
50
+ name = String (name) .replace (/_\d+$/, "");
51
+
52
+ let
53
+ newName = number ? `${name}_1` : name,
54
+ lo = 1,
55
+ hi = 1;
56
+
57
+ while (array .has (newName) || newName .length === 0)
58
+ {
59
+ lo = hi;
60
+ hi <<= 1;
61
+
62
+ newName = `${name}_${lo}`;
63
+ }
64
+
65
+ lo >>>= 1;
66
+ hi >>>= 1;
67
+
68
+ if (lo && hi)
69
+ {
70
+ while (lo < hi)
71
+ {
72
+ const m = (lo + hi) >>> 1;
73
+
74
+ if (array .has (`${name}_${m}`))
75
+ lo = m + 1;
76
+ else
77
+ hi = m;
78
+ }
79
+
80
+ newName = `${name}_${lo}`;
81
+ }
82
+
83
+ return newName;
84
+ };
@@ -48,6 +48,7 @@
48
48
  import SupportedNodes from "../Configuration/SupportedNodes.js";
49
49
  import Fields from "../Fields.js";
50
50
  import X3DBaseNode from "../Base/X3DBaseNode.js";
51
+ import { getUniqueName } from "./NamedNodesHandling.js";
51
52
  import NamedNodesArray from "./NamedNodesArray.js";
52
53
  import X3DImportedNode from "./X3DImportedNode.js";
53
54
  import ImportedNodesArray from "./ImportedNodesArray.js";
@@ -60,7 +61,6 @@ import X3DRoute from "../Routing/X3DRoute.js";
60
61
  import X3DCast from "../Base/X3DCast.js";
61
62
  import X3DConstants from "../Base/X3DConstants.js";
62
63
  import SFNodeCache from "../Fields/SFNodeCache.js";
63
- import Algorithm from "../../standard/Math/Algorithm.js";
64
64
 
65
65
  SupportedNodes .addAbstractType ("X3DExecutionContext", X3DExecutionContext);
66
66
 
@@ -281,9 +281,9 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
281
281
  {
282
282
  return this [_namedNodes];
283
283
  },
284
- getUniqueName: function (name = "")
284
+ getUniqueName: function (name)
285
285
  {
286
- return getUniqueName .call (this, _namedNodes, name);
286
+ return getUniqueName (this [_namedNodes], name);
287
287
  },
288
288
  addImportedNode: function (inlineNode, exportedName, importedName)
289
289
  {
@@ -464,9 +464,9 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
464
464
  {
465
465
  return this [_protos];
466
466
  },
467
- getUniqueProtoName: function (name = "")
467
+ getUniqueProtoName: function (name)
468
468
  {
469
- return getUniqueName .call (this, _protos, name);
469
+ return getUniqueName (this [_protos], name);
470
470
  },
471
471
  getExternProtoDeclaration: function (name)
472
472
  {
@@ -528,9 +528,9 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
528
528
  {
529
529
  return this [_externprotos];
530
530
  },
531
- getUniqueExternProtoName: function (name = "")
531
+ getUniqueExternProtoName: function (name)
532
532
  {
533
- return getUniqueName .call (this, _externprotos, name);
533
+ return getUniqueName (this [_externprotos], name);
534
534
  },
535
535
  addRoute: function (sourceNode, sourceField, destinationNode, destinationField)
536
536
  {
@@ -917,36 +917,6 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
917
917
  },
918
918
  });
919
919
 
920
- const getUniqueName = (function ()
921
- {
922
- const _TrailingNumbers = /_\d+$/;
923
-
924
- return function (array, name = "")
925
- {
926
- name = String (name) .replace (_TrailingNumbers, "");
927
-
928
- let
929
- newName = name,
930
- i = 64;
931
-
932
- for (; i;)
933
- {
934
- if (! (this [array] .has (newName) || newName .length === 0))
935
- break;
936
-
937
- const
938
- min = i,
939
- max = i <<= 1;
940
-
941
- newName = name;
942
- newName += '_';
943
- newName += Math .round (Algorithm .random (min, max));
944
- }
945
-
946
- return newName;
947
- };
948
- })();
949
-
950
920
  for (const key of Reflect .ownKeys (X3DExecutionContext .prototype))
951
921
  Object .defineProperty (X3DExecutionContext .prototype, key, { enumerable: false });
952
922
 
@@ -48,6 +48,7 @@
48
48
  import SupportedNodes from "../Configuration/SupportedNodes.js";
49
49
  import Fields from "../Fields.js";
50
50
  import X3DExecutionContext from "./X3DExecutionContext.js";
51
+ import { getUniqueName } from "./NamedNodesHandling.js";
51
52
  import ComponentInfoArray from "../Configuration/ComponentInfoArray.js";
52
53
  import UnitInfo from "../Configuration/UnitInfo.js";
53
54
  import UnitInfoArray from "../Configuration/UnitInfoArray.js";
@@ -357,6 +358,10 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
357
358
  {
358
359
  return this [_exportedNodes];
359
360
  },
361
+ getUniqueExportName: function (name)
362
+ {
363
+ return getUniqueName (this [_exportedNodes], name);
364
+ },
360
365
  addRootNode: function (node)
361
366
  {
362
367
  node = SFNodeCache .get (X3DCast (X3DConstants .X3DNode, node, false));
@@ -132,7 +132,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
132
132
  else
133
133
  scene .setExecutionContext (this .executionContext);
134
134
 
135
- scene .setWorldURL (decodeURI (new URL (worldURL, this .getReferer ()) .href));
135
+ scene .setWorldURL (new URL (worldURL, this .getReferer ()) .href);
136
136
 
137
137
  if (success)
138
138
  success = this .setScene .bind (this, scene, success, error);
@@ -45,7 +45,8 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DConstants from "../Base/X3DConstants.js";
48
+ import X3DConstants from "../Base/X3DConstants.js";
49
+ import { getUniqueName } from "../Execution/NamedNodesHandling.js";
49
50
 
50
51
  function Generator ({ style = "TIDY", precision = 7, doublePrecision = 15 })
51
52
  {
@@ -67,12 +68,11 @@ function Generator ({ style = "TIDY", precision = 7, doublePrecision = 15 })
67
68
  this .importedNames = new Map ();
68
69
  this .routeNodes = new Set ();
69
70
  this .level = 0;
70
- this .newName = 0;
71
71
  this .containerFields = [ ];
72
72
  this .units = true;
73
73
  this .unitCategories = [ ];
74
74
 
75
- this .names .set (null, new Map ());
75
+ this .names .set (null, new Set ());
76
76
  }
77
77
 
78
78
  Generator .prototype =
@@ -212,7 +212,7 @@ Generator .prototype =
212
212
  this .executionContextStack .push (executionContext);
213
213
 
214
214
  if (! this .names .has (executionContext))
215
- this .names .set (executionContext, new Map ());
215
+ this .names .set (executionContext, Object .assign (new Set (), { index: 0 }));
216
216
 
217
217
  if (! this .importedNodesIndex .has (executionContext))
218
218
  this .importedNodesIndex .set (executionContext, new Set ());
@@ -236,9 +236,6 @@ Generator .prototype =
236
236
  },
237
237
  EnterScope: function ()
238
238
  {
239
- if (this .level === 0)
240
- this .newName = 0;
241
-
242
239
  ++ this .level;
243
240
  },
244
241
  LeaveScope: function ()
@@ -306,79 +303,47 @@ Generator .prototype =
306
303
  {
307
304
  return this .nodes .has (baseNode);
308
305
  },
309
- Name: (function ()
306
+ Name: function (baseNode)
310
307
  {
311
- const _TrailingNumbers = /_\d+$/;
308
+ // Is the node already in index.
312
309
 
313
- return function (baseNode)
314
- {
315
- // Is the node already in index
310
+ const name = this .namesByNode .get (baseNode);
316
311
 
317
- const name = this .namesByNode .get (baseNode);
312
+ if (name !== undefined)
313
+ {
314
+ return name;
315
+ }
316
+ else
317
+ {
318
+ const
319
+ name = baseNode .getName (),
320
+ match = name .match (/^(.*?)(_\d+)?$/),
321
+ names = this .names .get (this .ExecutionContext ());
318
322
 
319
- if (name !== undefined)
323
+ if (match [1])
320
324
  {
321
- return name;
325
+ // The node has a name.
326
+
327
+ var newName = getUniqueName (names, name, !! match [2]);
322
328
  }
323
329
  else
324
330
  {
325
- const names = this .names .get (this .ExecutionContext ());
326
-
327
- // The node has no name
328
-
329
- if (baseNode .getName () .length === 0)
330
- {
331
- if (this .NeedsName (baseNode))
332
- {
333
- const name = this .UniqueName ();
334
-
335
- names .set (name, baseNode);
336
- this .namesByNode .set (baseNode, name);
337
-
338
- return name;
339
- }
340
-
341
- // The node doesn't need a name
342
-
343
- return baseNode .getName ();
344
- }
345
-
346
- // The node has a name
347
-
348
- let name = baseNode .getName ();
349
- const hasNumber = name .match (_TrailingNumbers) !== null;
331
+ // The node has no name.
350
332
 
351
- name = name .replace (_TrailingNumbers, "");
333
+ if (!this .NeedsName (baseNode))
334
+ return "";
352
335
 
353
- if (name .length === 0)
354
- {
355
- if (this .NeedsName (baseNode))
356
- name = this .UniqueName ();
357
-
358
- else
359
- return "";
360
- }
361
- else
362
- {
363
- let
364
- i = 0,
365
- newName = hasNumber ? name + '_' + (++ i) : name;
366
-
367
- while (names .has (newName))
368
- {
369
- newName = name + '_' + (++ i);
370
- }
336
+ var newName = `_${++ names .index}`;
337
+ }
371
338
 
372
- name = newName;
373
- }
339
+ // Add to indices.
374
340
 
375
- names .set (name, baseNode);
376
- this .namesByNode .set (baseNode, name);
341
+ names .add (newName);
342
+ this .namesByNode .set (baseNode, newName);
377
343
 
378
- return name;
379
- }
380
- };
381
- })(),
344
+ return newName;
345
+ }
346
+ },
382
347
  NeedsName: function (baseNode)
383
348
  {
384
349
  if (baseNode .getCloneCount () > 1)
@@ -409,20 +374,6 @@ Generator .prototype =
409
374
  return false;
410
375
  }
411
376
  },
412
- UniqueName: function ()
413
- {
414
- const names = this .names .get (this .ExecutionContext ());
415
-
416
- for (; ;)
417
- {
418
- const name = '_' + (++ this .newName);
419
-
420
- if (names .has (name))
421
- continue;
422
-
423
- return name;
424
- }
425
- },
426
377
  LocalName: function (baseNode)
427
378
  {
428
379
  const importedName = this .importedNames .get (baseNode);