public override void SetFromChannel(Channel channel, int preIndex, int postIndex, float interpFactor, Accessor transformAccessor) { // TODO: This can be made to resemble more closely the implementations in // the other NamedTransform subclasses, but it involves separating terms // of the quaternion. I don't want to deal with this yet, but it should be done. //------------------------------------------------------------------------------- // Set orientation ApplyChannelToQuaternion(transformAccessor, channel.TargetParam, channel.TargetMember, preIndex); Quaternion preOrient = Rotate; ApplyChannelToQuaternion(transformAccessor, channel.TargetParam, channel.TargetMember, postIndex); Quaternion postOrient = Rotate; Quaternion interpOrient = (Quaternion)AnimableValue.InterpolateValues(interpFactor, AnimableType.Quaternion, preOrient, postOrient); Debug.Assert(Math.Abs(1.0 - interpOrient.Norm) < .001); // Make sure the axis is not perturbed when we set the rotation Vector3 preAxis = Axis; // NOTE: setting Rotate has a side-effect of altering the Axis Rotate = interpOrient; Vector3 interpAxis = Axis; if ((interpAxis - preAxis).Length > .001) { Debug.Assert(false, "pre axis and interp axis mismatch"); Rotate = interpOrient; } }
public override void SetFromChannel(Channel channel, int preIndex, int postIndex, float interpFactor, Accessor transformAccessor) { Vector3 preScale = BuildScaleFromAccessor(transformAccessor, channel.TargetParam, preIndex);; Vector3 postScale = BuildScaleFromAccessor(transformAccessor, channel.TargetParam, postIndex);; Scale = (Vector3)AnimableValue.InterpolateValues(interpFactor, AnimableType.Vector3, preScale, postScale); }
public override void SetFromChannel(Channel channel, int preIndex, int postIndex, float interpFactor, Accessor transformAccessor) { Vector3 preTrans = BuildTranslationFromAccessor(transformAccessor, channel.TargetParam, preIndex); Vector3 postTrans = BuildTranslationFromAccessor(transformAccessor, channel.TargetParam, postIndex); Vector3 interpTrans = (Vector3)AnimableValue.InterpolateValues(interpFactor, AnimableType.Vector3, preTrans, postTrans); Translate = interpTrans; }