示例#1
0
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Started(Point e)
        {
            base.Started(e);
            this.rotationPoint = new Point(
                this.Viewport.ActualWidth / 2, this.Viewport.ActualHeight / 2);
            this.rotationPoint3D = this.Camera.CameraInternal.Target;

            switch (this.CameraMode)
            {
            case CameraMode.WalkAround:
                this.rotationPoint   = this.MouseDownPoint;
                this.rotationPoint3D = this.Camera.CameraInternal.Position;
                break;

            default:
                if (Controller.FixedRotationPointEnabled)
                {
                    this.rotationPoint3D = Controller.FixedRotationPoint;
                }
                else if (this.changeLookAt && this.MouseDownNearestPoint3D != null)
                {
                    this.LookAt(this.MouseDownNearestPoint3D.Value, 0);
                    this.rotationPoint3D = this.Camera.CameraInternal.Target;
                }
                else if (this.Controller.RotateAroundMouseDownPoint && this.MouseDownNearestPoint3D != null)
                {
                    this.rotationPoint   = this.MouseDownPoint;
                    this.rotationPoint3D = this.MouseDownNearestPoint3D.Value;
                }

                break;
            }

            if (this.CameraMode == CameraMode.Inspect)
            {
                this.Viewport.ShowTargetAdorner(this.rotationPoint);
            }

            switch (this.CameraRotationMode)
            {
            case CameraRotationMode.Trackball:
                break;

            case CameraRotationMode.Turntable:
                break;

            case CameraRotationMode.Turnball:
                CameraMath.InitTurnballRotationAxes(e.ToVector2(), (int)Viewport.ActualWidth, (int)Viewport.ActualHeight, Camera,
                                                    out rotationAxisX, out rotationAxisY);
                break;
            }

            this.Controller.StopSpin();
        }
示例#2
0
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="T:SharpDX.Vector2" /> instance containing the event data.</param>
        protected override void Started(Vector2 e)
        {
            base.Started(e);
            this.rotationPoint = new Vector2(
                this.Controller.Width / 2, this.Controller.Height / 2);
            this.rotationPoint3D = this.Camera.Target;

            switch (this.CameraMode)
            {
            case CameraMode.WalkAround:
                this.rotationPoint   = this.MouseDownPoint;
                this.rotationPoint3D = this.Camera.Position;
                break;

            default:
                if (Controller.FixedRotationPointEnabled)
                {
                    this.rotationPoint3D = Controller.FixedRotationPoint;
                }
                else if (this.changeLookAt && this.MouseDownNearestPoint3D != null)
                {
                    this.LookAt(this.MouseDownNearestPoint3D.Value, 0);
                    this.rotationPoint3D = this.Camera.Target;
                }
                else if (this.Controller.RotateAroundMouseDownPoint && this.MouseDownNearestPoint3D != null)
                {
                    this.rotationPoint   = this.MouseDownPoint;
                    this.rotationPoint3D = this.MouseDownNearestPoint3D.Value;
                }

                break;
            }

            switch (this.CameraRotationMode)
            {
            case CameraRotationMode.Trackball:
                break;

            case CameraRotationMode.Turntable:
                break;

            case CameraRotationMode.Turnball:
                CameraMath.InitTurnballRotationAxes(e, (int)Controller.Width, (int)Controller.Height, Camera,
                                                    out rotationAxisX, out rotationAxisY);
                break;
            }

            this.Controller.StopSpin();
        }