Allow to create images with floating point formats.

While IGUIImage doesn't support those well yet, it at least allocates memory and that turns out to be useful sometimes. For example we can now lock() floating point textures and access the data on OpenGL, which wasn't possible before. If this turns out to cause any problems (shouldn't really) we can handle them case-by-case.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5666 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2018-11-29 16:04:39 +00:00
parent b584c39295
commit 8f2eb13099
3 changed files with 4 additions and 14 deletions

View File

@ -20,6 +20,7 @@ namespace video
//! Interface for software image data.
/** Image loaders create these images from files. IVideoDrivers convert
these images into their (hardware) textures.
NOTE: Floating point formats are not well supported yet. Basically only getData() works for them.
*/
class IImage : public virtual IReferenceCounted
{
@ -444,7 +445,7 @@ public:
}
}
//! check if the color format is only viable for RenderTarget textures
//! Check if the color format is only viable for RenderTarget textures
/** Since we don't have support for e.g. floating point IImage formats
one should test if the color format can be used for arbitrary usage, or
if it is restricted to RTTs. */
@ -472,6 +473,7 @@ public:
case ECF_ETC2_ARGB:
return false;
default:
// All floating point formats. Function name should really be isFloatingPointFormat.
return true;
}
}

View File

@ -1667,12 +1667,6 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
const core::dimension2d<u32>& size, void *data, bool ownForeignMemory,
bool deleteMemory)
{
if(IImage::isRenderTargetOnlyFormat(format))
{
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
return 0;
}
return new CImage(format, size, data, ownForeignMemory, deleteMemory);
}
@ -1680,12 +1674,6 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
//! Creates an empty software image.
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
{
if(IImage::isRenderTargetOnlyFormat(format))
{
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
return 0;
}
return new CImage(format, size);
}

View File

@ -211,7 +211,7 @@ public:
if (LockImage)
return LockImage->getData();
if (IImage::isCompressedFormat(ColorFormat) || IImage::isRenderTargetOnlyFormat(ColorFormat))
if (IImage::isCompressedFormat(ColorFormat))
return 0;
LockReadOnly |= (mode == ETLM_READ_ONLY);