Matrix/vector refactor (#426)

This commit is contained in:
Christian Semmler
2024-01-12 19:34:38 -05:00
committed by GitHub
parent eac096036a
commit d24f5db42f
41 changed files with 865 additions and 1365 deletions

View File

@@ -10,7 +10,7 @@ DECOMP_SIZE_ASSERT(LegoCameraController, 0xc8);
// FUNCTION: LEGO1 0x10011d50
LegoCameraController::LegoCameraController()
{
SetWorldTransform(Vector3Data(0, 0, 0), Vector3Data(0, 0, 1), Vector3Data(0, 1, 0));
SetWorldTransform(Mx3DPointFloat(0, 0, 0), Mx3DPointFloat(0, 0, 1), Mx3DPointFloat(0, 1, 0));
}
// FUNCTION: LEGO1 0x10011f70
@@ -71,37 +71,49 @@ void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point)
}
// FUNCTION: LEGO1 0x10012260
void LegoCameraController::SetWorldTransform(const Vector3Impl& p_at, const Vector3Impl& p_dir, const Vector3Impl& p_up)
void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up)
{
CalcLocalTransform(p_at, p_dir, p_up, m_matrix1);
m_matrix2 = m_matrix1;
}
// STUB: LEGO1 0x100123e0
void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
void LegoCameraController::FUN_100123e0(MxMatrix& p_transform, MxU32)
{
}
// STUB: LEGO1 0x10012740
Vector3Data& LegoCameraController::FUN_10012740()
// FUNCTION: LEGO1 0x10012740
Mx3DPointFloat LegoCameraController::GetWorldUp()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldUp();
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
}
else
return Mx3DPointFloat(0, 0, 0);
}
// STUB: LEGO1 0x100127f0
Vector3Data& LegoCameraController::FUN_100127f0()
// FUNCTION: LEGO1 0x100127f0
Mx3DPointFloat LegoCameraController::GetWorldLocation()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldPosition();
return Mx3DPointFloat(vec[0], vec[1] - m_entityOffsetUp, vec[2]);
}
else
return Mx3DPointFloat(0, 0, 0);
}
// STUB: LEGO1 0x100128a0
Vector3Data& LegoCameraController::FUN_100128a0()
// FUNCTION: LEGO1 0x100128a0
Mx3DPointFloat LegoCameraController::GetWorldDirection()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldDirection();
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
}
else
return Mx3DPointFloat(0, 0, 0);
}

View File

@@ -36,7 +36,7 @@ void LegoEntity::ResetWorldTransform(MxBool p_inVehicle)
}
// STUB: LEGO1 0x10010790
void LegoEntity::SetWorldTransform(const Vector3Impl& p_loc, const Vector3Impl& p_dir, const Vector3Impl& p_up)
void LegoEntity::SetWorldTransform(const Vector3& p_loc, const Vector3& p_dir, const Vector3& p_up)
{
// TODO
}
@@ -77,7 +77,7 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
}
// STUB: LEGO1 0x100109b0
void LegoEntity::SetLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up, MxBool)
void LegoEntity::SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up, MxBool)
{
// TODO
}

View File

@@ -82,7 +82,11 @@ void LegoEntityPresenter::RepeatingTickle()
}
// FUNCTION: LEGO1 0x10053730
void LegoEntityPresenter::SetBackendLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up)
void LegoEntityPresenter::SetBackendLocation(
Mx3DPointFloat& p_location,
Mx3DPointFloat& p_direction,
Mx3DPointFloat& p_up
)
{
if (m_objectBackend) {
m_objectBackend->SetLocation(p_location, p_direction, p_up, TRUE);

View File

@@ -39,7 +39,7 @@ void LegoPathActor::VTable0x8c()
}
// STUB: LEGO1 0x1002e740
void LegoPathActor::VTable0x74(Matrix4Impl& p_transform)
void LegoPathActor::VTable0x74(Matrix4& p_transform)
{
// TODO
}

View File

@@ -131,13 +131,13 @@ void LegoWorld::VTable0x50()
}
// STUB: LEGO1 0x100727e0
MxBool LegoWorld::FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
MxBool LegoWorld::FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10072980
MxBool LegoWorld::FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
MxBool LegoWorld::FUN_10072980(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up)
{
return FALSE;
}