From 76aa524129eb8623654cd49c78d421bf2567782d Mon Sep 17 00:00:00 2001 From: Mark Langen Date: Tue, 28 Nov 2023 22:09:35 -0800 Subject: [PATCH] Fixups FloatMatrix -> FloatMatrix4 --- LEGO1/tgl/d3drm/camera.cpp | 2 +- LEGO1/tgl/d3drm/group.cpp | 2 +- LEGO1/tgl/d3drm/impl.h | 8 ++++---- LEGO1/tgl/d3drm/light.cpp | 2 +- LEGO1/tgl/tgl.h | 6 +++--- LEGO1/tgl/tglvector.h | 30 +++++++++++++++--------------- LEGO1/viewmanager/viewlodlist.h | 2 +- LEGO1/viewmanager/viewroi.cpp | 3 +-- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/LEGO1/tgl/d3drm/camera.cpp b/LEGO1/tgl/d3drm/camera.cpp index 3d8e1912..0f6f4b0a 100644 --- a/LEGO1/tgl/d3drm/camera.cpp +++ b/LEGO1/tgl/d3drm/camera.cpp @@ -21,7 +21,7 @@ void* CameraImpl::ImplementationDataPtr() } // OFFSET: LEGO1 0x100a3700 -Result CameraImpl::SetTransformation(const FloatMatrix& p_matrix) +Result CameraImpl::SetTransformation(const FloatMatrix4& p_matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* pTransformation = Translate(p_matrix, helper); diff --git a/LEGO1/tgl/d3drm/group.cpp b/LEGO1/tgl/d3drm/group.cpp index c968a08d..644348fb 100644 --- a/LEGO1/tgl/d3drm/group.cpp +++ b/LEGO1/tgl/d3drm/group.cpp @@ -18,7 +18,7 @@ void* GroupImpl::ImplementationDataPtr() } // OFFSET: LEGO1 0x100a31e0 -Result GroupImpl::SetTransformation(const FloatMatrix& p_matrix) +Result GroupImpl::SetTransformation(const FloatMatrix4& p_matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* matrix = Translate(p_matrix, helper); diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index f46f959f..287f107e 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -170,7 +170,7 @@ class CameraImpl : public Camera { virtual void* ImplementationDataPtr(); // vtable+0x08 - virtual Result SetTransformation(const FloatMatrix&); + virtual Result SetTransformation(const FloatMatrix4&); inline IDirect3DRMFrame* ImplementationData() const { return m_data; } @@ -189,7 +189,7 @@ class LightImpl : public Light { virtual void* ImplementationDataPtr(); // vtable+0x08 - virtual Result SetTransformation(const FloatMatrix&); + virtual Result SetTransformation(const FloatMatrix4&); virtual Result SetColor(float p_r, float p_g, float p_b); inline IDirect3DRMFrame* ImplementationData() const { return m_data; } @@ -243,7 +243,7 @@ class GroupImpl : public Group { virtual void* ImplementationDataPtr(); // 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); // vtable+0x10 @@ -405,7 +405,7 @@ inline D3DRMPROJECTIONTYPE Translate(ProjectionType p_tglProjectionType) // Yes this function serves no purpose, originally they intended it to // convert from doubles to floats but ended up using floats throughout // 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 j = 0; j < (sizeof(rD3DRMMatrix4x4[0]) / sizeof(rD3DRMMatrix4x4[0][0])); j++) { diff --git a/LEGO1/tgl/d3drm/light.cpp b/LEGO1/tgl/d3drm/light.cpp index 96db0fd6..ced46c92 100644 --- a/LEGO1/tgl/d3drm/light.cpp +++ b/LEGO1/tgl/d3drm/light.cpp @@ -21,7 +21,7 @@ void* LightImpl::ImplementationDataPtr() } // OFFSET: LEGO1 0x100a3780 -Result LightImpl::SetTransformation(const FloatMatrix& p_matrix) +Result LightImpl::SetTransformation(const FloatMatrix4& p_matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* matrix = Translate(p_matrix, helper); diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index c32353f7..0006e4db 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -222,13 +222,13 @@ class View : public Object { // VTABLE 0x100dbae8 class Camera : public Object { public: - virtual Result SetTransformation(const FloatMatrix&) = 0; + virtual Result SetTransformation(const FloatMatrix4&) = 0; }; // VTABLE 0x100dbb08 class Light : public Object { 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; }; @@ -252,7 +252,7 @@ class Mesh : public Object { // VTABLE 0x100dbaa0 class Group : public Object { 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 SetTexture(const Texture*) = 0; virtual Result GetTexture(Texture*&) = 0; diff --git a/LEGO1/tgl/tglvector.h b/LEGO1/tgl/tglvector.h index f0fd5ec7..78255937 100644 --- a/LEGO1/tgl/tglvector.h +++ b/LEGO1/tgl/tglvector.h @@ -75,22 +75,22 @@ inline void Array::operator+=(const Array& rArray) ////////////////////////////////////////////////////////////////////////////// // -// FloatMatrix +// FloatMatrix4 -class FloatMatrix : public Array, 4> { +class FloatMatrix4 : public Array, 4> { public: - FloatMatrix() {} - FloatMatrix(const FloatMatrix& rMatrix) { *this = rMatrix; } - FloatMatrix(const FloatMatrix&, const FloatMatrix&); + FloatMatrix4() {} + FloatMatrix4(const FloatMatrix4& rMatrix) { *this = rMatrix; } + 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 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; } @@ -117,7 +117,7 @@ inline void FloatMatrix::operator*=(const FloatMatrix& rMatrix) // // Transformation matrices -class Translation : public FloatMatrix { +class Translation : public FloatMatrix4 { public: Translation(const float[3]); Translation(float x, float y, float z); @@ -126,7 +126,7 @@ class Translation : public FloatMatrix { void Init(float x, float y, float z); }; -class Scale : public FloatMatrix { +class Scale : public FloatMatrix4 { public: Scale(const float[3]); Scale(float x, float y, float z); @@ -136,12 +136,12 @@ class Scale : public FloatMatrix { void Init(float x, float y, float z); }; -class RotationX : public FloatMatrix { +class RotationX : public FloatMatrix4 { public: RotationX(float radians); }; -class RotationY : public FloatMatrix { +class RotationY : public FloatMatrix4 { public: RotationY(float radians); }; diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index 12817ff9..9e7c778c 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -44,7 +44,7 @@ class ViewLODList : public LODList { // ??? for now, until we have symbol management typedef const char* ROIName; 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; } diff --git a/LEGO1/viewmanager/viewroi.cpp b/LEGO1/viewmanager/viewroi.cpp index 50100444..461d606c 100644 --- a/LEGO1/viewmanager/viewroi.cpp +++ b/LEGO1/viewmanager/viewroi.cpp @@ -27,8 +27,7 @@ void ViewROI::UpdateWorldData(const Matrix4Data& parent2world) { OrientableROI::UpdateWorldData(parent2world); if (geometry) { - // Tgl::FloatMatrix4 tgl_mat; - Matrix4 mat; + Tgl::FloatMatrix4 mat; SETMAT4(mat, m_local2world.GetMatrix()); Tgl::Result result = geometry->SetTransformation(mat); // assert(Tgl::Succeeded(result));