#include <Camera.h>
Public Member Functions | |
Camera () | |
~Camera () | |
void | SetAttributes (double angle, double aspect_ratio, double near_cutoff, double far_cutoff) |
void | ApplyAttributes () |
void | ApplyPosition (int time) |
void | ComputeInverseView (int time) |
float * | GetInverseView () |
void | BuildPlanes (int time) |
void | BuildPlanes2 () |
void | DrawFrustum () |
void | DrawFrustum2 (int time) |
void | MoveForward (double amount) |
void | MoveRight (double amount) |
void | MoveUp (double amount) |
Public Attributes | |
PositionPath * | position |
Plane | left |
Plane | right |
Plane | top |
Plane | bottom |
Plane | front |
Plane | back |
Plane | planes [6] |
Private Attributes | |
double | angle |
double | aspect_ratio |
double | near_cutoff |
double | far_cutoff |
float | inverse_view [16] |
This class implements a simple pinhole camera. It has attributes like the aspect ratio between the horizontal and vertical size of the capture window, the size of the viewing angle and a near and far cutoff threshold which define the interval in which the objects are visibible to the camera.
The camera class also provides means to apply its position and orientation to the current OpenGL matrix as well as some functionality that can be used for viewing frustum culling.
It is important to notice, that the viewing direction of this camera is along the positive x axis (and not the z axis as in most other implementations). This choice has been made to make camera placement in world coordinates simpler as the rotation angles to be applied get more intuitive.
Definition at line 35 of file Camera.h.
|
Constructor: Initializes the camera with some standard values. Definition at line 11 of file Camera.cpp. |
|
Destructor. Definition at line 21 of file Camera.cpp. |
|
Sets up the projection matrix of OpenGL. Definition at line 34 of file Camera.cpp. |
|
Sets up the modelview matrix of OpenGL at any given time.
Definition at line 45 of file Camera.cpp. |
|
Builds the planes of the viewing frustum in world coordinates. Since the camera may change its position as well as orientation over time, these planes may vary over time.
Definition at line 96 of file Camera.cpp. |
|
Builds the planes of the viewing frustum in the coordinate system right before the projection. Since the camera position is just another transformation used to express everything our desired world coordinates, these planes are time independent. Definition at line 300 of file Camera.cpp. |
|
Computes the inverse view matrix at any given time.
Definition at line 63 of file Camera.cpp. |
|
Draws the view frustum of the camera by using the planes defined in world coordinates. This routine does not display a meaningful frustum unless BuildPlanes (...) has been called before. Definition at line 200 of file Camera.cpp. |
|
Draws the view frustum of the camera by using the planes defined in the coordinate system right before the projection. Since this frustum is independent of the camera position, it must be transformed back into world coordinates before it can be drawn. This routine does not display a meaningful frustum unless BuildPlanes2 () has been called before.
Definition at line 230 of file Camera.cpp. |
|
Returns a pointer to the inverse view matrix. The returned values are only valid if ComputeInverseView (...) has been called before.
Definition at line 91 of file Camera.cpp. |
|
Moves the camera forward by a certain distance.
Definition at line 356 of file Camera.cpp. |
|
Moves the camera to the right by a certain distance.
Definition at line 370 of file Camera.cpp. |
|
Moves the camera upwards by a certain distance.
Definition at line 384 of file Camera.cpp. |
|
Set the attributes of the camera.
Definition at line 26 of file Camera.cpp. |
|
viewing angle in degrees |
|
aspect_ratio |
|
far cutoff value |
|
stores the inverse view matrix |
|
class members: the view frustum planes in world coordinates. |
|
near cutoff value |
|
class members: the view frustum planes in the coordinate system right before projection takes place. |
|
The path of the camera over time. |