changed cubemaps write order.

This commit is contained in:
hyzboy 2021-12-13 18:16:23 +08:00
parent 29b98bba33
commit 4bac4e4e23
2 changed files with 22 additions and 18 deletions

View File

@ -80,20 +80,20 @@ bool ConvertCubemap(const OSString &filename,const OSStringList &file_list,const
return(false);
}
for(uint face=0;face<6;face++)
for(int i=0;i<miplevel;i++)
{
image[face].Bind();
width=image[face].width();
height=image[face].height();
if (!tex_file_creater->InitFormat(&image[face]))
for(uint face=0;face<6;face++)
{
LOG_ERROR(OS_TEXT("Init texture format failed."));
return(false);
}
image[face].Bind();
width=image[face].width();
height=image[face].height();
if (!tex_file_creater->InitFormat(&image[face]))
{
LOG_ERROR(OS_TEXT("Init texture format failed."));
return(false);
}
for(int i=0;i<miplevel;i++)
{
bytes=tex_file_creater->Write();
if(bytes<=0)
@ -103,14 +103,18 @@ bool ConvertCubemap(const OSString &filename,const OSStringList &file_list,const
}
total+=bytes;
}
if(miplevel>1&&i<miplevel)
{
if(width>1)width>>=1;
if(height>1)height>>=1;
if(miplevel>1&&i<miplevel)
{
if(width>1)width>>=1;
if(height>1)height>>=1;
}
image[face].Resize(width,height);
}
for(uint face=0;face<6;face++)
{
image[face].Bind();
image[face].Resize(width,height);
}
}

View File

@ -66,7 +66,7 @@ public:
target_fmt_name=fmt_name_list[fmt_index];
std::cout<<"Compress Image to "<<target_fmt_name.c_str()<<" Format."<<std::endl;
// std::cout<<"Compress Image to "<<target_fmt_name.c_str()<<" Format."<<std::endl;
if(type==IL_UNSIGNED_BYTE ){cf=CF_8bit; pixel_bytes=1;}else
if(type==IL_UNSIGNED_SHORT ){cf=CF_16bit; pixel_bytes=2;}else