src/library_visual_scenes/parse-visual-scenes.js
function parseJoints (node, parentJointName, accumulator) {
  accumulator = accumulator || {}
  node.forEach(function (joint) {
    accumulator[joint.$.sid] = accumulator[joint.$.sid] || {}
    // The bind pose of the matrix. We don't make use of this right now, but you would
    // use it to render a model in bind pose. Right now we only render the model based on
    // their animated joint positions, so we ignore this bind pose data
    accumulator[joint.$.sid].jointMatrix = joint.matrix[0]._.split(' ').map(Number)
    accumulator[joint.$.sid].parent = parentJointName
    if (joint.node) {
      parseJoints(joint.node, joint.$.sid, accumulator)
    }
  })

  return accumulator
}
function parseJoints (node, parentJointName, accumulator) {
  accumulator = accumulator || {}
  node.forEach(function (joint) {
    accumulator[joint.$.sid] = accumulator[joint.$.sid] || {}
    // The bind pose of the matrix. We don't make use of this right now, but you would
    // use it to render a model in bind pose. Right now we only render the model based on
    // their animated joint positions, so we ignore this bind pose data
    accumulator[joint.$.sid].jointMatrix = joint.matrix[0]._.split(' ').map(Number)
    accumulator[joint.$.sid].parent = parentJointName
    if (joint.node) {
      parseJoints(joint.node, joint.$.sid, accumulator)
    }
  })

  return accumulator
}
function parseJoints ( node , parentJointName , accumulator ) { accumulator = accumulator || { } node . forEach ( function ( joint ) { accumulator [ joint . $ . sid ] = accumulator [ joint . $ . sid ] || { } // The bind pose of the matrix. We don't make use of this right now, but you would // use it to render a model in bind pose. Right now we only render the model based on // their animated joint positions, so we ignore this bind pose data accumulator [ joint . $ . sid ] . jointMatrix = joint . matrix [ 0 ] . _ . split ( ' ' ) . map ( Number ) accumulator [ joint . $ . sid ] . parent = parentJointName if ( joint . node ) { parseJoints ( joint . node , joint . $ . sid , accumulator ) } } ) return accumulator }
Recursively parse child joints
Recursively parse child joints