mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(component): add TextureCacheGetMip
This commit is contained in:
parent
d33b0ed4b6
commit
f72e50f083
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user