From 7d2629318c796f4ac21db9061966b14c0e00b810 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 13 Jan 2024 14:58:10 -0500 Subject: [PATCH] Match Lego3DView::Create (#431) --- LEGO1/lego/sources/3dmanager/lego3dview.cpp | 26 ++++++++++++--------- LEGO1/omni/src/video/mxbitmap.cpp | 2 +- LEGO1/viewmanager/viewmanager.cpp | 12 +++++++++- LEGO1/viewmanager/viewmanager.h | 7 +++++- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/LEGO1/lego/sources/3dmanager/lego3dview.cpp b/LEGO1/lego/sources/3dmanager/lego3dview.cpp index 9225e2ea..37b8215e 100644 --- a/LEGO1/lego/sources/3dmanager/lego3dview.cpp +++ b/LEGO1/lego/sources/3dmanager/lego3dview.cpp @@ -25,27 +25,31 @@ Lego3DView::~Lego3DView() Destroy(); } -// STUB: LEGO1 0x100aaf90 +// FUNCTION: LEGO1 0x100aaf90 BOOL Lego3DView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer) { double viewAngle = 45; - double frontClippingDistance = 1; - double backClippingDistance = 5000; + if (rCreateStruct.m_isWideViewAngle) + viewAngle = 90; + + float frontClippingDistance = 0.1; + float backClippingDistance = 500; if (!LegoView1::Create(rCreateStruct, pRenderer)) { return FALSE; } - // assert(GetView()); - // GetView()->SetFrustrum(frontClippingDistance, backClippingDistance, viewAngle); + assert(GetView()); + GetView()->SetFrustrum(frontClippingDistance, backClippingDistance, viewAngle); - // assert(GetScene()); - // assert(!m_pViewManager); + assert(GetScene()); + assert(!m_pViewManager); - // m_pViewManager = new ViewManager(GetScene(), 0); - // m_pViewManager->SetResolution(GetWidth(), GetHeight()); - // m_pViewManager->SetFrustrum(viewAngle, -frontClippingDistance, -backClippingDistance); - // m_previousRenderTime = 0; + m_pViewManager = new ViewManager(pRenderer, GetScene(), 0); + m_pViewManager->SetResolution(GetWidth(), GetHeight()); + m_pViewManager->SetFrustrum(viewAngle, frontClippingDistance, backClippingDistance); + m_previousRenderTime = 0; + m_unk0x98 = 0; // // NOTE: a derived class must inform view manager when it configures // // its (Tgl) view: calling Tgl::View::SetFrustrum() should be diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index ea93279b..9e21e449 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -103,7 +103,7 @@ MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info) } if (this->m_data) { - delete this->m_data; + delete[] this->m_data; this->m_data = NULL; } } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 71ab5fcc..7d412641 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -1,7 +1,7 @@ #include "viewmanager.h" // STUB: LEGO1 0x100a5eb0 -ViewManager::ViewManager(Tgl::Group* scene, const OrientableROI* point_of_view) +ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view) { } @@ -16,6 +16,16 @@ void ViewManager::RemoveAll(ViewROI*) // TODO } +// STUB: LEGO1 0x100a6d50 +void ViewManager::SetResolution(int width, int height) +{ +} + +// STUB: LEGO1 0x100a6d70 +void ViewManager::SetFrustrum(float fov, float front, float back) +{ +} + // STUB: LEGO1 0x100a6da0 void ViewManager::SetPOVSource(const OrientableROI* point_of_view) { diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 41421b14..03b23366 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -7,12 +7,17 @@ // SIZE 0x1bc class ViewManager { public: - ViewManager(Tgl::Group* scene, const OrientableROI* point_of_view); + ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view); virtual ~ViewManager(); __declspec(dllexport) void RemoveAll(ViewROI*); void SetPOVSource(const OrientableROI* point_of_view); + void SetResolution(int width, int height); + void SetFrustrum(float fov, float front, float back); + +private: + undefined m_pad[0x1b8]; }; #endif // VIEWMANAGER_H