Class Camera


  • public final class Camera
    extends Object
    This Camera data structure represents a camera located at the origin, looking down the negative z-axis.

    This Camera has associated to it a "view volume" that determines what part of space the camera "sees" when we use the camera to take a picture (that is, when we render a Scene).

    This Camera can "take a picture" two ways, using a perspective projection or a parallel (orthographic) projection. Each way of taking a picture has a different shape for its view volume.

    For the perspective projection, the view volume is an infinitely long pyramid that is formed by the pyramid with its apex at the origin and its base in the plane z = -1 with edges x = -1, x = +1, y = -1, and y = +1.

    For the orthographic projection, the view volume is an infinitely long rectangular cylinder parallel to the z-axis and with sides x = -1, x = +1, y = -1, and y = +1 (an infinite parallelepiped).

    When the graphics rendering Pipeline uses this Camera to render a Scene, the renderer "sees" the geometry from the scene that is contained in this camera's view volume. (Notice that this means the orthographic camera will see geometry that is behind the camera. In fact, the perspective camera also sees geometry that is behind the camera.) The renderer's Rasterize pipeline stage is responsible for making sure that the scene's geometry that is outside of this camera's view volume is not visible.

    The plane z = -1 is the camera's "image plane". The rectangle in the image plane with corners (-1, -1, -1) and (+1, +1, -1) is the camera's "view rectangle". The view rectangle is like the film in a real camera, it is where the camera's image appears when you take a picture. The contents of the camera's view rectangle is what gets rasterized, by the renderer's Rasterize pipeline stage, into a FrameBuffer's FrameBuffer.Viewport.

    • Method Detail

      • projPerspective

        public static Camera projPerspective()
        This is a static factory method.

        Set up this Camera's view volume as a perspective projection of an infinite view pyramid extending along the negative z-axis.

        Returns:
        a new Camera object with the default perspective parameter
      • projOrtho

        public static Camera projOrtho()
        This is a static factory method.

        Set up this Camera's view volume as a parallel (orthographic) projection of an infinite view parallelepiped extending along the z-axis.

        Returns:
        a new Camera object with the default orthographic parameter