Implement/match ViewManager::FUN_100a6b90 (#646)

* Implement/match ViewManager::FUN_100a6b90

* Fix comment

* Fix order
This commit is contained in:
Christian Semmler 2024-03-09 18:40:29 -05:00 committed by GitHub
parent 8069923651
commit 86f84e1740
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 3 deletions

View file

@ -5,6 +5,9 @@
DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
// GLOBAL: LEGO1 0x100dbcd8
int g_unk0x100dbcd8[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6};
inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
@ -114,6 +117,47 @@ void ViewManager::Update(float p_previousRenderTime, float p_und2)
// TODO
}
// FUNCTION: LEGO1 0x100a6b90
void ViewManager::FUN_100a6b90()
{
flags &= ~c_bit2;
// TODO: Should be signed, but worsens match
unsigned int i, j, k;
for (i = 0; i < 8; i++) {
for (j = 0; j < 3; j++) {
unk0xf0[i][j] = pov[3][j];
for (k = 0; k < 3; k++) {
unk0xf0[i][j] += pov[k][j] * unk0x90[i][k];
}
}
}
for (i = 0; i < 6; i++) {
Vector3 a(unk0xf0[g_unk0x100dbcd8[i * 3]]);
Vector3 b(unk0xf0[g_unk0x100dbcd8[i * 3 + 1]]);
Vector3 c(unk0xf0[g_unk0x100dbcd8[i * 3 + 2]]);
Mx3DPointFloat x;
Mx3DPointFloat y;
Vector3 u(unk0x150[i]);
x = c;
((Vector3&) x).Sub(&b); // TODO: Fix call
y = a;
((Vector3&) y).Sub(&b); // TODO: Fix call
u.EqualsCross(&x, &y);
u.Unitize();
unk0x150[i][3] = -u.Dot(&u, &a);
}
flags |= c_bit4;
}
// FUNCTION: LEGO1 0x100a6d50
void ViewManager::SetResolution(int width, int height)
{

View file

@ -28,6 +28,7 @@ class ViewManager {
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 FUN_100a6b90();
void Update(float p_previousRenderTime, float p_und2);
// SYNTHETIC: LEGO1 0x100a6000
@ -51,9 +52,9 @@ class ViewManager {
MxMatrix pov; // 0x40
float front; // 0x88
float back; // 0x8c
undefined unk0x90[0x60]; // 0x90
undefined unk0xf0[0x60]; // 0xf0
undefined unk0x150[0x60]; // 0x150
float unk0x90[8][3]; // 0x90
float unk0xf0[8][3]; // 0xf0
float unk0x150[6][4]; // 0x150
IDirect3DRM2* d3drm; // 0x1b0
IDirect3DRMFrame2* frame; // 0x1b4
float seconds_allowed; // 0x1b8