1
0
forked from josh/j3ml

Implement CreateFrustumFromCamera

This commit is contained in:
2024-01-10 14:46:12 -05:00
parent cc9ff95daa
commit dea5735c87
7 changed files with 179 additions and 14 deletions

View File

@@ -1,5 +1,80 @@
#include <J3ML/LinearAlgebra/Matrix4x4.h>
#include <J3ML/LinearAlgebra/Vector4.h>
namespace LinearAlgebra {
const Matrix4x4 Matrix4x4::Zero = Matrix4x4(0);
const Matrix4x4 Matrix4x4::Identity = Matrix4x4({1,0,0,0}, {0,1,0,0}, {0,0,1,0}, {0,0,0,1});
const Matrix4x4 Matrix4x4::NaN = Matrix4x4(NAN);
Matrix4x4::Matrix4x4(const Vector4 &r1, const Vector4 &r2, const Vector4 &r3, const Vector4 &r4) {
this->elems[0][0] = r1.x;
this->elems[0][1] = r1.y;
this->elems[0][2] = r1.z;
this->elems[0][3] = r1.w;
this->elems[1][0] = r2.x;
this->elems[1][1] = r2.y;
this->elems[1][2] = r2.z;
this->elems[1][3] = r2.w;
this->elems[2][0] = r3.x;
this->elems[2][1] = r3.y;
this->elems[2][2] = r3.z;
this->elems[2][3] = r3.w;
this->elems[3][0] = r4.x;
this->elems[3][1] = r4.y;
this->elems[3][2] = r4.z;
this->elems[3][3] = r4.w;
}
Matrix4x4::Matrix4x4(float val) {
this->elems[0][0] = val;
this->elems[0][1] = val;
this->elems[0][2] = val;
this->elems[0][3] = val;
this->elems[1][0] = val;
this->elems[1][1] = val;
this->elems[1][2] = val;
this->elems[1][3] = val;
this->elems[2][0] = val;
this->elems[2][1] = val;
this->elems[2][2] = val;
this->elems[2][3] = val;
this->elems[3][0] = val;
this->elems[3][1] = val;
this->elems[3][2] = val;
this->elems[3][3] = val;
}
Matrix4x4::Matrix4x4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) {
this->elems[0][0] = m00;
this->elems[0][1] = m01;
this->elems[0][2] = m02;
this->elems[0][3] = m03;
this->elems[1][0] = m10;
this->elems[1][1] = m11;
this->elems[1][2] = m12;
this->elems[1][3] = m13;
this->elems[2][0] = m20;
this->elems[2][1] = m21;
this->elems[2][2] = m22;
this->elems[2][3] = m23;
this->elems[3][0] = m30;
this->elems[3][1] = m31;
this->elems[3][2] = m32;
this->elems[3][3] = m33;
}
Matrix4x4::Matrix4x4(const Quaternion &orientation) {
}
}