zenilib
0.5.3.0
|
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 °rees) |
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 |
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.
Contact: bazal d@ze nipex .com
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.
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.
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.
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.
|
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().
|
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.
|
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().
|
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().
|
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.
|
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().
|
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.
|
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().
|
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().
|
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().
|
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().
|
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().
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.
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.
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.
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.
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().