29 lines
610 B
C++
29 lines
610 B
C++
|
#include "Camera3D.h"
|
||
|
|
||
|
#include <glm/gtc/matrix_transform.hpp>
|
||
|
|
||
|
Camera3D::Camera3D(
|
||
|
float fov_y,
|
||
|
float aspect_ratio,
|
||
|
float znear,
|
||
|
float zfar,
|
||
|
const vec3& position,
|
||
|
const vec3& forward,
|
||
|
const vec3& up,
|
||
|
const vec3& right
|
||
|
)
|
||
|
: Camera(position, forward, up, right)
|
||
|
{
|
||
|
update_frustum(fov_y, aspect_ratio, znear, zfar);
|
||
|
}
|
||
|
|
||
|
void Camera3D::update_frustum(float fov_y, float aspect_ratio, float znear, float zfar)
|
||
|
{
|
||
|
m_projection_matrix = glm::perspective(fov_y, aspect_ratio, znear, zfar);
|
||
|
}
|
||
|
|
||
|
void Camera3D::translate(const vec3& translation)
|
||
|
{
|
||
|
m_position += translation;
|
||
|
Poseable::translate(-translation);
|
||
|
}
|