From 5d022b712344898864d18e6f3b6fa1ce77190e3f Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Tue, 27 Sep 2022 14:12:05 +0800 Subject: [PATCH] Fixed mipoffset --- SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp b/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp index 29c1146a..33270bb6 100644 --- a/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp +++ b/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp @@ -70,12 +70,12 @@ namespace SHADE size_t totalBytes{ 0 }; - std::vector mipOff; + std::vector mipOff(file.GetMipCount()); for (auto i{0}; i < file.GetMipCount(); ++i) { - totalBytes += file.GetImageData(i, 0)->m_memSlicePitch; mipOff.push_back(totalBytes); + totalBytes += file.GetImageData(i, 0)->m_memSlicePitch; } SHTexture::PixelChannel* pixel = new SHTexture::PixelChannel[totalBytes];