Merging r5877 through r5891 from trunk to ogl-es branch
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5892 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
14ffa95ccd
commit
6ee00a39fd
|
@ -9,6 +9,9 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
|||
|
||||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
- Drivers can now try to create textures from images in more exotic color formats (like floating point formats). It depends on the driver how much that works (so far mainly OpenGL can handle it somewhat).
|
||||
- Fix OpenGL to no longer switch colors red and blue in 24-bit RGB format. But warnings added to documentation to avoid 24-bit textures as they are generally just trouble.
|
||||
- No longer try to convert ECF_R5G6B5 to ECF_A1R5G5B5 on OpenGL (just made texture-loading seem to fail).
|
||||
- Add flag SIrrlichtCreationParameters.WindowResizable. Mainly to work around troubles with SDL+OpenGL on some platforms where resizing later can be tricky/impossible.
|
||||
- Add operator[] to vector2d and vector3d
|
||||
- Bugfix: IrrlichtDevice::isWindowMinimized no longer returns true when it's maximized on Windows.
|
||||
|
@ -245,6 +248,7 @@ should now be fps independentn
|
|||
|
||||
--------------------------
|
||||
Changes in 1.8.5
|
||||
- Fix CIrrDeviceSDL::getVideoModeList which didn't return video modes before. Thx @kas1e for report and patch.
|
||||
- CIrrDeviceMacOSX now sets the SEvent.MouseInput Shift and Control values on mouse events like the other devices. Thanks @ Zero King for patch (#321)
|
||||
- isWindowFocused in IrrDeviceSDL device now returns the input focus like the other devices. Before it was returning a mouse-over-window state.
|
||||
- Prevent SDL device from dropping OpenGL resources on Win32 when setResizable was called with OpenGL driver. Thanks @ kas1e for reporting (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52083&start=0)
|
||||
|
|
|
@ -445,40 +445,25 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
//! 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. */
|
||||
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
|
||||
//! Check if the color format uses floating point values for pixels
|
||||
static bool isFloatingPointFormat(const ECOLOR_FORMAT format)
|
||||
{
|
||||
if (isCompressedFormat(format))
|
||||
return false;
|
||||
|
||||
switch(format)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_R8G8B8:
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
case ECF_PVRTC_RGB2:
|
||||
case ECF_PVRTC_ARGB2:
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
case ECF_PVRTC_RGB4:
|
||||
case ECF_PVRTC_ARGB4:
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
case ECF_ETC1:
|
||||
case ECF_ETC2_RGB:
|
||||
case ECF_ETC2_ARGB:
|
||||
return false;
|
||||
default:
|
||||
// All floating point formats. Function name should really be isFloatingPointFormat.
|
||||
return true;
|
||||
case ECF_R16:
|
||||
case ECF_G16R16F:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_R32F:
|
||||
case ECF_G32R32F:
|
||||
case ECF_A32B32G32R32F:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -28,7 +28,8 @@ enum E_TEXTURE_CREATION_FLAG
|
|||
the space in memory.
|
||||
When using this flag, it does not make sense to use the flags
|
||||
ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
|
||||
ETCF_OPTIMIZED_FOR_SPEED at the same time. */
|
||||
ETCF_OPTIMIZED_FOR_SPEED at the same time.
|
||||
Not all texture formats are affected (usually those up to ECF_A8R8G8B8). */
|
||||
ETCF_ALWAYS_16_BIT = 0x00000001,
|
||||
|
||||
/** Forces the driver to create 32 bit textures always, independent of
|
||||
|
@ -37,7 +38,8 @@ enum E_TEXTURE_CREATION_FLAG
|
|||
create and use 16 bit textures.
|
||||
When using this flag, it does not make sense to use the flags
|
||||
ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
|
||||
ETCF_OPTIMIZED_FOR_SPEED at the same time. */
|
||||
ETCF_OPTIMIZED_FOR_SPEED at the same time.
|
||||
Not all texture formats are affected (usually those up to ECF_A8R8G8B8). */
|
||||
ETCF_ALWAYS_32_BIT = 0x00000002,
|
||||
|
||||
/** Lets the driver decide in which format the textures are created and
|
||||
|
@ -45,20 +47,25 @@ enum E_TEXTURE_CREATION_FLAG
|
|||
chooses the format in which the texture was stored on disk.
|
||||
When using this flag, it does not make sense to use the flags
|
||||
ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at
|
||||
the same time. */
|
||||
the same time.
|
||||
Not all texture formats are affected (usually those up to ECF_A8R8G8B8). */
|
||||
ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
|
||||
|
||||
/** Lets the driver decide in which format the textures are created and
|
||||
tries to create them maximizing render speed.
|
||||
When using this flag, it does not make sense to use the flags
|
||||
ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY,
|
||||
at the same time. */
|
||||
at the same time.
|
||||
Not all texture formats are affected (usually those up to ECF_A8R8G8B8). */
|
||||
ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
|
||||
|
||||
/** Automatically creates mip map levels for the textures. */
|
||||
ETCF_CREATE_MIP_MAPS = 0x00000010,
|
||||
|
||||
/** Discard any alpha layer and use non-alpha color format. */
|
||||
/** Discard any alpha layer and use non-alpha color format.
|
||||
Warning: This may lead to getting 24-bit texture formats which
|
||||
are often badly supported by drivers. So it's generally
|
||||
not recommended to enable this flag. */
|
||||
ETCF_NO_ALPHA_CHANNEL = 0x00000020,
|
||||
|
||||
//! Allow the Driver to use Non-Power-2-Textures
|
||||
|
|
|
@ -787,9 +787,11 @@ namespace video
|
|||
//! Draws a 2d image without any special effects
|
||||
/** \param texture Pointer to texture to use.
|
||||
\param destPos Upper left 2d destination position where the
|
||||
image will be drawn. */
|
||||
image will be drawn.
|
||||
\param useAlphaChannelOfTexture: If true, the alpha channel of
|
||||
the texture is used to draw the image.*/
|
||||
virtual void draw2DImage(const video::ITexture* texture,
|
||||
const core::position2d<s32>& destPos) =0;
|
||||
const core::position2d<s32>& destPos, bool useAlphaChannelOfTexture=false) =0;
|
||||
|
||||
//! Draws a 2d image using a color
|
||||
/** (if color is other than
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace video
|
|||
ECF_R5G6B5,
|
||||
|
||||
//! 24 bit color, no alpha channel, but 8 bit for red, green and blue.
|
||||
//! Warning: 24 bit formats tend to be badly supported. Depending on driver it's usually converted to another
|
||||
// format or even not working at all. It's mostly better to use 16-bit or 32-bit formats.
|
||||
ECF_R8G8B8,
|
||||
|
||||
//! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
|
||||
|
|
|
@ -234,7 +234,6 @@ void CCameraSceneNode::setFOV(f32 f)
|
|||
|
||||
void CCameraSceneNode::recalculateProjectionMatrix()
|
||||
{
|
||||
video::E_DRIVER_TYPE driverType = SceneManager->getVideoDriver()->getDriverType();
|
||||
ViewArea.getTransform ( video::ETS_PROJECTION ).buildProjectionMatrixPerspectiveFovLH(Fovy, Aspect, ZNear, ZFar, HasD3DStyleProjectionMatrix);
|
||||
IsOrthogonal = false;
|
||||
}
|
||||
|
|
|
@ -678,10 +678,68 @@ void CColorConverter::convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
|||
*dB++ = R5G6B5toA1R5G5B5(*sB++);
|
||||
}
|
||||
|
||||
bool CColorConverter::canConvertFormat(ECOLOR_FORMAT sourceFormat, ECOLOR_FORMAT destFormat)
|
||||
{
|
||||
switch (sourceFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
switch (destFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_R8G8B8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ECF_R5G6B5:
|
||||
switch (destFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_R8G8B8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
switch (destFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_R8G8B8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
switch (destFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_R8G8B8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void* dP, ECOLOR_FORMAT dF)
|
||||
{
|
||||
// please also update can_convert_viaFormat when adding new conversions
|
||||
switch (sF)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
static void convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void* dP, ECOLOR_FORMAT dF);
|
||||
// Check if convert_viaFormat is usable
|
||||
static bool canConvertFormat(ECOLOR_FORMAT sourceFormat, ECOLOR_FORMAT destFormat);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -746,6 +746,11 @@ ITexture* CD3D9Driver::createDeviceDependentTexture(const io::path& name, IImage
|
|||
imageArray.push_back(image);
|
||||
|
||||
CD3D9Texture* texture = new CD3D9Texture(name, imageArray, ETT_2D, this);
|
||||
if ( !texture->getDX9Texture() )
|
||||
{
|
||||
texture->drop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
@ -754,6 +759,12 @@ ITexture* CD3D9Driver::createDeviceDependentTextureCubemap(const io::path& name,
|
|||
{
|
||||
CD3D9Texture* texture = new CD3D9Texture(name, image, ETT_CUBEMAP, this);
|
||||
|
||||
if ( !texture->getDX9CubeTexture() )
|
||||
{
|
||||
texture->drop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
@ -3323,7 +3334,8 @@ IImage* CD3D9Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_REND
|
|||
if (format==video::ECF_UNKNOWN)
|
||||
format=getColorFormat();
|
||||
|
||||
if (IImage::isRenderTargetOnlyFormat(format) || IImage::isCompressedFormat(format) || IImage::isDepthFormat(format))
|
||||
// TODO: Maybe we could support more formats (floating point and some of those beyond ECF_R8), didn't really try yet
|
||||
if (IImage::isCompressedFormat(format) || IImage::isDepthFormat(format) || IImage::isFloatingPointFormat(format) || format >= ECF_R8)
|
||||
return 0;
|
||||
|
||||
// query the screen dimensions of the current adapter
|
||||
|
@ -3481,6 +3493,7 @@ D3DFORMAT CD3D9Driver::getD3DFormatFromColorFormat(ECOLOR_FORMAT format) const
|
|||
return D3DFMT_R8G8B8;
|
||||
case ECF_A8R8G8B8:
|
||||
return D3DFMT_A8R8G8B8;
|
||||
|
||||
case ECF_DXT1:
|
||||
return D3DFMT_DXT1;
|
||||
case ECF_DXT2:
|
||||
|
@ -3503,6 +3516,16 @@ D3DFORMAT CD3D9Driver::getD3DFormatFromColorFormat(ECOLOR_FORMAT format) const
|
|||
return D3DFMT_G32R32F;
|
||||
case ECF_A32B32G32R32F:
|
||||
return D3DFMT_A32B32G32R32F;
|
||||
|
||||
case ECF_R8:
|
||||
return D3DFMT_A8; // not correct, but somewhat similar
|
||||
case ECF_R8G8:
|
||||
return D3DFMT_A8L8; // not correct, but somewhat similar
|
||||
case ECF_R16:
|
||||
return D3DFMT_L16; // not correct, but somewhat similar
|
||||
case ECF_R16G16:
|
||||
return D3DFMT_G16R16; // flipped :-(
|
||||
|
||||
case ECF_D16:
|
||||
return D3DFMT_D16;
|
||||
case ECF_D24S8:
|
||||
|
|
|
@ -36,25 +36,6 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||
|
||||
getImageValues(image[0]);
|
||||
|
||||
core::array<IImage*> tmpImage = image;
|
||||
|
||||
bool releaseImageData = false;
|
||||
|
||||
if (OriginalSize != Size || OriginalColorFormat != ColorFormat)
|
||||
{
|
||||
releaseImageData = true;
|
||||
|
||||
for (u32 i = 0; i < image.size(); ++i)
|
||||
{
|
||||
tmpImage[i] = Driver->createImage(ColorFormat, Size);
|
||||
|
||||
if (image[i]->getDimension() == Size)
|
||||
image[i]->copyTo(tmpImage[i]);
|
||||
else
|
||||
image[i]->copyToScaling(tmpImage[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DWORD flags = 0;
|
||||
|
||||
if (HasMipMaps && AutoGenerateMipMaps)
|
||||
|
@ -84,8 +65,50 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||
break;
|
||||
}
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// Try again with 16-bit format
|
||||
if (InternalFormat == D3DFMT_A8R8G8B8)
|
||||
{
|
||||
InternalFormat = D3DFMT_A1R5G5B5;
|
||||
ColorFormat = ECF_A1R5G5B5;
|
||||
}
|
||||
else if (InternalFormat == D3DFMT_R8G8B8) // (24 bit is usually failing in d3d9, not sure if it's ever supported)
|
||||
{
|
||||
InternalFormat = D3DFMT_R5G6B5;
|
||||
ColorFormat = ECF_R5G6B5;
|
||||
}
|
||||
switch (Type)
|
||||
{
|
||||
case ETT_2D:
|
||||
hr = Device->CreateTexture(Size.Width, Size.Height, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &Texture, NULL);
|
||||
break;
|
||||
case ETT_CUBEMAP:
|
||||
hr = Device->CreateCubeTexture(Size.Width, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &CubeTexture, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
core::array<IImage*> tmpImage = image;
|
||||
bool releaseImageData = false;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (OriginalSize != Size || OriginalColorFormat != ColorFormat)
|
||||
{
|
||||
releaseImageData = true;
|
||||
|
||||
for (u32 i = 0; i < image.size(); ++i)
|
||||
{
|
||||
tmpImage[i] = Driver->createImage(ColorFormat, Size);
|
||||
|
||||
if (image[i]->getDimension() == Size)
|
||||
image[i]->copyTo(tmpImage[i]);
|
||||
else
|
||||
image[i]->copyToScaling(tmpImage[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tmpImage.size(); ++i)
|
||||
uploadTexture(i, 0, tmpImage[i]->getData());
|
||||
|
||||
|
@ -203,6 +226,11 @@ void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel, u32 layer, E
|
|||
|
||||
hr = CubeTexture->LockRect(static_cast<_D3DCUBEMAP_FACES>(layer), 0, &rect, 0, LockReadOnly ? D3DLOCK_READONLY : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Could not lock DIRECT3D9 Texture. Missing internal D3D texture.", ELL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -408,7 +436,8 @@ void CD3D9Texture::generateRenderTarget()
|
|||
|
||||
ECOLOR_FORMAT CD3D9Texture::getBestColorFormat(ECOLOR_FORMAT format)
|
||||
{
|
||||
ECOLOR_FORMAT destFormat = (!IImage::isCompressedFormat(format)) ? ECF_A8R8G8B8 : format;
|
||||
// We only try for to adapt "simple" formats
|
||||
ECOLOR_FORMAT destFormat = (format <= ECF_A8R8G8B8) ? ECF_A8R8G8B8 : format;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
|
@ -418,7 +447,7 @@ ECOLOR_FORMAT CD3D9Texture::getBestColorFormat(ECOLOR_FORMAT format)
|
|||
break;
|
||||
case ECF_R5G6B5:
|
||||
if (!Driver->getTextureCreationFlag(ETCF_ALWAYS_32_BIT))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
destFormat = ECF_R5G6B5;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) ||
|
||||
|
@ -426,6 +455,7 @@ ECOLOR_FORMAT CD3D9Texture::getBestColorFormat(ECOLOR_FORMAT format)
|
|||
destFormat = ECF_A1R5G5B5;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
// Note: Using ECF_A8R8G8B8 even when ETCF_ALWAYS_32_BIT is not set as 24 bit textures fail with too many cards
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) || Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
default:
|
||||
|
|
|
@ -127,7 +127,14 @@ void CImage::copyTo(IImage* target, const core::position2d<s32>& pos)
|
|||
return;
|
||||
}
|
||||
|
||||
Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0);
|
||||
if ( !Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0)
|
||||
&& target && pos.X == 0 && pos.Y == 0 &&
|
||||
CColorConverter::canConvertFormat(Format, target->getColorFormat()) )
|
||||
{
|
||||
// No fast blitting, but copyToScaling uses other color conversions and might work
|
||||
irr::core::dimension2du dim(target->getDimension());
|
||||
copyToScaling(target->getData(), dim.Width, dim.Height, target->getColorFormat(), target->getPitch());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1005,15 +1005,34 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList()
|
|||
{
|
||||
// enumerate video modes.
|
||||
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
|
||||
SDL_Rect **modes = SDL_ListModes(vi->vfmt, SDL_Flags);
|
||||
if (modes != 0)
|
||||
|
||||
SDL_PixelFormat pixelFormat = *(vi->vfmt);
|
||||
|
||||
core::array<Uint8> checkBitsPerPixel;
|
||||
checkBitsPerPixel.push_back(8);
|
||||
checkBitsPerPixel.push_back(16);
|
||||
checkBitsPerPixel.push_back(24);
|
||||
checkBitsPerPixel.push_back(32);
|
||||
if ( pixelFormat.BitsPerPixel > 32 )
|
||||
checkBitsPerPixel.push_back(pixelFormat.BitsPerPixel);
|
||||
|
||||
for ( u32 i=0; i<checkBitsPerPixel.size(); ++i)
|
||||
{
|
||||
if (modes == (SDL_Rect **)-1)
|
||||
os::Printer::log("All modes available.\n");
|
||||
else
|
||||
pixelFormat.BitsPerPixel = checkBitsPerPixel[i];
|
||||
SDL_Rect **modes = SDL_ListModes(&pixelFormat, SDL_Flags|SDL_FULLSCREEN);
|
||||
if (modes != 0)
|
||||
{
|
||||
for (u32 i=0; modes[i]; ++i)
|
||||
VideoModeList->addMode(core::dimension2d<u32>(modes[i]->w, modes[i]->h), vi->vfmt->BitsPerPixel);
|
||||
if (modes == (SDL_Rect **)-1)
|
||||
{
|
||||
core::stringc strLog("All modes available for bit-depth ");
|
||||
strLog += core::stringc(pixelFormat.BitsPerPixel);
|
||||
os::Printer::log(strLog.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (u32 i=0; modes[i]; ++i)
|
||||
VideoModeList->addMode(core::dimension2d<u32>(modes[i]->w, modes[i]->h), vi->vfmt->BitsPerPixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,12 +432,6 @@ void CNullDriver::renameTexture(ITexture* texture, const io::path& newName)
|
|||
|
||||
ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size, const io::path& name, ECOLOR_FORMAT format)
|
||||
{
|
||||
if (IImage::isRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (0 == name.size())
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, texture needs to have a non-empty name.", ELL_WARNING);
|
||||
|
@ -531,12 +525,6 @@ ITexture* CNullDriver::addTextureCubemap(const irr::u32 sideLen, const io::path&
|
|||
if ( 0 == sideLen )
|
||||
return 0;
|
||||
|
||||
if (IImage::isRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (0 == name.size())
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, texture needs to have a non-empty name.", ELL_WARNING);
|
||||
|
@ -872,13 +860,17 @@ void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
|
|||
|
||||
|
||||
//! draws an 2d image
|
||||
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos)
|
||||
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, bool useAlphaChannelOfTexture)
|
||||
{
|
||||
if (!texture)
|
||||
return;
|
||||
|
||||
draw2DImage(texture,destPos, core::rect<s32>(core::position2d<s32>(0,0),
|
||||
core::dimension2di(texture->getOriginalSize())));
|
||||
core::dimension2di(texture->getOriginalSize())),
|
||||
0,
|
||||
SColor(255,255,255,255),
|
||||
useAlphaChannelOfTexture
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1687,11 +1679,6 @@ IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<u
|
|||
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, IImage *imageToCopy)
|
||||
{
|
||||
os::Printer::log("Deprecated method, please create an empty image instead and use copyTo().", ELL_WARNING);
|
||||
if(IImage::isRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CImage* tmp = new CImage(format, imageToCopy->getDimension());
|
||||
imageToCopy->copyTo(tmp);
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace video
|
|||
SColor color = SColor(255,255,255,255)) _IRR_OVERRIDE_;
|
||||
|
||||
//! draws an 2d image
|
||||
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos) _IRR_OVERRIDE_;
|
||||
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, bool useAlphaChannelOfTexture) _IRR_OVERRIDE_;
|
||||
|
||||
//! draws a set of 2d images, using a color and the alpha
|
||||
/** channel of the texture if desired. The images are drawn
|
||||
|
|
|
@ -431,7 +431,8 @@ public:
|
|||
protected:
|
||||
ECOLOR_FORMAT getBestColorFormat(ECOLOR_FORMAT format)
|
||||
{
|
||||
ECOLOR_FORMAT destFormat = (!IImage::isCompressedFormat(format)) ? ECF_A8R8G8B8 : format;
|
||||
// We only try for to adapt "simple" formats
|
||||
ECOLOR_FORMAT destFormat = (format <= ECF_A8R8G8B8) ? ECF_A8R8G8B8 : format;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
|
@ -441,7 +442,7 @@ protected:
|
|||
break;
|
||||
case ECF_R5G6B5:
|
||||
if (!Driver->getTextureCreationFlag(ETCF_ALWAYS_32_BIT))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
destFormat = ECF_R5G6B5;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) ||
|
||||
|
@ -449,6 +450,7 @@ protected:
|
|||
destFormat = ECF_A1R5G5B5;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
// Note: Using ECF_A8R8G8B8 even when ETCF_ALWAYS_32_BIT is not set as 24 bit textures fail with too many cards
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) || Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
default:
|
||||
|
|
|
@ -3940,7 +3940,8 @@ IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
|
|||
if (format==video::ECF_UNKNOWN)
|
||||
format=getColorFormat();
|
||||
|
||||
if (IImage::isRenderTargetOnlyFormat(format) || IImage::isCompressedFormat(format) || IImage::isDepthFormat(format))
|
||||
// TODO: Maybe we could support more formats (floating point and some of those beyond ECF_R8), didn't really try yet
|
||||
if (IImage::isCompressedFormat(format) || IImage::isDepthFormat(format) || IImage::isFloatingPointFormat(format) || format >= ECF_R8)
|
||||
return 0;
|
||||
|
||||
// allows to read pixels in top-to-bottom order
|
||||
|
@ -4178,6 +4179,8 @@ GLenum COpenGLDriver::getZBufferBits() const
|
|||
bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
{
|
||||
// NOTE: Converter variable not used here, but don't remove, it's used in the OGL-ES drivers.
|
||||
|
||||
bool supported = false;
|
||||
internalFormat = GL_RGBA;
|
||||
pixelFormat = GL_RGBA;
|
||||
|
@ -4200,7 +4203,7 @@ bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R8G8B8:
|
||||
supported = true;
|
||||
internalFormat = GL_RGB;
|
||||
pixelFormat = GL_BGR;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
|
|
Loading…
Reference in New Issue