change Mat4 getFront to getForward

This commit is contained in:
Triplelexx 2017-03-21 22:33:37 +00:00
parent 66d697873f
commit 6e740a5fbb
3 changed files with 6 additions and 4 deletions
libraries/script-engine/src
scripts/developer/tests

View file

@ -54,7 +54,7 @@ glm::mat4 Mat4::inverse(const glm::mat4& m) const {
return glm::inverse(m);
}
glm::vec3 Mat4::getFront(const glm::mat4& m) const {
glm::vec3 Mat4::getForward(const glm::mat4& m) const {
return glm::vec3(-m[0][2], -m[1][2], -m[2][2]);
}

View file

@ -37,7 +37,9 @@ public slots:
glm::mat4 inverse(const glm::mat4& m) const;
glm::vec3 getFront(const glm::mat4& m) const;
// redundant, calls getForward which better describes the returned vector as a direction
glm::vec3 getFront(const glm::mat4& m) const { return getForward(m); }
glm::vec3 getForward(const glm::mat4& m) const;
glm::vec3 getRight(const glm::mat4& m) const;
glm::vec3 getUp(const glm::mat4& m) const;

View file

@ -143,10 +143,10 @@ function testInverse() {
function testFront() {
var test0 = IDENTITY;
assert(mat4FuzzyEqual({x: 0, y: 0, z: -1}, Mat4.getFront(test0)));
assert(mat4FuzzyEqual({x: 0, y: 0, z: -1}, Mat4.getForward(test0)));
var test1 = Mat4.createFromScaleRotAndTrans(ONE_HALF, ROT_Y_180, ONE_TWO_THREE);
assert(mat4FuzzyEqual({x: 0, y: 0, z: 1}, Mat4.getFront(test1)));
assert(mat4FuzzyEqual({x: 0, y: 0, z: 1}, Mat4.getForward(test1)));
}
function testMat4() {