mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 23:57:54 -05:00
Implement/match ViewManager::Update (#647)
* Implement/match ViewManager::Update * Fix
This commit is contained in:
parent
86f84e1740
commit
4b0c6d1f5f
2 changed files with 87 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
|
||||||
|
#include "mxdirectx/mxstopwatch.h"
|
||||||
#include "tgl/d3drm/impl.h"
|
#include "tgl/d3drm/impl.h"
|
||||||
#include "viewlod.h"
|
#include "viewlod.h"
|
||||||
|
|
||||||
|
@ -8,6 +9,9 @@ DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
|
||||||
// GLOBAL: LEGO1 0x100dbcd8
|
// 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};
|
int g_unk0x100dbcd8[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x10101060
|
||||||
|
float g_elapsedSeconds = 0;
|
||||||
|
|
||||||
inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
|
inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
|
||||||
inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
|
inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
|
||||||
|
|
||||||
|
@ -111,12 +115,89 @@ void ViewManager::FUN_100a66a0(ViewROI* p_roi)
|
||||||
p_roi->SetUnknown0xe0(-1);
|
p_roi->SetUnknown0xe0(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100a6930
|
// STUB: LEGO1 0x100a66f0
|
||||||
void ViewManager::Update(float p_previousRenderTime, float p_und2)
|
void ViewManager::FUN_100a66f0(ViewROI* p_roi, undefined4 p_und)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100a6930
|
||||||
|
void ViewManager::Update(float p_previousRenderTime, float)
|
||||||
|
{
|
||||||
|
MxStopWatch stopWatch;
|
||||||
|
stopWatch.Start();
|
||||||
|
|
||||||
|
unk0x28 = p_previousRenderTime;
|
||||||
|
flags |= c_bit1;
|
||||||
|
|
||||||
|
if (flags & c_bit3) {
|
||||||
|
Unknown();
|
||||||
|
}
|
||||||
|
else if (flags & c_bit2) {
|
||||||
|
FUN_100a6b90();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) {
|
||||||
|
FUN_100a66f0((ViewROI*) *it, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
stopWatch.Stop();
|
||||||
|
g_elapsedSeconds = stopWatch.ElapsedSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int ViewManager::Unknown()
|
||||||
|
{
|
||||||
|
flags &= ~c_bit3;
|
||||||
|
|
||||||
|
if (height == 0.0F || front == 0.0F) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
float fVar7 = tan(view_angle / 2.0F);
|
||||||
|
unk0x2c = view_angle * view_angle * 4.0F;
|
||||||
|
|
||||||
|
float fVar1 = front * fVar7;
|
||||||
|
float fVar2 = (width / height) * fVar1;
|
||||||
|
float uVar6 = front;
|
||||||
|
float fVar3 = back + front;
|
||||||
|
float fVar4 = fVar3 / front;
|
||||||
|
float fVar5 = fVar4 * fVar1;
|
||||||
|
fVar4 = fVar4 * fVar2;
|
||||||
|
|
||||||
|
float* unk0x90 = (float*) this->unk0x90;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
*unk0x90 = fVar2; unk0x90++;
|
||||||
|
*unk0x90 = fVar1; unk0x90++;
|
||||||
|
*unk0x90 = uVar6; unk0x90++;
|
||||||
|
*unk0x90 = fVar2; unk0x90++;
|
||||||
|
*unk0x90 = -fVar1; unk0x90++;
|
||||||
|
*unk0x90 = uVar6; unk0x90++;
|
||||||
|
*unk0x90 = -fVar2; unk0x90++;
|
||||||
|
*unk0x90 = -fVar1; unk0x90++;
|
||||||
|
*unk0x90 = uVar6; unk0x90++;
|
||||||
|
*unk0x90 = -fVar2; unk0x90++;
|
||||||
|
*unk0x90 = fVar1; unk0x90++;
|
||||||
|
*unk0x90 = uVar6; unk0x90++;
|
||||||
|
*unk0x90 = fVar4; unk0x90++;
|
||||||
|
*unk0x90 = fVar5; unk0x90++;
|
||||||
|
*unk0x90 = fVar3; unk0x90++;
|
||||||
|
*unk0x90 = fVar4; unk0x90++;
|
||||||
|
*unk0x90 = -fVar5; unk0x90++;
|
||||||
|
*unk0x90 = fVar3; unk0x90++;
|
||||||
|
*unk0x90 = -fVar4; unk0x90++;
|
||||||
|
*unk0x90 = -fVar5; unk0x90++;
|
||||||
|
*unk0x90 = fVar3; unk0x90++;
|
||||||
|
*unk0x90 = -fVar4; unk0x90++;
|
||||||
|
*unk0x90 = fVar5; unk0x90++;
|
||||||
|
*unk0x90 = fVar3;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
FUN_100a6b90();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a6b90
|
// FUNCTION: LEGO1 0x100a6b90
|
||||||
void ViewManager::FUN_100a6b90()
|
void ViewManager::FUN_100a6b90()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,10 @@ class ViewManager {
|
||||||
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
|
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
|
||||||
void SetResolution(int width, int height);
|
void SetResolution(int width, int height);
|
||||||
void SetFrustrum(float fov, float front, float back);
|
void SetFrustrum(float fov, float front, float back);
|
||||||
|
void FUN_100a66f0(ViewROI* p_roi, undefined4 p_und);
|
||||||
|
void Update(float p_previousRenderTime, float);
|
||||||
|
inline int Unknown();
|
||||||
void FUN_100a6b90();
|
void FUN_100a6b90();
|
||||||
void Update(float p_previousRenderTime, float p_und2);
|
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x100a6000
|
// SYNTHETIC: LEGO1 0x100a6000
|
||||||
// ViewManager::`scalar deleting destructor'
|
// ViewManager::`scalar deleting destructor'
|
||||||
|
@ -44,7 +46,7 @@ class ViewManager {
|
||||||
RealtimeView rt_view; // 0x14
|
RealtimeView rt_view; // 0x14
|
||||||
ROIList visible_rois; // 0x18
|
ROIList visible_rois; // 0x18
|
||||||
float unk0x28; // 0x28
|
float unk0x28; // 0x28
|
||||||
undefined4 unk0x2c; // 0x2c
|
float unk0x2c; // 0x2c
|
||||||
unsigned int flags; // 0x30
|
unsigned int flags; // 0x30
|
||||||
float width; // 0x34
|
float width; // 0x34
|
||||||
float height; // 0x38
|
float height; // 0x38
|
||||||
|
|
Loading…
Reference in a new issue