Beispiel #1
0
        internal JointChange GetRightHandedJointChange(string boneName)
        {
            var jointChange = jointChangeByBoneName[boneName];
            var zFlipMatrix = Matrix3D.Identity;

            zFlipMatrix.Scale(new Vector3D(1, 1, -1));
            var orientation = new Quaternion(jointChange.Orientation.X,
                                             jointChange.Orientation.Y,
                                             -jointChange.Orientation.Z,
                                             -jointChange.Orientation.W);

            jointChange = new JointChange(zFlipMatrix.Transform(jointChange.Position), orientation);
            return(jointChange);
        }
Beispiel #2
0
        internal void Morph(Armature result, Pose pose)
        {
            if (result.GetJointCount() != GetJointCount())
            {
                throw new ValueException("Armature::morph() : result armature does not have the same number of joints.");
            }

            for (int joint_index = 0; joint_index < GetJointCount(); joint_index++)
            {
                Joint       joint        = GetJoint(joint_index);
                JointChange joint_change = pose.GetJointChange(joint.Name);

                Vector3D   new_position    = joint.Position + joint_change.Position;
                Quaternion new_orientation = joint.Orientation * joint_change.Orientation;
                result.SetJointParameter(joint_index, new_position, new_orientation);
            }
        }
Beispiel #3
0
 internal void SetJointChange(string name, JointChange jointChange)
 {
     jointChangesByName[name] = jointChange;
 }
Beispiel #4
0
 internal void SetJointChange(string boneName, JointChange jointChange)
 {
     jointChangeByBoneName[boneName] = jointChange;
 }