Implement/match ViewManager ctor/dtor/structure (#614)

* Implement/match ViewManager constructor/structure

* Add dtor
This commit is contained in:
Christian Semmler 2024-03-02 09:43:19 -05:00 committed by GitHub
parent c643723a9c
commit 05965f5357
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 94 additions and 8 deletions

View file

@ -14,6 +14,17 @@ float g_userMaxLod = 3.6f;
// GLOBAL: LEGO1 0x1010104c // GLOBAL: LEGO1 0x1010104c
float g_partsThreshold = 1000.0f; float g_partsThreshold = 1000.0f;
// FUNCTION: LEGO1 0x100a5dc0
RealtimeView::RealtimeView()
{
UpdateMaxLOD();
}
// FUNCTION: LEGO1 0x100a5dd0
RealtimeView::~RealtimeView()
{
}
// FUNCTION: LEGO1 0x100a5de0 // FUNCTION: LEGO1 0x100a5de0
void RealtimeView::SetUserMaxLOD(float p_lod) void RealtimeView::SetUserMaxLOD(float p_lod)
{ {

View file

@ -3,6 +3,9 @@
class RealtimeView { class RealtimeView {
public: public:
RealtimeView();
~RealtimeView();
static float GetPartsThreshold(); static float GetPartsThreshold();
static float GetUserMaxLOD(); static float GetUserMaxLOD();
static void SetPartsThreshold(float); static void SetPartsThreshold(float);

View file

@ -84,6 +84,8 @@ class RendererImpl : public Renderer {
return m_data->CreateTextureFromSurface(pSurface, pTexture2); return m_data->CreateTextureFromSurface(pSurface, pTexture2);
} }
inline IDirect3DRM2* ImplementationData() const { return m_data; }
public: public:
inline Result Create(); inline Result Create();
inline void Destroy(); inline void Destroy();

View file

@ -1,17 +1,35 @@
#include "viewmanager.h" #include "viewmanager.h"
#include "decomp.h" #include "tgl/d3drm/impl.h"
DECOMP_SIZE_ASSERT(ViewManager, 0x1bc) DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
// STUB: LEGO1 0x100a5eb0 inline undefined4 SetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
inline undefined4 SetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
// FUNCTION: LEGO1 0x100a5eb0
ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view) ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view)
: scene(scene), flags(c_bit1 | c_bit2 | c_bit3 | c_bit4)
{ {
SetPOVSource(point_of_view);
unk0x28 = 0.09;
SetD3DRM(d3drm, pRenderer);
SetFrame(frame, scene);
unk0x34 = 0.0;
unk0x38 = 0.0;
unk0x3c = 0.0;
unk0x40.SetIdentity();
unk0x88 = 0.0;
unk0x8c = 0.0;
memset(unk0xf0, 0, sizeof(unk0xf0));
seconds_allowed = 1.0;
} }
// STUB: LEGO1 0x100a60c0 // FUNCTION: LEGO1 0x100a60c0
ViewManager::~ViewManager() ViewManager::~ViewManager()
{ {
SetPOVSource(NULL);
} }
// STUB: LEGO1 0x100a64d0 // STUB: LEGO1 0x100a64d0
@ -23,19 +41,35 @@ void ViewManager::RemoveAll(ViewROI*)
// STUB: LEGO1 0x100a6930 // STUB: LEGO1 0x100a6930
void ViewManager::Update(float p_previousRenderTime, float p_und2) void ViewManager::Update(float p_previousRenderTime, float p_und2)
{ {
// TODO
} }
// STUB: LEGO1 0x100a6d50 // STUB: LEGO1 0x100a6d50
void ViewManager::SetResolution(int width, int height) void ViewManager::SetResolution(int width, int height)
{ {
// TODO
} }
// STUB: LEGO1 0x100a6d70 // STUB: LEGO1 0x100a6d70
void ViewManager::SetFrustrum(float fov, float front, float back) void ViewManager::SetFrustrum(float fov, float front, float back)
{ {
// TODO
} }
// STUB: LEGO1 0x100a6da0 // STUB: LEGO1 0x100a6da0
void ViewManager::SetPOVSource(const OrientableROI* point_of_view) void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
{ {
// TODO
}
inline undefined4 SetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer)
{
d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData();
return 0;
}
inline undefined4 SetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene)
{
frame = ((TglImpl::GroupImpl*) scene)->ImplementationData();
return 0;
} }

View file

@ -1,12 +1,23 @@
#ifndef VIEWMANAGER_H #ifndef VIEWMANAGER_H
#define VIEWMANAGER_H #define VIEWMANAGER_H
#include "decomp.h"
#include "realtime/realtimeview.h"
#include "viewroi.h" #include "viewroi.h"
#include <d3drm.h>
// VTABLE: LEGO1 0x100dbd88 // VTABLE: LEGO1 0x100dbd88
// SIZE 0x1bc // SIZE 0x1bc
class ViewManager { class ViewManager {
public: public:
enum Flags {
c_bit1 = 0x01,
c_bit2 = 0x02,
c_bit3 = 0x04,
c_bit4 = 0x08
};
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();
@ -20,17 +31,42 @@ class ViewManager {
// SYNTHETIC: LEGO1 0x100a6000 // SYNTHETIC: LEGO1 0x100a6000
// ViewManager::`scalar deleting destructor' // ViewManager::`scalar deleting destructor'
inline CompoundObject& GetUnknown0x08() { return m_unk0x08; } inline CompoundObject& GetUnknown0x08() { return unk0x08; }
inline void AddToUnknown0x08(ViewROI* p_roi) { m_unk0x08.push_back(p_roi); } inline void AddToUnknown0x08(ViewROI* p_roi) { unk0x08.push_back(p_roi); }
private: private:
undefined4 m_unk0x04; // 0x04 Tgl::Group* scene; // 0x04
CompoundObject m_unk0x08; // 0x08 CompoundObject unk0x08; // 0x08
undefined m_pad[0x1a8]; // 0x14 RealtimeView rt_view; // 0x14
ROIList visible_rois; // 0x18
float unk0x28; // 0x28
undefined4 unk0x2c; // 0x2c
unsigned int flags; // 0x30
float unk0x34; // 0x34
float unk0x38; // 0x38
float unk0x3c; // 0x3c
MxMatrix unk0x40; // 0x40
float unk0x88; // 0x88
float unk0x8c; // 0x8c
undefined unk0x90[0x60]; // 0x90
undefined unk0xf0[0x60]; // 0xf0
undefined unk0x150[0x60]; // 0x150
IDirect3DRM2* d3drm; // 0x1b0
IDirect3DRMFrame2* frame; // 0x1b4
float seconds_allowed; // 0x1b8
}; };
// TEMPLATE: LEGO1 0x10022030 // TEMPLATE: LEGO1 0x10022030
// list<ROI *,allocator<ROI *> >::insert // list<ROI *,allocator<ROI *> >::insert
// TEMPLATE: LEGO1 0x100a6020
// List<ROI *>::~List<ROI *>
// TEMPLATE: LEGO1 0x100a6070
// Vector<ROI const *>::~Vector<ROI const *>
// TEMPLATE: LEGO1 0x100a6f80
// vector<ROI const *,allocator<ROI const *> >::~vector<ROI const *,allocator<ROI const *> >
#endif // VIEWMANAGER_H #endif // VIEWMANAGER_H