mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Reorganize sources and files (#414)
* Reorganize sources * Refactor * Remove relative paths * Renames * Fix gitignore * Remove stuff * Try fixing format script * Fix format * Fix format * Fix naming script * Test format * Fix format
This commit is contained in:

committed by
GitHub

parent
6a85e62406
commit
c47206617d
96
LEGO1/lego/sources/3dmanager/lego3dmanager.cpp
Normal file
96
LEGO1/lego/sources/3dmanager/lego3dmanager.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
// Lego3DManager.cpp : implementation file
|
||||
//
|
||||
#include "lego3dmanager.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "viewmanager/viewlodlist.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Lego3DManager, 0x10);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab2d0
|
||||
BOOL InitializeCreateStruct(
|
||||
TglSurface::CreateStruct& rTglSurfaceCreateStruct,
|
||||
const Lego3DManager::CreateStruct& rCreateStruct
|
||||
)
|
||||
{
|
||||
// initializes a TglSurface::CreateStruct from a Lego3DManager::CreateStruct
|
||||
rTglSurfaceCreateStruct.m_pDriverGUID = rCreateStruct.m_pDriverGUID;
|
||||
rTglSurfaceCreateStruct.m_hWnd = rCreateStruct.m_hWnd;
|
||||
rTglSurfaceCreateStruct.m_pDirectDraw = rCreateStruct.m_pDirectDraw;
|
||||
rTglSurfaceCreateStruct.m_pFrontBuffer = rCreateStruct.m_pFrontBuffer;
|
||||
rTglSurfaceCreateStruct.m_pBackBuffer = rCreateStruct.m_pBackBuffer;
|
||||
rTglSurfaceCreateStruct.m_pPalette = rCreateStruct.m_pPalette;
|
||||
rTglSurfaceCreateStruct.m_isFullScreen = rCreateStruct.m_isFullScreen;
|
||||
rTglSurfaceCreateStruct.m_isWideViewAngle = rCreateStruct.m_isWideViewAngle;
|
||||
rTglSurfaceCreateStruct.m_direct3d = rCreateStruct.m_direct3d;
|
||||
rTglSurfaceCreateStruct.m_d3dDevice = rCreateStruct.m_d3dDevice;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab320
|
||||
Lego3DManager::Lego3DManager()
|
||||
{
|
||||
// Tgl things
|
||||
m_pRenderer = 0;
|
||||
|
||||
m_pLego3DView = 0;
|
||||
m_pViewLODListManager = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab360
|
||||
Lego3DManager::~Lego3DManager()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab370
|
||||
BOOL Lego3DManager::Create(CreateStruct& rCreateStruct)
|
||||
{
|
||||
TglSurface::CreateStruct tglSurfaceCreateStruct;
|
||||
BOOL result;
|
||||
|
||||
assert(!m_pViewLODListManager);
|
||||
assert(!m_pRenderer);
|
||||
assert(!m_pLego3DView);
|
||||
|
||||
m_pViewLODListManager = new ViewLODListManager;
|
||||
assert(m_pViewLODListManager);
|
||||
|
||||
m_pRenderer = Tgl::CreateRenderer();
|
||||
assert(m_pRenderer);
|
||||
|
||||
m_pLego3DView = new Lego3DView;
|
||||
|
||||
result = InitializeCreateStruct(tglSurfaceCreateStruct, rCreateStruct);
|
||||
assert(result);
|
||||
|
||||
result = m_pLego3DView->Create(tglSurfaceCreateStruct, m_pRenderer);
|
||||
assert(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab460
|
||||
void Lego3DManager::Destroy()
|
||||
{
|
||||
delete m_pLego3DView;
|
||||
m_pLego3DView = 0;
|
||||
|
||||
delete m_pRenderer;
|
||||
m_pRenderer = 0;
|
||||
|
||||
delete m_pViewLODListManager;
|
||||
m_pViewLODListManager = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab4b0
|
||||
double Lego3DManager::Render(double p_und)
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->Render(p_und);
|
||||
}
|
117
LEGO1/lego/sources/3dmanager/lego3dmanager.h
Normal file
117
LEGO1/lego/sources/3dmanager/lego3dmanager.h
Normal file
@@ -0,0 +1,117 @@
|
||||
#ifndef _Lego3DManager_h
|
||||
#define _Lego3DManager_h
|
||||
|
||||
#include "assert.h"
|
||||
#include "lego3dview.h"
|
||||
|
||||
class Tgl::Renderer;
|
||||
class Tgl::Group;
|
||||
class ViewROI;
|
||||
|
||||
// ??? for now
|
||||
class ViewLODListManager;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Lego3DManager
|
||||
|
||||
// VTABLE: LEGO1 0x100dbfa4
|
||||
// SIZE 0x10
|
||||
class Lego3DManager {
|
||||
public:
|
||||
// SIZE 0x28
|
||||
struct CreateStruct {
|
||||
const GUID* m_pDriverGUID; // 0x00
|
||||
HWND m_hWnd; // 0x04
|
||||
IDirectDraw* m_pDirectDraw; // 0x08
|
||||
IDirectDrawSurface* m_pFrontBuffer; // 0x0c
|
||||
IDirectDrawSurface* m_pBackBuffer; // 0x10
|
||||
IDirectDrawPalette* m_pPalette; // 0x14
|
||||
BOOL m_isFullScreen; // 0x18
|
||||
BOOL m_isWideViewAngle; // 0x1c
|
||||
IDirect3D2* m_direct3d; // 0x20
|
||||
IDirect3DDevice2* m_d3dDevice; // 0x24
|
||||
};
|
||||
|
||||
public:
|
||||
Lego3DManager();
|
||||
virtual ~Lego3DManager();
|
||||
|
||||
BOOL Create(CreateStruct&);
|
||||
void Destroy();
|
||||
|
||||
BOOL Add(ViewROI&);
|
||||
BOOL Remove(ViewROI&);
|
||||
BOOL Moved(ViewROI&);
|
||||
BOOL SetPointOfView(ViewROI&);
|
||||
|
||||
double Render(double p_und);
|
||||
|
||||
Tgl::Renderer* GetRenderer();
|
||||
Tgl::Group* GetScene();
|
||||
Lego3DView* GetLego3DView();
|
||||
// ??? for now
|
||||
ViewLODListManager* GetViewLODListManager();
|
||||
|
||||
private:
|
||||
Tgl::Renderer* m_pRenderer; // 0x04
|
||||
|
||||
Lego3DView* m_pLego3DView; // 0x08
|
||||
ViewLODListManager* m_pViewLODListManager; // 0x0c
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Lego3DManager implementaion
|
||||
|
||||
inline BOOL Lego3DManager::Add(ViewROI& rROI)
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->Add(rROI);
|
||||
}
|
||||
|
||||
inline BOOL Lego3DManager::Remove(ViewROI& rROI)
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->Remove(rROI);
|
||||
}
|
||||
|
||||
inline BOOL Lego3DManager::SetPointOfView(ViewROI& rROI)
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->SetPointOfView(rROI);
|
||||
}
|
||||
|
||||
inline BOOL Lego3DManager::Moved(ViewROI& rROI)
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->Moved(rROI);
|
||||
}
|
||||
|
||||
inline Tgl::Renderer* Lego3DManager::GetRenderer()
|
||||
{
|
||||
return m_pRenderer;
|
||||
}
|
||||
|
||||
inline Tgl::Group* Lego3DManager::GetScene()
|
||||
{
|
||||
assert(m_pLego3DView);
|
||||
|
||||
return m_pLego3DView->GetScene();
|
||||
}
|
||||
|
||||
inline Lego3DView* Lego3DManager::GetLego3DView()
|
||||
{
|
||||
return m_pLego3DView;
|
||||
}
|
||||
|
||||
inline ViewLODListManager* Lego3DManager::GetViewLODListManager()
|
||||
{
|
||||
return m_pViewLODListManager;
|
||||
}
|
||||
|
||||
#endif /* _Lego3DManager_h */
|
221
LEGO1/lego/sources/3dmanager/lego3dview.cpp
Normal file
221
LEGO1/lego/sources/3dmanager/lego3dview.cpp
Normal file
@@ -0,0 +1,221 @@
|
||||
// Lego3DView.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "lego3dview.h"
|
||||
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Lego3DView, 0xa8)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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(double p_und)
|
||||
{
|
||||
// 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);
|
||||
// }
|
62
LEGO1/lego/sources/3dmanager/lego3dview.h
Normal file
62
LEGO1/lego/sources/3dmanager/lego3dview.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef _Lego3DView_h
|
||||
#define _Lego3DView_h
|
||||
|
||||
#include "decomp.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(double p_und);
|
||||
|
||||
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
|
||||
|
||||
undefined m_unk0x94[0x0c]; // 0x94
|
||||
};
|
||||
|
||||
// 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 */
|
184
LEGO1/lego/sources/3dmanager/legoview1.cpp
Normal file
184
LEGO1/lego/sources/3dmanager/legoview1.cpp
Normal file
@@ -0,0 +1,184 @@
|
||||
// LegoView1.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "legoview1.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "realtime/realtime.h"
|
||||
|
||||
#include <vec.h> // SETMAT4
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoView, 0x78);
|
||||
DECOMP_SIZE_ASSERT(LegoView1, 0x88);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// LegoView
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab510
|
||||
LegoView::LegoView()
|
||||
{
|
||||
m_pScene = 0;
|
||||
m_pCamera = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab5a0
|
||||
LegoView::~LegoView()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab600
|
||||
BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
|
||||
{
|
||||
float viewAngle = 45;
|
||||
if (rCreateStruct.m_isWideViewAngle)
|
||||
viewAngle = 90;
|
||||
|
||||
float frontClippingDistance = 0.1;
|
||||
float backClippingDistance = 500;
|
||||
|
||||
assert(!m_pScene);
|
||||
assert(!m_pCamera);
|
||||
assert(pRenderer);
|
||||
|
||||
m_pScene = pRenderer->CreateGroup();
|
||||
assert(m_pScene);
|
||||
// TglSurface::Create() calls CreateView(), and we need the camera in
|
||||
// CreateView(), so create camera before calling TglSurface::Create()
|
||||
m_pCamera = pRenderer->CreateCamera();
|
||||
assert(m_pCamera);
|
||||
|
||||
if (!TglSurface::Create(rCreateStruct, pRenderer, m_pScene)) {
|
||||
delete m_pScene;
|
||||
m_pScene = 0;
|
||||
|
||||
delete m_pCamera;
|
||||
m_pCamera = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
assert(GetView());
|
||||
GetView()->SetFrustrum(frontClippingDistance, backClippingDistance, viewAngle);
|
||||
GetView()->SetBackgroundColor(.223, .639, .851);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab6c0
|
||||
Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice)
|
||||
{
|
||||
assert(pRenderer);
|
||||
assert(pDevice);
|
||||
|
||||
return pRenderer->CreateView(pDevice, m_pCamera, 0, 0, GetWidth(), GetHeight());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab6f0
|
||||
void LegoView::Destroy()
|
||||
{
|
||||
delete m_pScene;
|
||||
m_pScene = 0;
|
||||
|
||||
delete m_pCamera;
|
||||
m_pCamera = 0;
|
||||
|
||||
TglSurface::Destroy();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// LegoView1
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab730
|
||||
LegoView1::LegoView1()
|
||||
{
|
||||
m_pSunLight = 0;
|
||||
m_pDirectionalLight = 0;
|
||||
m_pAmbientLight = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab7c0
|
||||
LegoView1::~LegoView1()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ab820
|
||||
BOOL LegoView1::AddLightsToViewport()
|
||||
{
|
||||
GetView()->Add(m_pSunLight);
|
||||
GetView()->Add(m_pDirectionalLight);
|
||||
GetView()->Add(m_pAmbientLight);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100ab860
|
||||
BOOL LegoView1::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
|
||||
{
|
||||
double position[3] = {0, 0, 0};
|
||||
double direction[3];
|
||||
double up[3] = {0, 1, 0};
|
||||
|
||||
if (!LegoView::Create(rCreateStruct, pRenderer)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// lights
|
||||
m_pSunLight = pRenderer->CreateLight(Tgl::Directional, .9, .9, .9);
|
||||
m_pDirectionalLight = pRenderer->CreateLight(Tgl::Directional, .4, .4, .4);
|
||||
m_pAmbientLight = pRenderer->CreateLight(Tgl::Ambient, .3, .3, .3);
|
||||
|
||||
#if 0
|
||||
direction[0] = 1, direction[1] = -1, direction[2] = 2;
|
||||
m_pSunLight->SetOrientation(direction, up);
|
||||
direction[0] = -1, direction[1] = -2, direction[2] = -1;
|
||||
m_pDirectionalLight->SetOrientation(direction, up);
|
||||
#else
|
||||
{
|
||||
// Change everything to float and proper Matrix types
|
||||
/*
|
||||
Tgl::FloatMatrix4 transformation;
|
||||
Matrix4Data transform;
|
||||
|
||||
direction[0] = 1, direction[1] = -1, direction[2] = 2;
|
||||
CalcLocalTransform(position, direction, up, transform);
|
||||
SETMAT4(transformation, transform);
|
||||
m_pSunLight->SetTransformation(transformation);
|
||||
|
||||
direction[0] = -1, direction[1] = -2, direction[2] = -1;
|
||||
CalcLocalTransform(position, direction, up, transform);
|
||||
SETMAT4(transformation, transform);
|
||||
m_pDirectionalLight->SetTransformation(transformation);
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(GetView());
|
||||
AddLightsToViewport();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100abad0
|
||||
void LegoView1::Destroy()
|
||||
{
|
||||
if (m_pSunLight) {
|
||||
GetView()->Remove(m_pSunLight);
|
||||
delete m_pSunLight;
|
||||
m_pSunLight = 0;
|
||||
}
|
||||
|
||||
if (m_pDirectionalLight) {
|
||||
GetView()->Remove(m_pDirectionalLight);
|
||||
delete m_pDirectionalLight;
|
||||
m_pDirectionalLight = 0;
|
||||
}
|
||||
|
||||
if (m_pAmbientLight) {
|
||||
GetView()->Remove(m_pAmbientLight);
|
||||
delete m_pAmbientLight;
|
||||
m_pAmbientLight = 0;
|
||||
}
|
||||
|
||||
LegoView::Destroy();
|
||||
}
|
72
LEGO1/lego/sources/3dmanager/legoview1.h
Normal file
72
LEGO1/lego/sources/3dmanager/legoview1.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _LegoView1_h
|
||||
#define _LegoView1_h
|
||||
|
||||
#include "compat.h"
|
||||
#include "tglsurface.h"
|
||||
|
||||
class Tgl::Camera;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// LegoView
|
||||
|
||||
// VTABLE: 0x100dc000
|
||||
// SIZE 0x78
|
||||
class LegoView : public TglSurface {
|
||||
public:
|
||||
LegoView();
|
||||
virtual ~LegoView() override;
|
||||
|
||||
BOOL Create(const CreateStruct&, Tgl::Renderer*);
|
||||
virtual void Destroy() override; // vtable+0x08
|
||||
|
||||
Tgl::Group* GetScene() const;
|
||||
Tgl::Camera* GetCamera() const;
|
||||
|
||||
protected:
|
||||
virtual Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*); // vtable+0x10
|
||||
|
||||
private:
|
||||
Tgl::Group* m_pScene; // 0x70
|
||||
Tgl::Camera* m_pCamera; // 0x74
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// LegoView implementation
|
||||
|
||||
inline Tgl::Group* LegoView::GetScene() const
|
||||
{
|
||||
return m_pScene;
|
||||
}
|
||||
|
||||
inline Tgl::Camera* LegoView::GetCamera() const
|
||||
{
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100ab580
|
||||
// LegoView::`scalar deleting destructor'
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// LegoView1
|
||||
|
||||
// VTABLE: LEGO1 0x100dc018
|
||||
// SIZE 0x88
|
||||
class LegoView1 : public LegoView {
|
||||
public:
|
||||
LegoView1();
|
||||
virtual ~LegoView1() override;
|
||||
|
||||
BOOL AddLightsToViewport();
|
||||
BOOL Create(const TglSurface::CreateStruct&, Tgl::Renderer*);
|
||||
virtual void Destroy() override; // vtable+0x08
|
||||
|
||||
private:
|
||||
Tgl::Light* m_pSunLight; // 0x78
|
||||
Tgl::Light* m_pDirectionalLight; // 0x7c
|
||||
Tgl::Light* m_pAmbientLight; // 0x80
|
||||
};
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100ab7a0
|
||||
// LegoView1::`scalar deleting destructor'
|
||||
|
||||
#endif /* _LegoView1_h */
|
224
LEGO1/lego/sources/3dmanager/tglsurface.cpp
Normal file
224
LEGO1/lego/sources/3dmanager/tglsurface.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
// TglSurface.cpp : implementation file
|
||||
|
||||
#include "tglsurface.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(TglSurface, 0x70);
|
||||
|
||||
using namespace Tgl;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// TglSurface
|
||||
|
||||
// FUNCTION: LEGO1 0x100abbf0
|
||||
TglSurface::TglSurface()
|
||||
{
|
||||
m_pRenderer = 0;
|
||||
m_pDevice = 0;
|
||||
m_pView = 0;
|
||||
m_pScene = 0;
|
||||
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
|
||||
m_stopRendering = FALSE;
|
||||
m_isInitialized = FALSE;
|
||||
|
||||
// statistics
|
||||
m_frameCount = 0;
|
||||
#ifdef _DEBUG
|
||||
m_triangleCount = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100abd60
|
||||
TglSurface::~TglSurface()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100abde0
|
||||
void TglSurface::Destroy()
|
||||
{
|
||||
DestroyView();
|
||||
|
||||
delete m_pDevice;
|
||||
m_pDevice = 0;
|
||||
|
||||
m_pRenderer = 0;
|
||||
m_pScene = 0;
|
||||
}
|
||||
|
||||
// ???
|
||||
// FUNCTION: LEGO1 0x100abe10
|
||||
int GetBitsPerPixel(IDirectDrawSurface* pSurface)
|
||||
{
|
||||
DDPIXELFORMAT pixelFormat;
|
||||
HRESULT result;
|
||||
|
||||
memset(&pixelFormat, 0, sizeof(pixelFormat));
|
||||
pixelFormat.dwSize = sizeof(pixelFormat);
|
||||
|
||||
result = pSurface->GetPixelFormat(&pixelFormat);
|
||||
assert(result == DD_OK);
|
||||
assert(pixelFormat.dwFlags & DDPF_RGB);
|
||||
|
||||
return pixelFormat.dwRGBBitCount;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100abe50
|
||||
BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer, Group* pScene)
|
||||
{
|
||||
DeviceDirect3DCreateData createData = {rCreateStruct.m_direct3d, rCreateStruct.m_d3dDevice};
|
||||
int bitsPerPixel = GetBitsPerPixel(rCreateStruct.m_pFrontBuffer);
|
||||
|
||||
ColorModel colorModel = Ramp;
|
||||
ShadingModel shadingModel = Gouraud;
|
||||
int shadeCount = 32;
|
||||
BOOL dither = TRUE;
|
||||
int textureShadeCount = -1;
|
||||
int textureColorCount = -1;
|
||||
Result result;
|
||||
|
||||
m_pRenderer = pRenderer;
|
||||
m_pScene = pScene;
|
||||
m_pDevice = m_pRenderer->CreateDevice(createData);
|
||||
|
||||
if (!m_pDevice) {
|
||||
assert(0);
|
||||
m_pRenderer = 0;
|
||||
m_pScene = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bitsPerPixel == 1) {
|
||||
shadeCount = 4;
|
||||
textureShadeCount = 4;
|
||||
}
|
||||
else if (bitsPerPixel == 8) {
|
||||
shadeCount = 16;
|
||||
dither = FALSE;
|
||||
textureShadeCount = 16;
|
||||
textureColorCount = 256;
|
||||
}
|
||||
else if (bitsPerPixel == 16) {
|
||||
shadeCount = 32;
|
||||
dither = FALSE;
|
||||
textureShadeCount = 32;
|
||||
textureColorCount = 256;
|
||||
}
|
||||
else if (bitsPerPixel >= 24) {
|
||||
shadeCount = 256;
|
||||
dither = FALSE;
|
||||
textureShadeCount = 256;
|
||||
textureColorCount = 64;
|
||||
}
|
||||
else {
|
||||
dither = FALSE;
|
||||
}
|
||||
|
||||
if (textureShadeCount != -1) {
|
||||
result = pRenderer->SetTextureDefaultShadeCount(textureShadeCount);
|
||||
assert(Succeeded(result));
|
||||
}
|
||||
if (textureColorCount != -1) {
|
||||
result = pRenderer->SetTextureDefaultColorCount(textureColorCount);
|
||||
assert(Succeeded(result));
|
||||
}
|
||||
|
||||
result = m_pDevice->SetColorModel(colorModel);
|
||||
assert(Succeeded(result));
|
||||
result = m_pDevice->SetShadingModel(shadingModel);
|
||||
assert(Succeeded(result));
|
||||
result = m_pDevice->SetShadeCount(shadeCount);
|
||||
assert(Succeeded(result));
|
||||
result = m_pDevice->SetDither(dither);
|
||||
assert(Succeeded(result));
|
||||
|
||||
m_width = m_pDevice->GetWidth();
|
||||
m_height = m_pDevice->GetHeight();
|
||||
|
||||
m_pView = CreateView(m_pRenderer, m_pDevice);
|
||||
if (!m_pView) {
|
||||
delete m_pDevice;
|
||||
m_pDevice = 0;
|
||||
m_pRenderer = 0;
|
||||
m_pScene = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_frameRateMeter.Reset();
|
||||
m_renderingRateMeter.Reset();
|
||||
#ifdef _DEBUG
|
||||
m_triangleRateMeter.Reset();
|
||||
#endif
|
||||
m_frameRateMeter.StartOperation();
|
||||
|
||||
m_isInitialized = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac030
|
||||
void TglSurface::DestroyView()
|
||||
{
|
||||
delete m_pView;
|
||||
m_pView = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac050
|
||||
double TglSurface::Render()
|
||||
{
|
||||
MxStopWatch renderTimer;
|
||||
|
||||
if (m_isInitialized && !m_stopRendering) {
|
||||
Result result;
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_triangleRateMeter.StartOperation();
|
||||
#endif
|
||||
m_renderingRateMeter.StartOperation();
|
||||
renderTimer.Start();
|
||||
|
||||
// TODO: Wrong interface
|
||||
result = m_pView->Render((Tgl::Light*) m_pScene);
|
||||
|
||||
renderTimer.Stop();
|
||||
assert(Succeeded(result));
|
||||
m_renderingRateMeter.EndOperation();
|
||||
#ifdef _DEBUG
|
||||
m_triangleRateMeter.EndOperation();
|
||||
#endif
|
||||
m_frameRateMeter.EndOperation();
|
||||
m_frameCount++;
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
unsigned long triangleCount = m_pDevice->GetDrawnTriangleCount();
|
||||
|
||||
m_triangleRateMeter.IncreaseOperationCount(triangleCount - m_triangleCount - 1);
|
||||
m_triangleCount = triangleCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// reset rate meters every 20 frames
|
||||
if ((++m_frameCount % 20) == 0)
|
||||
#else
|
||||
// reset rate meters every 4 seconds
|
||||
if (m_frameRateMeter.ElapsedSeconds() > 4.0)
|
||||
#endif
|
||||
{
|
||||
m_frameRateMeter.Reset();
|
||||
m_renderingRateMeter.Reset();
|
||||
#ifdef _DEBUG
|
||||
m_triangleRateMeter.Reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
m_frameRateMeter.StartOperation();
|
||||
}
|
||||
|
||||
return renderTimer.ElapsedSeconds();
|
||||
}
|
87
LEGO1/lego/sources/3dmanager/tglsurface.h
Normal file
87
LEGO1/lego/sources/3dmanager/tglsurface.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef _TglSurface_h
|
||||
#define _TglSurface_h
|
||||
|
||||
#include "mxdirectx/mxstopwatch.h"
|
||||
#include "tgl/tgl.h"
|
||||
|
||||
class Tgl::Renderer;
|
||||
class Tgl::Device;
|
||||
class Tgl::View;
|
||||
class Tgl::Group;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// TglSurface
|
||||
|
||||
// VTABLE: LEGO1 0x100dc060
|
||||
// SIZE 0x70
|
||||
class TglSurface {
|
||||
public:
|
||||
// SIZE 0x28
|
||||
struct CreateStruct {
|
||||
const GUID* m_pDriverGUID; // 0x00
|
||||
HWND m_hWnd; // 0x04
|
||||
IDirectDraw* m_pDirectDraw; // 0x08
|
||||
IDirectDrawSurface* m_pFrontBuffer; // 0x0c
|
||||
IDirectDrawSurface* m_pBackBuffer; // 0x10
|
||||
IDirectDrawPalette* m_pPalette; // 0x14
|
||||
BOOL m_isFullScreen; // 0x18
|
||||
BOOL m_isWideViewAngle; // 0x1c
|
||||
IDirect3D2* m_direct3d; // 0x20
|
||||
IDirect3DDevice2* m_d3dDevice; // 0x24
|
||||
};
|
||||
|
||||
public:
|
||||
TglSurface();
|
||||
virtual ~TglSurface();
|
||||
|
||||
virtual BOOL Create(const CreateStruct&, Tgl::Renderer*, Tgl::Group* pScene); // vtable+0x04
|
||||
virtual void Destroy(); // vtable+0x08
|
||||
virtual double Render(); // render time in seconds // vtable+0x0c
|
||||
|
||||
Tgl::Renderer* GetRenderer() const { return m_pRenderer; }
|
||||
Tgl::Device* GetDevice() const { return m_pDevice; }
|
||||
Tgl::View* GetView() const { return m_pView; }
|
||||
Tgl::Group* GetScene() const { return m_pScene; }
|
||||
|
||||
unsigned long GetWidth() const { return m_width; }
|
||||
unsigned long GetHeight() const { return m_height; }
|
||||
|
||||
double GetRenderingRate() const { return m_renderingRateMeter.Frequency(); }
|
||||
double GetFrameRate() const { return m_frameRateMeter.Frequency(); }
|
||||
unsigned long GetFrameCount() const { return m_frameCount; }
|
||||
#ifdef _DEBUG
|
||||
double GetTriangleRate() const { return m_triangleRateMeter.Frequency(); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*) = 0; // vtable+0x10
|
||||
virtual void DestroyView(); // vtable+0x14
|
||||
|
||||
private:
|
||||
Tgl::Renderer* m_pRenderer; // 0x08
|
||||
Tgl::Device* m_pDevice; // 0x0c
|
||||
Tgl::View* m_pView; // 0x10
|
||||
Tgl::Group* m_pScene; // 0x14
|
||||
|
||||
unsigned long m_width; // 0x18
|
||||
unsigned long m_height; // 0x1c
|
||||
|
||||
BOOL m_isInitialized; // 0x20
|
||||
BOOL m_stopRendering; // 0x24
|
||||
|
||||
// statistics
|
||||
MxFrequencyMeter m_renderingRateMeter; // 0x28
|
||||
MxFrequencyMeter m_frameRateMeter; // 0x48
|
||||
unsigned long m_frameCount; // 0x68
|
||||
#ifdef _DEBUG
|
||||
MxFrequencyMeter m_triangleRateMeter;
|
||||
unsigned long m_triangleCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100abcf0
|
||||
// TglSurface::`scalar deleting destructor'
|
||||
|
||||
#endif /* _TglSurface_h */
|
127
LEGO1/lego/sources/roi/legoroi.cpp
Normal file
127
LEGO1/lego/sources/roi/legoroi.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#include "legoroi.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoROI, 0x10c);
|
||||
|
||||
// SIZE 0x14
|
||||
typedef struct {
|
||||
const char* m_name;
|
||||
MxS32 m_red;
|
||||
MxS32 m_green;
|
||||
MxS32 m_blue;
|
||||
MxS32 m_unk0x10;
|
||||
} ROIColorAlias;
|
||||
|
||||
// GLOBAL: LEGO1 0x100dbe28
|
||||
const double g_normalizeByteToFloat = 1.0 / 255;
|
||||
|
||||
// GLOBAL: LEGO1 0x101011b0
|
||||
ROIColorAlias g_roiColorAliases[22] = {
|
||||
{"lego black", 0x21, 0x21, 0x21, 0}, {"lego black f", 0x21, 0x21, 0x21, 0},
|
||||
{"lego black flat", 0x21, 0x21, 0x21, 0}, {"lego blue", 0x00, 0x54, 0x8c, 0},
|
||||
{"lego blue flat", 0x00, 0x54, 0x8c, 0}, {"lego brown", 0x4a, 0x23, 0x1a, 0},
|
||||
{"lego brown flt", 0x4a, 0x23, 0x1a, 0}, {"lego brown flat", 0x4a, 0x23, 0x1a, 0},
|
||||
{"lego drk grey", 0x40, 0x40, 0x40, 0}, {"lego drk grey flt", 0x40, 0x40, 0x40, 0},
|
||||
{"lego dk grey flt", 0x40, 0x40, 0x40, 0}, {"lego green", 0x00, 0x78, 0x2d, 0},
|
||||
{"lego green flat", 0x00, 0x78, 0x2d, 0}, {"lego lt grey", 0x82, 0x82, 0x82, 0},
|
||||
{"lego lt grey flt", 0x82, 0x82, 0x82, 0}, {"lego lt grey fla", 0x82, 0x82, 0x82, 0},
|
||||
{"lego red", 0xcb, 0x12, 0x20, 0}, {"lego red flat", 0xcb, 0x12, 0x20, 0},
|
||||
{"lego white", 0xfa, 0xfa, 0xfa, 0}, {"lego white flat", 0xfa, 0xfa, 0xfa, 0},
|
||||
{"lego yellow", 0xff, 0xb9, 0x00, 0}, {"lego yellow flat", 0xff, 0xb9, 0x00, 0},
|
||||
};
|
||||
|
||||
// GLOBAL: LEGO1 0x10101368
|
||||
MxS32 g_roiConfig = 100;
|
||||
|
||||
// GLOBAL: LEGO1 0x101013ac
|
||||
ROIHandler g_someHandlerFunction = NULL;
|
||||
|
||||
// FUNCTION: LEGO1 0x100a46a0
|
||||
void LegoROI::WrappedSetLocalTransform(Matrix4Impl& p_transform)
|
||||
{
|
||||
SetLocalTransform(p_transform);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a46b0
|
||||
void LegoROI::FUN_100a46b0(Matrix4Impl& p_transform)
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a58f0
|
||||
void LegoROI::FUN_100a58f0(Matrix4Impl& p_transform)
|
||||
{
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a81c0
|
||||
void LegoROI::configureLegoROI(MxS32 p_roiConfig)
|
||||
{
|
||||
g_roiConfig = p_roiConfig;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a9a50
|
||||
LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, MxTime p_time) : ViewROI(p_renderer, p_lodList)
|
||||
{
|
||||
m_time = p_time;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9bf0
|
||||
MxBool LegoROI::CallTheHandlerFunction(
|
||||
char* p_param,
|
||||
MxFloat& p_red,
|
||||
MxFloat& p_green,
|
||||
MxFloat& p_blue,
|
||||
MxFloat& p_other
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
if (p_param == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (g_someHandlerFunction) {
|
||||
char buf[32];
|
||||
if (g_someHandlerFunction(p_param, buf, 32))
|
||||
p_param = buf;
|
||||
}
|
||||
|
||||
return ColorAliasLookup(p_param, p_red, p_green, p_blue, p_other);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9c50
|
||||
MxBool LegoROI::ColorAliasLookup(char* p_param, MxFloat& p_red, MxFloat& p_green, MxFloat& p_blue, MxFloat& p_other)
|
||||
{
|
||||
// TODO: this seems awfully hacky for these devs. is there a dynamic way
|
||||
// to represent `the end of this array` that would improve this?
|
||||
MxU32 i = 0;
|
||||
do {
|
||||
if (strcmpi(g_roiColorAliases[i].m_name, p_param) == 0) {
|
||||
p_red = g_roiColorAliases[i].m_red * g_normalizeByteToFloat;
|
||||
p_green = g_roiColorAliases[i].m_green * g_normalizeByteToFloat;
|
||||
p_blue = g_roiColorAliases[i].m_blue * g_normalizeByteToFloat;
|
||||
p_other = g_roiColorAliases[i].m_unk0x10 * g_normalizeByteToFloat;
|
||||
return TRUE;
|
||||
}
|
||||
i++;
|
||||
} while ((MxS32*) &g_roiColorAliases[i] < &g_roiConfig);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9d30
|
||||
void LegoROI::SetSomeHandlerFunction(ROIHandler p_func)
|
||||
{
|
||||
g_someHandlerFunction = p_func;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9e10
|
||||
void LegoROI::SetDisplayBB(MxS32 p_displayBB)
|
||||
{
|
||||
// Intentionally empty function
|
||||
}
|
||||
|
||||
// Note: Actually part of parent class (doesn't exist yet)
|
||||
// STUB: LEGO1 0x100aa350
|
||||
void LegoROI::UpdateWorldBoundingVolumes()
|
||||
{
|
||||
// TODO
|
||||
}
|
43
LEGO1/lego/sources/roi/legoroi.h
Normal file
43
LEGO1/lego/sources/roi/legoroi.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef LEGOROI_H
|
||||
#define LEGOROI_H
|
||||
|
||||
#include "mxtypes.h"
|
||||
#include "viewmanager/viewroi.h"
|
||||
|
||||
typedef MxBool (*ROIHandler)(char*, char*, MxU32);
|
||||
|
||||
// Note: There is an extra class between LegoROI and ViewROI,
|
||||
// maybe called "AutoROI". VTABLE 0x100dbe38
|
||||
|
||||
// VTABLE: LEGO1 0x100dbea8
|
||||
// SIZE 0x10c
|
||||
class LegoROI : public ViewROI {
|
||||
public:
|
||||
LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, MxTime p_time);
|
||||
|
||||
__declspec(dllexport) void SetDisplayBB(MxS32 p_displayBB);
|
||||
__declspec(dllexport) static void configureLegoROI(MxS32 p_roi);
|
||||
|
||||
static void SetSomeHandlerFunction(ROIHandler p_func);
|
||||
static MxBool CallTheHandlerFunction(
|
||||
char* p_param,
|
||||
MxFloat& p_red,
|
||||
MxFloat& p_green,
|
||||
MxFloat& p_blue,
|
||||
MxFloat& p_other
|
||||
);
|
||||
static MxBool ColorAliasLookup(char* p_param, MxFloat& p_red, MxFloat& p_green, MxFloat& p_blue, MxFloat& p_other);
|
||||
|
||||
void WrappedSetLocalTransform(Matrix4Impl& p_transform);
|
||||
void FUN_100a46b0(Matrix4Impl& p_transform);
|
||||
void FUN_100a58f0(Matrix4Impl& p_transform);
|
||||
|
||||
// Note: Actually part of parent class (doesn't exist yet)
|
||||
virtual void UpdateWorldBoundingVolumes() override; // vtable+0x18
|
||||
|
||||
private:
|
||||
undefined m_pad[0x28]; // 0xe0
|
||||
MxTime m_time; // 0x108
|
||||
};
|
||||
|
||||
#endif // LEGOROI_H
|
Reference in New Issue
Block a user