Inheritance: ICloneable
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 // Constructors
 public FloatingCageScene()
     : base()
 {
     innerCage = new Vertex ();
     outerCage = new Vertex ();
     camera = new Vertex ();
 }
Exemplo n.º 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;
        }
Exemplo n.º 6
0
        public Camera(Vertex position, Vertex target, Vector upVector)
        {
            this.position = position;

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

            LookAt (target);
        }
Exemplo n.º 8
0
 // Strafe the camera left or right, relative to the camera's orientation
 public void Strafe(float amount)
 {
     position += (right * amount);
 }
Exemplo n.º 9
0
 // Zoom the camera in or out, relative to the camera's orientation (obviously)
 public void Zoom(float amount)
 {
     position += (viewdir * amount);
 }
Exemplo n.º 10
0
 // Move the camera to a specific position, keeping its orientation
 public void MoveTo(Vertex point)
 {
     position = point;
 }
Exemplo n.º 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);
 }
Exemplo n.º 12
0
 // Move the camera relative to world axis
 public void Move(Vector amount)
 {
     position += amount;
 }
Exemplo n.º 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 ();
        }
Exemplo n.º 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 ();
        }
Exemplo n.º 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);
 }
Exemplo n.º 16
0
 // Change the elevation of the camera, relative to the camera's orientation
 public void Elevate(float amount)
 {
     position += (up * amount);
 }