//update JOINT private void UpdateJoint(ref int channelIndex, int frameIndex, BVHJoint joint) { List <float> frame; Vector3D translate, rotate; //get MOTION data of frameIndex frame = FFrames[frameIndex]; //init transform translate = new Vector3D(0.0); rotate = new Vector3D(0.0); //set transform channel count times for (int i = 0; i < joint.GetChannelCount(); i++) { //get one value from MOTION data float f = frame[channelIndex++]; //get target channel BVHChannel ch = joint.Channels[i]; //set value to channel if (ch == BVHChannel.X_POSITION) { translate.x = f; } else if (ch == BVHChannel.Y_POSITION) { translate.y = f; } else if (ch == BVHChannel.Z_POSITION) { translate.z = f;// -f; //Right Hand to Left Hand } else if (ch == BVHChannel.X_ROTATION) { //Degrees into Radians rotate.x = f * VMath.DegToRad; } else if (ch == BVHChannel.Y_ROTATION) { //Degrees into Radians rotate.y = f * VMath.DegToRad; } else if (ch == BVHChannel.Z_ROTATION) { //Degrees into Radians rotate.z = f * VMath.DegToRad; } } //update AnimationTransform joint.AnimationTransform = VMath.Transform(translate, new Vector3D(1.0), rotate); //recusive call all children for (int i = 0; i < joint.Children.Count; i++) { UpdateJoint(ref channelIndex, frameIndex, (BVHJoint)joint.Children[i]); } }
public void SetChannel(int index, BVHChannel channel) { FChannels[index] = channel; }
public void SetChannel(int index, BVHChannel channel) { FChannels[index] = channel; }