1#ifndef BALL_VIEW_RENDERING_CAMERA_H
2#define BALL_VIEW_RENDERING_CAMERA_H
4#ifndef BALL_COMMON_GLOBAL_H
8#ifndef BALL_MATHS_VECTOR3_H
12#ifndef BALL_MATHS_QUATERNION_H
58 { view_point_ += right_vector_*translation; look_at_ += right_vector_*translation; }
62 { view_point_ += look_up_vector_*translation; look_at_ += look_up_vector_*translation; }
67 Vector3 normal_view_vector(view_vector_);
69 view_point_ += normal_view_vector*translation;
70 look_at_ += normal_view_vector*translation;
75 {
return view_point_;}
79 { view_point_ = view_point; calculateVectors_();}
87 { look_at_ = look_at; calculateVectors_();}
91 {
return look_up_vector_;}
95 { look_up_vector_ = look_up_vector; calculateVectors_();}
102 {
return view_point_.getDistance(look_at_);}
106 {
return view_vector_;}
110 {
return right_vector_;}
130 { projection_mode_ = mode; }
134 {
return projection_mode_; }
148 bool operator == (
const Camera& camera)
const;
151 bool operator < (
const Camera& camera)
const;
161 virtual void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
void translate(const Vector3 &v)
Translate the view point and the point the camera is looking to by a given vector.
void setLookAtPosition(const Vector3 &look_at)
Set the direction of the camera.
const Vector3 & getViewPoint() const
Get the position of the camera.
void moveForward(float translation)
Move the camera along the view vector.
Camera(const Vector3 &view_point, const Vector3 &look_at, const Vector3 &look_up_vector, const ProjectionMode &mode=PERSPECTIVE)
Camera(const Camera &camera)
Copy Constructor.
const Vector3 & getLookAtPosition() const
Get the direction of the camera.
Vector3 getRightVector() const
Get an vector orthogonal to the viewing vector and showing to the right.
void moveUp(float translation)
Move the camera along the up vector.
Vector3 convertCameraToSceneCoordinates(const Vector3 &v)
Convert the given vector from camera system to cartesian coordinates.
void setProjectionMode(ProjectionMode const &mode)
Set the projection mode.
void rotateAboutView(float degree)
Rotate up and right around the view vector.
ProjectionMode getProjectionMode() const
Get the projection mode.
ProjectionMode
Enumeration of different projection modes.
virtual ~Camera()
Destructor.
float getDistance() const
Get the distance between the view point and the look at point.
void rotate(const Matrix4x4 &mat, const Vector3 &origin)
Rotate the camera.
Vector3 getViewVector() const
Get the view vector.
const Vector3 & getLookUpVector() const
Get the look up vector.
virtual void clear()
Reset Camera to standard values.
void setLookUpVector(const Vector3 &look_up_vector)
Set the look up vector and compute the new right vector.
void setViewPoint(const Vector3 &view_point)
Set the position of the camera.
void moveRight(float translation)
Move the camera along the right vector.
bool readFromString(const String &data)
ProjectionMode projection_mode_
void rotate(const Quaternion &q, const Vector3 &origin)
Rotate the camera.