#include "math/View.hpp" void Core::View::updateDirections(float lengthAngle, float widthAngle) { back.setAngles(lengthAngle, widthAngle); right = back.cross(Vector3(0.0f, 1.0f, 0.0f)); right.normalize(); up = right.cross(back); up.normalize(); back = -back; } void Core::View::updateDirections(const Quaternion& q) { up = q * Vector3(0.0f, 1.0f, 0.0f); back = q * Vector3(-1.0f, 0.0f, 0.0f); right = up.cross(back); right.normalize(); } const Core::Matrix& Core::View::updateMatrix(const Vector3& pos) { view.set(0, Vector4(right[0], right[1], right[2], right.dot(-pos))); view.set(1, Vector4(up[0], up[1], up[2], up.dot(-pos))); view.set(2, Vector4(back[0], back[1], back[2], back.dot(-pos))); view.set(3, Vector4(0.0f, 0.0f, 0.0f, 1.0f)); return view; } Core::Vector3 Core::View::getUp() const { return up; } Core::Vector3 Core::View::getDown() const { return -up; } Core::Vector3 Core::View::getLeft() const { return -right; } Core::Vector3 Core::View::getRight() const { return right; } Core::Vector3 Core::View::getFront() const { return -back; } Core::Vector3 Core::View::getBack() const { return back; }