zenilib: Zeni::Camera Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
Zeni::Camera Class Reference
Zenilib

Camera / Point of View. More...

`#include <Camera.h>`

## Public Member Functions

| Camera (const Point3f &position=ZENI_DEFAULT_CAMERA_POSITION, const Quaternion &orientation=ZENI_DEFAULT_CAMERA_ORIENTATION, const float &near_clip=ZENI_DEFAULT_CAMERA_NEAR_CLIP, const float &far_clip=ZENI_DEFAULT_CAMERA_FAR_CLIP, const float &fov_rad_=ZENI_DEFAULT_CAMERA_FOV, const float &tunnel_vision_factor=ZENI_DEFAULT_CAMERA_TUNNEL_VISION)
| The Camera constructor is an alternative to using the numerous setter functions. More...
void | adjust_pitch (const float &phi)
| Adjust the orientation of the camera: up == positive;. More...
void | adjust_roll (const float &rho)
| Adjust the orientation of the camera: spin right == positive;. More...
void | adjust_yaw (const float &theta)
| Adjust the orientation of the camera: left == positive;. More...
Vector3f | get_forward () const
| Get the vector indicating the direction in which the camera is pointing. More...
float | get_fov_deg () const
| Get the field of view (in the y-axis) in degrees. More...
Vector3f | get_left () const
| Get the vector indicating what is "left" from the perspective of the camera. More...
Matrix4f | get_projection_matrix (const std::pair< Point2i, Point2i > &viewport) const
| Equivalent to gluPerspective + tunnel_vision_factor. More...
float | get_tunnel_vision_factor () const
| Get the tunnel vision factor a.k.a. how far to pull back the focal point, scaling the near distance and keeping all else equal. More...
float | get_tunneled_far_clip () const
| Get the far clip shifted by tunnel vision. More...
float | get_tunneled_fov_deg () const
| Get the field of view (in the y-axis) in degrees, shifted by tunnel vision. More...
float | get_tunneled_fov_rad () const
| Get the field of view (in the y-axis) in radians, shifted by tunnel vision. More...
float | get_tunneled_near_clip () const
| Get the near clip shifted by tunnel vision. More...
Point3f | get_tunneled_position () const
| Get the position shifted by tunnel vision. More...
Vector3f | get_up () const
| Get the vector indicating what is "up" from the perspective of the camera. More...
Matrix4f | get_view_matrix () const
| Equivalent to gluLookAt + tunnel_vision_factor. More...
void | look_at (const Point3f &world_coord, const Vector3f &horizon_plane_normal=ZENI_DEFAULT_UP_VECTOR)
| Set the Camera to look at a specific Point3f while maintaining a horizontal horizon for a Plane with the given normal Vector3f. More...
void | look_at (const Point3f &world_coord, const Collision::Plane &horizon_plane)
| Set the Camera to look at a specific Point3f while maintaining a horizontal horizon for the given Plane. More...
void | move_forward_xy (const float &distance)
| Move the camera in the forward direction, projected onto the xy-plane. More...
void | move_left_xy (const float &distance)
| Move the camera in the left direction, projected onto the xy-plane. More...
void | set_fov_deg (const float &degrees)
| Set the field of view (in the y-axis) in degrees. More...
void | turn_left_xy (const float &theta)
| Turn the camera left about the z-axis. More...

## Public Attributes

float | far_clip
float | fov_rad
float | near_clip
Quaternion | orientation
Point3f | position
float | tunnel_vision_factor

## Detailed Description

Camera / Point of View.

This class describes a viewpoint for a scene. Its use is similar in concept to that of an actual camera. You take time to position a camera before you shoot (render) a scene.

Note
  Tell the rendering engine to use a camera with a call to get_Video().set_3d(...);

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 49 of file Camera.h.

## Constructor & Destructor Documentation

Zeni::Camera::Camera | ( | const Point3f & | position = `ZENI_DEFAULT_CAMERA_POSITION`,
|  | const Quaternion & | orientation = `ZENI_DEFAULT_CAMERA_ORIENTATION`,
|  | const float & | near_clip = `ZENI_DEFAULT_CAMERA_NEAR_CLIP`,
|  | const float & | far_clip = `ZENI_DEFAULT_CAMERA_FAR_CLIP`,
|  | const float & | fov_rad_ = `ZENI_DEFAULT_CAMERA_FOV`,
|  | const float & | tunnel_vision_factor = `ZENI_DEFAULT_CAMERA_TUNNEL_VISION`
| ) |  |

