x_ite 8.9.2 → 8.9.4

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 (64) hide show
  1. package/dist/assets/components/Annotation.js +13 -13
  2. package/dist/assets/components/Annotation.min.js +1 -1
  3. package/dist/assets/components/CADGeometry.js +13 -13
  4. package/dist/assets/components/CADGeometry.min.js +1 -1
  5. package/dist/assets/components/CubeMapTexturing.js +25 -25
  6. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  7. package/dist/assets/components/DIS.js +13 -13
  8. package/dist/assets/components/DIS.min.js +1 -1
  9. package/dist/assets/components/EventUtilities.js +9 -9
  10. package/dist/assets/components/EventUtilities.min.js +1 -1
  11. package/dist/assets/components/Geometry2D.js +19 -19
  12. package/dist/assets/components/Geometry2D.min.js +1 -1
  13. package/dist/assets/components/Geospatial.js +77 -73
  14. package/dist/assets/components/Geospatial.min.js +1 -1
  15. package/dist/assets/components/HAnim.js +19 -19
  16. package/dist/assets/components/HAnim.min.js +1 -1
  17. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  18. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  19. package/dist/assets/components/Layout.js +27 -27
  20. package/dist/assets/components/Layout.min.js +1 -1
  21. package/dist/assets/components/NURBS.js +31 -30
  22. package/dist/assets/components/NURBS.min.js +1 -1
  23. package/dist/assets/components/ParticleSystems.js +23 -23
  24. package/dist/assets/components/ParticleSystems.min.js +1 -1
  25. package/dist/assets/components/Picking.js +18 -18
  26. package/dist/assets/components/Picking.min.js +1 -1
  27. package/dist/assets/components/RigidBodyPhysics.js +71 -83
  28. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  29. package/dist/assets/components/Scripting.js +38 -38
  30. package/dist/assets/components/Scripting.min.js +1 -1
  31. package/dist/assets/components/Text.js +24 -24
  32. package/dist/assets/components/Text.min.js +1 -1
  33. package/dist/assets/components/TextureProjector.js +14 -14
  34. package/dist/assets/components/TextureProjector.min.js +1 -1
  35. package/dist/assets/components/Texturing3D.js +30 -30
  36. package/dist/assets/components/Texturing3D.min.js +1 -1
  37. package/dist/assets/components/VolumeRendering.js +18 -18
  38. package/dist/assets/components/VolumeRendering.min.js +1 -1
  39. package/dist/assets/components/X_ITE.js +9 -9
  40. package/dist/assets/components/X_ITE.min.js +1 -1
  41. package/dist/x_ite.css +1 -1
  42. package/dist/x_ite.js +778 -801
  43. package/dist/x_ite.min.js +1 -1
  44. package/dist/x_ite.zip +0 -0
  45. package/docs/_config.yml +1 -1
  46. package/docs/_posts/getting-started.md +7 -1
  47. package/package.json +2 -2
  48. package/src/tests.js +360 -0
  49. package/src/x_ite/Browser/VERSION.js +1 -1
  50. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +11 -20
  51. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +8 -5
  52. package/src/x_ite/Components/Geometry3D/Extrusion.js +10 -12
  53. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +46 -56
  54. package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +44 -40
  55. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +7 -6
  56. package/src/x_ite/Components/Networking/X3DUrlObject.js +2 -3
  57. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +11 -13
  58. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +4 -6
  59. package/src/x_ite/Components/RigidBodyPhysics/BallJoint.js +8 -9
  60. package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +8 -4
  61. package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +20 -21
  62. package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +12 -13
  63. package/src/x_ite/Components/RigidBodyPhysics/SliderJoint.js +6 -7
  64. package/src/x_ite/Components/Scripting/Script.js +1 -1
