-
-
Save alanhaugen/1872f5950c4912f78cf6be0323614f0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mat.h" | |
Mat::Mat() | |
: matrix(glm::mat4()) | |
{ | |
rotation = glm::quat(); | |
position = glm::vec3(); | |
scale = glm::vec3(1.0f); | |
} | |
Mat::Mat(glm::mat4 matrix_) | |
: matrix(matrix_) | |
{ | |
rotation = glm::quat(); | |
position = glm::vec3(); | |
scale = glm::vec3(1.0f); | |
} | |
void Mat::Translate(glm::vec3 pos) | |
{ | |
matrix = glm::translate(matrix, pos) * matrix; | |
} | |
/*void Mat::Translate(glm::vec4 pos) | |
{ | |
//matrix[3] += pos; // Not correct??? | |
}*/ | |
void Mat::Scale(glm::vec3 scale) | |
{ | |
matrix = glm::scale(matrix, scale) * matrix; | |
} | |
void Mat::Rotate(glm::vec4 rotation) | |
{ | |
glm::quat quat(rotation.w, rotation.x, rotation.y, rotation.z); | |
matrix = glm::mat4_cast(quat) * matrix; | |
} | |
void Mat::Rotate(glm::quat quat) | |
{ | |
matrix = glm::mat4_cast(quat) * matrix; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment