mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Lego3DView
This commit is contained in:
parent
c5bf56d476
commit
360366515c
@ -7,6 +7,7 @@ option(ISLE_USE_SMARTHEAP "Build with SmartHeap" ${MSVC})
|
||||
option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON)
|
||||
|
||||
add_library(lego1 SHARED
|
||||
LEGO1/3dmanager/lego3dview.cpp
|
||||
LEGO1/3dmanager/legoview1.cpp
|
||||
LEGO1/3dmanager/tglsurface.cpp
|
||||
LEGO1/act1state.cpp
|
||||
@ -50,7 +51,6 @@ add_library(lego1 SHARED
|
||||
LEGO1/jukeboxentity.cpp
|
||||
LEGO1/jukeboxstate.cpp
|
||||
LEGO1/lego3dmanager.cpp
|
||||
LEGO1/lego3dview.cpp
|
||||
LEGO1/legoact2state.cpp
|
||||
LEGO1/legoactioncontrolpresenter.cpp
|
||||
LEGO1/legoactor.cpp
|
||||
|
||||
219
LEGO1/3dmanager/lego3dview.cpp
Normal file
219
LEGO1/3dmanager/lego3dview.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
// Lego3DView.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "lego3dview.h"
|
||||
|
||||
#include "../viewmanager/viewmanager.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Lego3DView
|
||||
|
||||
// STUB: LEGO1 0x100aae90
|
||||
Lego3DView::Lego3DView()
|
||||
{
|
||||
m_pViewManager = 0;
|
||||
m_previousRenderTime = 0;
|
||||
m_pPointOfView = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100aaf30
|
||||
Lego3DView::~Lego3DView()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100aaf90
|
||||
BOOL Lego3DView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
|
||||
{
|
||||
double viewAngle = 45;
|
||||
double frontClippingDistance = 1;
|
||||
double backClippingDistance = 5000;
|
||||
|
||||
if (!LegoView1::Create(rCreateStruct, pRenderer)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// assert(GetView());
|
||||
// GetView()->SetFrustrum(frontClippingDistance, backClippingDistance, viewAngle);
|
||||
|
||||
// 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;
|
||||
|
||||
// // NOTE: a derived class must inform view manager when it configures
|
||||
// // its (Tgl) view: calling Tgl::View::SetFrustrum() should be
|
||||
// // accompanied by calling ViewManager::SetFrustrum()
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab0b0
|
||||
void Lego3DView::Destroy()
|
||||
{
|
||||
if (m_pPointOfView) {
|
||||
m_pPointOfView = 0;
|
||||
// m_pViewManager->SetPOVSource(0);
|
||||
}
|
||||
|
||||
delete m_pViewManager;
|
||||
m_pViewManager = 0;
|
||||
|
||||
LegoView1::Destroy();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab100
|
||||
BOOL Lego3DView::Add(ViewROI& rROI)
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Add(rROI);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab170
|
||||
BOOL Lego3DView::Remove(ViewROI& rROI)
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Remove(rROI);
|
||||
|
||||
// if (m_pPointOfView == &rROI) {
|
||||
// m_pPointOfView = 0;
|
||||
// m_pViewManager->SetPOVSource(0);
|
||||
// }
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab1b0
|
||||
BOOL Lego3DView::SetPointOfView(ViewROI& rROI)
|
||||
{
|
||||
// Tgl::DoubleMatrix4 transformation;
|
||||
// Tgl::Result result;
|
||||
|
||||
// m_pPointOfView = &rROI;
|
||||
|
||||
// assert(m_pViewManager);
|
||||
// m_pViewManager->SetPOVSource(m_pPointOfView);
|
||||
|
||||
// assert(GetCamera());
|
||||
// SETMAT4(transformation, rROI.GetLocalTransform());
|
||||
// result = GetCamera()->SetTransformation(transformation);
|
||||
// assert(Tgl::Succeeded(result));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab210
|
||||
BOOL Lego3DView::Moved(ViewROI& rROI)
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Moved(rROI);
|
||||
|
||||
// if (m_pPointOfView == &rROI) {
|
||||
// // move the camera
|
||||
// Tgl::DoubleMatrix4 transformation;
|
||||
// Tgl::Result result;
|
||||
|
||||
// assert(GetCamera());
|
||||
|
||||
// SETMAT4(transformation, rROI.GetLocalTransform());
|
||||
// result = GetCamera()->SetTransformation(transformation);
|
||||
// assert(Tgl::Succeeded(result));
|
||||
// }
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab270
|
||||
double Lego3DView::Render()
|
||||
{
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// m_pViewManager->Update(m_previousRenderTime);
|
||||
|
||||
// m_previousRenderTime = LegoView1::Render();
|
||||
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
// double Lego3DView::GetTargetRenderingRate() const
|
||||
// {
|
||||
// double secondsAllowed;
|
||||
|
||||
// assert(m_pViewManager);
|
||||
|
||||
// secondsAllowed = m_pViewManager->GetSecondsAllowed();
|
||||
|
||||
// return (secondsAllowed ? (1 / secondsAllowed) : HUGE_VAL);
|
||||
// }
|
||||
59
LEGO1/3dmanager/lego3dview.h
Normal file
59
LEGO1/3dmanager/lego3dview.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef _Lego3DView_h
|
||||
#define _Lego3DView_h
|
||||
|
||||
#include "legoview1.h"
|
||||
|
||||
class ViewROI;
|
||||
class ViewManager;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Lego3DView
|
||||
|
||||
// VTABLE: LEGO1 0x100dbf78
|
||||
// SIZE 0xa8
|
||||
class Lego3DView : public LegoView1 {
|
||||
public:
|
||||
Lego3DView();
|
||||
virtual ~Lego3DView() override;
|
||||
|
||||
BOOL Create(const CreateStruct&, Tgl::Renderer*);
|
||||
virtual void Destroy() override; // vtable+0x08
|
||||
|
||||
BOOL Add(ViewROI&);
|
||||
BOOL Remove(ViewROI&);
|
||||
BOOL Moved(ViewROI&);
|
||||
BOOL SetPointOfView(ViewROI&);
|
||||
|
||||
double Render();
|
||||
|
||||
ViewROI* Pick(unsigned long x, unsigned long y);
|
||||
|
||||
ViewROI* GetPointOfView();
|
||||
ViewManager* GetViewManager();
|
||||
// double GetTargetRenderingRate() const;
|
||||
|
||||
private:
|
||||
ViewManager* m_pViewManager; // 0x88
|
||||
double m_previousRenderTime; // 0x8c
|
||||
|
||||
ViewROI* m_pPointOfView; // 0x90
|
||||
};
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100aaf10
|
||||
// Lego3DView::`scalar deleting destructor'
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Lego3DView implementation
|
||||
|
||||
inline ViewManager* Lego3DView::GetViewManager()
|
||||
{
|
||||
return m_pViewManager;
|
||||
}
|
||||
|
||||
inline ViewROI* Lego3DView::GetPointOfView()
|
||||
{
|
||||
return m_pPointOfView;
|
||||
}
|
||||
|
||||
#endif /* _Lego3DView_h */
|
||||
@ -14,7 +14,7 @@ class Tgl::Camera;
|
||||
class LegoView : public TglSurface {
|
||||
public:
|
||||
LegoView();
|
||||
~LegoView();
|
||||
virtual ~LegoView() override;
|
||||
|
||||
BOOL Create(const CreateStruct&, Tgl::Renderer*);
|
||||
virtual void Destroy() override; // vtable+0x08
|
||||
@ -54,11 +54,11 @@ inline Tgl::Camera* LegoView::GetCamera() const
|
||||
class LegoView1 : public LegoView {
|
||||
public:
|
||||
LegoView1();
|
||||
~LegoView1();
|
||||
virtual ~LegoView1() override;
|
||||
|
||||
BOOL AddLightsToViewport();
|
||||
BOOL Create(const TglSurface::CreateStruct&, Tgl::Renderer*);
|
||||
void Destroy();
|
||||
virtual void Destroy() override; // vtable+0x08
|
||||
|
||||
private:
|
||||
Tgl::Light* m_pSunLight; // 0x78
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
#include "lego3dview.h"
|
||||
|
||||
#include "legoroi.h"
|
||||
#include "tgl/tgl.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Lego3DView, 0xa8)
|
||||
|
||||
// STUB: LEGO1 0x100aae90
|
||||
Lego3DView::Lego3DView()
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100aaf30
|
||||
Lego3DView::~Lego3DView()
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100aaf90
|
||||
BOOL Lego3DView::Create(TglSurface::CreateStruct& p_createStruct, Tgl::Renderer* p_renderer)
|
||||
{
|
||||
Tgl::DeviceDirectDrawCreateData createData = {
|
||||
p_createStruct.m_pDriverGUID,
|
||||
p_createStruct.m_hWnd,
|
||||
p_createStruct.m_pDirectDraw,
|
||||
p_createStruct.m_pFrontBuffer,
|
||||
p_createStruct.m_pBackBuffer
|
||||
};
|
||||
|
||||
m_device = p_renderer->CreateDevice(createData);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab100
|
||||
void Lego3DView::FUN_100ab100(LegoROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab1b0
|
||||
void Lego3DView::FUN_100ab1b0(LegoROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab2b0
|
||||
LegoROI* Lego3DView::PickROI(MxLong p_a, MxLong p_b)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
#ifndef LEGO3DVIEW_H
|
||||
#define LEGO3DVIEW_H
|
||||
|
||||
#include "3dmanager/tglsurface.h"
|
||||
#include "decomp.h"
|
||||
#include "mxtypes.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
class LegoROI;
|
||||
|
||||
// VTABLE: LEGO1 0x100dbf78
|
||||
// SIZE 0xa8
|
||||
class Lego3DView {
|
||||
public:
|
||||
Lego3DView();
|
||||
virtual ~Lego3DView();
|
||||
|
||||
BOOL Create(TglSurface::CreateStruct& p_createStruct, Tgl::Renderer* p_renderer);
|
||||
LegoROI* PickROI(MxLong p_a, MxLong p_b);
|
||||
void FUN_100ab100(LegoROI* p_roi);
|
||||
void FUN_100ab1b0(LegoROI* p_roi);
|
||||
|
||||
inline ViewManager* GetViewManager() { return this->m_viewManager; }
|
||||
inline Tgl::Device* GetDevice() { return this->m_device; }
|
||||
inline Tgl::View* GetView() { return this->m_view; }
|
||||
|
||||
private:
|
||||
// TODO: all of these fields are in various base classes
|
||||
undefined4 m_unk0x4; // 0x04
|
||||
Tgl::Renderer* m_renderer; // 0x08
|
||||
Tgl::Device* m_device; // 0x0c
|
||||
Tgl::View* m_view; // 0x10
|
||||
undefined m_unk0x14[0x74]; // 0x14
|
||||
ViewManager* m_viewManager; // 0x88
|
||||
undefined m_unk0x8c[0x1c]; // 0x8c
|
||||
};
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100aaf10
|
||||
// Lego3DView::`scalar deleting destructor'
|
||||
|
||||
#endif // LEGO3DVIEW_H
|
||||
Loading…
Reference in New Issue
Block a user