Fix T5 loading and dumping images

This commit is contained in:
Jan 2021-08-14 13:57:18 +02:00
parent 1e1485cedc
commit f052a97886

View File

@ -104,11 +104,11 @@ void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone)
if (loadedTexture != nullptr) if (loadedTexture != nullptr)
{ {
image->texture.texture = loadedTexture; image->texture.texture = loadedTexture;
image->cardMemory.platform[0] = 0; image->loadedSize = 0;
const auto textureMipCount = loadedTexture->GetMipMapCount(); const auto textureMipCount = loadedTexture->GetMipMapCount();
for (auto mipLevel = 0; mipLevel < textureMipCount; mipLevel++) for (auto mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
image->cardMemory.platform[0] += static_cast<int>(loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount()); image->loadedSize += static_cast<int>(loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount());
} }
} }
@ -130,11 +130,11 @@ void ObjLoader::LoadImageFromIwi(GfxImage* image, ISearchPath* searchPath, Zone*
if (loadedTexture != nullptr) if (loadedTexture != nullptr)
{ {
image->texture.texture = loadedTexture; image->texture.texture = loadedTexture;
image->cardMemory.platform[0] = 0; image->loadedSize = 0;
const auto textureMipCount = loadedTexture->GetMipMapCount(); const auto textureMipCount = loadedTexture->GetMipMapCount();
for (auto mipLevel = 0; mipLevel < textureMipCount; mipLevel++) for (auto mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
image->cardMemory.platform[0] += static_cast<int>(loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount()); image->loadedSize += static_cast<int>(loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount());
} }
else else
{ {
@ -152,7 +152,7 @@ void ObjLoader::LoadImageData(ISearchPath* searchPath, Zone* zone)
{ {
auto* image = imageEntry->Asset(); auto* image = imageEntry->Asset();
if (image->cardMemory.platform[0] > 0) if (image->loadedSize > 0)
{ {
continue; continue;
} }