V-ART
|
Virtual camera. More...
#include <camera.h>
Public Types | |
enum | ProjectionType { ORTHOGRAPHIC, PERSPECTIVE } |
Public Member Functions | |
Camera () | |
Camera (const Point4D &position, const Point4D &focus, const Point4D &upVec) | |
Camera (const Camera &cam) | |
Camera & | operator= (const Camera &cam) |
const std::string & | GetDescription () const |
Gets the description associated with the camera. More... | |
void | SetDescription (const std::string &descriptionValue) |
Sets the description associated with the camera. More... | |
ProjectionType | GetProjectionType () const |
Gets the projection type (PERSPECTIVE/ORTHOGRAPHIC). More... | |
void | SetProjectionType (ProjectionType newValue) |
Sets the projection type (PERSPECTIVE/ORTHOGRAPHIC). More... | |
float | GetAspectRatio () const |
Gets the camera's width/height ratio. More... | |
void | SetAspectRatio (float newAR) |
Sets the camera's width/height ratio. More... | |
float | GetNearPlaneDistance () const |
Returns the distance to the near plane. More... | |
void | SetNearPlaneDistance (float newValue) |
Sets the distance to the near plane. More... | |
float | GetFarPlaneDistance () const |
Returns the distance to the far plane. More... | |
void | SetFarPlaneDistance (float newValue) |
Sets the distance to the far plane distance. More... | |
float | GetFovY () const |
Returns the vertical field of view (in degrees). More... | |
void | SetFovY (float f) |
Sets the vertical field of view (in degrees). More... | |
Point4D | GetLocation () const |
Returns the camera location (its position). More... | |
void | SetLocation (const Point4D &locationValue) |
Sets the camera location. More... | |
Point4D | GetTarget () const |
Returns the camera target (where it is looking at). More... | |
void | SetTarget (const Point4D &targetValue) |
Sets the camera target (where it is looking at). More... | |
Point4D | GetUp () const |
Returns the camera up vector. More... | |
void | LeftVector (Point4D *resultPtr) const |
Computes the vector pointing left. More... | |
void | FrontVector (Point4D *resultPtr) const |
Computes the vector pointing ahead. More... | |
void | SetUp (const Point4D &upValue) |
Sets the camera up vector. More... | |
void | SetVisibleVolumeHLimits (double left, double right) |
Sets the horizontal limit coordinates of the orthographic view volume. More... | |
void | SetVisibleVolumeVLimits (double top, double bottom) |
Sets the vertical limit coordinates of the orthographic view volume. More... | |
const double | GetVisibleVolumeLeftLimit () const |
Gets the coordinates of the orthographic view volume. More... | |
const double | GetVisibleVolumeRightLimit () const |
Gets the coordinates of the orthographic view volume. More... | |
const double | GetVisibleVolumeTopLimit () const |
Gets the coordinates of the orthographic view volume. More... | |
const double | GetVisibleVolumeBottomLimit () const |
Gets the coordinates of the orthographic view volume. More... | |
void | SetVisibleVolumeHeight (double newValue) |
Sets the visible volume by given height. More... | |
void | ScaleVisibleVolume (float horScale, float verScale) |
Scales the visible volume. More... | |
void | YawAroundTarget (float radians) |
Rotates the Camera around the axis defined by the target and up vector. More... | |
void | Yaw (float radians) |
Rotates the Camera around itself (location and up vector). More... | |
void | Roll (float radians) |
Rolls the Camera around itself. More... | |
void | PitchAroundTarget (float radians) |
Rotates the Camera around the axis defined by the target and left vector. More... | |
void | MoveForward (double distance) |
Moves the camera forward (relative to the camera). More... | |
void | MoveSideways (double distance) |
Moves the camera sideways. More... | |
void | MoveUp (double distance) |
Moves the camera up and down. More... | |
bool | DrawOGL () const |
Positions a camera using OpenGL commands. More... | |
void | SetMatrices () const |
Loads camera transform into rendering engine. More... | |
Protected Attributes | |
ProjectionType | projectionType |
Indicates whether a perspective ou orthographic projection should be used. More... | |
float | fovY |
Vertical angle of frustum. Used if projectionType == PERSPECTIVE. More... | |
float | aspectRatio |
Viewing aspect ratio (width/height). More... | |
float | nearPlaneDistance |
Distance to near plane. More... | |
float | farPlaneDistance |
Distance to far plane. More... | |
double | vvLeft |
Visible Volume left coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC. More... | |
double | vvRight |
Visible Volume right coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC. More... | |
double | vvTop |
Visible Volume top coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC. More... | |
double | vvBottom |
Visible Volume bottom coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC. More... | |
Point4D | location |
Position where the camera is at. More... | |
Point4D | target |
Position where the camera is looking at. More... | |
Point4D | up |
Up direction, relative to the camera. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &output, const Camera &cam) |
Virtual camera.
FixMe: A detailed class description is needed here.
VART::Camera::Camera | ( | ) |
Definition at line 20 of file camera.cpp.
Creates a camera.
position | [in] Location of the new camera |
focus | [in] Position at which the new camera is looking at |
upVec | [in] Up vector specifing camera's orientation |
Creates a camera with given parameters. The "up vector" is modified in order to be orthogonal to the camera line of view and is normalized.
Definition at line 35 of file camera.cpp.
References VART::Point4D::CrossProduct(), and VART::Point4D::Normalize().
VART::Camera::Camera | ( | const Camera & | cam | ) |
Definition at line 57 of file camera.cpp.
References aspectRatio, farPlaneDistance, fovY, location, nearPlaneDistance, projectionType, target, up, vvBottom, vvLeft, vvRight, and vvTop.
bool VART::Camera::DrawOGL | ( | ) | const |
Positions a camera using OpenGL commands.
Definition at line 276 of file camera.cpp.
Referenced by VART::Scene::DrawOGL().
void VART::Camera::FrontVector | ( | Point4D * | resultPtr | ) | const |
Computes the vector pointing ahead.
Definition at line 187 of file camera.cpp.
References VART::Point4D::Normalize().
|
inline |
Gets the camera's width/height ratio.
Definition at line 49 of file camera.h.
References aspectRatio.
|
inline |
|
inline |
Returns the distance to the far plane.
Definition at line 61 of file camera.h.
References farPlaneDistance.
float VART::Camera::GetFovY | ( | ) | const |
Returns the vertical field of view (in degrees).
Definition at line 173 of file camera.cpp.
VART::Point4D VART::Camera::GetLocation | ( | ) | const |
Returns the camera location (its position).
Definition at line 149 of file camera.cpp.
|
inline |
Returns the distance to the near plane.
Definition at line 55 of file camera.h.
References nearPlaneDistance.
|
inline |
Gets the projection type (PERSPECTIVE/ORTHOGRAPHIC).
Definition at line 43 of file camera.h.
References projectionType.
VART::Point4D VART::Camera::GetTarget | ( | ) | const |
Returns the camera target (where it is looking at).
Definition at line 157 of file camera.cpp.
VART::Point4D VART::Camera::GetUp | ( | ) | const |
Returns the camera up vector.
Definition at line 165 of file camera.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
void VART::Camera::LeftVector | ( | Point4D * | resultPtr | ) | const |
Computes the vector pointing left.
Definition at line 181 of file camera.cpp.
References VART::Point4D::CrossProduct(), and VART::Point4D::Normalize().
void VART::Camera::MoveForward | ( | double | distance | ) |
Moves the camera forward (relative to the camera).
Definition at line 241 of file camera.cpp.
References VART::Transform::ApplyTo(), VART::Transform::MakeTranslation(), and VART::Point4D::Normalize().
void VART::Camera::MoveSideways | ( | double | distance | ) |
Moves the camera sideways.
Definition at line 251 of file camera.cpp.
References VART::Transform::ApplyTo(), VART::Transform::MakeRotation(), VART::Transform::MakeTranslation(), and VART::Point4D::Normalize().
void VART::Camera::MoveUp | ( | double | distance | ) |
Moves the camera up and down.
Definition at line 265 of file camera.cpp.
References VART::Transform::ApplyTo(), VART::Transform::MakeTranslation(), and VART::Point4D::Normalize().
VART::Camera & VART::Camera::operator= | ( | const Camera & | cam | ) |
Definition at line 78 of file camera.cpp.
References aspectRatio, farPlaneDistance, fovY, location, nearPlaneDistance, projectionType, target, up, vvBottom, vvLeft, vvRight, and vvTop.
void VART::Camera::PitchAroundTarget | ( | float | radians | ) |
Rotates the Camera around the axis defined by the target and left vector.
Definition at line 230 of file camera.cpp.
References VART::Transform::ApplyTo(), VART::Point4D::CrossProduct(), VART::Transform::MakeRotation(), and VART::Point4D::Normalize().
void VART::Camera::Roll | ( | float | radians | ) |
Rolls the Camera around itself.
Definition at line 221 of file camera.cpp.
References VART::Transform::ApplyTo(), VART::Transform::MakeRotation(), and VART::Point4D::Normalize().
void VART::Camera::ScaleVisibleVolume | ( | float | horScale, |
float | verScale | ||
) |
Scales the visible volume.
The visible volume is changed by scaling horizontal and vertical limits by given factors. Usefull when changing the viewer size.
Definition at line 202 of file camera.cpp.
|
inline |
Sets the camera's width/height ratio.
Definition at line 52 of file camera.h.
References aspectRatio.
void VART::Camera::SetDescription | ( | const std::string & | descriptionValue | ) |
Sets the description associated with the camera.
Definition at line 96 of file camera.cpp.
|
inline |
Sets the distance to the far plane distance.
Definition at line 64 of file camera.h.
References farPlaneDistance.
void VART::Camera::SetFovY | ( | float | f | ) |
Sets the vertical field of view (in degrees).
Definition at line 177 of file camera.cpp.
void VART::Camera::SetLocation | ( | const Point4D & | locationValue | ) |
Sets the camera location.
Definition at line 153 of file camera.cpp.
void VART::Camera::SetMatrices | ( | ) | const |
Loads camera transform into rendering engine.
This method if much like DrawOGL, it only does not clear the camera transformation before setting loading the camera transform. It is usefull for object selection, if called after a call to gluPickMatrix.
Definition at line 297 of file camera.cpp.
|
inline |
Sets the distance to the near plane.
Definition at line 58 of file camera.h.
References nearPlaneDistance.
|
inline |
Sets the projection type (PERSPECTIVE/ORTHOGRAPHIC).
Definition at line 46 of file camera.h.
References projectionType.
void VART::Camera::SetTarget | ( | const Point4D & | targetValue | ) |
Sets the camera target (where it is looking at).
Definition at line 161 of file camera.cpp.
void VART::Camera::SetUp | ( | const Point4D & | upValue | ) |
Sets the camera up vector.
Definition at line 169 of file camera.cpp.
void VART::Camera::SetVisibleVolumeHeight | ( | double | newValue | ) |
Sets the visible volume by given height.
The visible volume is changed so that the origin is centered. The camera's aspect ratio is used to compute the visible volume's width. Usefull only for orthographic cameras.
Definition at line 193 of file camera.cpp.
|
inline |
|
inline |
void VART::Camera::Yaw | ( | float | radians | ) |
Rotates the Camera around itself (location and up vector).
Definition at line 215 of file camera.cpp.
References VART::Transform::ApplyTo(), and VART::Transform::MakeRotation().
void VART::Camera::YawAroundTarget | ( | float | radians | ) |
Rotates the Camera around the axis defined by the target and up vector.
Definition at line 209 of file camera.cpp.
References VART::Transform::ApplyTo(), and VART::Transform::MakeRotation().
|
friend |
|
protected |
Viewing aspect ratio (width/height).
Definition at line 165 of file camera.h.
Referenced by Camera(), GetAspectRatio(), operator=(), and SetAspectRatio().
|
protected |
Distance to far plane.
Definition at line 169 of file camera.h.
Referenced by Camera(), GetFarPlaneDistance(), operator=(), and SetFarPlaneDistance().
|
protected |
Vertical angle of frustum. Used if projectionType == PERSPECTIVE.
Definition at line 163 of file camera.h.
Referenced by Camera(), and operator=().
|
protected |
Position where the camera is at.
Definition at line 185 of file camera.h.
Referenced by Camera(), and operator=().
|
protected |
Distance to near plane.
Definition at line 167 of file camera.h.
Referenced by Camera(), GetNearPlaneDistance(), operator=(), and SetNearPlaneDistance().
|
protected |
Indicates whether a perspective ou orthographic projection should be used.
Definition at line 161 of file camera.h.
Referenced by Camera(), GetProjectionType(), operator=(), and SetProjectionType().
|
protected |
Position where the camera is looking at.
Definition at line 187 of file camera.h.
Referenced by Camera(), and operator=().
|
protected |
Up direction, relative to the camera.
Definition at line 190 of file camera.h.
Referenced by Camera(), and operator=().
|
protected |
Visible Volume bottom coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
Definition at line 182 of file camera.h.
Referenced by Camera(), GetVisibleVolumeBottomLimit(), operator=(), and SetVisibleVolumeVLimits().
|
protected |
Visible Volume left coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
Definition at line 173 of file camera.h.
Referenced by Camera(), GetVisibleVolumeLeftLimit(), operator=(), and SetVisibleVolumeHLimits().
|
protected |
Visible Volume right coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
Definition at line 176 of file camera.h.
Referenced by Camera(), GetVisibleVolumeRightLimit(), operator=(), and SetVisibleVolumeHLimits().
|
protected |
Visible Volume top coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
Definition at line 179 of file camera.h.
Referenced by Camera(), GetVisibleVolumeTopLimit(), operator=(), and SetVisibleVolumeVLimits().