The Camera constructor is an alternative to using the numerous setter functions.

Definition at line 26 of file Camera.cpp.

## Member Function Documentation

void Zeni::Camera::adjust_pitch | ( | const float & | phi | ) |

Adjust the orientation of the camera: up == positive;.

Definition at line 40 of file Camera.cpp.

References Zeni::Quaternion::Axis_Angle(), get_left(), and orientation.

void Zeni::Camera::adjust_roll | ( | const float & | rho | ) |

Adjust the orientation of the camera: spin right == positive;.

Definition at line 44 of file Camera.cpp.

References Zeni::Quaternion::Axis_Angle(), get_forward(), and orientation.

void Zeni::Camera::adjust_yaw | ( | const float & | theta | ) |

Adjust the orientation of the camera: left == positive;.

Definition at line 36 of file Camera.cpp.

References Zeni::Quaternion::Axis_Angle(), get_up(), and orientation.

Vector3f Zeni::Camera::get_forward | ( |  | ) | const

inline

Get the vector indicating the direction in which the camera is pointing.

Definition at line 33 of file Camera.hxx.

References orientation, and ZENI_DEFAULT_FORWARD_VECTOR.

Referenced by adjust_roll(), get_tunneled_position(), get_view_matrix(), and move_forward_xy().

float Zeni::Camera::get_fov_deg | ( |  | ) | const

inline

Get the field of view (in the y-axis) in degrees.

Definition at line 44 of file Camera.hxx.

References fov_rad, and Zeni::Global::pi.

Vector3f Zeni::Camera::get_left | ( |  | ) | const

inline

Get the vector indicating what is "left" from the perspective of the camera.

Definition at line 41 of file Camera.hxx.

References orientation, and ZENI_DEFAULT_LEFT_VECTOR.

Referenced by adjust_pitch(), and move_left_xy().

Matrix4f Zeni::Camera::get_projection_matrix | ( | const std::pair< Point2i, Point2i > & | viewport | ) | const

inline

Equivalent to gluPerspective + tunnel_vision_factor.

Definition at line 76 of file Camera.hxx.

References get_tunneled_far_clip(), get_tunneled_fov_rad(), get_tunneled_near_clip(), and Zeni::Matrix4f::Perspective().

Referenced by Zeni::Video::set_3d_view().

float Zeni::Camera::get_tunnel_vision_factor | ( |  | ) | const

inline

Get the tunnel vision factor a.k.a. how far to pull back the focal point, scaling the near distance and keeping all else equal.

float Zeni::Camera::get_tunneled_far_clip | ( |  | ) | const

inline

Get the far clip shifted by tunnel vision.

Definition at line 60 of file Camera.hxx.

References far_clip, get_tunneled_near_clip(), and near_clip.

Referenced by get_projection_matrix().

float Zeni::Camera::get_tunneled_fov_deg | ( |  | ) | const

inline

Get the field of view (in the y-axis) in degrees, shifted by tunnel vision.

Definition at line 64 of file Camera.hxx.

References get_tunneled_fov_rad(), and Zeni::Global::pi.

float Zeni::Camera::get_tunneled_fov_rad | ( |  | ) | const

inline

Get the field of view (in the y-axis) in radians, shifted by tunnel vision.

Definition at line 68 of file Camera.hxx.

References atan(), fov_rad, get_tunneled_near_clip(), and near_clip.

Referenced by get_projection_matrix(), and get_tunneled_fov_deg().

float Zeni::Camera::get_tunneled_near_clip | ( |  | ) | const

inline

Get the near clip shifted by tunnel vision.

Definition at line 56 of file Camera.hxx.

References near_clip, and tunnel_vision_factor.

Referenced by get_projection_matrix(), get_tunneled_far_clip(), and get_tunneled_fov_rad().

Point3f Zeni::Camera::get_tunneled_position | ( |  | ) | const

inline

Get the position shifted by tunnel vision.

Definition at line 52 of file Camera.hxx.

