public class Camera extends java.lang.Object
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
Clip
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 Viewport
and
Rasterize
pipeline stages, into a FrameBuffer
.
Modifier and Type | Field and Description |
---|---|
boolean |
perspective |
Constructor and Description |
---|
Camera()
The default
Camera uses perspective projection. |
Modifier and Type | Method and Description |
---|---|
void |
projOrtho()
Set up this
Camera 's view volume as a parallel (orthographic)
projection of an infinite view parallelepiped. |
void |
projPerspective()
Set up this camera's view volume as a perspective projection
of an infinite view pyramid extending along the negative z-axis.
|
java.lang.String |
toString()
For debugging.
|
public boolean perspective
public Camera()
Camera
uses perspective projection.public void projOrtho()
Camera
's view volume as a parallel (orthographic)
projection of an infinite view parallelepiped.public void projPerspective()
public java.lang.String toString()
toString
in class java.lang.Object
String
representation of this Camera
object