three-stdlib 2.29.12 → 2.30.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const THREE = require("three");
4
4
  const BufferGeometryUtils = require("../utils/BufferGeometryUtils.cjs");
5
5
  const constants = require("../_polyfill/constants.cjs");
6
+ const SRGBColorSpace = "srgb";
7
+ const LinearSRGBColorSpace = "srgb-linear";
8
+ const sRGBEncoding = 3001;
9
+ const LinearEncoding = 3e3;
6
10
  class GLTFLoader extends THREE.Loader {
7
11
  constructor(manager) {
8
12
  super(manager);
@@ -13,6 +17,9 @@ class GLTFLoader extends THREE.Loader {
13
17
  this.register(function(parser) {
14
18
  return new GLTFMaterialsClearcoatExtension(parser);
15
19
  });
20
+ this.register(function(parser) {
21
+ return new GLTFMaterialsDispersionExtension(parser);
22
+ });
16
23
  this.register(function(parser) {
17
24
  return new GLTFTextureBasisUExtension(parser);
18
25
  });
@@ -46,6 +53,9 @@ class GLTFLoader extends THREE.Loader {
46
53
  this.register(function(parser) {
47
54
  return new GLTFMaterialsAnisotropyExtension(parser);
48
55
  });
56
+ this.register(function(parser) {
57
+ return new GLTFMaterialsBumpExtension(parser);
58
+ });
49
59
  this.register(function(parser) {
50
60
  return new GLTFLightsExtension(parser);
51
61
  });
@@ -62,7 +72,8 @@ class GLTFLoader extends THREE.Loader {
62
72
  if (this.resourcePath !== "") {
63
73
  resourcePath = this.resourcePath;
64
74
  } else if (this.path !== "") {
65
- resourcePath = this.path;
75
+ const relativeUrl = THREE.LoaderUtils.extractUrlBase(url);
76
+ resourcePath = THREE.LoaderUtils.resolveURL(relativeUrl, this.path);
66
77
  } else {
67
78
  resourcePath = THREE.LoaderUtils.extractUrlBase(url);
68
79
  }
@@ -168,6 +179,8 @@ class GLTFLoader extends THREE.Loader {
168
179
  parser.fileLoader.setRequestHeader(this.requestHeader);
169
180
  for (let i = 0; i < this.pluginCallbacks.length; i++) {
170
181
  const plugin = this.pluginCallbacks[i](parser);
182
+ if (!plugin.name)
183
+ console.error("THREE.GLTFLoader: Invalid plugin found: missing name");
171
184
  plugins[plugin.name] = plugin;
172
185
  extensions[plugin.name] = true;
173
186
  }
@@ -228,6 +241,7 @@ const EXTENSIONS = {
228
241
  KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
229
242
  KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
230
243
  KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
244
+ KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
231
245
  KHR_MATERIALS_IOR: "KHR_materials_ior",
232
246
  KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
233
247
  KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
@@ -240,6 +254,7 @@ const EXTENSIONS = {
240
254
  KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
241
255
  KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
242
256
  KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
257
+ EXT_MATERIALS_BUMP: "EXT_materials_bump",
243
258
  EXT_TEXTURE_WEBP: "EXT_texture_webp",
244
259
  EXT_TEXTURE_AVIF: "EXT_texture_avif",
245
260
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
@@ -274,7 +289,7 @@ class GLTFLightsExtension {
274
289
  let lightNode;
275
290
  const color = new THREE.Color(16777215);
276
291
  if (lightDef.color !== void 0)
277
- color.fromArray(lightDef.color);
292
+ color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace);
278
293
  const range = lightDef.range !== void 0 ? lightDef.range : 0;
279
294
  switch (lightDef.type) {
280
295
  case "directional":
@@ -344,11 +359,11 @@ class GLTFMaterialsUnlitExtension {
344
359
  if (metallicRoughness) {
345
360
  if (Array.isArray(metallicRoughness.baseColorFactor)) {
346
361
  const array = metallicRoughness.baseColorFactor;
347
- materialParams.color.fromArray(array);
362
+ materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace);
348
363
  materialParams.opacity = array[3];
349
364
  }
350
365
  if (metallicRoughness.baseColorTexture !== void 0) {
351
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
366
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace));
352
367
  }
353
368
  }
354
369
  return Promise.all(pending);
@@ -414,6 +429,29 @@ class GLTFMaterialsClearcoatExtension {
414
429
  return Promise.all(pending);
415
430
  }
416
431
  }
432
+ class GLTFMaterialsDispersionExtension {
433
+ constructor(parser) {
434
+ this.parser = parser;
435
+ this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;
436
+ }
437
+ getMaterialType(materialIndex) {
438
+ const parser = this.parser;
439
+ const materialDef = parser.json.materials[materialIndex];
440
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
441
+ return null;
442
+ return THREE.MeshPhysicalMaterial;
443
+ }
444
+ extendMaterialParams(materialIndex, materialParams) {
445
+ const parser = this.parser;
446
+ const materialDef = parser.json.materials[materialIndex];
447
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
448
+ return Promise.resolve();
449
+ }
450
+ const extension = materialDef.extensions[this.name];
451
+ materialParams.dispersion = extension.dispersion !== void 0 ? extension.dispersion : 0;
452
+ return Promise.resolve();
453
+ }
454
+ }
417
455
  class GLTFMaterialsIridescenceExtension {
418
456
  constructor(parser) {
419
457
  this.parser = parser;
@@ -484,13 +522,14 @@ class GLTFMaterialsSheenExtension {
484
522
  materialParams.sheen = 1;
485
523
  const extension = materialDef.extensions[this.name];
486
524
  if (extension.sheenColorFactor !== void 0) {
487
- materialParams.sheenColor.fromArray(extension.sheenColorFactor);
525
+ const colorFactor = extension.sheenColorFactor;
526
+ materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace);
488
527
  }
489
528
  if (extension.sheenRoughnessFactor !== void 0) {
490
529
  materialParams.sheenRoughness = extension.sheenRoughnessFactor;
491
530
  }
492
531
  if (extension.sheenColorTexture !== void 0) {
493
- pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, 3001));
532
+ pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, SRGBColorSpace));
494
533
  }
495
534
  if (extension.sheenRoughnessTexture !== void 0) {
496
535
  pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture));
@@ -553,7 +592,12 @@ class GLTFMaterialsVolumeExtension {
553
592
  }
554
593
  materialParams.attenuationDistance = extension.attenuationDistance || Infinity;
555
594
  const colorArray = extension.attenuationColor || [1, 1, 1];
556
- materialParams.attenuationColor = new THREE.Color(colorArray[0], colorArray[1], colorArray[2]);
595
+ materialParams.attenuationColor = new THREE.Color().setRGB(
596
+ colorArray[0],
597
+ colorArray[1],
598
+ colorArray[2],
599
+ LinearSRGBColorSpace
600
+ );
557
601
  return Promise.all(pending);
558
602
  }
559
603
  }
