001package scene;
002
003/**
004   This Camera data structure represents a camera located
005   at the origin and looking down the negative z-axis.
006
007   This camera has associated to it a "view volume" that
008   determines what part of space the camera "sees" in front
009   of it when we use the camera to take a picture (that is,
010   when we render a scene).
011
012   This camera can "take a picture" two ways, using a
013   perspective projection or using a parallel (orthographic)
014   projection. Each way of taking a picture has a different
015   shape for its view volume.
016
017   For the perspective projection, the view volume is an
018   infinitely long pyramid that is formed by the pyramid
019   with its apex at the origin and its base in the plane
020   z = -1 with edges x = -1, x = +1, y = -1, and y = +1.
021
022   For the orthographic projection, the view volume is an
023   infinitely long rectangular cylinder parallel to the
024   z-axis and with sides x = -1, x = +1, y = -1, and y = +1
025   (an infinite parallelepiped).
026
027   The part of space determined by the view volume is what
028   the camera "sees" when we "take a picture" (that is,
029   when we render a scene).
030
031   The plane z = -1 is the camera's view plane. The rectangle
032   in the view plane with corners (-1, -1, -1) and (+1, +1, -1)
033   is the camera's view rectangle. The view rectangle is like
034   the film in a real camera, it is where the camera's image
035   appears when you take a picture. The contents of the camera's
036   view rectangle is what gets rasterized into the framebuffer.
037*/
038public class Camera
039{
040   public boolean perspective;  // choose either perspective or parallel projection
041
042
043   /**
044      The default camera uses perspective projection.
045   */
046   public Camera()
047   {
048      this.perspective = true;
049   }
050
051
052
053   /**
054      For debugging.
055
056      @return String representation of this Camera object
057   */
058   public String toString()
059   {
060      String result = "";
061      result += "Camera: \n";
062      result += "perspective = " + perspective + "\n";
063      return result;
064   }
065}