mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Matrix/vector refactor (#426)
This commit is contained in:

committed by
GitHub

parent
eac096036a
commit
d24f5db42f
6
LEGO1/mxgeometry/mxgeometry3d.cpp
Normal file
6
LEGO1/mxgeometry/mxgeometry3d.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mxgeometry3d.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Mx3DPointFloat, 0x14);
|
||||
DECOMP_SIZE_ASSERT(Mx4DPointFloat, 0x18);
|
48
LEGO1/mxgeometry/mxgeometry3d.h
Normal file
48
LEGO1/mxgeometry/mxgeometry3d.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef MXGEOMETRY3D_H
|
||||
#define MXGEOMETRY3D_H
|
||||
|
||||
#include "realtime/vector.h"
|
||||
|
||||
// VTABLE: LEGO1 0x100d4488
|
||||
// SIZE 0x14
|
||||
class Mx3DPointFloat : public Vector3 {
|
||||
public:
|
||||
inline Mx3DPointFloat() : Vector3(m_elements) {}
|
||||
inline Mx3DPointFloat(float p_x, float p_y, float p_z) : Vector3(m_elements)
|
||||
{
|
||||
m_elements[0] = p_x;
|
||||
m_elements[1] = p_y;
|
||||
m_elements[2] = p_z;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10003c10
|
||||
virtual void operator=(const Vector3& p_impl) { EqualsImpl(p_impl.m_data); } // vtable+0x88
|
||||
|
||||
inline void CopyFrom(const Mx3DPointFloat& p_other)
|
||||
{
|
||||
// ALPHA: 0x10010860, multiple indirections to this call
|
||||
EqualsImpl(p_other.m_data);
|
||||
|
||||
float* dest = m_elements;
|
||||
const float* src = p_other.m_elements;
|
||||
for (size_t i = sizeof(m_elements) / sizeof(float); i > 0; --i)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
inline void EqualsCross(Mx3DPointFloat& p_a, Mx3DPointFloat& p_b) { EqualsCrossImpl(p_a.m_data, p_b.m_data); }
|
||||
|
||||
private:
|
||||
float m_elements[3];
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d41e8
|
||||
// SIZE 0x18
|
||||
class Mx4DPointFloat : public Vector4 {
|
||||
public:
|
||||
inline Mx4DPointFloat() : Vector4(m_elements) {}
|
||||
|
||||
private:
|
||||
float m_elements[4];
|
||||
};
|
||||
|
||||
#endif // MXGEOMETRY3D_H
|
5
LEGO1/mxgeometry/mxmatrix.cpp
Normal file
5
LEGO1/mxgeometry/mxmatrix.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "mxmatrix.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxMatrix, 0x48);
|
22
LEGO1/mxgeometry/mxmatrix.h
Normal file
22
LEGO1/mxgeometry/mxmatrix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef MXMATRIX_H
|
||||
#define MXMATRIX_H
|
||||
|
||||
#include "realtime/matrix.h"
|
||||
|
||||
// VTABLE: LEGO1 0x100d4300
|
||||
// SIZE 0x48
|
||||
class MxMatrix : public Matrix4 {
|
||||
public:
|
||||
inline MxMatrix() : Matrix4(m_elements) {}
|
||||
inline MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
|
||||
|
||||
// No idea why there's another equals. Maybe to some other type like the
|
||||
// DirectX Retained Mode Matrix type which is also a float* alias?
|
||||
// FUNCTION: LEGO1 0x10002860
|
||||
virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48
|
||||
|
||||
private:
|
||||
float m_elements[4][4];
|
||||
};
|
||||
|
||||
#endif // MXMATRIX_H
|
Reference in New Issue
Block a user