class
camera_tClass for calulation of mvp-matricies.
The camera_
Constructors, destructors, conversion operators
- camera_t() defaulted noexcept
- default constructor of camera_
t -
camera_t(camera_
t&& mov) defaulted noexcept - move constructor
-
camera_t(const camera_
t& cpy) defaulted noexcept - copy constructor
- camera_t(glm::vec3 position, glm::quat orientation = glm::quat(glm::vec3(0.0, 0.0, 0.0)), float fov = 90, float near_plane = 0.1f, float far_plane = 100.0f, float aspect_ratio = 1.0f) noexcept
- value intialisation constructor using position and orientation.
- camera_t(glm::vec3 position, glm::vec3 look_at, glm::vec3 up, float fov = 90, float near_plane = 0.1f, float far_plane = 100.0f, float aspect_ratio = 1.0f) noexcept
- value intialisation constructor using position, look_at and up vectors.
Public functions
Public variables
- glm::vec3 position
- position of the camera in global space
- glm::quat orientation
- orientation of the camera
- float fov
- field of view of the camera
- float near_plane
- near clipping plane of the view frustum
- float far_plane
- far clipping plane of the view frustum
- float aspect_ratio
- aspect ratio of the view frustum
Function documentation
glpp:: core:: render:: camera_t:: camera_t(glm::vec3 position,
glm::quat orientation = glm::quat(glm::vec3(0.0, 0.0, 0.0)),
float fov = 90,
float near_plane = 0.1f,
float far_plane = 100.0f,
float aspect_ratio = 1.0f) noexcept
value intialisation constructor using position and orientation.
Parameters | |
---|---|
position | [in] position of the origin of the view frustum. The origin is outside of the rendered frustum volume. |
orientation | [in] orientation of the frustum |
fov | [in] field of view |
near_plane | [in] distance of the near plane from the origin. Must be greater than zero. |
far_plane | [in] distance of the far plane from the origin. Must be greater than near_plane. |
aspect_ratio | [in] aspect ratio of the view frustum |
Constructs a camera_
glpp:: core:: render:: camera_t:: camera_t(glm::vec3 position,
glm::vec3 look_at,
glm::vec3 up,
float fov = 90,
float near_plane = 0.1f,
float far_plane = 100.0f,
float aspect_ratio = 1.0f) noexcept
value intialisation constructor using position, look_at and up vectors.
Parameters | |
---|---|
position | [in] position of the origin of the view frustum. The origin is outside of the rendered frustum volume. |
look_at | [in] vector from the position to the center of the view frustum. Must have a length greater than zero. |
up | [in] vector in the up direction of the view frustum. Must have a length greater than zero and orthogonal to look_at. |
fov | [in] field of view |
near_plane | [in] distance of the near plane from the origin. Must be greater than zero. |
far_plane | [in] distance of the far plane from the origin. Must be greater than near_plane. |
aspect_ratio | [in] aspect ratio of the view frustum |
Constructs a camera_
glm::mat4 glpp:: core:: render:: camera_t:: mvp(const glm::mat4& model_matrix = glm::mat4(1.0f)) const
calculate model-view-projection matrix
Parameters | |
---|---|
model_matrix in | transformation matrix of a mesh. |
Returns | Model-view-projection matrix to transform global space coordinations to clip space. |
Calculate the model-view-projection matrix for a specific mesh. The model matrix of the mesh is passed as first parameter. The mvp matrix transform local space coordinates of the mesh to clip space. If no model matrix is passed global space will be transformed into clip space.
Variable documentation
glm::quat glpp:: core:: render:: camera_t:: orientation
orientation of the camera
Rotation of the camera from its native orientation. The native orientation is facing in the -z direction, with +y facing up.
float glpp:: core:: render:: camera_t:: fov
field of view of the camera
Field of view of the view frustum in degrees.
float glpp:: core:: render:: camera_t:: near_plane
near clipping plane of the view frustum
Distance of the near clipping plane from position in the direction of the view vector, measured in global units.
float glpp:: core:: render:: camera_t:: far_plane
far clipping plane of the view frustum
Distance of the far clipping plane from position in the direction of the view vector, measured in global units.
float glpp:: core:: render:: camera_t:: aspect_ratio
aspect ratio of the view frustum
Aspect ratio of the view frustum (width / height). Should be set equal to the aspect ratio of the active framebuffer to prevent distortion.