x_ite 8.9.1 → 8.9.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.
Files changed (57) 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 +18 -18
  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 +144 -157
  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/package.json +2 -2
  47. package/src/tests.js +360 -0
  48. package/src/x_ite/Browser/VERSION.js +1 -1
  49. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +8 -5
  50. package/src/x_ite/Components/Geometry3D/Extrusion.js +10 -12
  51. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +46 -56
  52. package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +44 -40
  53. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +7 -6
  54. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +11 -13
  55. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +4 -6
  56. package/src/x_ite/Components/Scripting/Script.js +1 -1
  57. package/src/x_ite/Parser/GLTF2Parser.js +7 -7
@@ -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
  }
@@ -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
  {
@@ -167,7 +167,7 @@ Object .assign (Object .setPrototypeOf (Script .prototype, X3DScriptNode .protot
167
167
  }
168
168
  }
169
169
 
170
- sourceText += "\n[" + callbacks .map (c => `typeof ${c} !== "undefined" ? ${c} : undefined`) .join (",") + "];";
170
+ sourceText += ";\n[" + callbacks .map (c => `typeof ${c} !== "undefined" ? ${c} : undefined`) .join (",") + "];";
171
171
 
172
172
  this .globalObject = this .getGlobalObject ();
173
173
 
@@ -85,13 +85,13 @@ function GLTF2Parser (scene)
85
85
  this .samplers = [ ];
86
86
  this .materials = [ ];
87
87
  this .textureTransformNodes = [ ];
88
+ this .meshes = [ ];
88
89
  this .cameras = [ ];
89
90
  this .viewpoints = 0;
90
91
  this .nodes = [ ];
91
92
  this .skins = [ ];
92
93
  this .joints = new Set ();
93
94
  this .skeletons = new Set ();
94
- this .inverseBindMatrices = new Map ();
95
95
  this .animations = 0;
96
96
  }
97
97
 
@@ -1486,9 +1486,9 @@ Object .assign (Object .setPrototypeOf (GLTF2Parser .prototype, X3DParser .proto
1486
1486
  if (skeletonNode)
1487
1487
  humanoidNode ._skeleton .push (skeletonNode);
1488
1488
 
1489
- for (const joint of skin .joints)
1489
+ for (const [i, joint] of skin .joints .entries ())
1490
1490
  {
1491
- const inverseBindMatrix = this .inverseBindMatrices .get (joint);
1491
+ const inverseBindMatrix = skin .inverseBindMatrices [i] ?? Matrix4 .Identity;
1492
1492
 
1493
1493
  inverseBindMatrix .get (translation, rotation, scale);
1494
1494
 
@@ -1577,7 +1577,7 @@ Object .assign (Object .setPrototypeOf (GLTF2Parser .prototype, X3DParser .proto
1577
1577
 
1578
1578
  this .skeletons .add (skin .skeleton);
1579
1579
 
1580
- this .inverseBindMatricesAccessors (this .accessors [skin .inverseBindMatrices], skin .joints);
1580
+ skin .inverseBindMatrices = this .inverseBindMatricesAccessors (this .accessors [skin .inverseBindMatrices]);
1581
1581
  },
1582
1582
  jointsArray: function (joints)
1583
1583
  {
@@ -1598,10 +1598,10 @@ Object .assign (Object .setPrototypeOf (GLTF2Parser .prototype, X3DParser .proto
1598
1598
 
1599
1599
  return joints .filter (index => !children .has (index)) [0];
1600
1600
  },
1601
- inverseBindMatricesAccessors: function (inverseBindMatrices, joints)
1601
+ inverseBindMatricesAccessors: function (inverseBindMatrices)
1602
1602
  {
1603
1603
  if (!inverseBindMatrices)
1604
- return;
1604
+ return [ ];
1605
1605
 
1606
1606
  const
1607
1607
  array = inverseBindMatrices .array,
@@ -1611,7 +1611,7 @@ Object .assign (Object .setPrototypeOf (GLTF2Parser .prototype, X3DParser .proto
1611
1611
  for (let i = 0; i < length; i += 16)
1612
1612
  matrices .push (new Matrix4 (... array .subarray (i, i + 16)));
1613
1613
 
1614
- matrices .forEach ((matrix, i) => this .inverseBindMatrices .set (joints [i], matrix));
1614
+ return matrices;
1615
1615
  },
1616
1616
  scenesArray (scenes, sceneNumber)
1617
1617
  {