@@ -605,16 +649,42 @@ class GLTFMaterialsSpecularExtension {
605
649
  pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture));
606
650
  }
607
651
  const colorArray = extension.specularColorFactor || [1, 1, 1];
608
- materialParams.specularColor = new THREE.Color(colorArray[0], colorArray[1], colorArray[2]);
652
+ materialParams.specularColor = new THREE.Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace);
609
653
  if (extension.specularColorTexture !== void 0) {
610
654
  pending.push(
611
- parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, 3001)
612
- // sRGBEncoding
655
+ parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, SRGBColorSpace)
613
656
  );
614
657
  }
615
658
  return Promise.all(pending);
616
659
  }
617
660
  }
661
+ class GLTFMaterialsBumpExtension {
662
+ constructor(parser) {
663
+ this.parser = parser;
664
+ this.name = EXTENSIONS.EXT_MATERIALS_BUMP;
665
+ }
666
+ getMaterialType(materialIndex) {
667
+ const parser = this.parser;
668
+ const materialDef = parser.json.materials[materialIndex];
669
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
670
+ return null;
671
+ return THREE.MeshPhysicalMaterial;
672
+ }
673
+ extendMaterialParams(materialIndex, materialParams) {
674
+ const parser = this.parser;
675
+ const materialDef = parser.json.materials[materialIndex];
676
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
677
+ return Promise.resolve();
678
+ }
679
+ const pending = [];
680
+ const extension = materialDef.extensions[this.name];
681
+ materialParams.bumpScale = extension.bumpFactor !== void 0 ? extension.bumpFactor : 1;
682
+ if (extension.bumpTexture !== void 0) {
683
+ pending.push(parser.assignTexture(materialParams, "bumpMap", extension.bumpTexture));
684
+ }
685
+ return Promise.all(pending);
686
+ }
687
+ }
618
688
  class GLTFMaterialsAnisotropyExtension {
619
689
  constructor(parser) {
620
690
  this.parser = parser;
@@ -865,7 +935,10 @@ class GLTFMeshGpuInstancing {
865
935
  instancedMesh.setMatrixAt(i, m.compose(p, q, s));
866
936
  }
867
937
  for (const attributeName in attributes) {
868
- if (attributeName !== "TRANSLATION" && attributeName !== "ROTATION" && attributeName !== "SCALE") {
938
+ if (attributeName === "_COLOR_0") {
939
+ const attr = attributes[attributeName];
940
+ instancedMesh.instanceColor = new THREE.InstancedBufferAttribute(attr.array, attr.itemSize, attr.normalized);
941
+ } else if (attributeName !== "TRANSLATION" && attributeName !== "ROTATION" && attributeName !== "SCALE") {
869
942
  mesh.geometry.setAttribute(attributeName, attributes[attributeName]);
870
943
  }
871
944
  }
@@ -955,7 +1028,7 @@ class GLTFDracoMeshCompressionExtension {
955
1028
  }
956
1029
  }
957
1030
  return parser.getDependency("bufferView", bufferViewIndex).then(function(bufferView) {
958
- return new Promise(function(resolve) {
1031
+ return new Promise(function(resolve, reject) {
959
1032
  dracoLoader.decodeDracoFile(
960
1033
  bufferView,
961
1034
  function(geometry) {
@@ -968,7 +1041,9 @@ class GLTFDracoMeshCompressionExtension {
968
1041
  resolve(geometry);
969
1042
  },
970
1043
  threeAttributeMap,
971
- attributeTypeMap
1044
+ attributeTypeMap,
1045
+ LinearSRGBColorSpace,
1046
+ reject
972
1047
  );
973
1048
  });
974
1049
  });
@@ -1360,11 +1435,14 @@ class GLTFParser {
1360
1435
  };
1361
1436
  addUnknownExtensionsToUserData(extensions, result, json);
1362
1437
  assignExtrasToUserData(result, json);
1363
- Promise.all(
1438
+ return Promise.all(
1364
1439
  parser._invokeAll(function(ext) {
1365
1440
  return ext.afterRoot && ext.afterRoot(result);
1366
1441
  })
1367
1442
  ).then(function() {
1443
+ for (const scene of result.scenes) {
1444
+ scene.updateMatrixWorld();
1445
+ }
1368
1446
  onLoad(result);
1369
1447
  });
1370
1448
  }).catch(onError);
@@ -1751,6 +1829,7 @@ class GLTFParser {
1751
1829
  if (isObjectURL === true) {
1752
1830
  URL.revokeObjectURL(sourceURI);
1753
1831
  }
1832
+ assignExtrasToUserData(texture, sourceDef);
1754
1833
  texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);
1755
1834
  return texture;
1756
1835
  }).catch(function(error) {
@@ -1767,7 +1846,7 @@ class GLTFParser {
1767
1846
  * @param {Object} mapDef
1768
1847
  * @return {Promise<Texture>}
1769
1848
  */
1770
- assignTexture(materialParams, mapName, mapDef, encoding) {
1849
+ assignTexture(materialParams, mapName, mapDef, colorSpace) {
1771
1850
  const parser = this;
1772
1851
  return this.getDependency("texture", mapDef.index).then(function(texture) {
1773
1852
  if (!texture)
@@ -1784,11 +1863,13 @@ class GLTFParser {
1784
1863
  parser.associations.set(texture, gltfReference);
1785
1864
  }
1786
1865
  }
1787
- if (encoding !== void 0) {
1866
+ if (colorSpace !== void 0) {
1867
+ if (typeof colorSpace === "number")
1868
+ colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
1788
1869
  if ("colorSpace" in texture)
1789
- texture.colorSpace = encoding === 3001 ? "srgb" : "srgb-linear";
1870
+ texture.colorSpace = colorSpace;
1790
1871
  else
1791
- texture.encoding = encoding;
1872
+ texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
1792
1873
  }
1793
1874
  materialParams[mapName] = texture;
1794
1875
  return texture;
@@ -1887,11 +1968,11 @@ class GLTFParser {
1887
1968
  materialParams.opacity = 1;
1888
1969
  if (Array.isArray(metallicRoughness.baseColorFactor)) {
1889
1970
  const array = metallicRoughness.baseColorFactor;
1890
- materialParams.color.fromArray(array);
1971
+ materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace);
1891
1972
  materialParams.opacity = array[3];
1892
1973
  }
1893
1974
  if (metallicRoughness.baseColorTexture !== void 0) {
1894
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
1975
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace));
1895
1976
  }
1896
1977
  materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;
1897
1978
  materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;
@@ -1938,10 +2019,16 @@ class GLTFParser {
1938
2019
  }
1939
2020
  }
1940
2021
  if (materialDef.emissiveFactor !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1941
- materialParams.emissive = new THREE.Color().fromArray(materialDef.emissiveFactor);
2022
+ const emissiveFactor = materialDef.emissiveFactor;
2023
+ materialParams.emissive = new THREE.Color().setRGB(
2024
+ emissiveFactor[0],
2025
+ emissiveFactor[1],
2026
+ emissiveFactor[2],
2027
+ LinearSRGBColorSpace
2028
+ );
1942
2029
  }
1943
2030
  if (materialDef.emissiveTexture !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1944
- pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, 3001));
2031
+ pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, SRGBColorSpace));
1945
2032
  }
1946
2033
  return Promise.all(pending).then(function() {
1947
2034
  const material = new materialType(materialParams);
@@ -2151,6 +2238,7 @@ class GLTFParser {
2151
2238
  */
2152
2239
  loadAnimation(animationIndex) {
2153
2240
  const json = this.json;
2241
+ const parser = this;
2154
2242
  const animationDef = json.animations[animationIndex];
2155
2243
  const animationName = animationDef.name ? animationDef.name : "animation_" + animationIndex;
2156
2244
  const pendingNodes = [];
@@ -2194,57 +2282,14 @@ class GLTFParser {
2194
2282
  const target = targets[i];
2195
2283
  if (node === void 0)
2196
2284
  continue;
2197
- node.updateMatrix();
2198
- let TypedKeyframeTrack;
2199
- switch (PATH_PROPERTIES[target.path]) {
2200
- case PATH_PROPERTIES.weights:
2201
- TypedKeyframeTrack = THREE.NumberKeyframeTrack;
2202
- break;
2203
- case PATH_PROPERTIES.rotation:
2204
- TypedKeyframeTrack = THREE.QuaternionKeyframeTrack;
2205
- break;
2206
- case PATH_PROPERTIES.position:
2207
- case PATH_PROPERTIES.scale:
2208
- default:
2209
- TypedKeyframeTrack = THREE.VectorKeyframeTrack;
2210
- break;
2211
- }
2212
- const targetName = node.name ? node.name : node.uuid;
2213
- const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : THREE.InterpolateLinear;
2214
- const targetNames = [];
2215
- if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
2216
- node.traverse(function(object) {
2217
- if (object.morphTargetInfluences) {
2218
- targetNames.push(object.name ? object.name : object.uuid);
2219
- }
2220
- });
2221
- } else {
2222
- targetNames.push(targetName);
2285
+ if (node.updateMatrix) {
2286
+ node.updateMatrix();
2223
2287
  }
2224
- let outputArray = outputAccessor.array;
2225
- if (outputAccessor.normalized) {
2226
- const scale = getNormalizedComponentScale(outputArray.constructor);
2227
- const scaled = new Float32Array(outputArray.length);
2228
- for (let j = 0, jl = outputArray.length; j < jl; j++) {
2229
- scaled[j] = outputArray[j] * scale;
2288
+ const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target);
2289
+ if (createdTracks) {
2290
+ for (let k = 0; k < createdTracks.length; k++) {
2291
+ tracks.push(createdTracks[k]);
2230
2292
  }
2231
- outputArray = scaled;
2232
- }
2233
- for (let j = 0, jl = targetNames.length; j < jl; j++) {
2234
- const track = new TypedKeyframeTrack(
2235
- targetNames[j] + "." + PATH_PROPERTIES[target.path],
2236
- inputAccessor.array,
2237
- outputArray,
2238
- interpolation
2239
- );
2240
- if (sampler.interpolation === "CUBICSPLINE") {
2241
- track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
2242
- const interpolantType = this instanceof THREE.QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
2243
- return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
2244
- };
2245
- track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
2246
- }
2247
- tracks.push(track);
2248
2293
  }
2249
2294
  }
2250
2295
  return new THREE.AnimationClip(animationName, void 0, tracks);
@@ -2422,6 +2467,79 @@ class GLTFParser {
2422
2467
  return scene;
2423
2468
  });
2424
2469
  }
2470
+ _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) {
2471
+ const tracks = [];
2472
+ const targetName = node.name ? node.name : node.uuid;
2473
+ const targetNames = [];
2474
+ if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
2475
+ node.traverse(function(object) {
2476
+ if (object.morphTargetInfluences) {
2477
+ targetNames.push(object.name ? object.name : object.uuid);
2478
+ }
2479
+ });
2480
+ } else {
2481
+ targetNames.push(targetName);
2482
+ }
2483
+ let TypedKeyframeTrack;
2484
+ switch (PATH_PROPERTIES[target.path]) {
2485
+ case PATH_PROPERTIES.weights:
2486
+ TypedKeyframeTrack = THREE.NumberKeyframeTrack;
2487
+ break;
2488
+ case PATH_PROPERTIES.rotation:
2489
+ TypedKeyframeTrack = THREE.QuaternionKeyframeTrack;
2490
+ break;
2491
+ case PATH_PROPERTIES.position:
2492
+ case PATH_PROPERTIES.scale:
2493
+ TypedKeyframeTrack = THREE.VectorKeyframeTrack;
2494
+ break;
2495
+ default:
2496
+ switch (outputAccessor.itemSize) {
2497
+ case 1:
2498
+ TypedKeyframeTrack = THREE.NumberKeyframeTrack;
2499
+ break;
2500
+ case 2:
2501
+ case 3:
2502
+ default:
2503
+ TypedKeyframeTrack = THREE.VectorKeyframeTrack;
2504
+ break;
2505
+ }
2506
+ break;
2507
+ }
2508
+ const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : THREE.InterpolateLinear;
2509
+ const outputArray = this._getArrayFromAccessor(outputAccessor);
2510
+ for (let j = 0, jl = targetNames.length; j < jl; j++) {
2511
+ const track = new TypedKeyframeTrack(
2512
+ targetNames[j] + "." + PATH_PROPERTIES[target.path],
2513
+ inputAccessor.array,
2514
+ outputArray,
2515
+ interpolation
2516
+ );
2517
+ if (sampler.interpolation === "CUBICSPLINE") {
2518
+ this._createCubicSplineTrackInterpolant(track);
2519
+ }
2520
+ tracks.push(track);
2521
+ }
2522
+ return tracks;
2523
+ }
2524
+ _getArrayFromAccessor(accessor) {
2525
+ let outputArray = accessor.array;
2526
+ if (accessor.normalized) {
2527
+ const scale = getNormalizedComponentScale(outputArray.constructor);
2528
+ const scaled = new Float32Array(outputArray.length);
2529
+ for (let j = 0, jl = outputArray.length; j < jl; j++) {
2530
+ scaled[j] = outputArray[j] * scale;
2531
+ }
2532
+ outputArray = scaled;
2533
+ }
2534
+ return outputArray;
2535
+ }
2536
+ _createCubicSplineTrackInterpolant(track) {
2537
+ track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
2538
+ const interpolantType = this instanceof THREE.QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
2539
+ return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
2540
+ };
2541
+ track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
2542
+ }
2425
2543
  }
2426
2544
  function computeBounds(geometry, primitiveDef, parser) {
2427
2545
  const attributes = primitiveDef.attributes;