/// <summary> /// constructor with a device. Is called from <see cref="Camera"/> /// </summary> /// <param name="Camera"></param> public AnimatedCamera(Camera Camera) { this.Camera = Camera; LeftRight = new RotationAnimator(Device); UpDown = new RotationAnimator(Device); Roll = new RotationAnimator(Device); Forward = new GoForwardAnimator(Device); }
public M2AnimationBone(M2Bone bone, M2BoneAnimator Anim, Stormlib.MPQFile f, uint[] gs, Stormlib.MPQFile[] Anims) { Animator = Anim; fileInfo = bone; var ap = new M2Animator<Vector3, Vector3>(fileInfo.Translation, f, gs, Anims); ap.Load(); ap.SelectedAnim = 0; AnimPos = new PositionAnimator(ap); AnimPos.MaxTime = TimeSpan.FromMilliseconds(Anim.Animations[0].Length); ap = new M2Animator<Vector3, Vector3>(fileInfo.Scaling, f, gs, Anims); ap.Load(); ap.SelectedAnim = 0; AnimScale = new PositionAnimator(ap); AnimScale.Default = new Vector3(1, 1, 1); AnimScale.MaxTime = TimeSpan.FromMilliseconds(Anim.Animations[0].Length); var ar = new M2Animator<Quaternion16, Quaternion>(fileInfo.Rotation, f, gs, Anims); ar.Load(); ar.SelectedAnim = 0; AnimRot = new RotationAnimator(ar); AnimRot.MaxTime = TimeSpan.FromMilliseconds(Anim.Animations[0].Length); }
private void SetAnimator(RotationAnimator Animator, int Kind, float value, long Duration, bool KeepCenter) { Camera.MakeConsistent(); Animator.End(); Animator.Duration = Duration; Animator.ToValue = value; switch (Kind) { case 0: // LeftRight if (KeepCenter) { RotationAxis = new LineType(Center, UpVector); } else { RotationAxis = new LineType(Position, UpVector); } break; case 1: // UpDown if (KeepCenter) { RotationAxis = new LineType(Center, Base.BaseX); } else { RotationAxis = new LineType(Position, Base.BaseX); } break; case 2: // Rollup RotationAxis = new LineType(Position, Base.BaseZ); break; default: break; } Animator.Start(); }
private void SetAnimatorSpeed(RotationAnimator Animator, int Kind, double Speed, bool KeepCenter) { Camera.MakeConsistent(); Animator.End(); Animator.Duration = -1; Animator.SpeedInUnitsPerMilliSec = Speed; switch (Kind) { case 0: // LeftRight if (KeepCenter) { RotationAxis = new LineType(Center, UpVector); } else { RotationAxis = new LineType(Position, UpVector); } break; case 1: // UpDown if (KeepCenter) { RotationAxis = new LineType(Center, Base.BaseX); } else { RotationAxis = new LineType(Position, Base.BaseX); } break; case 2: // Rollup RotationAxis = new LineType(Position, Base.BaseZ); break; default: break; } Animator.Start(); }