Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created June 27, 2015 19:59
Show Gist options
  • Save LordNed/336cd41e30ddafdd9909 to your computer and use it in GitHub Desktop.
Save LordNed/336cd41e30ddafdd9909 to your computer and use it in GitHub Desktop.
private static void BuildSkeletonRecursive(SceneNode node, List<SkeletonBone> skeleton, List<SkeletonBone> rawJoints, int parentJointIndex)
{
switch(node.Type)
{
case J3DFileResource.HierarchyDataTypes.NewNode:
parentJointIndex = skeleton.Count - 1;
break;
case J3DFileResource.HierarchyDataTypes.Joint:
var joint = rawJoints[node.Value];
if(parentJointIndex < skeleton.Count)
joint.Parent = skeleton[parentJointIndex];
skeleton.Add(joint);
break;
}
foreach (SceneNode child in node.Children)
BuildSkeletonRecursive(child, skeleton, rawJoints, parentJointIndex);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment