fixed align bug while wrote file header

This commit is contained in:
hyzboy 2021-12-13 20:53:15 +08:00
parent 4bac4e4e23
commit 1ae4396640

View File

@ -123,13 +123,13 @@ bool TextureFileCreater::WriteSize2DArray(const uint32 width,const uint32 height
bool TextureFileCreater::WritePixelFormat(const uint mip_level)
{
constexpr uint8 spaces[7]={0,0,0,0,0,0,0};
if (pixel_format->format > ColorFormat::COMPRESS)
{
if(!dos->WriteUint8(0))return(false);
if(!dos->WriteUint16(uint(pixel_format->format)-uint(ColorFormat::BC1RGB)))return(false);
constexpr uint8 spaces[7]={0,0,0,0,0,0,0};
if(dos->WriteUint8(spaces,7)!=7)return(false);
}
else
@ -142,6 +142,10 @@ bool TextureFileCreater::WritePixelFormat(const uint mip_level)
if(!dos->WriteUint8(mip_level))return(false); //mipmaps级数
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(dos->WriteUint8(spaces,7)!=7)return(false); //补齐TextureFileHeader头40字节问题
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return(true);
}