charcoal/OpenGLEngine/Camera3D.h

36 lines
858 B
C
Raw Normal View History

#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);
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;
};