Esempio n. 1
0
        /// <summary>
        /// Get a predefined camera
        /// </summary>
        /// <param name="camera">The desired predifined camera</param>
        /// <returns>A reference to the camera, this reference may be shared by multiple viewports</returns>
        public MidgetCamera CreateCamera(PredefinedCameras camera)
        {
            switch (camera)
            {
                case PredefinedCameras.Perspective:
                {

                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Perspective] == null)
                    {
                        return this.GenerateNewCamera("Perspective",(int)PredefinedCameras.Perspective,
                            CameraType.Perspective,
                            new Vector3(5, 5, 5),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 1, 0));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Perspective);
                    }
                }
                case PredefinedCameras.Front:
                {
                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Front] == null)
                    {
                        return this.GenerateNewCamera("Front",(int)PredefinedCameras.Front,
                            CameraType.Orthogonal,
                            new Vector3(0, 0, -10),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 1, 0));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Front);
                    }
                }
                case PredefinedCameras.Left:
                {
                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Left] == null)
                    {
                        return this.GenerateNewCamera("Left",(int)PredefinedCameras.Left,
                            CameraType.Orthogonal,
                            new Vector3(10, 0, 0),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 1, 0));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Left);
                    }
                }
                case PredefinedCameras.Back:
                {
                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Back] == null)
                    {
                        return this.GenerateNewCamera("Back",(int)PredefinedCameras.Back,
                            CameraType.Orthogonal,
                            new Vector3(0, 0, 10),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 1, 0));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Back);
                    }
                }
                case PredefinedCameras.Right:
                {
                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Right] == null)
                    {
                        return this.GenerateNewCamera("Right",(int)PredefinedCameras.Right,
                            CameraType.Orthogonal,
                            new Vector3(-10, 0, 0),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 1, 0));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Right);
                    }
                }
                case PredefinedCameras.Top:
                {
                    // if the camera hasn't already been created, create it
                    if(cameraList[(int)PredefinedCameras.Top] == null)
                    {
                        return this.GenerateNewCamera("Top",(int)PredefinedCameras.Top,
                            CameraType.Orthogonal,
                            new Vector3(0, 10, 0),
                            new Vector3(0, 0, 0),
                            new Vector3(0, 0, 1));
                    }
                    else
                    {
                        return this.GetExistingCamera((int)PredefinedCameras.Top);
                    }
                }
                default:
                    return null;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get a predefined camera
        /// </summary>
        /// <param name="camera">The desired predifined camera</param>
        /// <returns>A reference to the camera, this reference may be shared by multiple viewports</returns>
        public MidgetCamera CreateCamera(PredefinedCameras camera)
        {
            switch (camera)
            {
            case PredefinedCameras.Perspective:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Perspective] == null)
                {
                    return(this.GenerateNewCamera("Perspective", (int)PredefinedCameras.Perspective,
                                                  CameraType.Perspective,
                                                  new Vector3(5, 5, 5),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 1, 0)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Perspective));
                }
            }

            case PredefinedCameras.Front:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Front] == null)
                {
                    return(this.GenerateNewCamera("Front", (int)PredefinedCameras.Front,
                                                  CameraType.Orthogonal,
                                                  new Vector3(0, 0, -10),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 1, 0)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Front));
                }
            }

            case PredefinedCameras.Left:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Left] == null)
                {
                    return(this.GenerateNewCamera("Left", (int)PredefinedCameras.Left,
                                                  CameraType.Orthogonal,
                                                  new Vector3(10, 0, 0),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 1, 0)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Left));
                }
            }

            case PredefinedCameras.Back:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Back] == null)
                {
                    return(this.GenerateNewCamera("Back", (int)PredefinedCameras.Back,
                                                  CameraType.Orthogonal,
                                                  new Vector3(0, 0, 10),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 1, 0)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Back));
                }
            }

            case PredefinedCameras.Right:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Right] == null)
                {
                    return(this.GenerateNewCamera("Right", (int)PredefinedCameras.Right,
                                                  CameraType.Orthogonal,
                                                  new Vector3(-10, 0, 0),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 1, 0)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Right));
                }
            }

            case PredefinedCameras.Top:
            {
                // if the camera hasn't already been created, create it
                if (cameraList[(int)PredefinedCameras.Top] == null)
                {
                    return(this.GenerateNewCamera("Top", (int)PredefinedCameras.Top,
                                                  CameraType.Orthogonal,
                                                  new Vector3(0, 10, 0),
                                                  new Vector3(0, 0, 0),
                                                  new Vector3(0, 0, 1)));
                }
                else
                {
                    return(this.GetExistingCamera((int)PredefinedCameras.Top));
                }
            }

            default:
                return(null);
            }
        }