summaryrefslogtreecommitdiff
path: root/gfx/gl/transform.cpp
blob: c7004ba134453c1dc2116b9a4b84d2c948f2d524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "transform.h"
#include <glm/gtx/transform.hpp>
#include <maths.h>

Transform::Transform(glm::vec3 pos, glm::vec3 rot) : pos {pos}, rot {rot} { }

glm::mat4
Transform::GetModel() const
{
	const auto posMat = glm::translate(pos);
	const auto rotX = glm::rotate(rot.x, west);
	const auto rotY = glm::rotate(rot.y, up);
	const auto rotZ = glm::rotate(rot.z, north);

	return posMat * rotY * rotX * rotZ;
}