@@ -88,25 +88,9 @@ Object .assign (Object .setPrototypeOf (X3DPrototypeInstance .prototype, X3DNode
88
88
  {
89
89
  this [_body] ?.dispose ();
90
90
 
91
- const protoNode = this [_protoNode];
92
-
93
- if (protoNode .isExternProto)
94
- {
95
- if (protoNode .checkLoadState () !== X3DConstants .COMPLETE_STATE)
96
- {
97
- this [_body] = null;
98
-
99
- if (this .isInitialized ())
100
- X3DChildObject .prototype .addEvent .call (this);
101
-
102
- protoNode ._updateInstances .addInterest ("construct", this);
103
- protoNode .requestImmediateLoad () .catch (Function .prototype);
104
-
105
- return;
106
- }
107
- }
108
-
109
- const proto = protoNode .getProtoDeclaration ();
91
+ const
92
+ protoNode = this [_protoNode],
93
+ proto = protoNode .getProtoDeclaration ();
110
94
 
111
95
  // If there is a proto, the externproto is completely loaded.
112
96
 
@@ -249,7 +233,14 @@ Object .assign (Object .setPrototypeOf (X3DPrototypeInstance .prototype, X3DNode
249
233
 
250
234
  protoNode ._name_changed .addFieldInterest (this ._typeName_changed);
251
235
 
252
- this .construct ();
236
+ if (protoNode .isExternProto && protoNode .checkLoadState () !== X3DConstants .COMPLETE_STATE)
237
+ {
238
+ protoNode ._updateInstances .addInterest ("construct", this);
239
+ }
240
+ else
241
+ {
242
+ this .construct ();
243
+ }
253
244
  },
254
245
  getBody ()
255
246
  {
@@ -196,11 +196,11 @@ Object .assign (Object .setPrototypeOf (ElevationGrid .prototype, X3DGeometryNod
196
196
  {
197
197
  const
198
198
  cw = ! this ._ccw .getValue (),
199
- normalIndex = [ ],
199
+ normalIndex = new Map (),
200
200
  normals = [ ];
201
201
 
202
202
  for (let p = 0, length = points .length; p < length; ++ p)
203
- normalIndex [p] = [ ];
203
+ normalIndex .set (p, [ ]);
204
204
 
205
205
  for (let c = 0, length = coordIndex .length; c < length; c += 3)
206
206
  {
@@ -209,9 +209,9 @@ Object .assign (Object .setPrototypeOf (ElevationGrid .prototype, X3DGeometryNod
209
209
  c1 = coordIndex [c + 1],
210
210
  c2 = coordIndex [c + 2];
211
211
 
212
- normalIndex [c0] .push (normals .length);
213
- normalIndex [c1] .push (normals .length + 1);
214
- normalIndex [c2] .push (normals .length + 2);
212
+ normalIndex .get (c0) .push (normals .length);
213
+ normalIndex .get (c1) .push (normals .length + 1);
214
+ normalIndex .get (c2) .push (normals .length + 2);
215
215
 
216
216
  const normal = Triangle3 .normal (points [c0], points [c1], points [c2], new Vector3 (0, 0, 0));
217
217
 
@@ -223,6 +223,9 @@ Object .assign (Object .setPrototypeOf (ElevationGrid .prototype, X3DGeometryNod
223
223
  normals .push (normal);
224
224
  }
225
225
 
226
+ // if (!this ._normalPerVertex .getValue ())
227
+ // return normals;
228
+
226
229
  return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
227
230
  },
228
231
  createCoordIndex ()
@@ -381,12 +381,12 @@ Object .assign (Object .setPrototypeOf (Extrusion .prototype, X3DGeometryNode .p
381
381
  // Create
382
382
 
383
383
  const
384
- normalIndex = [ ],
384
+ normalIndex = new Map (),
385
385
  normals = [ ],
386
386
  points = this .createPoints ();
387
387
 
388
388
  for (let p = 0, length = points .length; p < length; ++ p)
389
- normalIndex [p] = [ ];
389
+ normalIndex .set (p, [ ]);
390
390
 
391
391
  // Build body.
392
392
 
@@ -490,19 +490,19 @@ Object .assign (Object .setPrototypeOf (Extrusion .prototype, X3DGeometryNode .p
490
490
  texCoordArray .push (k / numCrossSection_1, y, 0, 1);
491
491
  }
492
492
 
493
- normalIndex [i1] .push (normals .length);
493
+ normalIndex .get (i1) .push (normals .length);
494
494
  normals .push (normal1);
495
495
  vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
496
496
 
497
497
  // p2
498
498
  texCoordArray .push ((k + 1) / numCrossSection_1, n / numSpine_1, 0, 1);
499
- normalIndex [i2] .push (normals .length);
499
+ normalIndex .get (i2) .push (normals .length);
500
500
  normals .push (normal1);
501
501
  vertexArray .push (p2 .x, p2 .y, p2 .z, 1);
502
502
 
503
503
  // p3
504
504
  texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
505
- normalIndex [i3] .push (normals .length);
505
+ normalIndex .get (i3) .push (normals .length);
506
506
  normals .push (normal1);
507
507
  vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
508
508
  }
@@ -513,7 +513,7 @@ Object .assign (Object .setPrototypeOf (Extrusion .prototype, X3DGeometryNode .p
513
513
  {
514
514
  // p1
515
515
  texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1);
516
- normalIndex [i1] .push (normals .length);
516
+ normalIndex .get (i1) .push (normals .length);
517
517
  normals .push (normal2);
518
518
  vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
519
519
 
@@ -530,13 +530,13 @@ Object .assign (Object .setPrototypeOf (Extrusion .prototype, X3DGeometryNode .p
530
530
  texCoordArray .push ((k + 1) / numCrossSection_1, y, 0, 1);
531
531
  }
532
532
 
533
- normalIndex [i3] .push (normals .length);
533
+ normalIndex .get (i3) .push (normals .length);
534
534
  normals .push (normal2);
535
535
  vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
536
536
 
537
537
  // p4
538
538
  texCoordArray .push (k / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
539
- normalIndex [i4] .push (normals .length);
539
+ normalIndex .get (i4) .push (normals .length);
540
540
  normals .push (normal2);
541
541
  vertexArray .push (p4 .x, p4 .y, p4 .z, 1);
542
542
  }
@@ -545,12 +545,10 @@ Object .assign (Object .setPrototypeOf (Extrusion .prototype, X3DGeometryNode .p
545
545
 
546
546
  // Refine body normals and add them.
547
547
 
548
- const refineNormals = this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
548
+ const refinedNormals = this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
549
549
 
550
- for (const normal of refineNormals)
551
- {
550
+ for (const normal of refinedNormals)
552
551
  normalArray .push (normal .x, normal .y, normal .z);
553
- }
554
552
 
555
553
  // Build caps
556
554
 
@@ -319,80 +319,70 @@ Object .assign (Object .setPrototypeOf (IndexedFaceSet .prototype, X3DComposedGe
319
319
  }
320
320
  }
321
321
  },
322
- createNormals: (() =>
322
+ createNormals (polygons)
323
323
  {
324
324
  const
325
- normals = [ ],
326
- normalIndex = [ ];
325
+ cw = !this ._ccw .getValue (),
326
+ coordIndex = this ._coordIndex .getValue (),
327
+ coord = this .getCoord (),
328
+ normalIndex = new Map (),
329
+ normals = [ ];
327
330
 
328
- return function (polygons)
331
+ for (const polygon of polygons)
329
332
  {
330
333
  const
331
- cw = ! this ._ccw .getValue (),
332
- coordIndex = this ._coordIndex .getValue (),
333
- coord = this .getCoord ();
334
+ vertices = polygon .vertices,
335
+ length = vertices .length;
334
336
 
335
- normals .length = 0;
336
- normalIndex .length = 0;
337
-
338
- for (const polygon of polygons)
337
+ switch (length)
339
338
  {
340
- const
341
- vertices = polygon .vertices,
342
- length = vertices .length;
343
-
344
- switch (length)
339
+ case 3:
345
340
  {
346
- case 3:
347
- {
348
- var normal = coord .getNormal (coordIndex [vertices [0]],
349
- coordIndex [vertices [1]],
350
- coordIndex [vertices [2]]);
351
- break;
352
- }
353
- case 4:
354
- {
355
- var normal = coord .getQuadNormal (coordIndex [vertices [0]],
356
- coordIndex [vertices [1]],
357
- coordIndex [vertices [2]],
358
- coordIndex [vertices [3]]);
359
- break;
360
- }
361
- default:
362
- {
363
- var normal = this .getPolygonNormal (vertices, coordIndex, coord);
364
- break;
365
- }
341
+ var normal = coord .getNormal (coordIndex [vertices [0]],
342
+ coordIndex [vertices [1]],
343
+ coordIndex [vertices [2]]);
344
+ break;
366
345
  }
367
-
368
- // Add a normal index for each point.
369
-
370
- for (let i = 0; i < length; ++ i)
346
+ case 4:
371
347
  {
372
- const
373
- index = vertices [i],
374
- point = coordIndex [index];
348
+ var normal = coord .getQuadNormal (coordIndex [vertices [0]],
349
+ coordIndex [vertices [1]],
350
+ coordIndex [vertices [2]],
351
+ coordIndex [vertices [3]]);
352
+ break;
353
+ }
354
+ default:
355
+ {
356
+ var normal = this .getPolygonNormal (vertices, coordIndex, coord);
357
+ break;
358
+ }
359
+ }
375
360
 
376
- let pointNormals = normalIndex [point];
361
+ // Add a normal index for each point.
377
362
 
378
- if (!pointNormals)
379
- pointNormals = normalIndex [point] = [ ];
363
+ for (const index of vertices)
364
+ {
365
+ const point = coordIndex [index];
380
366
 
381
- pointNormals .push (index);
382
- }
367
+ let pointNormals = normalIndex .get (point);
383
368
 
384
- if (cw)
385
- normal .negate ();
369
+ if (!pointNormals)
370
+ normalIndex .set (point, pointNormals = [ ]);
386
371
 
387
- // Add this normal for each vertex.
372
+ pointNormals .push (index);
388
373
 
389
- for (let i = 0; i < length; ++ i)
390
- normals [vertices [i]] = normal;
374
+ normals [index] = normal;
391
375
  }
392
376
 
393
- return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
394
- };
395
- })(),
377
+ if (cw)
378
+ normal .negate ();
379
+ }
380
+
381
+ // if (!this ._normalPerVertex .getValue ())
382
+ // return normals;
383
+
384
+ return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
385
+ },
396
386
  getPolygonNormal: (() =>
397
387
  {
398
388
  let
@@ -136,16 +136,16 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
136
136
  },
137
137
  createTexCoords ()
138
138
  {
139
- var
139
+ const
140
140
  texCoords = [ ],
141
141
  xDimension = this ._xDimension .getValue (),
142
142
  zDimension = this ._zDimension .getValue (),
143
143
  xSize = xDimension - 1,
144
144
  zSize = zDimension - 1;
145
145
 
146
- for (var z = 0; z < zDimension; ++ z)
146
+ for (let z = 0; z < zDimension; ++ z)
147
147
  {
148
- for (var x = 0; x < xDimension; ++ x)
148
+ for (let x = 0; x < xDimension; ++ x)
149
149
  texCoords .push (new Vector2 (x / xSize, z / zSize));
150
150
  }
151
151
 
@@ -153,26 +153,26 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
153
153
  },
154
154
  createNormals (points, coordIndex, creaseAngle)
155
155
  {
156
- var
157
- cw = ! this ._ccw .getValue (),
158
- normalIndex = [ ],
156
+ const
157
+ cw = !this ._ccw .getValue (),
158
+ normalIndex = new Map (),
159
159
  normals = [ ];
160
160
 
161
- for (var p = 0; p < points .length; ++ p)
162
- normalIndex [p] = [ ];
161
+ for (let p = 0; p < points .length; ++ p)
162
+ normalIndex .set (p, [ ]);
163
163
 
164
- for (var c = 0; c < coordIndex .length; c += 3)
164
+ for (let c = 0; c < coordIndex .length; c += 3)
165
165
  {
166
- var
166
+ const
167
167
  c0 = coordIndex [c],
168
168
  c1 = coordIndex [c + 1],
169
169
  c2 = coordIndex [c + 2];
170
170
 
171
- normalIndex [c0] .push (normals .length);
172
- normalIndex [c1] .push (normals .length + 1);
173
- normalIndex [c2] .push (normals .length + 2);
171
+ normalIndex .get (c0) .push (normals .length);
172
+ normalIndex .get (c1) .push (normals .length + 1);
173
+ normalIndex .get (c2) .push (normals .length + 2);
174
174
 
175
- var normal = Triangle3 .normal (points [c0], points [c1], points [c2], new Vector3 (0, 0, 0));
175
+ const normal = Triangle3 .normal (points [c0], points [c1], points [c2], new Vector3 (0, 0, 0));
176
176
 
177
177
  if (cw)
178
178
  normal .negate ();
@@ -182,6 +182,9 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
182
182
  normals .push (normal);
183
183
  }
184
184
 
185
+ // if (!this ._normalPerVertex .getValue ())
186
+ // return normals;
187
+
185
188
  return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
186
189
  },
187
190
  createCoordIndex ()
@@ -190,18 +193,18 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
190
193
  // | \ |
191
194
  // p2 - p3
192
195
 
193
- var
196
+ const
194
197
  coordIndex = [ ],
195
198
  xDimension = this ._xDimension .getValue (),
196
199
  zDimension = this ._zDimension .getValue (),
197
200
  xSize = xDimension - 1,
198
201
  zSize = zDimension - 1;
199
202
 
200
- for (var z = 0; z < zSize; ++ z)
203
+ for (let z = 0; z < zSize; ++ z)
201
204
  {
202
- for (var x = 0; x < xSize; ++ x)
205
+ for (let x = 0; x < xSize; ++ x)
203
206
  {
204
- var
207
+ const
205
208
  i1 = z * xDimension + x,
206
209
  i2 = (z + 1) * xDimension + x,
207
210
  i3 = (z + 1) * xDimension + (x + 1),
@@ -221,7 +224,7 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
221
224
  },
222
225
  createPoints ()
223
226
  {
224
- var
227
+ const
225
228
  points = [ ],
226
229
  xDimension = this ._xDimension .getValue (),
227
230
  zDimension = this ._zDimension .getValue (),
@@ -237,13 +240,13 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
237
240
 
238
241
  if (this .getStandardOrder ())
239
242
  {
240
- for (var z = 0; z < zDimension; ++ z)
243
+ for (let z = 0; z < zDimension; ++ z)
241
244
  {
242
- for (var x = 0; x < xDimension; ++ x)
245
+ for (let x = 0; x < xDimension; ++ x)
243
246
  {
244
- var point = new Vector3 (zSpacing * z, // latitude, northing
245
- xSpacing * x, // longitude, easting
246
- this .getHeight (x + z * xDimension));
247
+ const point = new Vector3 (zSpacing * z, // latitude, northing
248
+ xSpacing * x, // longitude, easting
249
+ this .getHeight (x + z * xDimension));
247
250
 
248
251
  point .add (this ._geoGridOrigin .getValue ());
249
252
 
@@ -253,13 +256,13 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
253
256
  }
254
257
  else
255
258
  {
256
- for (var z = 0; z < zDimension; ++ z)
259
+ for (let z = 0; z < zDimension; ++ z)
257
260
  {
258
- for (var x = 0; x < xDimension; ++ x)
261
+ for (let x = 0; x < xDimension; ++ x)
259
262
  {
260
- var point = new Vector3 (xSpacing * x, // longitude, easting
261
- zSpacing * z, // latitude, northing
262
- this .getHeight (x + z * xDimension));
263
+ const point = new Vector3 (xSpacing * x, // longitude, easting
264
+ zSpacing * z, // latitude, northing
265
+ this .getHeight (x + z * xDimension));
263
266
 
264
267
  point .add (this ._geoGridOrigin .getValue ());
265
268
 
@@ -275,7 +278,7 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
275
278
  if (this ._xDimension .getValue () < 2 || this ._zDimension .getValue () < 2)
276
279
  return;
277
280
 
278
- var
281
+ const
279
282
  colorPerVertex = this ._colorPerVertex .getValue (),
280
283
  normalPerVertex = this ._normalPerVertex .getValue (),
281
284
  coordIndex = this .createCoordIndex (),
@@ -286,8 +289,9 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
286
289
  colorArray = this .getColors (),
287
290
  multiTexCoordArray = this .getMultiTexCoords (),
288
291
  normalArray = this .getNormals (),
289
- vertexArray = this .getVertices (),
290
- face = 0;
292
+ vertexArray = this .getVertices ();
293
+
294
+ let face = 0;
291
295
 
292
296
  // Vertex attribute
293
297
 
@@ -311,11 +315,11 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
311
315
 
312
316
  // Build geometry
313
317
 
314
- for (var c = 0; c < coordIndex .length; ++ face)
318
+ for (let c = 0; c < coordIndex .length; ++ face)
315
319
  {
316
- for (var p = 0; p < 6; ++ p, ++ c)
320
+ for (let p = 0; p < 6; ++ p, ++ c)
317
321
  {
318
- var
322
+ const
319
323
  index = coordIndex [c],
320
324
  point = points [index];
321
325
 
@@ -336,7 +340,7 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
336
340
  }
337
341
  else
338
342
  {
339
- var t = texCoords [index];
343
+ const t = texCoords [index];
340
344
 
341
345
  texCoordArray .push (t .x, t .y, 0, 1);
342
346
  }
@@ -356,13 +360,13 @@ Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, X3DGeometry
356
360
 
357
361
  // Add auto-generated normals if needed.
358
362
 
359
- if (! normalNode)
363
+ if (!normalNode)
360
364
  {
361
- var normals = this .createNormals (points, coordIndex);
365
+ const normals = this .createNormals (points, coordIndex);
362
366
 
363
- for (var i = 0; i < normals .length; ++ i)
367
+ for (let i = 0; i < normals .length; ++ i)
364
368
  {
365
- var normal = normals [i];
369
+ const normal = normals [i];
366
370
 
367
371
  normalArray .push (normal .x, normal .y, normal .z);
368
372
  }
@@ -165,7 +165,7 @@ Object .assign (Object .setPrototypeOf (X3DNurbsSurfaceGeometryNode .prototype,
165
165
  if (this ._vDimension .getValue () < this ._vOrder .getValue ())
166
166
  return;
167
167
 
168
- if (! this .controlPointNode)
168
+ if (!this .controlPointNode)
169
169
  return;
170
170
 
171
171
  if (this .controlPointNode .getSize () !== this ._uDimension .getValue () * this ._vDimension .getValue ())
@@ -320,17 +320,18 @@ Object .assign (Object .setPrototypeOf (X3DNurbsSurfaceGeometryNode .prototype,
320
320
  createNormals (faces, points)
321
321
  {
322
322
  const
323
+ normalIndex = new Map (),
323
324
  normals = this .createFaceNormals (faces, points),
324
- normalIndex = [ ];
325
+ length = faces .length;
325
326
 
326
- for (let i = 0, length = faces .length; i < length; ++ i)
327
+ for (let i = 0; i < length; ++ i)
327
328
  {
328
329
  const index = faces [i];
329
330
 
330
- let pointIndex = normalIndex [index];
331
+ let pointIndex = normalIndex .get (index);
331
332
 
332
- if (! pointIndex)
333
- pointIndex = normalIndex [index] = [ ];
333
+ if (!pointIndex)
334
+ normalIndex .set (index, pointIndex = [ ]);
334
335
 
335
336
  pointIndex .push (i);
336
337
  }
@@ -45,9 +45,8 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import Fields from "../../Fields.js";
49
- import X3DConstants from "../../Base/X3DConstants.js";
50
- import X3DProtoDeclaration from "../../Prototype/X3DProtoDeclaration.js";
48
+ import Fields from "../../Fields.js";
49
+ import X3DConstants from "../../Base/X3DConstants.js";
51
50
 
52
51
  const
53
52
  _cache = Symbol (),
@@ -271,26 +271,24 @@ Object .assign (Object .setPrototypeOf (X3DComposedGeometryNode .prototype, X3DG
271
271
  {
272
272
  const normals = this .createFaceNormals (verticesPerPolygon, polygonsSize);
273
273
 
274
- if (this ._normalPerVertex .getValue ())
275
- {
276
- const normalIndex = [ ];
274
+ if (!this ._normalPerVertex .getValue ())
275
+ return normals;
277
276
 
278
- for (let i = 0; i < polygonsSize; ++ i)
279
- {
280
- const index = this .getPolygonIndex (i);
277
+ const normalIndex = new Map ();
281
278
 
282
- let pointIndex = normalIndex [index];
279
+ for (let i = 0; i < polygonsSize; ++ i)
280
+ {
281
+ const index = this .getPolygonIndex (i);
283
282
 
284
- if (!pointIndex)
285
- pointIndex = normalIndex [index] = [ ];
283
+ let pointIndex = normalIndex .get (index);
286
284
 
287
- pointIndex .push (i);
288
- }
285
+ if (!pointIndex)
286
+ normalIndex .set (index, pointIndex = [ ]);
289
287
 
290
- return this .refineNormals (normalIndex, normals, Math .PI);
288
+ pointIndex .push (i);
291
289
  }
292
290
 
293
- return normals;
291
+ return this .refineNormals (normalIndex, normals, Math .PI);
294
292
  },
295
293
  createFaceNormals (verticesPerPolygon, polygonsSize)
296
294
  {
@@ -441,12 +441,10 @@ Object .assign (Object .setPrototypeOf (X3DGeometryNode .prototype, X3DNode .pro
441
441
 
442
442
  const
443
443
  cosCreaseAngle = Math .cos (Algorithm .clamp (creaseAngle, 0, Math .PI)),
444
- normals_ = [ ];
444
+ refinedNormals = [ ];
445
445
 
446
- for (const i in normalIndex) // Don't use forEach
446
+ for (const vertex of normalIndex .values ())
447
447
  {
448
- const vertex = normalIndex [i];
449
-
450
448
  for (const p of vertex)
451
449
  {
452
450
  const
@@ -461,11 +459,11 @@ Object .assign (Object .setPrototypeOf (X3DGeometryNode .prototype, X3DNode .pro
461
459
  N .add (Q);
462
460
  }
463
461
 
464
- normals_ [p] = N .normalize ();
462
+ refinedNormals [p] = N .normalize ();
465
463
  }
466
464
  }
467
465
 
468
- return normals_;
466
+ return refinedNormals;
469
467
  },
470
468
  transformLine (hitRay)
471
469
  {
@@ -62,7 +62,7 @@ function BallJoint (executionContext)
62
62
  this ._anchorPoint .setUnit ("length");
63
63
 
64
64
  this .joint = null;
65
- this .outputs = { };
65
+ this .outputs = new Set ();
66
66
  this .localAnchorPoint1 = new Vector3 (0, 0, 0);
67
67
  this .localAnchorPoint2 = new Vector3 (0, 0, 0);
68
68
  }
@@ -114,8 +114,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, X3DRigidJointNode
114
114
  },
115
115
  set_forceOutput__ ()
116
116
  {
117
- for (var key in this .outputs)
118
- delete this .outputs [key];
117
+ this .outputs .clear ();
119
118
 
120
119
  for (var i = 0, length = this ._forceOutput .length; i < length; ++ i)
121
120
  {
@@ -123,16 +122,16 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, X3DRigidJointNode
123
122
 
124
123
  if (value == "ALL")
125
124
  {
126
- this .outputs .body1AnchorPoint = true;
127
- this .outputs .body2AnchorPoint = true;
125
+ this .outputs .add ("body1AnchorPoint");
126
+ this .outputs .add ("body2AnchorPoint");
128
127
  }
129
128
  else
130
129
  {
131
- this .outputs [value] = true;
130
+ this .outputs .add (value);
132
131
  }
133
132
  }
134
133
 
135
- this .setOutput (!$.isEmptyObject (this .outputs));
134
+ this .setOutput (!! this .outputs .size);
136
135
  },
137
136
  set_anchorPoint__ ()
138
137
  {
@@ -155,7 +154,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, X3DRigidJointNode
155
154
 
156
155
  return function ()
157
156
  {
158
- if (this .outputs .body1AnchorPoint)
157
+ if (this .outputs .has ("body1AnchorPoint"))
159
158
  this ._body1AnchorPoint = this .getBody1 () .getMatrix () .multVecMatrix (this .getInitialInverseMatrix1 () .multVecMatrix (localAnchorPoint1 .assign (this .localAnchorPoint1)));
160
159
  };
161
160
  })(),
@@ -165,7 +164,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, X3DRigidJointNode
165
164
 
166
165
  return function ()
167
166
  {
168
- if (this .outputs .body2AnchorPoint)
167
+ if (this .outputs .has ("body2AnchorPoint"))
169
168
  this ._body2AnchorPoint = this .getBody2 () .getMatrix () .multVecMatrix (this .getInitialInverseMatrix2 () .multVecMatrix (localAnchorPoint2 .assign (this .localAnchorPoint2)));
170
169
  };
171
170
  })(),