mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-07 07:09:53 +03:00
feat(component): add TextureCacheGetMip
This commit is contained in:
2 files changed
+19
No files matched your search
@@ -164,6 +164,23 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) {
|
||||
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) {
|
||||
auto entry = static_cast<CACHEENTRY*>(handle);
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture);
|
||||
|
||||
int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3);
|
||||
|
||||
uint8_t* TextureCacheGetMip(void* handle, uint32_t mipLevel);
|
||||
|
||||
BlpPalPixel* TextureCacheGetPal(void* handle);
|
||||
|
||||
int32_t TextureCacheHasMips(void* handle);
|
||||
|
||||
Reference in new issue
Block a user