#include "Camera.hpp" namespace MC::GFX { Vector<3> Camera::position() { return m_position; } void Camera::set_position(Vector<3> position) { m_position = position; } void Camera::move(Vector<3> vector) { m_position = m_position + vector; } void Camera::move_relative(Vector<3> by) { auto rotation = Matrix<4, 4>::rotation(m_angles); auto result = rotation.transpose() * Vector<4>{by.x(), by.y(), by.z(), 1.0f}; move(result.elements); } Rotation Camera::angles() { return m_angles; } void Camera::set_angles(Rotation angles) { m_angles = angles; } void Camera::rotate(Rotation by) { m_angles = m_angles + by; if (m_angles.pitch() > 89.0f) { m_angles.pitch() = 89.0f; } else if (m_angles.pitch() < -89.0f) { m_angles.pitch() = -89.0f; } } }