diff options
Diffstat (limited to 'src/util/mat4.cpp')
-rw-r--r-- | src/util/mat4.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/util/mat4.cpp b/src/util/mat4.cpp index 861ad5c035..44bd3edd7c 100644 --- a/src/util/mat4.cpp +++ b/src/util/mat4.cpp @@ -26,7 +26,7 @@ using namespace llmr; -void mat4::identity(float out[16]) { +void matrix::identity(mat4& out) { out[0] = 1.0f; out[1] = 0.0f; out[2] = 0.0f; @@ -45,7 +45,7 @@ void mat4::identity(float out[16]) { out[15] = 1.0f; } -void mat4::ortho(float out[16], float left, float right, float bottom, float top, float near, float far) { +void matrix::ortho(mat4& out, float left, float right, float bottom, float top, float near, float far) { float lr = 1.0f / (left - right), bt = 1.0f / (bottom - top), nf = 1.0f / (near - far); @@ -67,7 +67,7 @@ void mat4::ortho(float out[16], float left, float right, float bottom, float top out[15] = 1.0f; } -void mat4::copy(float out[16], float a[16]) { +void matrix::copy(mat4& out, const mat4& a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; @@ -86,7 +86,7 @@ void mat4::copy(float out[16], float a[16]) { out[15] = a[15]; } -void mat4::translate(float out[16], float a[16], float x, float y, float z) { +void matrix::translate(mat4& out, const mat4& a, float x, float y, float z) { float a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23; @@ -112,7 +112,7 @@ void mat4::translate(float out[16], float a[16], float x, float y, float z) { } } -void mat4::rotate_z(float out[16], float a[16], float rad) { +void matrix::rotate_z(mat4& out, const mat4& a, float rad) { float s = sin(rad), c = cos(rad), a00 = a[0], @@ -146,7 +146,7 @@ void mat4::rotate_z(float out[16], float a[16], float rad) { out[7] = a13 * c - a03 * s; } -void mat4::scale(float out[16], float a[16], float x, float y, float z) { +void matrix::scale(mat4& out, const mat4& a, float x, float y, float z) { out[0] = a[0] * x; out[1] = a[1] * x; out[2] = a[2] * x; @@ -165,14 +165,14 @@ void mat4::scale(float out[16], float a[16], float x, float y, float z) { out[15] = a[15]; } -void mat4::multiply(float out[16], float a[16], float b[16]) { +void matrix::multiply(mat4& out, const mat4& a, const mat4& b) { float a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix - float b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + float b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; |