Implement/match LegoROI/LegoLOD::GetTexture

This commit is contained in:
Christian Semmler 2024-04-17 08:44:30 -04:00
parent a64bb4d460
commit ce1756bf7a
6 changed files with 66 additions and 4 deletions

View file

@ -17,6 +17,7 @@ class LegoTextureInfo {
static LegoTextureInfo* Create(const char* p_name, LegoTexture* p_texture); static LegoTextureInfo* Create(const char* p_name, LegoTexture* p_texture);
static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo); static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo);
static BOOL GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo);
LegoResult FUN_10066010(LegoU8* p_bits); LegoResult FUN_10066010(LegoU8* p_bits);
@ -27,4 +28,7 @@ class LegoTextureInfo {
LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c
}; };
// GLOBAL: LEGO1 0x100db6f0
// IID_IDirect3DRMTexture2
#endif // LEGOTEXTUREINFO_H #endif // LEGOTEXTUREINFO_H

View file

@ -160,6 +160,30 @@ BOOL LegoTextureInfo::SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textu
return TRUE; return TRUE;
} }
// FUNCTION: LEGO1 0x10065f90
BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo)
{
TglImpl::MeshImpl::MeshData* data = ((TglImpl::MeshImpl*) pMesh)->ImplementationData();
IDirect3DRMMesh* mesh = data->groupMesh;
D3DRMGROUPINDEX id = data->groupIndex;
LPDIRECT3DRMTEXTURE returnPtr = NULL;
LPDIRECT3DRMTEXTURE2 texture = NULL;
if (mesh->GetGroupTexture(id, &returnPtr) == D3DRM_OK) {
if (returnPtr->QueryInterface(IID_IDirect3DRMTexture2, (LPVOID*) &texture) == D3DRM_OK) {
p_textureInfo = (LegoTextureInfo*) texture->GetAppData();
texture->Release();
returnPtr->Release();
}
return TRUE;
}
return FALSE;
}
// STUB: LEGO1 0x10066010 // STUB: LEGO1 0x10066010
LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits) LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits)
{ {

View file

@ -362,6 +362,20 @@ LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo)
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x100aadc0
LegoResult LegoLOD::GetTexture(LegoTextureInfo*& p_textureInfo)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
if (m_melems[i].m_unk0x04) {
if (LegoTextureInfo::GetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo) == TRUE) {
return SUCCESS;
}
}
}
return FAILURE;
}
// FUNCTION: LEGO1 0x100aae20 // FUNCTION: LEGO1 0x100aae20
LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name) LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name)
{ {

View file

@ -32,6 +32,7 @@ class LegoLOD : public ViewLOD {
LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo); LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo);
LegoResult FUN_100aad70(LegoTextureInfo* p_textureInfo); LegoResult FUN_100aad70(LegoTextureInfo* p_textureInfo);
LegoResult GetTexture(LegoTextureInfo*& p_textureInfo);
static LegoBool FUN_100aae20(const LegoChar* p_name); static LegoBool FUN_100aae20(const LegoChar* p_name);

View file

@ -498,10 +498,29 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo)
return result; return result;
} }
// STUB: LEGO1 0x100a92a0 // FUNCTION: LEGO1 0x100a92a0
LegoResult LegoROI::GetTexture(LegoTextureInfo*&) // FUNCTION: BETA10 0x1018b12d
LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo)
{ {
// TODO CompoundObject::iterator it;
int lodCount = GetLODCount();
for (LegoU32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
if (lod->GetTexture(p_textureInfo) == SUCCESS) {
return SUCCESS;
}
}
if (comp != NULL) {
for (it = comp->begin(); it != comp->end(); it++) {
if (((LegoROI*) *it)->GetTexture(p_textureInfo) == SUCCESS) {
return SUCCESS;
}
}
}
return FAILURE; return FAILURE;
} }

View file

@ -36,7 +36,7 @@ class LegoROI : public ViewROI {
LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time); LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo); LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo);
LegoResult GetTexture(LegoTextureInfo*&); LegoResult GetTexture(LegoTextureInfo*& p_textureInfo);
LegoU32 FUN_100a9410(Vector3&, Vector3&, float, float, Vector3&, LegoBool); LegoU32 FUN_100a9410(Vector3&, Vector3&, float, float, Vector3&, LegoBool);
void SetName(const LegoChar* p_name); void SetName(const LegoChar* p_name);