Class Camera
- java.lang.Object
-
- renderer.scene.Camera
-
public final class Camera extends Object
ThisCamera
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 aScene
).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 edgesx = -1
,x = +1
,y = -1
, andy = +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
, andy = +1
(an infinite parallelepiped).When the graphics rendering
Pipeline
uses thisCamera
to render aScene
, 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'sRasterize
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'sRasterize
pipeline stage, into aFrameBuffer
'sFrameBuffer.Viewport
.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
perspective
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Camera
projOrtho()
This is a static factory method.static Camera
projPerspective()
This is a static factory method.String
toString()
For debugging.
-
-
-
Field Detail
-
perspective
public final boolean perspective
-
-
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
-
-