implement functions in ViewROI and ViewLodList (#631)

This commit is contained in:
Misha 2024-03-05 16:15:32 -05:00 committed by GitHub
parent 3897e9c015
commit 8ecae549df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 66 additions and 11 deletions

View file

@ -1,6 +1,7 @@
#include "viewlodlist.h"
#include "decomp.h"
#include "viewlod.h"
#include <stdio.h>
@ -17,10 +18,33 @@ ViewLODListManager::ViewLODListManager()
{
}
// STUB: LEGO1 0x100a7130
// FUNCTION: LEGO1 0x100a7130
ViewLODListManager::~ViewLODListManager()
{
// TODO
ViewLODListMap::iterator iterator;
// delete all ViewLODLists
for (iterator = m_map.begin(); !(iterator == m_map.end()); ++iterator) {
const ROIName& rROIName = (*iterator).first;
ViewLODList* pLODList = (*iterator).second;
// LODList's refCount should be 0
assert(pLODList->m_refCount == 0);
// ???who pops and deletes LODObjects
while (pLODList->Size() > 0) {
delete const_cast<ViewLOD*>(pLODList->PopBack());
}
delete pLODList;
// ??? for now
delete[] const_cast<char*>(rROIName);
}
// ??? correct way of "emptying" map
m_map.erase(m_map.begin(), m_map.end());
assert(m_map.begin() == m_map.end());
}
// FUNCTION: LEGO1 0x100a72c0
@ -63,10 +87,23 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
return pLODList;
}
// STUB: LEGO1 0x100a75b0
ViewLODList* ViewLODListManager::Lookup(const ROIName&) const
// FUNCTION: LEGO1 0x100a75b0
ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const
{
return NULL;
// returned ViewLODList's refCount is increased, i.e. caller must call Release()
// when it no longer holds on to the list
ViewLODListMap::const_iterator iterator = m_map.find(p_roiName);
ViewLODList* pLODList = 0;
if (!(iterator == m_map.end())) {
pLODList = (*iterator).second;
assert(pLODList);
pLODList->AddRef();
}
return pLODList;
}
// STUB: LEGO1 0x100a7680

View file

@ -41,22 +41,40 @@ void ViewROI::UpdateWorldData(const Matrix4& parent2world)
}
}
// STUB: LEGO1 0x100a9fc0
// FUNCTION: LEGO1 0x100a9fc0
void ViewROI::VTable0x24(const Matrix4& p_transform)
{
// TODO
OrientableROI::VTable0x24(p_transform);
if (geometry) {
Tgl::FloatMatrix4 matrix;
Matrix4 in(matrix);
SETMAT4(in, m_local2world);
geometry->SetTransformation(matrix);
}
}
// STUB: LEGO1 0x100aa0a0
// FUNCTION: LEGO1 0x100aa0a0
void ViewROI::SetLocalTransform(const Matrix4& p_transform)
{
// TODO
OrientableROI::SetLocalTransform(p_transform);
if (geometry) {
Tgl::FloatMatrix4 matrix;
Matrix4 in(matrix);
SETMAT4(in, m_local2world);
geometry->SetTransformation(matrix);
}
}
// STUB: LEGO1 0x100aa180
// FUNCTION: LEGO1 0x100aa180
void ViewROI::VTable0x1c()
{
// TODO
OrientableROI::VTable0x1c();
if (geometry) {
Tgl::FloatMatrix4 matrix;
Matrix4 in(matrix);
SETMAT4(in, m_local2world);
geometry->SetTransformation(matrix);
}
}
// FUNCTION: LEGO1 0x100aa500