References get_forward(), near_clip, position, and tunnel_vision_factor.

Referenced by get_view_matrix().

Vector3f Zeni::Camera::get_up | ( |  | ) | const

inline

Get the vector indicating what is "up" from the perspective of the camera.

Definition at line 37 of file Camera.hxx.

References orientation, and ZENI_DEFAULT_UP_VECTOR.

Referenced by adjust_yaw(), and get_view_matrix().

Matrix4f Zeni::Camera::get_view_matrix | ( |  | ) | const

inline

Equivalent to gluLookAt + tunnel_vision_factor.

Definition at line 72 of file Camera.hxx.

References get_forward(), get_tunneled_position(), get_up(), and Zeni::Matrix4f::View().

Referenced by Zeni::Video::set_3d_view().

void Zeni::Camera::look_at | ( | const Point3f & | world_coord,
|  | const Vector3f & | horizon_plane_normal = `ZENI_DEFAULT_UP_VECTOR`
| ) |  |

Set the Camera to look at a specific Point3f while maintaining a horizontal horizon for a Plane with the given normal Vector3f.

Definition at line 60 of file Camera.cpp.

References Zeni::Quaternion::Forward_Up(), orientation, position, ZENI_DEFAULT_FORWARD_VECTOR, and ZENI_DEFAULT_UP_VECTOR.

Referenced by look_at().

void Zeni::Camera::look_at | ( | const Point3f & | world_coord,
|  | const Collision::Plane & | horizon_plane
| ) |  |

Set the Camera to look at a specific Point3f while maintaining a horizontal horizon for the given Plane.

Definition at line 70 of file Camera.cpp.

References Zeni::Collision::Plane::get_normal(), and look_at().

void Zeni::Camera::move_forward_xy | ( | const float & | distance | ) |

Move the camera in the forward direction, projected onto the xy-plane.

Definition at line 48 of file Camera.cpp.

References get_forward(), Zeni::Vector3f::get_ij(), Zeni::Vector3f::normalized(), and position.

void Zeni::Camera::move_left_xy | ( | const float & | distance | ) |

Move the camera in the left direction, projected onto the xy-plane.

Definition at line 52 of file Camera.cpp.

References Zeni::Vector3f::get_ij(), get_left(), Zeni::Vector3f::normalized(), and position.

void Zeni::Camera::set_fov_deg | ( | const float & | degrees | ) |

inline

Set the field of view (in the y-axis) in degrees.

Definition at line 48 of file Camera.hxx.

References fov_rad, and Zeni::Global::pi.

void Zeni::Camera::turn_left_xy | ( | const float & | theta | ) |

Turn the camera left about the z-axis.

Definition at line 56 of file Camera.cpp.

References Zeni::Quaternion::Axis_Angle(), orientation, and ZENI_DEFAULT_UP_VECTOR.

## Member Data Documentation

float Zeni::Camera::far_clip

Definition at line 94 of file Camera.h.

Referenced by get_tunneled_far_clip().

float Zeni::Camera::fov_rad

Definition at line 95 of file Camera.h.

Referenced by get_fov_deg(), get_tunneled_fov_rad(), and set_fov_deg().

float Zeni::Camera::near_clip

Definition at line 93 of file Camera.h.

Referenced by get_tunneled_far_clip(), get_tunneled_fov_rad(), get_tunneled_near_clip(), and get_tunneled_position().

Quaternion Zeni::Camera::orientation

Definition at line 91 of file Camera.h.

Referenced by adjust_pitch(), adjust_roll(), adjust_yaw(), get_forward(), get_left(), get_up(), look_at(), and turn_left_xy().

Point3f Zeni::Camera::position

Definition at line 90 of file Camera.h.

Referenced by get_tunneled_position(), look_at(), move_forward_xy(), and move_left_xy().

float Zeni::Camera::tunnel_vision_factor

Definition at line 97 of file Camera.h.

Referenced by get_tunneled_near_clip(), and get_tunneled_position().

The documentation for this class was generated from the following files:

- zenilib/jni/external/zenilib/zeni/Zeni/Camera.h
- zenilib/jni/external/zenilib/zeni/Camera.cpp
- zenilib/jni/external/zenilib/zeni/Zeni/Camera.hxx