Implement/match LegoROI::FUN_100a9170 (#639)

* Implement.match LegoROI::FUN_100a9170

* Add two LOD functions
This commit is contained in:
Christian Semmler 2024-03-08 15:29:16 -05:00 committed by GitHub
parent d978cbe7f9
commit 32ae9f3803
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 7 deletions

View file

@ -311,10 +311,29 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
return FAILURE;
}
// STUB: LEGO1 0x100aad00
// FUNCTION: LEGO1 0x100aacb0
LegoResult LegoLOD::FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
if (!m_meshes[i].m_unk0x04) {
m_meshes[i].m_tglMesh->SetColor(p_red, p_green, p_blue, p_alpha);
}
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x100aad00
LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo)
{
// TODO
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
if (m_meshes[i].m_unk0x04) {
SetGroupTexture(m_meshes[i].m_tglMesh, p_textureInfo);
m_meshes[i].m_tglMesh->SetColor(1.0F, 1.0F, 1.0F, 0.0F);
m_meshes[i].m_unk0x04 = TRUE;
}
}
return SUCCESS;
}

View file

@ -28,6 +28,7 @@ class LegoLOD : public ViewLOD {
float VTable0x10() override { return 0.0; } // vtable+0x10
LegoResult Read(Tgl::Renderer*, LegoTextureContainer* p_textureContainer, LegoStorage* p_storage);
LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo);
static LegoBool FUN_100aae20(const LegoChar* p_name);

View file

@ -418,11 +418,30 @@ LegoResult LegoROI::SetFrame(LegoAnim* p_anim, LegoTime p_time)
return FUN_100a8da0(root, mat, p_time, this);
}
// STUB: LEGO1 0x100a9170
LegoResult LegoROI::FUN_100a9170(LegoFloat, LegoFloat, LegoFloat, LegoFloat)
// FUNCTION: LEGO1 0x100a9170
LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
{
// TODO
return SUCCESS;
LegoResult result = SUCCESS;
CompoundObject::iterator it;
int lodCount = GetLODCount();
for (LegoU32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
if (lod->FUN_100aacb0(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
result = FAILURE;
}
}
if (comp != NULL) {
for (it = comp->begin(); it != comp->end(); it++) {
if (((LegoROI*) *it)->FUN_100a9170(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
result = FAILURE;
}
}
}
return result;
}
// FUNCTION: LEGO1 0x100a9210

View file

@ -32,7 +32,7 @@ class LegoROI : public ViewROI {
LegoROI* FUN_100a8ce0(const LegoChar* p_name, LegoROI* p_roi);
LegoResult FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi);
LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
LegoResult FUN_100a9170(LegoFloat, LegoFloat, LegoFloat, LegoFloat);
LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo);
float IntrinsicImportance() const override; // vtable+0x04