mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Fix Cubemap mipmap sizes
This commit is contained in:
parent
d35560ccd7
commit
e7898a1f3c
@ -219,11 +219,6 @@ TextureType TextureCube::GetTextureType() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
int TextureCube::GetFaceCount() const
|
int TextureCube::GetFaceCount() const
|
||||||
{
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t TextureCube::GetSizeOfMipLevel(const int mipLevel) const
|
|
||||||
{
|
{
|
||||||
return FACE_COUNT;
|
return FACE_COUNT;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ public:
|
|||||||
|
|
||||||
int GetFaceCount() const override;
|
int GetFaceCount() const override;
|
||||||
|
|
||||||
size_t GetSizeOfMipLevel(int mipLevel) const override;
|
|
||||||
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
|
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void TextureConverter::ReorderUnsignedToUnsigned() const
|
|||||||
|
|
||||||
for (auto mipLevel = 0; mipLevel < mipCount; mipLevel++)
|
for (auto mipLevel = 0; mipLevel < mipCount; mipLevel++)
|
||||||
{
|
{
|
||||||
const auto mipLevelSize = m_input_texture->GetSizeOfMipLevel(mipLevel);
|
const auto mipLevelSize = m_input_texture->GetSizeOfMipLevel(mipLevel) * m_input_texture->GetFaceCount();
|
||||||
const auto* inputBuffer = m_input_texture->GetBufferForMipLevel(mipLevel);
|
const auto* inputBuffer = m_input_texture->GetBufferForMipLevel(mipLevel);
|
||||||
auto* outputBuffer = m_output_texture->GetBufferForMipLevel(mipLevel);
|
auto* outputBuffer = m_output_texture->GetBufferForMipLevel(mipLevel);
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ void ObjLoaderT6::LoadImageFromIwi(T6::GfxImage* image, ISearchPath* searchPath,
|
|||||||
|
|
||||||
const int textureMipCount = loadedTexture->GetMipMapCount();
|
const int textureMipCount = loadedTexture->GetMipMapCount();
|
||||||
for(int mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
|
for(int mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
|
||||||
image->loadedSize += loadedTexture->GetSizeOfMipLevel(mipLevel);
|
image->loadedSize += loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ public:
|
|||||||
for (auto mipLevel = 0; mipLevel < mipCount; mipLevel++)
|
for (auto mipLevel = 0; mipLevel < mipCount; mipLevel++)
|
||||||
{
|
{
|
||||||
const auto* buffer = m_texture->GetBufferForMipLevel(mipLevel);
|
const auto* buffer = m_texture->GetBufferForMipLevel(mipLevel);
|
||||||
const auto mipLevelSize = m_texture->GetSizeOfMipLevel(mipLevel);
|
const auto mipLevelSize = m_texture->GetSizeOfMipLevel(mipLevel) * m_texture->GetFaceCount();
|
||||||
m_file->Write(buffer, 1, mipLevelSize);
|
m_file->Write(buffer, 1, mipLevelSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void IwiWriter27::DumpImage(FileAPI::IFile* file, Texture* texture)
|
|||||||
const int textureMipCount = texture->HasMipMaps() ? texture->GetMipMapCount() : 1;
|
const int textureMipCount = texture->HasMipMaps() ? texture->GetMipMapCount() : 1;
|
||||||
for (int currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
for (int currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||||
{
|
{
|
||||||
const size_t mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel);
|
const size_t mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += mipLevelSize;
|
currentFileSize += mipLevelSize;
|
||||||
|
|
||||||
if(currentMipLevel < static_cast<int>(_countof(iwi27::IwiHeader::fileSizeForPicmip)))
|
if(currentMipLevel < static_cast<int>(_countof(iwi27::IwiHeader::fileSizeForPicmip)))
|
||||||
@ -132,7 +132,7 @@ void IwiWriter27::DumpImage(FileAPI::IFile* file, Texture* texture)
|
|||||||
|
|
||||||
for (int currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
for (int currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||||
{
|
{
|
||||||
const size_t mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel);
|
const size_t mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
file->Write(texture->GetBufferForMipLevel(currentMipLevel), 1, mipLevelSize);
|
file->Write(texture->GetBufferForMipLevel(currentMipLevel), 1, mipLevelSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user