Isle
Loading...
Searching...
No Matches
matrix.h
Go to the documentation of this file.
1#ifndef MATRIX_H
2#define MATRIX_H
3
4#include "vector.h"
5
6// Note: virtual function overloads appear in the virtual table
7// in reverse order of appearance.
8
14 float m_data[4][4];
15};
16
21// VTABLE: LEGO1 0x100d4350
22// VTABLE: BETA10 0x101b8340
23// SIZE 0x08
24class Matrix4 {
25protected:
29 float (*m_data)[4];
30
31public:
36 Matrix4(float (*p_data)[4]) { SetData(p_data); }
37
42 inline virtual void Equals(float (*p_data)[4]); // vtable+0x04
43
48 inline virtual void Equals(const Matrix4& p_matrix); // vtable+0x00
49
54 inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c
55
60 inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08
61
66 inline virtual float (*GetData())[4]; // vtable+0x14
67
72 inline virtual float (*GetData() const)[4]; // vtable+0x10
73
80 inline virtual float* Element(int p_row, int p_col); // vtable+0x1c
81
88 inline virtual const float* Element(int p_row, int p_col) const; // vtable+0x18
89
93 inline virtual void Clear(); // vtable+0x20
94
98 inline virtual void SetIdentity(); // vtable+0x24
99
104 inline virtual void operator=(const Matrix4& p_matrix); // vtable+0x28
105
111 inline virtual Matrix4& operator+=(float (*p_data)[4]); // vtable+0x2c
112
119 inline virtual void TranslateBy(const float& p_x, const float& p_y, const float& p_z); // vtable+0x30
120
127 inline virtual void SetTranslation(const float& p_x, const float& p_y, const float& p_z); // vtable+0x34
128
134 inline virtual void Product(float (*p_a)[4], float (*p_b)[4]); // vtable+0x3c
135
141 inline virtual void Product(const Matrix4& p_a, const Matrix4& p_b); // vtable+0x38
142
147 inline virtual void ToQuaternion(Vector4& p_resultQuat); // vtable+0x40
148
154 inline virtual int FromQuaternion(const Vector4& p_vec); // vtable+0x44
155
162 inline void Scale(const float& p_x, const float& p_y, const float& p_z); // [AI]
163
168 inline void RotateX(const float& p_angle); // [AI]
169
174 inline void RotateY(const float& p_angle); // [AI]
175
180 inline void RotateZ(const float& p_angle); // [AI]
181
187 inline int BETA_1005a590(Matrix4& p_mat); // [AI_UNKNOWN]
188
194 inline void Swap(int p_d1, int p_d2); // [AI]
195
201 float* operator[](int idx) { return m_data[idx]; }
202
208 const float* operator[](int idx) const { return m_data[idx]; }
209};
210
211#ifdef COMPAT_MODE
212#include "matrix4d.inl.h"
213#endif
214
215#endif // MATRIX_H
4x4 Matrix class with virtual interface for manipulation and transformation.
Definition: matrix.h:24
virtual float(* GetData())[4]
Gets modifiable access to the 4x4 float matrix.
virtual void Product(const Matrix4 &p_a, const Matrix4 &p_b)
Multiplies two Matrix4s, storing result in this matrix.
virtual Matrix4 & operator+=(float(*p_data)[4])
In-place matrix addition with external float[4][4].
virtual void SetData(float(*p_data)[4])
Set this matrix instance to use/point to a new 4x4 data block.
virtual void Clear()
Sets every element of the matrix to zero.
virtual float * Element(int p_row, int p_col)
Accesses an individual element of the matrix in writable form.
virtual void SetTranslation(const float &p_x, const float &p_y, const float &p_z)
Overwrites the translation part of the matrix (last column).
Matrix4(float(*p_data)[4])
Constructs a Matrix4 object referring to the given 4x4 float array.
Definition: matrix.h:36
void RotateY(const float &p_angle)
Applies a rotation (in radians or degrees, depending on implementation) about the Y axis.
virtual void Equals(float(*p_data)[4])
Set the matrix elements from a 4x4 float array.
virtual void TranslateBy(const float &p_x, const float &p_y, const float &p_z)
Applies translation by amounts along X, Y, Z axes.
void Swap(int p_d1, int p_d2)
Swaps the data between two rows/columns (presumably).
virtual void Equals(const Matrix4 &p_matrix)
Copies the matrix from another Matrix4.
void RotateX(const float &p_angle)
Applies a rotation (in radians or degrees, depending on implementation) about the X axis.
virtual float(* GetData() const)[4]
Gets read-only access to the 4x4 float matrix data.
virtual void ToQuaternion(Vector4 &p_resultQuat)
Converts the 3x3 rotation part of this matrix to a quaternion (Vector4).
void Scale(const float &p_x, const float &p_y, const float &p_z)
Applies scaling factors along X, Y, and Z axes.
float * operator[](int idx)
Array subscript operator for modifiable row access.
Definition: matrix.h:201
float(* m_data)[4]
Pointer to 4x4 float array, owns or refers to matrix data.
Definition: matrix.h:29
void RotateZ(const float &p_angle)
Applies a rotation (in radians or degrees) about the Z axis.
virtual void Product(float(*p_a)[4], float(*p_b)[4])
Multiplies two 4x4 float matrices, storing result in this.
const float * operator[](int idx) const
Const array subscript operator for readonly row access.
Definition: matrix.h:208
virtual const float * Element(int p_row, int p_col) const
Accesses an individual element in read-only form.
virtual void SetIdentity()
Sets this matrix to identity (diagonal 1, others 0).
virtual int FromQuaternion(const Vector4 &p_vec)
Initializes the matrix from a quaternion (Vector4).
virtual void operator=(const Matrix4 &p_matrix)
Assign/copy another matrix's values into this one.
int BETA_1005a590(Matrix4 &p_mat)
[AI] Appears to perform some operation using another matrix, but function/purpose unknown.
virtual void SetData(UnknownMatrixType &p_matrix)
Copies the matrix data from a raw UnknownMatrixType instance.
[AI] A four-dimensional vector, supporting operations relevant for matrix and quaternion math (homoge...
Definition: vector.h:365
Matrix-like wrapper of 4x4 float array, with no methods.
Definition: matrix.h:13
float m_data[4][4]
[AI] Raw matrix data storage (row-major 4x4 floats).
Definition: matrix.h:14