public void SetupJoint(AvatarJoint currentJoint) { for (UInt32 sj = 0; sj < NumSkinJoints; sj++) { SkinJoint js = SkinJoints[sj]; if (js.Joint != currentJoint) { continue; } // we've found a skinjoint for this joint.. Logger.LogDebug("AvatarJointMesh.SetupJoint", $"Mesh: {Name} joint {currentJoint.Name} matches skinjoint {sj}"); // is the last joint in the array our parent? List <JointRenderData> jrd = Mesh.JointRenderData; // SL-287 - need to update this so the results are the same if // additional extended-skeleton joints lie between this joint // and the original parent. LLJoint ancestor = GetBaseSkeletonAncestor(currentJoint); if (jrd.Count != 0 && jrd.LastItem().WorldMatrix == ancestor.GetWorldMatrix()) { // ...then just add ourselves AvatarJoint joint = js.Joint; jrd.Add(new JointRenderData(joint.GetWorldMatrix(), js)); Logger.LogDebug("AvatarJointMesh.SetupJoint", $"add joint[{jrd.Count - 1}] = {js.Joint.Name}"); } // otherwise add our ancestor and ourselves else { jrd.Add(new JointRenderData(ancestor.GetWorldMatrix(), null)); Logger.LogDebug("AvatarJointMesh.SetupJoint", $"add2 ancestor joint[{jrd.Count - 1}] = {ancestor.Name}"); jrd.Add(new JointRenderData(currentJoint.GetWorldMatrix(), js)); Logger.LogDebug("AvatarJointMesh.SetupJoint", $"add2 joint[{jrd.Count - 1}] = {currentJoint.Name}"); } } // depth-first traversal foreach (LLJoint child in currentJoint.Children) { SetupJoint((AvatarJoint)child); } }
protected bool AllocateSkinData(UInt32 numSkinJoints) { SkinJoints = new SkinJoint[numSkinJoints]; NumSkinJoints = numSkinJoints; return(true); }
public JointRenderData(Matrix4x4 worldMatrix, SkinJoint skinJoint) { WorldMatrix = worldMatrix; SkinJoint = skinJoint; }