isle-portable/LEGO1/realtime/orientableroi.cpp
Nathan M Gilbert 7fc1f8019f
Implement ViewROI and base classes (#287)
* Implement ViewROI and base classes

* Clean up Orientable header

* Move tgl to tgl subdirectory, and use target_include_directories

* Move classes to submodules

* Fix some missed references

* Fix/match UpdateWorldData

* Renaming / removing MxTypes / refactoring

* Consistent naming for Matrix

* Adjust format action

* Add Vector3/Vector4 to Data vector

* Add TGL comment

* Add a comment about Matrix4Impl

* Add ROI comment

---------

Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
2023-11-19 15:38:07 +01:00

68 lines
1.6 KiB
C++

#include "orientableroi.h"
#include "../decomp.h"
DECOMP_SIZE_ASSERT(OrientableROI, 0xdc)
// OFFSET: LEGO1 0x100a5910
void OrientableROI::VTable0x1c()
{
UpdateWorldBoundingVolumes();
UpdateWorldVelocity();
}
// OFFSET: LEGO1 0x100a5930
void OrientableROI::SetLocalTransform(const Matrix4Impl& p_transform)
{
reinterpret_cast<Matrix4Impl&>(m_local2world) = p_transform;
UpdateWorldBoundingVolumes();
UpdateWorldVelocity();
}
// OFFSET: LEGO1 0x100a5960
void OrientableROI::VTable0x24(const Matrix4Data& p_transform)
{
Matrix4Data l_matrix(m_local2world);
m_local2world.EqualsMxProduct(&p_transform, &l_matrix);
UpdateWorldBoundingVolumes();
UpdateWorldVelocity();
}
// OFFSET: LEGO1 0x100a59b0
void OrientableROI::UpdateWorldData(const Matrix4Data& p_transform)
{
Matrix4Data l_matrix(m_local2world);
m_local2world.EqualsMxProduct(&l_matrix, &p_transform);
UpdateWorldBoundingVolumes();
UpdateWorldVelocity();
// iterate over comps
if (m_comp)
for (CompoundObject::iterator iter = m_comp->begin(); !(iter == m_comp->end()); iter++) {
ROI* child = *iter;
static_cast<OrientableROI*>(child)->UpdateWorldData(p_transform);
}
}
// OFFSET: LEGO1 0x100a5a50
void OrientableROI::UpdateWorldVelocity()
{
}
// OFFSET: LEGO1 0x100a5d80
const Vector3& OrientableROI::GetWorldVelocity() const
{
return (Vector3&) *m_world_velocity.GetData();
}
// OFFSET: LEGO1 0x100a5d90
const BoundingBox& OrientableROI::GetWorldBoundingBox() const
{
return m_world_bounding_box;
}
// OFFSET: LEGO1 0x100a5da0
const BoundingSphere& OrientableROI::GetWorldBoundingSphere() const
{
return m_world_bounding_sphere;
}