Inheritance: ICloneable
Example #1
0
 // Default Constructor
 public Camera()
 {
     position = new Vertex (0.0f, 0.0f, 0.0f);
     viewdir = new Vector (0.0f, 0.0f, -1.0f);
     right = new Vector (1.0f, 0.0f, 0.0f);
     up = new Vector (0.0f, 1.0f, 0.0f);
 }
Example #2
0
        public Camera(float x, float y, float z)
        {
            position = new Vertex (x, y, z);

            viewdir = new Vector (0.0f, 0.0f, -1.0f);
            right = new Vector (1.0f, 0.0f, 0.0f);
            up = new Vector (0.0f, 1.0f, 0.0f);
        }
Example #3
0
        // Positional Constructors
        public Camera(Vertex position)
        {
            this.position = position;

            viewdir = new Vector (0.0f, 0.0f, -1.0f);
            right = new Vector (1.0f, 0.0f, 0.0f);
            up = new Vector (0.0f, 1.0f, 0.0f);
        }
Example #4
0
 // Constructors
 public FloatingCageScene()
     : base()
 {
     innerCage = new Vertex ();
     outerCage = new Vertex ();
     camera = new Vertex ();
 }
Example #5
0
        public override bool AdvanceFrame()
        {
            bool zoom = false;

            innerCage += InnerRotation;
            outerCage += OuterRotation;

            if (state == State.ZoomIn) {
                camera -= CameraZoom;
                zoom = true;
            } else if (state == State.ZoomOut) {
                camera += CameraZoom;
                zoom = true;
            } else if (state == State.FadeOut) {
                // this is a short-lived state as well
                zoom = true;
            }

            if ((zoom && nFrames == 175) || nFrames == 800) {
                nFrames = 0;
                state++;
            } else
                nFrames++;

            return state != State.Complete;
        }
Example #6
0
        public Camera(Vertex position, Vertex target, Vector upVector)
        {
            this.position = position;

            LookAt (target, upVector);
        }
Example #7
0
        // Positional + LookAt Constructors
        public Camera(Vertex position, Vertex target)
        {
            this.position = position;

            LookAt (target);
        }
Example #8
0
 // Strafe the camera left or right, relative to the camera's orientation
 public void Strafe(float amount)
 {
     position += (right * amount);
 }
Example #9
0
 // Zoom the camera in or out, relative to the camera's orientation (obviously)
 public void Zoom(float amount)
 {
     position += (viewdir * amount);
 }
Example #10
0
 // Move the camera to a specific position, keeping its orientation
 public void MoveTo(Vertex point)
 {
     position = point;
 }
Example #11
0
 // Move the camera to a specific position, keeping its orientation
 public void MoveTo(float x, float y, float z)
 {
     position = new Vertex (x, y, z);
 }
Example #12
0
 // Move the camera relative to world axis
 public void Move(Vector amount)
 {
     position += amount;
 }
Example #13
0
        // Direct the camera toward a specific point in space using the specified upward orientation
        public void LookAt(Vertex point, Vector upVector)
        {
            viewdir = point - position;
            viewdir.Normalize ();

            up = upVector.Normal;

            right = viewdir.Cross (up);
            right.Normalize ();
        }
Example #14
0
        public void LookAt(Vertex point)
        {
            Vector delta = point - position;

            viewdir = delta.Normal;

            if (Math.Abs (delta.x) < 0.00001f && Math.Abs (delta.z) < 0.00001f) {
                delta.x = 0.0f;
                delta.Normalize ();

                right = new Vector (1.0f, 0.0f, 0.0f);
                up = delta.Cross (right);

                right = viewdir.Cross (up) * -1.0f;
            } else {
                delta.y = 0.0f;
                delta.Normalize ();

                up = new Vector (0.0f, 1.0f, 0.0f);
                right = delta.Cross (up) * -1.0f;

                up = viewdir.Cross (right);
            }

            right.Normalize ();
            up.Normalize ();
        }
Example #15
0
 // Methods
 // Direct the camera toward a specific point in space
 public void LookAt(float x, float y, float z)
 {
     Vertex point = new Vertex (x, y, z);
     LookAt (point);
 }
Example #16
0
 // Change the elevation of the camera, relative to the camera's orientation
 public void Elevate(float amount)
 {
     position += (up * amount);
 }