mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-26 01:28:30 -05:00
Implement/match remaining Lego3DView functions (#623)
This commit is contained in:
parent
d3b575169e
commit
00c05aa80b
6 changed files with 58 additions and 105 deletions
|
@ -73,68 +73,69 @@ void Lego3DView::Destroy()
|
|||
LegoView1::Destroy();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab100
|
||||
// FUNCTION: LEGO1 0x100ab100
|
||||
BOOL Lego3DView::Add(ViewROI& rROI)
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Add(rROI);
|
||||
m_pViewManager->Add(&rROI);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab170
|
||||
// FUNCTION: LEGO1 0x100ab170
|
||||
BOOL Lego3DView::Remove(ViewROI& rROI)
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Remove(rROI);
|
||||
m_pViewManager->Remove(&rROI);
|
||||
|
||||
// if (m_pPointOfView == &rROI) {
|
||||
// m_pPointOfView = 0;
|
||||
// m_pViewManager->SetPOVSource(0);
|
||||
// }
|
||||
if (m_pPointOfView == &rROI) {
|
||||
m_pPointOfView = 0;
|
||||
m_pViewManager->SetPOVSource(0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab1b0
|
||||
// FUNCTION: LEGO1 0x100ab1b0
|
||||
BOOL Lego3DView::SetPointOfView(ViewROI& rROI)
|
||||
{
|
||||
// Tgl::DoubleMatrix4 transformation;
|
||||
// Tgl::Result result;
|
||||
Tgl::FloatMatrix4 transformation;
|
||||
Matrix4 mat(transformation);
|
||||
Tgl::Result result;
|
||||
|
||||
// m_pPointOfView = &rROI;
|
||||
m_pPointOfView = &rROI;
|
||||
|
||||
// assert(m_pViewManager);
|
||||
// m_pViewManager->SetPOVSource(m_pPointOfView);
|
||||
assert(m_pViewManager);
|
||||
m_pViewManager->SetPOVSource(m_pPointOfView);
|
||||
|
||||
// assert(GetCamera());
|
||||
// SETMAT4(transformation, rROI.GetLocalTransform());
|
||||
// result = GetCamera()->SetTransformation(transformation);
|
||||
// assert(Tgl::Succeeded(result));
|
||||
assert(GetCamera());
|
||||
rROI.GetLocalTransform(mat);
|
||||
result = GetCamera()->SetTransformation(transformation);
|
||||
assert(Tgl::Succeeded(result));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab210
|
||||
// FUNCTION: LEGO1 0x100ab210
|
||||
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) {
|
||||
// // move the camera
|
||||
// Tgl::DoubleMatrix4 transformation;
|
||||
// Tgl::Result result;
|
||||
assert(GetCamera());
|
||||
|
||||
// assert(GetCamera());
|
||||
|
||||
// SETMAT4(transformation, rROI.GetLocalTransform());
|
||||
// result = GetCamera()->SetTransformation(transformation);
|
||||
// assert(Tgl::Succeeded(result));
|
||||
// }
|
||||
rROI.GetLocalTransform(mat);
|
||||
result = GetCamera()->SetTransformation(transformation);
|
||||
assert(Tgl::Succeeded(result));
|
||||
m_pViewManager->SetPOVSource(&rROI);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -148,77 +149,8 @@ double Lego3DView::Render(double p_und)
|
|||
return m_previousRenderTime;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
// FUNCTION: LEGO1 0x100ab2b0
|
||||
ViewROI* Lego3DView::Pick(unsigned long x, unsigned long y)
|
||||
{
|
||||
// const ROIList& visible_rois = m_pViewManager->GetVisibleROIs();
|
||||
// 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;
|
||||
return m_pViewManager->Pick(GetView(), x, y);
|
||||
}
|
||||
|
||||
// double Lego3DView::GetTargetRenderingRate() const
|
||||
// {
|
||||
// double secondsAllowed;
|
||||
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// secondsAllowed = m_pViewManager->GetSecondsAllowed();
|
||||
|
||||
// return (secondsAllowed ? (1 / secondsAllowed) : HUGE_VAL);
|
||||
// }
|
||||
|
|
|
@ -29,7 +29,6 @@ class Lego3DView : public LegoView1 {
|
|||
|
||||
ViewROI* GetPointOfView();
|
||||
ViewManager* GetViewManager();
|
||||
// double GetTargetRenderingRate() const;
|
||||
|
||||
private:
|
||||
ViewManager* m_pViewManager; // 0x88
|
||||
|
|
|
@ -40,6 +40,12 @@ void OrientableROI::WrappedVTable0x24(const Matrix4& p_transform)
|
|||
VTable0x24(p_transform);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a50a0
|
||||
void OrientableROI::GetLocalTransform(Matrix4& p_transform)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a58f0
|
||||
void OrientableROI::FUN_100a58f0(const Matrix4& p_transform)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ class OrientableROI : public ROI {
|
|||
void WrappedSetLocalTransform(const Matrix4& p_transform);
|
||||
void FUN_100a46b0(Matrix4& p_transform);
|
||||
void WrappedVTable0x24(const Matrix4& p_transform);
|
||||
void GetLocalTransform(Matrix4& p_transform);
|
||||
void FUN_100a58f0(const Matrix4& p_transform);
|
||||
void FUN_100a5a30(const Vector3& p_world_velocity);
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@ ViewManager::~ViewManager()
|
|||
SetPOVSource(NULL);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a6410
|
||||
void ViewManager::Remove(ViewROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a64d0
|
||||
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)
|
||||
{
|
||||
d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData();
|
||||
|
|
|
@ -21,9 +21,11 @@ class ViewManager {
|
|||
ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view);
|
||||
virtual ~ViewManager();
|
||||
|
||||
void Remove(ViewROI* p_roi);
|
||||
void RemoveAll(ViewROI* p_roi);
|
||||
void FUN_100a66a0(ViewROI* p_roi);
|
||||
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 SetFrustrum(float fov, float front, float back);
|
||||
void Update(float p_previousRenderTime, float p_und2);
|
||||
|
|
Loading…
Reference in a new issue