Fixups FloatMatrix -> FloatMatrix4

This commit is contained in:
Mark Langen 2023-11-28 22:09:35 -08:00
parent d476b7a7a0
commit 76aa524129
8 changed files with 27 additions and 28 deletions

View File

@ -21,7 +21,7 @@ void* CameraImpl::ImplementationDataPtr()
} }
// OFFSET: LEGO1 0x100a3700 // OFFSET: LEGO1 0x100a3700
Result CameraImpl::SetTransformation(const FloatMatrix& p_matrix) Result CameraImpl::SetTransformation(const FloatMatrix4& p_matrix)
{ {
D3DRMMATRIX4D helper; D3DRMMATRIX4D helper;
D3DRMMATRIX4D* pTransformation = Translate(p_matrix, helper); D3DRMMATRIX4D* pTransformation = Translate(p_matrix, helper);

View File

@ -18,7 +18,7 @@ void* GroupImpl::ImplementationDataPtr()
} }
// OFFSET: LEGO1 0x100a31e0 // OFFSET: LEGO1 0x100a31e0
Result GroupImpl::SetTransformation(const FloatMatrix& p_matrix) Result GroupImpl::SetTransformation(const FloatMatrix4& p_matrix)
{ {
D3DRMMATRIX4D helper; D3DRMMATRIX4D helper;
D3DRMMATRIX4D* matrix = Translate(p_matrix, helper); D3DRMMATRIX4D* matrix = Translate(p_matrix, helper);

View File

@ -170,7 +170,7 @@ class CameraImpl : public Camera {
virtual void* ImplementationDataPtr(); virtual void* ImplementationDataPtr();
// vtable+0x08 // vtable+0x08
virtual Result SetTransformation(const FloatMatrix&); virtual Result SetTransformation(const FloatMatrix4&);
inline IDirect3DRMFrame* ImplementationData() const { return m_data; } inline IDirect3DRMFrame* ImplementationData() const { return m_data; }
@ -189,7 +189,7 @@ class LightImpl : public Light {
virtual void* ImplementationDataPtr(); virtual void* ImplementationDataPtr();
// vtable+0x08 // vtable+0x08
virtual Result SetTransformation(const FloatMatrix&); virtual Result SetTransformation(const FloatMatrix4&);
virtual Result SetColor(float p_r, float p_g, float p_b); virtual Result SetColor(float p_r, float p_g, float p_b);
inline IDirect3DRMFrame* ImplementationData() const { return m_data; } inline IDirect3DRMFrame* ImplementationData() const { return m_data; }
@ -243,7 +243,7 @@ class GroupImpl : public Group {
virtual void* ImplementationDataPtr(); virtual void* ImplementationDataPtr();
// vtable+0x08 // vtable+0x08
virtual Result SetTransformation(const FloatMatrix&); virtual Result SetTransformation(const FloatMatrix4&);
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a); virtual Result SetColor(float p_r, float p_g, float p_b, float p_a);
// vtable+0x10 // vtable+0x10
@ -405,7 +405,7 @@ inline D3DRMPROJECTIONTYPE Translate(ProjectionType p_tglProjectionType)
// Yes this function serves no purpose, originally they intended it to // Yes this function serves no purpose, originally they intended it to
// convert from doubles to floats but ended up using floats throughout // convert from doubles to floats but ended up using floats throughout
// the software stack. // the software stack.
inline D3DRMMATRIX4D* Translate(const FloatMatrix& tglMatrix4x4, D3DRMMATRIX4D& rD3DRMMatrix4x4) inline D3DRMMATRIX4D* Translate(const FloatMatrix4& tglMatrix4x4, D3DRMMATRIX4D& rD3DRMMatrix4x4)
{ {
for (int i = 0; i < (sizeof(rD3DRMMatrix4x4) / sizeof(rD3DRMMatrix4x4[0])); i++) { for (int i = 0; i < (sizeof(rD3DRMMatrix4x4) / sizeof(rD3DRMMatrix4x4[0])); i++) {
for (int j = 0; j < (sizeof(rD3DRMMatrix4x4[0]) / sizeof(rD3DRMMatrix4x4[0][0])); j++) { for (int j = 0; j < (sizeof(rD3DRMMatrix4x4[0]) / sizeof(rD3DRMMatrix4x4[0][0])); j++) {

View File

@ -21,7 +21,7 @@ void* LightImpl::ImplementationDataPtr()
} }
// OFFSET: LEGO1 0x100a3780 // OFFSET: LEGO1 0x100a3780
Result LightImpl::SetTransformation(const FloatMatrix& p_matrix) Result LightImpl::SetTransformation(const FloatMatrix4& p_matrix)
{ {
D3DRMMATRIX4D helper; D3DRMMATRIX4D helper;
D3DRMMATRIX4D* matrix = Translate(p_matrix, helper); D3DRMMATRIX4D* matrix = Translate(p_matrix, helper);

View File

@ -222,13 +222,13 @@ class View : public Object {
// VTABLE 0x100dbae8 // VTABLE 0x100dbae8
class Camera : public Object { class Camera : public Object {
public: public:
virtual Result SetTransformation(const FloatMatrix&) = 0; virtual Result SetTransformation(const FloatMatrix4&) = 0;
}; };
// VTABLE 0x100dbb08 // VTABLE 0x100dbb08
class Light : public Object { class Light : public Object {
public: public:
virtual Result SetTransformation(const FloatMatrix&) = 0; virtual Result SetTransformation(const FloatMatrix4&) = 0;
virtual Result SetColor(float p_r, float p_g, float p_b) = 0; virtual Result SetColor(float p_r, float p_g, float p_b) = 0;
}; };
@ -252,7 +252,7 @@ class Mesh : public Object {
// VTABLE 0x100dbaa0 // VTABLE 0x100dbaa0
class Group : public Object { class Group : public Object {
public: public:
virtual Result SetTransformation(const FloatMatrix&) = 0; virtual Result SetTransformation(const FloatMatrix4&) = 0;
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a) = 0; virtual Result SetColor(float p_r, float p_g, float p_b, float p_a) = 0;
virtual Result SetTexture(const Texture*) = 0; virtual Result SetTexture(const Texture*) = 0;
virtual Result GetTexture(Texture*&) = 0; virtual Result GetTexture(Texture*&) = 0;

View File

@ -75,22 +75,22 @@ inline void Array<T, N>::operator+=(const Array<T, N>& rArray)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// FloatMatrix // FloatMatrix4
class FloatMatrix : public Array<Array<float, 4>, 4> { class FloatMatrix4 : public Array<Array<float, 4>, 4> {
public: public:
FloatMatrix() {} FloatMatrix4() {}
FloatMatrix(const FloatMatrix& rMatrix) { *this = rMatrix; } FloatMatrix4(const FloatMatrix4& rMatrix) { *this = rMatrix; }
FloatMatrix(const FloatMatrix&, const FloatMatrix&); FloatMatrix4(const FloatMatrix4&, const FloatMatrix4&);
void operator*=(const FloatMatrix&); void operator*=(const FloatMatrix4&);
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// FloatMatrix implementation // FloatMatrix4 implementation
inline FloatMatrix::FloatMatrix(const FloatMatrix& rMatrix1, const FloatMatrix& rMatrix2) inline FloatMatrix4::FloatMatrix4(const FloatMatrix4& rMatrix1, const FloatMatrix4& rMatrix2)
{ {
for (int row = 0; row < 4; row++) { for (int row = 0; row < 4; row++) {
for (int column = 0; column < 4; column++) { for (int column = 0; column < 4; column++) {
@ -105,11 +105,11 @@ inline FloatMatrix::FloatMatrix(const FloatMatrix& rMatrix1, const FloatMatrix&
} }
} }
inline void FloatMatrix::operator*=(const FloatMatrix& rMatrix) inline void FloatMatrix4::operator*=(const FloatMatrix4& rMatrix)
{ {
FloatMatrix temp(*this, rMatrix); FloatMatrix4 temp(*this, rMatrix);
// *this = FloatMatrix(*this, rMatrix); // *this = FloatMatrix4(*this, rMatrix);
*this = temp; *this = temp;
} }
@ -117,7 +117,7 @@ inline void FloatMatrix::operator*=(const FloatMatrix& rMatrix)
// //
// Transformation matrices // Transformation matrices
class Translation : public FloatMatrix { class Translation : public FloatMatrix4 {
public: public:
Translation(const float[3]); Translation(const float[3]);
Translation(float x, float y, float z); Translation(float x, float y, float z);
@ -126,7 +126,7 @@ class Translation : public FloatMatrix {
void Init(float x, float y, float z); void Init(float x, float y, float z);
}; };
class Scale : public FloatMatrix { class Scale : public FloatMatrix4 {
public: public:
Scale(const float[3]); Scale(const float[3]);
Scale(float x, float y, float z); Scale(float x, float y, float z);
@ -136,12 +136,12 @@ class Scale : public FloatMatrix {
void Init(float x, float y, float z); void Init(float x, float y, float z);
}; };
class RotationX : public FloatMatrix { class RotationX : public FloatMatrix4 {
public: public:
RotationX(float radians); RotationX(float radians);
}; };
class RotationY : public FloatMatrix { class RotationY : public FloatMatrix4 {
public: public:
RotationY(float radians); RotationY(float radians);
}; };

View File

@ -44,7 +44,7 @@ class ViewLODList : public LODList<ViewLOD> {
// ??? for now, until we have symbol management // ??? for now, until we have symbol management
typedef const char* ROIName; typedef const char* ROIName;
struct ROINameComparator { struct ROINameComparator {
bool operator()(const ROIName& rName1, const ROIName& rName2) const int operator()(const ROIName& rName1, const ROIName& rName2) const
{ {
return strcmp((const char*) rName1, (const char*) rName2) > 0; return strcmp((const char*) rName1, (const char*) rName2) > 0;
} }

View File

@ -27,8 +27,7 @@ void ViewROI::UpdateWorldData(const Matrix4Data& parent2world)
{ {
OrientableROI::UpdateWorldData(parent2world); OrientableROI::UpdateWorldData(parent2world);
if (geometry) { if (geometry) {
// Tgl::FloatMatrix4 tgl_mat; Tgl::FloatMatrix4 mat;
Matrix4 mat;
SETMAT4(mat, m_local2world.GetMatrix()); SETMAT4(mat, m_local2world.GetMatrix());
Tgl::Result result = geometry->SetTransformation(mat); Tgl::Result result = geometry->SetTransformation(mat);
// assert(Tgl::Succeeded(result)); // assert(Tgl::Succeeded(result));