2023-11-19 09:38:07 -05:00
|
|
|
#include "orientableroi.h"
|
|
|
|
|
2023-12-11 16:33:46 -05:00
|
|
|
#include "decomp.h"
|
2023-11-19 09:38:07 -05:00
|
|
|
|
2024-01-12 19:34:38 -05:00
|
|
|
#include <vec.h>
|
|
|
|
|
2023-11-19 09:38:07 -05:00
|
|
|
DECOMP_SIZE_ASSERT(OrientableROI, 0xdc)
|
|
|
|
|
2024-01-12 19:34:38 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a4420
|
|
|
|
OrientableROI::OrientableROI()
|
|
|
|
{
|
|
|
|
FILLVEC3(m_world_bounding_box.Min(), 888888.8);
|
|
|
|
FILLVEC3(m_world_bounding_box.Max(), -888888.8);
|
|
|
|
ZEROVEC3(m_world_bounding_sphere.Center());
|
|
|
|
m_world_bounding_sphere.Radius() = 0.0;
|
|
|
|
ZEROVEC3(m_world_velocity);
|
|
|
|
IDENTMAT4(m_local2world);
|
|
|
|
|
|
|
|
m_unk0xd4 = 0;
|
2024-01-17 11:53:53 -05:00
|
|
|
m_unk0xd8 |= c_bit1 | c_bit2;
|
2024-01-12 19:34:38 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5910
|
2023-11-19 09:38:07 -05:00
|
|
|
void OrientableROI::VTable0x1c()
|
|
|
|
{
|
|
|
|
UpdateWorldBoundingVolumes();
|
|
|
|
UpdateWorldVelocity();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5930
|
2024-01-12 19:34:38 -05:00
|
|
|
void OrientableROI::SetLocalTransform(const Matrix4& p_transform)
|
2023-11-19 09:38:07 -05:00
|
|
|
{
|
2024-01-12 19:34:38 -05:00
|
|
|
reinterpret_cast<Matrix4&>(m_local2world) = p_transform;
|
2023-11-19 09:38:07 -05:00
|
|
|
UpdateWorldBoundingVolumes();
|
|
|
|
UpdateWorldVelocity();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5960
|
2024-01-12 19:34:38 -05:00
|
|
|
void OrientableROI::VTable0x24(const MxMatrix& p_transform)
|
2023-11-19 09:38:07 -05:00
|
|
|
{
|
2024-01-12 19:34:38 -05:00
|
|
|
MxMatrix l_matrix(m_local2world);
|
|
|
|
m_local2world.Product(p_transform, l_matrix);
|
2023-11-19 09:38:07 -05:00
|
|
|
UpdateWorldBoundingVolumes();
|
|
|
|
UpdateWorldVelocity();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a59b0
|
2024-01-12 19:34:38 -05:00
|
|
|
void OrientableROI::UpdateWorldData(const MxMatrix& p_transform)
|
2023-11-19 09:38:07 -05:00
|
|
|
{
|
2024-01-12 19:34:38 -05:00
|
|
|
MxMatrix l_matrix(m_local2world);
|
|
|
|
m_local2world.Product(l_matrix, p_transform);
|
2023-11-19 09:38:07 -05:00
|
|
|
UpdateWorldBoundingVolumes();
|
|
|
|
UpdateWorldVelocity();
|
|
|
|
|
|
|
|
// iterate over comps
|
2024-02-17 10:07:34 -05:00
|
|
|
if (comp) {
|
|
|
|
for (CompoundObject::iterator iter = comp->begin(); !(iter == comp->end()); iter++) {
|
2023-11-19 09:38:07 -05:00
|
|
|
ROI* child = *iter;
|
|
|
|
static_cast<OrientableROI*>(child)->UpdateWorldData(p_transform);
|
|
|
|
}
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2023-11-19 09:38:07 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5a50
|
2023-11-19 09:38:07 -05:00
|
|
|
void OrientableROI::UpdateWorldVelocity()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5d80
|
2024-01-12 19:34:38 -05:00
|
|
|
const float* OrientableROI::GetWorldVelocity() const
|
2023-11-19 09:38:07 -05:00
|
|
|
{
|
2024-01-12 19:34:38 -05:00
|
|
|
return m_world_velocity.GetData();
|
2023-11-19 09:38:07 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5d90
|
2023-11-19 09:38:07 -05:00
|
|
|
const BoundingBox& OrientableROI::GetWorldBoundingBox() const
|
|
|
|
{
|
|
|
|
return m_world_bounding_box;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100a5da0
|
2023-11-19 09:38:07 -05:00
|
|
|
const BoundingSphere& OrientableROI::GetWorldBoundingSphere() const
|
|
|
|
{
|
|
|
|
return m_world_bounding_sphere;
|
|
|
|
}
|