21 projectionType = PERSPECTIVE;
28 nearPlaneDistance = 0.5f;
29 farPlaneDistance = 100.0f;
37 projectionType = PERSPECTIVE;
43 nearPlaneDistance = 0.5f;
44 farPlaneDistance = 100.0f;
59 description = cam.description;
80 description = cam.description;
97 description = descriptionValue;
154 location = locationValue;
162 target = targetValue;
194 double halfHeight = newValue / 2;
195 double halfWidth = halfHeight * aspectRatio;
197 vvBottom = -halfHeight;
204 vvBottom *= verScale;
255 trans.
MakeRotation(up,-1.5707963267948966192313216916398);
256 right = trans * (target - location);
270 translation *= distance;
280 glMatrixMode(GL_PROJECTION);
282 if (projectionType == PERSPECTIVE)
283 gluPerspective(fovY, aspectRatio, nearPlaneDistance, farPlaneDistance);
285 glOrtho(vvLeft, vvRight, vvBottom, vvTop, nearPlaneDistance, farPlaneDistance);
286 glMatrixMode(GL_MODELVIEW);
288 gluLookAt(location.GetX(),location.GetY(),location.GetZ(),
289 target.GetX(), target.GetY(), target.GetZ(),
290 up.GetX(), up.GetY(), up.GetZ());
302 glMatrixMode(GL_PROJECTION);
303 if (projectionType == PERSPECTIVE)
304 gluPerspective(fovY, aspectRatio, nearPlaneDistance, farPlaneDistance);
306 glOrtho(vvLeft, vvRight, vvBottom, vvTop, nearPlaneDistance, farPlaneDistance);
307 glMatrixMode(GL_MODELVIEW);
309 gluLookAt(location.GetX(),location.GetY(),location.GetZ(),
310 target.GetX(), target.GetY(), target.GetZ(),
311 up.GetX(), up.GetY(), up.GetZ());
313 cerr <<
"Error! Camera::SetMatrices() unimplemented for non OpenGL systems!" << endl;
319 output <<
"Camera(" << cam.description <<
": pos"<< cam.
location <<
" target" << cam.
target
void MoveForward(double distance)
Moves the camera forward (relative to the camera).
float GetFovY() const
Returns the vertical field of view (in degrees).
void SetMatrices() const
Loads camera transform into rendering engine.
Point4D location
Position where the camera is at.
Points and vectors using homogeneous coordinates.
void Roll(float radians)
Rolls the Camera around itself.
Header file for V-ART class "Camera".
float fovY
Vertical angle of frustum. Used if projectionType == PERSPECTIVE.
void Normalize()
Normalizes the point/vector.
void SetDescription(const std::string &descriptionValue)
Sets the description associated with the camera.
std::ostream & operator<<(std::ostream &output, const Joint::DofID &dofId)
void LeftVector(Point4D *resultPtr) const
Computes the vector pointing left.
void ScaleVisibleVolume(float horScale, float verScale)
Scales the visible volume.
Point4D GetTarget() const
Returns the camera target (where it is looking at).
Point4D CrossProduct(const Point4D &p) const
Computes the cross product between "this" and "p".
float farPlaneDistance
Distance to far plane.
void SetTarget(const Point4D &targetValue)
Sets the camera target (where it is looking at).
void SetUp(const Point4D &upValue)
Sets the camera up vector.
void SetFovY(float f)
Sets the vertical field of view (in degrees).
bool DrawOGL() const
Positions a camera using OpenGL commands.
void YawAroundTarget(float radians)
Rotates the Camera around the axis defined by the target and up vector.
void SetLocation(const Point4D &locationValue)
Sets the camera location.
Point4D up
Up direction, relative to the camera.
void Yaw(float radians)
Rotates the Camera around itself (location and up vector).
Point4D GetUp() const
Returns the camera up vector.
void MoveUp(double distance)
Moves the camera up and down.
void SetVisibleVolumeHeight(double newValue)
Sets the visible volume by given height.
double vvRight
Visible Volume right coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC...
void PitchAroundTarget(float radians)
Rotates the Camera around the axis defined by the target and left vector.
void MoveSideways(double distance)
Moves the camera sideways.
double vvBottom
Visible Volume bottom coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC...
float aspectRatio
Viewing aspect ratio (width/height).
Camera & operator=(const Camera &cam)
Point4D GetLocation() const
Returns the camera location (its position).
Point4D target
Position where the camera is looking at.
float nearPlaneDistance
Distance to near plane.
double vvTop
Visible Volume top coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
double vvLeft
Visible Volume left coordinate (in world coordinates). Used if projectionType is ORTHOGRAPHIC.
void FrontVector(Point4D *resultPtr) const
Computes the vector pointing ahead.
ProjectionType projectionType
Indicates whether a perspective ou orthographic projection should be used.