75357b330c
Now using GLM instead of the custom math libraries. Sadly, this did not 100% fix the problem at hand but it does give some closure that the math is not the problem. Also it will be nice to have a general math library to not have to deal with creating every math function every time.
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);
|
|
} |