removed OriginalFormat from CSoftwareTexture2, because ITexture has OriginalColorFormat;

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6102 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple 2020-02-29 01:13:48 +00:00
parent 704c9eec83
commit 92f3d266a0
2 changed files with 8 additions and 9 deletions

@ -22,7 +22,7 @@ void Resample_subSampling(eBlitter op, video::IImage* dst, const core::rect<s32>
//! constructor //! constructor
CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name, u32 flags, CBurningVideoDriver* driver) CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name, u32 flags, CBurningVideoDriver* driver)
: ITexture(name, ETT_2D),MipMapLOD(0), Flags ( flags ), OriginalFormat(video::ECF_UNKNOWN),Driver(driver) : ITexture(name, ETT_2D),MipMapLOD(0), Flags ( flags ), Driver(driver)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CSoftwareTexture2"); setDebugName("CSoftwareTexture2");
@ -44,13 +44,13 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name, u32 fl
if (!image) return; if (!image) return;
OriginalSize = image->getDimension(); OriginalSize = image->getDimension();
OriginalFormat = image->getColorFormat(); OriginalColorFormat = image->getColorFormat();
#if defined(IRRLICHT_sRGB) #if defined(IRRLICHT_sRGB)
if ( Flags & IMAGE_IS_LINEAR ) image->set_sRGB(0); if ( Flags & IMAGE_IS_LINEAR ) image->set_sRGB(0);
#endif #endif
bool isCompressed = IImage::isCompressedFormat(OriginalFormat); bool isCompressed = IImage::isCompressedFormat(OriginalColorFormat);
if (isCompressed) if (isCompressed)
{ {
os::Printer::log("Texture compression not available.", ELL_ERROR); os::Printer::log("Texture compression not available.", ELL_ERROR);
@ -81,7 +81,7 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name, u32 fl
core::stringw showName ( name ); core::stringw showName ( name );
snprintf_irr ( buf, sizeof(buf), "Burningvideo: Warning Texture %ls reformat %ux%u,%d -> %ux%u,%d", snprintf_irr ( buf, sizeof(buf), "Burningvideo: Warning Texture %ls reformat %ux%u,%d -> %ux%u,%d",
showName.c_str(), showName.c_str(),
OriginalSize.Width, OriginalSize.Height,OriginalFormat, OriginalSize.Width, OriginalSize.Height, OriginalColorFormat,
optSize.Width, optSize.Height,BURNINGSHADER_COLOR_FORMAT optSize.Width, optSize.Height,BURNINGSHADER_COLOR_FORMAT
); );
@ -172,7 +172,7 @@ void CSoftwareTexture2::regenerateMipMapLevels(void* data, u32 layer)
{ {
if (origSize.Width > 1) origSize.Width >>= 1; if (origSize.Width > 1) origSize.Width >>= 1;
if (origSize.Height > 1) origSize.Height >>= 1; if (origSize.Height > 1) origSize.Height >>= 1;
mip_end += IImage::getDataSizeFromFormat(OriginalFormat, origSize.Width, origSize.Height); mip_end += IImage::getDataSizeFromFormat(OriginalColorFormat, origSize.Width, origSize.Height);
i += 1; i += 1;
} while ((origSize.Width != 1 || origSize.Height != 1) && i < SOFTWARE_DRIVER_2_MIPMAPPING_MAX); } while ((origSize.Width != 1 || origSize.Height != 1) && i < SOFTWARE_DRIVER_2_MIPMAPPING_MAX);
@ -192,9 +192,9 @@ void CSoftwareTexture2::regenerateMipMapLevels(void* data, u32 layer)
if (origSize.Width > 1) origSize.Width >>= 1; if (origSize.Width > 1) origSize.Width >>= 1;
if (origSize.Height > 1) origSize.Height >>= 1; if (origSize.Height > 1) origSize.Height >>= 1;
if (OriginalFormat != BURNINGSHADER_COLOR_FORMAT) if (OriginalColorFormat != BURNINGSHADER_COLOR_FORMAT)
{ {
IImage* tmpImage = new CImage(OriginalFormat, origSize, mip_current, true, false); IImage* tmpImage = new CImage(OriginalColorFormat, origSize, mip_current, true, false);
MipMap[i] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize); MipMap[i] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize);
if (origSize == newSize) if (origSize == newSize)
tmpImage->copyTo(MipMap[i]); tmpImage->copyTo(MipMap[i]);
@ -214,7 +214,7 @@ void CSoftwareTexture2::regenerateMipMapLevels(void* data, u32 layer)
tmpImage->drop(); tmpImage->drop();
} }
} }
mip_current += IImage::getDataSizeFromFormat(OriginalFormat, origSize.Width, origSize.Height); mip_current += IImage::getDataSizeFromFormat(OriginalColorFormat, origSize.Width, origSize.Height);
} }
} }

@ -115,7 +115,6 @@ private:
//! controls MipmapSelection. relation between drawn area and image size //! controls MipmapSelection. relation between drawn area and image size
u32 MipMapLOD; // 0 .. original Texture pot -SOFTWARE_DRIVER_2_MIPMAPPING_MAX u32 MipMapLOD; // 0 .. original Texture pot -SOFTWARE_DRIVER_2_MIPMAPPING_MAX
u32 Flags; //eTex2Flags u32 Flags; //eTex2Flags
ECOLOR_FORMAT OriginalFormat;
CBurningVideoDriver* Driver; CBurningVideoDriver* Driver;
CImage* MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX]; CImage* MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX];