Implement/match remaining Lego3DView functions (#623)

This commit is contained in:
Christian Semmler 2024-03-04 12:54:25 -05:00 committed by GitHub
parent d3b575169e
commit 00c05aa80b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 58 additions and 105 deletions

View file

@ -73,68 +73,69 @@ void Lego3DView::Destroy()
LegoView1::Destroy(); LegoView1::Destroy();
} }
// STUB: LEGO1 0x100ab100 // FUNCTION: LEGO1 0x100ab100
BOOL Lego3DView::Add(ViewROI& rROI) BOOL Lego3DView::Add(ViewROI& rROI)
{ {
// assert(m_pViewManager); assert(m_pViewManager);
// m_pViewManager->Add(rROI); m_pViewManager->Add(&rROI);
return TRUE; return TRUE;
} }
// STUB: LEGO1 0x100ab170 // FUNCTION: LEGO1 0x100ab170
BOOL Lego3DView::Remove(ViewROI& rROI) BOOL Lego3DView::Remove(ViewROI& rROI)
{ {
// assert(m_pViewManager); assert(m_pViewManager);
// m_pViewManager->Remove(rROI); m_pViewManager->Remove(&rROI);
// if (m_pPointOfView == &rROI) { if (m_pPointOfView == &rROI) {
// m_pPointOfView = 0; m_pPointOfView = 0;
// m_pViewManager->SetPOVSource(0); m_pViewManager->SetPOVSource(0);
// } }
return TRUE; return TRUE;
} }
// STUB: LEGO1 0x100ab1b0 // FUNCTION: LEGO1 0x100ab1b0
BOOL Lego3DView::SetPointOfView(ViewROI& rROI) BOOL Lego3DView::SetPointOfView(ViewROI& rROI)
{ {
// Tgl::DoubleMatrix4 transformation; Tgl::FloatMatrix4 transformation;
// Tgl::Result result; Matrix4 mat(transformation);
Tgl::Result result;
// m_pPointOfView = &rROI; m_pPointOfView = &rROI;
// assert(m_pViewManager); assert(m_pViewManager);
// m_pViewManager->SetPOVSource(m_pPointOfView); m_pViewManager->SetPOVSource(m_pPointOfView);
// assert(GetCamera()); assert(GetCamera());
// SETMAT4(transformation, rROI.GetLocalTransform()); rROI.GetLocalTransform(mat);
// result = GetCamera()->SetTransformation(transformation); result = GetCamera()->SetTransformation(transformation);
// assert(Tgl::Succeeded(result)); assert(Tgl::Succeeded(result));
return TRUE; return TRUE;
} }
// STUB: LEGO1 0x100ab210 // FUNCTION: LEGO1 0x100ab210
BOOL Lego3DView::Moved(ViewROI& rROI) BOOL Lego3DView::Moved(ViewROI& rROI)
{ {
// assert(m_pViewManager); assert(m_pViewManager);
// m_pViewManager->Moved(rROI); if (m_pPointOfView == &rROI) {
// move the camera
Tgl::FloatMatrix4 transformation;
Matrix4 mat(transformation);
Tgl::Result result;
// if (m_pPointOfView == &rROI) { assert(GetCamera());
// // move the camera
// Tgl::DoubleMatrix4 transformation;
// Tgl::Result result;
// assert(GetCamera()); rROI.GetLocalTransform(mat);
result = GetCamera()->SetTransformation(transformation);
// SETMAT4(transformation, rROI.GetLocalTransform()); assert(Tgl::Succeeded(result));
// result = GetCamera()->SetTransformation(transformation); m_pViewManager->SetPOVSource(&rROI);
// assert(Tgl::Succeeded(result)); }
// }
return TRUE; return TRUE;
} }
@ -148,77 +149,8 @@ double Lego3DView::Render(double p_und)
return m_previousRenderTime; return m_previousRenderTime;
} }
/* // FUNCTION: LEGO1 0x100ab2b0
virtual Tgl::Result Tgl::View::Pick(unsigned long x,
unsigned long y,
const Tgl::Group** ppGroupsToPickFrom,
int groupsToPickFromCount,
const Tgl::Group**& rppPickedGroups,
int& rPickedGroupCount) = 0;
*/
// typedef std::map<const Tgl::Group*, const ROI*, std::less<const Tgl::Group*>> Group2ROI;
// STUB: LEGO1 0x100ab2b0
ViewROI* Lego3DView::Pick(unsigned long x, unsigned long y) ViewROI* Lego3DView::Pick(unsigned long x, unsigned long y)
{ {
// const ROIList& visible_rois = m_pViewManager->GetVisibleROIs(); return m_pViewManager->Pick(GetView(), x, y);
// int n_in = 0, n_out;
// const Tgl::Group** groups_in = new const Tgl::Group*[visible_rois.size()];
// const Tgl::Group** groups_out = NULL;
// Group2ROI roi_map;
// ViewROI* viewROI = NULL;
// // generate the list of groups to pick from which is all the geometry
// // groups of all the currently visible ROIs in the view manager.
// // Also, construct a mapping from each group back to it's ROI since that's
// // what we need to return.
// //
// WALK_STL_OBJECT(visible_rois, ROIList, vi)
// {
// ViewROI* vroi = (ViewROI*) (*vi);
// Tgl::Group* g = vroi->GetGeometry();
// assert(g);
// groups_in[n_in++] = g;
// roi_map[g] = *vi;
// }
// // perform the pick on our TglView passing the visible groups
// //
// Tgl::View* tglview = GetView();
// assert(tglview);
// tglview->Pick(x, y, groups_in, n_in, groups_out, n_out);
// // search the returned group hierarchy from the bottom for the
// // first group which was in groups_in.
// //
// for (int i = n_out - 1; i >= 0; i--) {
// const Tgl::Group* g = (const Tgl::Group*) (groups_out[i]);
// if (!g) // null entries means group node wasn't in groups_in
// continue;
// Group2ROI::iterator gi = roi_map.find(g);
// if (gi != roi_map.end()) {
// viewROI = (ViewROI*) ((*gi).second);
// break;
// }
// }
// // delete the heap allocated arrays.
// //
// delete[] groups_in;
// if (groups_out)
// delete[] groups_out;
return NULL;
} }
// double Lego3DView::GetTargetRenderingRate() const
// {
// double secondsAllowed;
// assert(m_pViewManager);
// secondsAllowed = m_pViewManager->GetSecondsAllowed();
// return (secondsAllowed ? (1 / secondsAllowed) : HUGE_VAL);
// }

View file

@ -29,7 +29,6 @@ class Lego3DView : public LegoView1 {
ViewROI* GetPointOfView(); ViewROI* GetPointOfView();
ViewManager* GetViewManager(); ViewManager* GetViewManager();
// double GetTargetRenderingRate() const;
private: private:
ViewManager* m_pViewManager; // 0x88 ViewManager* m_pViewManager; // 0x88

View file

@ -40,6 +40,12 @@ void OrientableROI::WrappedVTable0x24(const Matrix4& p_transform)
VTable0x24(p_transform); VTable0x24(p_transform);
} }
// STUB: LEGO1 0x100a50a0
void OrientableROI::GetLocalTransform(Matrix4& p_transform)
{
// TODO
}
// FUNCTION: LEGO1 0x100a58f0 // FUNCTION: LEGO1 0x100a58f0
void OrientableROI::FUN_100a58f0(const Matrix4& p_transform) void OrientableROI::FUN_100a58f0(const Matrix4& p_transform)
{ {

View file

@ -35,6 +35,7 @@ class OrientableROI : public ROI {
void WrappedSetLocalTransform(const Matrix4& p_transform); void WrappedSetLocalTransform(const Matrix4& p_transform);
void FUN_100a46b0(Matrix4& p_transform); void FUN_100a46b0(Matrix4& p_transform);
void WrappedVTable0x24(const Matrix4& p_transform); void WrappedVTable0x24(const Matrix4& p_transform);
void GetLocalTransform(Matrix4& p_transform);
void FUN_100a58f0(const Matrix4& p_transform); void FUN_100a58f0(const Matrix4& p_transform);
void FUN_100a5a30(const Vector3& p_world_velocity); void FUN_100a5a30(const Vector3& p_world_velocity);

View file

@ -32,6 +32,12 @@ ViewManager::~ViewManager()
SetPOVSource(NULL); SetPOVSource(NULL);
} }
// STUB: LEGO1 0x100a6410
void ViewManager::Remove(ViewROI* p_roi)
{
// TODO
}
// FUNCTION: LEGO1 0x100a64d0 // FUNCTION: LEGO1 0x100a64d0
void ViewManager::RemoveAll(ViewROI* p_roi) void ViewManager::RemoveAll(ViewROI* p_roi)
{ {
@ -101,6 +107,13 @@ void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
} }
} }
// STUB: LEGO1 0x100a6e00
ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned long x, unsigned long y)
{
// TODO
return NULL;
}
inline undefined4 SetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer) inline undefined4 SetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer)
{ {
d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData(); d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData();

View file

@ -21,9 +21,11 @@ class ViewManager {
ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view); ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view);
virtual ~ViewManager(); virtual ~ViewManager();
void Remove(ViewROI* p_roi);
void RemoveAll(ViewROI* p_roi); void RemoveAll(ViewROI* p_roi);
void FUN_100a66a0(ViewROI* p_roi); void FUN_100a66a0(ViewROI* p_roi);
void SetPOVSource(const OrientableROI* point_of_view); void SetPOVSource(const OrientableROI* point_of_view);
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
void SetResolution(int width, int height); void SetResolution(int width, int height);
void SetFrustrum(float fov, float front, float back); void SetFrustrum(float fov, float front, float back);
void Update(float p_previousRenderTime, float p_und2); void Update(float p_previousRenderTime, float p_und2);