function loadNode(loader, gltfNode, frameState) {
  const node = new Node();

  node.name = gltfNode.name;

  node.matrix = fromArray(Matrix4, gltfNode.matrix);
  node.translation = fromArray(Cartesian3, gltfNode.translation);
  node.rotation = fromArray(Quaternion, gltfNode.rotation);
  node.scale = fromArray(Cartesian3, gltfNode.scale);

  const nodeExtensions = gltfNode.extensions ?? Frozen.EMPTY_OBJECT;
  const instancingExtension = nodeExtensions.EXT_mesh_gpu_instancing;
  const articulationsExtension = nodeExtensions.AGI_articulations;

  if (defined(instancingExtension)) {
    if (loader._loadForClassification) {
      throw new RuntimeError(
        "Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.",
      );
    }
    node.instances = loadInstances(loader, nodeExtensions, frameState);
  }

  if (defined(articulationsExtension)) {
    node.articulationName = articulationsExtension.articulationName;
  }

  const meshId = gltfNode.mesh;
  if (defined(meshId)) {
    const mesh = loader.gltfJson.meshes[meshId];
    const primitives = mesh.primitives;
    for (let i = 0; i < primitives.length; ++i) {
      node.primitives.push(
        loadPrimitive(
          loader,
          primitives[i],
          defined(node.instances),
          frameState,
        ),
      );
    }

    // If the node has no weights array, it will look for the weights array provided
    // by the mesh. If both are undefined, it will default to an array of zero weights.
    const morphWeights = gltfNode.weights ?? mesh.weights;
    const targets = node.primitives[0].morphTargets;

    // Since meshes are not stored as separate components, the mesh weights will still
    // be stored at the node level.
    node.morphWeights = defined(morphWeights)
      ? morphWeights.slice()
      : new Array(targets.length).fill(0.0);
  }

  return node;
}
Load resources associated with one node from a glTF JSON
@param {GltfLoader} loader
@param {object} gltfNode An entry from the <code>.nodes</code> array in the glTF JSON
@param {FrameState} frameState
@returns {ModelComponents.Node}
@private