aboutsummaryrefslogtreecommitdiff
path: root/src/math/mat4.cpp
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2023-12-03 09:27:32 +0100
committervimene <vincent.menegaux@gmail.com>2023-12-03 09:27:32 +0100
commit48ec7df0fd27fab05c9918e83a3a7da1cc32d7a0 (patch)
tree259ec6e395e44b0af117adc9605203f8affb4b0f /src/math/mat4.cpp
parent5a8bc0a4936cdd461c43740437541f8c991ff117 (diff)
downloadengine-48ec7df0fd27fab05c9918e83a3a7da1cc32d7a0.tar.gz
renamed MathVector{2,3,4} to Vector{2,3,4} and Mat4 to Matrix4 in engine::math
Diffstat (limited to 'src/math/mat4.cpp')
-rw-r--r--src/math/mat4.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/math/mat4.cpp b/src/math/mat4.cpp
index 6418e9c..f1f28b7 100644
--- a/src/math/mat4.cpp
+++ b/src/math/mat4.cpp
@@ -1,11 +1,11 @@
#include "math/mat4.h"
#include <array>
#include <cmath>
-#include "math/math_vector.h"
+#include "math/vector.h"
using namespace engine::math;
-Mat4 Mat4::idty() {
+Matrix4 Matrix4::idty() {
return {
1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
@@ -14,7 +14,7 @@ Mat4 Mat4::idty() {
};
}
-Mat4 Mat4::translate(MathVector3 v) {
+Matrix4 Matrix4::translate(Vector3 v) {
return {
1.f, 0.f, 0.f, v.x,
0.f, 1.f, 0.f, v.y,
@@ -22,7 +22,7 @@ Mat4 Mat4::translate(MathVector3 v) {
0.f, 0.f, 0.f, 1.f,
};
}
-Mat4 Mat4::scale(float fac) {
+Matrix4 Matrix4::scale(float fac) {
return {
fac, 0.f, 0.f, 0.f,
0.f, fac, 0.f, 0.f,
@@ -31,7 +31,7 @@ Mat4 Mat4::scale(float fac) {
};
}
-Mat4 Mat4::rot_x(float a) {
+Matrix4 Matrix4::rot_x(float a) {
float c = std::cos(a);
float s = std::sin(a);
return {
@@ -42,7 +42,7 @@ Mat4 Mat4::rot_x(float a) {
};
}
-Mat4 Mat4::rot_y(float a) {
+Matrix4 Matrix4::rot_y(float a) {
float c = std::cos(a);
float s = std::sin(a);
return {
@@ -53,7 +53,7 @@ Mat4 Mat4::rot_y(float a) {
};
}
-Mat4 Mat4::rot_z(float a) {
+Matrix4 Matrix4::rot_z(float a) {
float c = std::cos(a);
float s = std::sin(a);
return {
@@ -64,7 +64,7 @@ Mat4 Mat4::rot_z(float a) {
};
}
-Mat4 Mat4::projection(float aspect_ratio, float min_z, float max_z) {
+Matrix4 Matrix4::projection(float aspect_ratio, float min_z, float max_z) {
return {{
aspect_ratio, 0.f, 0.f, 0.f,
0.f, -1.f, 0.f, 0.f,
@@ -73,11 +73,11 @@ Mat4 Mat4::projection(float aspect_ratio, float min_z, float max_z) {
}};
}
-Mat4 Mat4::operator+() {
+Matrix4 Matrix4::operator+() {
return *this;
}
-Mat4 Mat4::operator-() {
+Matrix4 Matrix4::operator-() {
return {
-values[ 0], -values[ 1], -values[ 2], -values[ 3],
-values[ 4], -values[ 5], -values[ 6], -values[ 7],
@@ -86,7 +86,7 @@ Mat4 Mat4::operator-() {
};
}
-Mat4 Mat4::operator+(Mat4 m) {
+Matrix4 Matrix4::operator+(Matrix4 m) {
return {
values[ 0] + m.values[ 0], values[ 1] + m.values[ 1], values[ 2] + m.values[ 2], values[ 3] + m.values[ 3],
values[ 4] + m.values[ 4], values[ 5] + m.values[ 5], values[ 6] + m.values[ 6], values[ 7] + m.values[ 7],
@@ -95,12 +95,12 @@ Mat4 Mat4::operator+(Mat4 m) {
};
}
-Mat4 Mat4::operator-(Mat4 m) {
+Matrix4 Matrix4::operator-(Matrix4 m) {
return *this + (-m);
}
-Mat4 Mat4::operator*(Mat4 m) {
- Mat4 ret;
+Matrix4 Matrix4::operator*(Matrix4 m) {
+ Matrix4 ret;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
ret.values[i * 4 + j] = 0.f;
@@ -111,7 +111,7 @@ Mat4 Mat4::operator*(Mat4 m) {
return ret;
}
-MathVector4 Mat4::operator*(MathVector4 v) {
+Vector4 Matrix4::operator*(Vector4 v) {
return {
values[ 0] * v.x + values[ 1] * v.y + values[ 2] * v.z + values[ 3] * v.w,
values[ 4] * v.x + values[ 5] * v.y + values[ 6] * v.z + values[ 7] * v.w,
@@ -120,7 +120,7 @@ MathVector4 Mat4::operator*(MathVector4 v) {
};
}
-std::array<MathVector4, 4> Mat4::to_vecs() {
+std::array<Vector4, 4> Matrix4::to_vecs() {
return {{
{ values[ 0], values[ 4], values[ 8], values[12] },
{ values[ 1], values[ 5], values[ 9], values[13] },
@@ -129,7 +129,7 @@ std::array<MathVector4, 4> Mat4::to_vecs() {
}};
}
-Mat4 engine::math::operator*(float fac, Mat4 m) {
+Matrix4 engine::math::operator*(float fac, Matrix4 m) {
return {
fac * m.values[ 0], fac * m.values[ 1], fac * m.values[ 2], fac * m.values[ 3],
fac * m.values[ 4], fac * m.values[ 5], fac * m.values[ 6], fac * m.values[ 7],