示例#1
0
        /// <summary>
        /// Change the "look-at" point.
        /// </summary>
        /// <param name="target">
        /// The target.
        /// </param>
        /// <param name="animationTime">
        /// The animation time.
        /// </param>
        public void LookAt(Vector3 target, double animationTime)
        {
            if (!this.Controller.IsPanEnabled)
            {
                return;
            }

            this.Camera.LookAt(target.ToPoint3D(), animationTime);
        }
        public void LookAt(Vector3 target, double animationTime)
        {
            if (!this.IsPanEnabled)
            {
                return;
            }

            this.PushCameraSetting();
            this.ActualCamera.LookAt(target.ToPoint3D(), animationTime);
        }
        /// <summary>
        /// Rotates the specified p0.
        /// </summary>
        /// <param name="p0">The p0.</param>
        /// <param name="p1">The p1.</param>
        /// <param name="rotateAround">The rotate around.</param>
        /// <param name="stopOther">if set to <c>true</c> [stop other].</param>
        public void Rotate(Vector2 p0, Vector2 p1, Vector3 rotateAround, bool stopOther = true)
        {
            if (!this.Controller.IsRotationEnabled)
            {
                return;
            }
            if (stopOther)
            {
                Controller.StopZooming();
                Controller.StopPanning();
            }
            p0 = Vector2.Multiply(p0, Controller.AllowRotateXY);
            p1 = Vector2.Multiply(p1, Controller.AllowRotateXY);
            Vector3 newPos  = Camera.CameraInternal.Position;
            Vector3 newLook = Camera.CameraInternal.LookDirection;
            Vector3 newUp   = Vector3.Normalize(Camera.CameraInternal.UpDirection);

            switch (this.Controller.CameraRotationMode)
            {
            case CameraRotationMode.Trackball:
                CameraMath.RotateTrackball(CameraMode, ref p0, ref p1, ref rotateAround, (float)RotationSensitivity,
                                           Controller.Width, Controller.Height, Camera, Inv, out newPos, out newLook, out newUp);
                break;

            case CameraRotationMode.Turntable:
                var p = p1 - p0;
                CameraMath.RotateTurntable(CameraMode, ref p, ref rotateAround, (float)RotationSensitivity,
                                           Controller.Width, Controller.Height, Camera, Inv, ModelUpDirection, out newPos, out newLook, out newUp);
                break;

            case CameraRotationMode.Turnball:
                CameraMath.RotateTurnball(CameraMode, ref p0, ref p1, ref rotateAround, (float)RotationSensitivity,
                                          Controller.Width, Controller.Height, Camera, Inv, out newPos, out newLook, out newUp);
                break;

            default:
                break;
            }
            Camera.LookDirection = newLook.ToVector3D();
            Camera.Position      = newPos.ToPoint3D();
            Camera.UpDirection   = newUp.ToVector3D();
        }
示例#4
0
 public static void LookAt(this ICameraModel camera, Vector3 target, double animationTime)
 {
     LookAt(camera, target.ToPoint3D(), camera.LookDirection, animationTime);
 }