feat(component): add TextureCacheGetMip

This commit is contained in:
fallenoak 2025-10-22 22:47:41 -05:00
parent d33b0ed4b6
commit f72e50f083
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 19 additions and 0 deletions

View File

@ -164,6 +164,23 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) {
return 1; return 1;
} }
uint8_t* TextureCacheGetMip(void* handle, uint32_t mipLevel) {
auto entry = static_cast<CACHEENTRY*>(handle);
if (!entry || entry->IsMissing() || !entry->m_data) {
return nullptr;
}
if (mipLevel >= entry->Info().mipCount) {
return nullptr;
}
auto blpHeader = static_cast<BLPHeader*>(entry->m_data);
auto mipOffset = blpHeader->mipOffsets[mipLevel];
return static_cast<uint8_t*>(entry->m_data) + mipOffset;
}
BlpPalPixel* TextureCacheGetPal(void* handle) { BlpPalPixel* TextureCacheGetPal(void* handle) {
auto entry = static_cast<CACHEENTRY*>(handle); auto entry = static_cast<CACHEENTRY*>(handle);

View File

@ -46,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture);
int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3); int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3);
uint8_t* TextureCacheGetMip(void* handle, uint32_t mipLevel);
BlpPalPixel* TextureCacheGetPal(void* handle); BlpPalPixel* TextureCacheGetPal(void* handle);
int32_t TextureCacheHasMips(void* handle); int32_t TextureCacheHasMips(void* handle);