charcoal/OpenGLEngine/Camera3D.h
elipzer 75357b330c Added Dependency: GLM
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.
2018-09-09 21:20:56 -04:00

36 lines
867 B
C++

#pragma once
#include "Camera.h"
#include <glm/glm.hpp>
using namespace glm;
class Camera3D : public Camera
{
public:
// Creates a Camera3D.
// Will throw if direction, up, and right are not orthogonal
Camera3D(
float fov_y,
float aspect_ratio,
float znear,
float zfar,
const vec3& position,
const vec3& forward = vec3(0.0f, 0.0f, 1.0f),
const vec3& up = vec3(0.0f, 1.0f, 0.0f),
const vec3& right = vec3(1.0f, 0.0f, 0.0f)
);
void update_frustum(float fov_y, float aspect_ratio, float znear, float zfar);
void translate(const vec3& translation) override;
const vec3& get_position() const { return m_position; }
vec3 get_forward() const { return vec3(m_orientation_matrix[2]); }
vec3 get_up() const { return vec3(m_orientation_matrix[1]); }
vec3 get_right() const { return vec3(m_orientation_matrix[0]); }
private:
vec3 m_position;
};